monaco-editor-core 0.55.0-dev-20251102 → 0.55.0-dev-20251103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/nls.messages.cs.js +1 -1
- package/esm/nls.messages.de.js +1 -1
- package/esm/nls.messages.es.js +1 -1
- package/esm/nls.messages.fr.js +1 -1
- package/esm/nls.messages.it.js +1 -1
- package/esm/nls.messages.ja.js +1 -1
- package/esm/nls.messages.ko.js +1 -1
- package/esm/nls.messages.pl.js +1 -1
- package/esm/nls.messages.pt-br.js +1 -1
- package/esm/nls.messages.ru.js +1 -1
- package/esm/nls.messages.tr.js +1 -1
- package/esm/nls.messages.zh-cn.js +1 -1
- package/esm/nls.messages.zh-tw.js +1 -1
- package/esm/vs/base/browser/dom.js.map +1 -1
- package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
- package/esm/vs/base/browser/ui/list/listView.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/abstractTree.js +2 -0
- package/esm/vs/base/browser/ui/tree/abstractTree.js.map +1 -1
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js +2 -0
- package/esm/vs/base/browser/ui/tree/asyncDataTree.js.map +1 -1
- package/esm/vs/base/common/arrays.js.map +1 -1
- package/esm/vs/base/common/event.js.map +1 -1
- package/esm/vs/base/common/glob.js.map +1 -1
- package/esm/vs/base/common/lifecycle.js.map +1 -1
- package/esm/vs/base/common/network.js.map +1 -1
- package/esm/vs/base/common/ternarySearchTree.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseTarget.js.map +1 -1
- package/esm/vs/editor/browser/dataTransfer.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/viewLines/viewLine.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.js.map +1 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorViewModel.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/gutterFeature.js.map +1 -1
- package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
- package/esm/vs/editor/common/core/edits/edit.js.map +1 -1
- package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js.map +1 -1
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/ast.js.map +1 -1
- package/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/concat23Trees.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/treeSitter/tokenStore.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/treeSitter/treeSitterTree.js.map +1 -1
- package/esm/vs/editor/common/viewModel/viewModelLines.js.map +1 -1
- package/esm/vs/editor/contrib/editorState/browser/editorState.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findDecorations.js.map +1 -1
- package/esm/vs/editor/contrib/find/browser/findModel.js.map +1 -1
- package/esm/vs/editor/contrib/folding/browser/folding.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/suggestWidgetAdapter.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js.map +1 -1
- package/esm/vs/editor/contrib/links/browser/links.js.map +1 -1
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js.map +1 -1
- package/esm/vs/editor/contrib/snippet/browser/snippetParser.js.map +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js.map +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollModelProvider.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneEditor.js.map +1 -1
- package/esm/vs/editor/standalone/common/monarch/monarchCompile.js.map +1 -1
- package/esm/vs/platform/configuration/common/configurationRegistry.js.map +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +0 -4
- package/esm/vs/platform/contextkey/common/contextkey.js.map +1 -1
- package/esm/vs/platform/hover/browser/hoverService.js.map +1 -1
- package/esm/vs/platform/observable/common/wrapInHotClass.js.map +1 -1
- package/esm/vs/platform/observable/common/wrapInReloadableClass.js +0 -1
- package/esm/vs/platform/observable/common/wrapInReloadableClass.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputList.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/widget/diffEditor/features/gutterFeature.ts","vs/editor/browser/widget/diffEditor/features/gutterFeature.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC,EAAE,MAAM,oCAAoC,CAAC;AAKzF,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AACrE,OAAO,EAAe,OAAO,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAEvL,OAAO,EAAsB,oBAAoB,EAAE,MAAM,oDAAoD,CAAC;AAC9G,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,mDAAmD,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,yDAAyD,CAAC;AAC7F,OAAO,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,MAA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js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { EventType, addDisposableListener, h } from '../../../../../base/browser/dom.js';\nimport { IMouseWheelEvent } from '../../../../../base/browser/mouseEvent.js';\nimport { ActionsOrientation } from '../../../../../base/browser/ui/actionbar/actionbar.js';\nimport { HoverPosition } from '../../../../../base/browser/ui/hover/hoverWidget.js';\nimport { IBoundarySashes } from '../../../../../base/browser/ui/sash/sash.js';\nimport { Disposable } from '../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, autorunWithStore, derived, derivedDisposable, derivedWithSetter, observableFromEvent, observableValue } from '../../../../../base/common/observable.js';\nimport { URI } from '../../../../../base/common/uri.js';\nimport { HiddenItemStrategy, MenuWorkbenchToolBar } from '../../../../../platform/actions/browser/toolbar.js';\nimport { IMenuService, MenuId } from '../../../../../platform/actions/common/actions.js';\nimport { IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.js';\nimport { WorkbenchHoverDelegate } from '../../../../../platform/hover/browser/hover.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { EditorOption } from '../../../../common/config/editorOptions.js';\nimport { LineRange, LineRangeSet } from '../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../common/core/ranges/offsetRange.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { TextEdit } from '../../../../common/core/edits/textEdit.js';\nimport { DetailedLineRangeMapping } from '../../../../common/diff/rangeMapping.js';\nimport { TextModelText } from '../../../../common/model/textModelText.js';\nimport { ActionRunnerWithContext } from '../../multiDiffEditor/utils.js';\nimport { DiffEditorEditors } from '../components/diffEditorEditors.js';\nimport { DiffEditorSash, SashLayout } from '../components/diffEditorSash.js';\nimport { DiffEditorOptions } from '../diffEditorOptions.js';\nimport { DiffEditorViewModel } from '../diffEditorViewModel.js';\nimport { appendRemoveOnDispose, applyStyle, prependRemoveOnDispose } from '../utils.js';\nimport { EditorGutter, IGutterItemInfo, IGutterItemView } from '../utils/editorGutter.js';\n\nconst emptyArr: never[] = [];\nconst width = 35;\n\nexport class DiffEditorGutter extends Disposable {\n\tprivate readonly _menu;\n\tprivate readonly _actions;\n\tprivate readonly _hasActions;\n\tprivate readonly _showSash;\n\n\tpublic readonly width;\n\n\tprivate readonly elements;\n\n\tconstructor(\n\t\tdiffEditorRoot: HTMLDivElement,\n\t\tprivate readonly _diffModel: IObservable<DiffEditorViewModel | undefined>,\n\t\tprivate readonly _editors: DiffEditorEditors,\n\t\tprivate readonly _options: DiffEditorOptions,\n\t\tprivate readonly _sashLayout: SashLayout,\n\t\tprivate readonly _boundarySashes: IObservable<IBoundarySashes | undefined>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t\t@IMenuService private readonly _menuService: IMenuService,\n\t) {\n\t\tsuper();\n\t\tthis._menu = this._register(this._menuService.createMenu(MenuId.DiffEditorHunkToolbar, this._contextKeyService));\n\t\tthis._actions = observableFromEvent(this, this._menu.onDidChange, () => this._menu.getActions());\n\t\tthis._hasActions = this._actions.map(a => a.length > 0);\n\t\tthis._showSash = derived(this, reader => this._options.renderSideBySide.read(reader) && this._hasActions.read(reader));\n\t\tthis.width = derived(this, reader => this._hasActions.read(reader) ? width : 0);\n\t\tthis.elements = h('div.gutter@gutter', { style: { position: 'absolute', height: '100%', width: width + 'px' } }, []);\n\t\tthis._currentDiff = derived(this, (reader) => {\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tif (!model) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst mappings = model.diff.read(reader)?.mappings;\n\n\t\t\tconst cursorPosition = this._editors.modifiedCursor.read(reader);\n\t\t\tif (!cursorPosition) { return undefined; }\n\n\t\t\treturn mappings?.find(m => m.lineRangeMapping.modified.contains(cursorPosition.lineNumber));\n\t\t});\n\t\tthis._selectedDiffs = derived(this, (reader) => {\n\t\t\t/** @description selectedDiffs */\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tconst diff = model?.diff.read(reader);\n\t\t\t// Return `emptyArr` because it is a constant. [] is always a new array and would trigger a change.\n\t\t\tif (!diff) { return emptyArr; }\n\n\t\t\tconst selections = this._editors.modifiedSelections.read(reader);\n\t\t\tif (selections.every(s => s.isEmpty())) { return emptyArr; }\n\n\t\t\tconst selectedLineNumbers = new LineRangeSet(selections.map(s => LineRange.fromRangeInclusive(s)));\n\n\t\t\tconst selectedMappings = diff.mappings.filter(m =>\n\t\t\t\tm.lineRangeMapping.innerChanges && selectedLineNumbers.intersects(m.lineRangeMapping.modified)\n\t\t\t);\n\t\t\tconst result = selectedMappings.map(mapping => ({\n\t\t\t\tmapping,\n\t\t\t\trangeMappings: mapping.lineRangeMapping.innerChanges!.filter(\n\t\t\t\t\tc => selections.some(s => Range.areIntersecting(c.modifiedRange, s))\n\t\t\t\t)\n\t\t\t}));\n\t\t\tif (result.length === 0 || result.every(r => r.rangeMappings.length === 0)) { return emptyArr; }\n\t\t\treturn result;\n\t\t});\n\n\t\tthis._register(prependRemoveOnDispose(diffEditorRoot, this.elements.root));\n\n\t\tthis._register(addDisposableListener(this.elements.root, 'click', () => {\n\t\t\tthis._editors.modified.focus();\n\t\t}));\n\n\t\tthis._register(applyStyle(this.elements.root, { display: this._hasActions.map(a => a ? 'block' : 'none') }));\n\n\t\tderivedDisposable(this, reader => {\n\t\t\tconst showSash = this._showSash.read(reader);\n\t\t\treturn !showSash ? undefined : new DiffEditorSash(\n\t\t\t\tdiffEditorRoot,\n\t\t\t\tthis._sashLayout.dimensions,\n\t\t\t\tthis._options.enableSplitViewResizing,\n\t\t\t\tthis._boundarySashes,\n\t\t\t\tderivedWithSetter(\n\t\t\t\t\tthis, reader => this._sashLayout.sashLeft.read(reader) - width,\n\t\t\t\t\t(v, tx) => this._sashLayout.sashLeft.set(v + width, tx)\n\t\t\t\t),\n\t\t\t\t() => this._sashLayout.resetSash(),\n\t\t\t);\n\t\t}).recomputeInitiallyAndOnChange(this._store);\n\n\t\tconst gutterItems = derived(this, reader => {\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tif (!model) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst diffs = model.diff.read(reader);\n\t\t\tif (!diffs) { return []; }\n\n\t\t\tconst selection = this._selectedDiffs.read(reader);\n\t\t\tif (selection.length > 0) {\n\t\t\t\tconst m = DetailedLineRangeMapping.fromRangeMappings(selection.flatMap(s => s.rangeMappings));\n\t\t\t\treturn [\n\t\t\t\t\tnew DiffGutterItem(\n\t\t\t\t\t\tm,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tMenuId.DiffEditorSelectionToolbar,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tmodel.model.original.uri,\n\t\t\t\t\t\tmodel.model.modified.uri,\n\t\t\t\t\t)];\n\t\t\t}\n\n\t\t\tconst currentDiff = this._currentDiff.read(reader);\n\n\t\t\treturn diffs.mappings.map(m => new DiffGutterItem(\n\t\t\t\tm.lineRangeMapping.withInnerChangesFromLineRanges(),\n\t\t\t\tm.lineRangeMapping === currentDiff?.lineRangeMapping,\n\t\t\t\tMenuId.DiffEditorHunkToolbar,\n\t\t\t\tundefined,\n\t\t\t\tmodel.model.original.uri,\n\t\t\t\tmodel.model.modified.uri,\n\t\t\t));\n\t\t});\n\n\t\tthis._register(new EditorGutter<DiffGutterItem>(this._editors.modified, this.elements.root, {\n\t\t\tgetIntersectingGutterItems: (range, reader) => gutterItems.read(reader),\n\t\t\tcreateView: (item, target) => {\n\t\t\t\treturn this._instantiationService.createInstance(DiffToolBar, item, target, this);\n\t\t\t},\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.elements.gutter, EventType.MOUSE_WHEEL, (e: IMouseWheelEvent) => {\n\t\t\tif (this._editors.modified.getOption(EditorOption.scrollbar).handleMouseWheel) {\n\t\t\t\tthis._editors.modified.delegateScrollFromMouseWheelEvent(e);\n\t\t\t}\n\t\t}, { passive: false }));\n\t}\n\n\tpublic computeStagedValue(mapping: DetailedLineRangeMapping): string {\n\t\tconst c = mapping.innerChanges ?? [];\n\t\tconst modified = new TextModelText(this._editors.modifiedModel.get()!);\n\t\tconst original = new TextModelText(this._editors.original.getModel()!);\n\n\t\tconst edit = new TextEdit(c.map(c => c.toTextEdit(modified)));\n\t\tconst value = edit.apply(original);\n\t\treturn value;\n\t}\n\n\tprivate readonly _currentDiff;\n\n\tprivate readonly _selectedDiffs;\n\n\tlayout(left: number) {\n\t\tthis.elements.gutter.style.left = left + 'px';\n\t}\n}\n\nclass DiffGutterItem implements IGutterItemInfo {\n\tconstructor(\n\t\tpublic readonly mapping: DetailedLineRangeMapping,\n\t\tpublic readonly showAlways: boolean,\n\t\tpublic readonly menuId: MenuId,\n\t\tpublic readonly rangeOverride: LineRange | undefined,\n\t\tpublic readonly originalUri: URI,\n\t\tpublic readonly modifiedUri: URI,\n\t) {\n\t}\n\tget id(): string { return this.mapping.modified.toString(); }\n\tget range(): LineRange { return this.rangeOverride ?? this.mapping.modified; }\n}\n\n\nclass DiffToolBar extends Disposable implements IGutterItemView {\n\tprivate readonly _elements;\n\n\tprivate readonly _showAlways;\n\tprivate readonly _menuId;\n\n\tprivate readonly _isSmall;\n\n\tconstructor(\n\t\tprivate readonly _item: IObservable<DiffGutterItem>,\n\t\ttarget: HTMLElement,\n\t\tgutter: DiffEditorGutter,\n\t\t@IInstantiationService instantiationService: IInstantiationService\n\t) {\n\t\tsuper();\n\t\tthis._elements = h('div.gutterItem', { style: { height: '20px', width: '34px' } }, [\n\t\t\th('div.background@background', {}, []),\n\t\t\th('div.buttons@buttons', {}, []),\n\t\t]);\n\t\tthis._showAlways = this._item.map(this, item => item.showAlways);\n\t\tthis._menuId = this._item.map(this, item => item.menuId);\n\t\tthis._isSmall = observableValue(this, false);\n\t\tthis._lastItemRange = undefined;\n\t\tthis._lastViewRange = undefined;\n\n\t\tconst hoverDelegate = this._register(instantiationService.createInstance(\n\t\t\tWorkbenchHoverDelegate,\n\t\t\t'element',\n\t\t\t{ instantHover: true },\n\t\t\t{ position: { hoverPosition: HoverPosition.RIGHT } }\n\t\t));\n\n\t\tthis._register(appendRemoveOnDispose(target, this._elements.root));\n\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description update showAlways */\n\t\t\tconst showAlways = this._showAlways.read(reader);\n\t\t\tthis._elements.root.classList.toggle('noTransition', true);\n\t\t\tthis._elements.root.classList.toggle('showAlways', showAlways);\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis._elements.root.classList.toggle('noTransition', false);\n\t\t\t}, 0);\n\t\t}));\n\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tthis._elements.buttons.replaceChildren();\n\t\t\tconst i = store.add(instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.buttons, this._menuId.read(reader), {\n\t\t\t\torientation: ActionsOrientation.VERTICAL,\n\t\t\t\thoverDelegate,\n\t\t\t\ttoolbarOptions: {\n\t\t\t\t\tprimaryGroup: g => g.startsWith('primary'),\n\t\t\t\t},\n\t\t\t\toverflowBehavior: { maxItems: this._isSmall.read(reader) ? 1 : 3 },\n\t\t\t\thiddenItemStrategy: HiddenItemStrategy.Ignore,\n\t\t\t\tactionRunner: store.add(new ActionRunnerWithContext(() => {\n\t\t\t\t\tconst item = this._item.read(undefined);\n\t\t\t\t\tconst mapping = item.mapping;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmapping,\n\t\t\t\t\t\toriginalWithModifiedChanges: gutter.computeStagedValue(mapping),\n\t\t\t\t\t\toriginalUri: item.originalUri,\n\t\t\t\t\t\tmodifiedUri: item.modifiedUri,\n\t\t\t\t\t} satisfies DiffEditorSelectionHunkToolbarContext;\n\t\t\t\t})),\n\t\t\t\tmenuOptions: {\n\t\t\t\t\tshouldForwardArgs: true,\n\t\t\t\t},\n\t\t\t}));\n\t\t\tstore.add(i.onDidChangeMenuItems(() => {\n\t\t\t\tif (this._lastItemRange) {\n\t\t\t\t\tthis.layout(this._lastItemRange, this._lastViewRange!);\n\t\t\t\t}\n\t\t\t}));\n\t\t}));\n\t}\n\n\tprivate _lastItemRange: OffsetRange | undefined;\n\tprivate _lastViewRange: OffsetRange | undefined;\n\n\tlayout(itemRange: OffsetRange, viewRange: OffsetRange): void {\n\t\tthis._lastItemRange = itemRange;\n\t\tthis._lastViewRange = viewRange;\n\n\t\tlet itemHeight = this._elements.buttons.clientHeight;\n\t\tthis._isSmall.set(this._item.get().mapping.original.startLineNumber === 1 && itemRange.length < 30, undefined);\n\t\t// Item might have changed\n\t\titemHeight = this._elements.buttons.clientHeight;\n\n\t\tconst middleHeight = itemRange.length / 2 - itemHeight / 2;\n\n\t\tconst margin = itemHeight;\n\n\t\tlet effectiveCheckboxTop = itemRange.start + middleHeight;\n\n\t\tconst preferredViewPortRange = OffsetRange.tryCreate(\n\t\t\tmargin,\n\t\t\tviewRange.endExclusive - margin - itemHeight\n\t\t);\n\n\t\tconst preferredParentRange = OffsetRange.tryCreate(\n\t\t\titemRange.start + margin,\n\t\t\titemRange.endExclusive - itemHeight - margin\n\t\t);\n\n\t\tif (preferredParentRange && preferredViewPortRange && preferredParentRange.start < preferredParentRange.endExclusive) {\n\t\t\teffectiveCheckboxTop = preferredViewPortRange!.clip(effectiveCheckboxTop);\n\t\t\teffectiveCheckboxTop = preferredParentRange!.clip(effectiveCheckboxTop);\n\t\t}\n\n\t\tthis._elements.buttons.style.top = `${effectiveCheckboxTop - itemRange.start}px`;\n\t}\n}\n\nexport interface DiffEditorSelectionHunkToolbarContext {\n\tmapping: DetailedLineRangeMapping;\n\n\t/**\n\t * The original text with the selected modified changes applied.\n\t*/\n\toriginalWithModifiedChanges: string;\n\n\tmodifiedUri: URI;\n\toriginalUri: URI;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { EventType, addDisposableListener, h } from '../../../../../base/browser/dom.js';\nimport { IMouseWheelEvent } from '../../../../../base/browser/mouseEvent.js';\nimport { ActionsOrientation } from '../../../../../base/browser/ui/actionbar/actionbar.js';\nimport { HoverPosition } from '../../../../../base/browser/ui/hover/hoverWidget.js';\nimport { IBoundarySashes } from '../../../../../base/browser/ui/sash/sash.js';\nimport { Disposable } from '../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, autorunWithStore, derived, derivedDisposable, derivedWithSetter, observableFromEvent, observableValue } from '../../../../../base/common/observable.js';\nimport { URI } from '../../../../../base/common/uri.js';\nimport { HiddenItemStrategy, MenuWorkbenchToolBar } from '../../../../../platform/actions/browser/toolbar.js';\nimport { IMenuService, MenuId } from '../../../../../platform/actions/common/actions.js';\nimport { IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.js';\nimport { WorkbenchHoverDelegate } from '../../../../../platform/hover/browser/hover.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { EditorOption } from '../../../../common/config/editorOptions.js';\nimport { LineRange, LineRangeSet } from '../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../common/core/ranges/offsetRange.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { TextEdit } from '../../../../common/core/edits/textEdit.js';\nimport { DetailedLineRangeMapping } from '../../../../common/diff/rangeMapping.js';\nimport { TextModelText } from '../../../../common/model/textModelText.js';\nimport { ActionRunnerWithContext } from '../../multiDiffEditor/utils.js';\nimport { DiffEditorEditors } from '../components/diffEditorEditors.js';\nimport { DiffEditorSash, SashLayout } from '../components/diffEditorSash.js';\nimport { DiffEditorOptions } from '../diffEditorOptions.js';\nimport { DiffEditorViewModel } from '../diffEditorViewModel.js';\nimport { appendRemoveOnDispose, applyStyle, prependRemoveOnDispose } from '../utils.js';\nimport { EditorGutter, IGutterItemInfo, IGutterItemView } from '../utils/editorGutter.js';\n\nconst emptyArr: never[] = [];\nconst width = 35;\n\nexport class DiffEditorGutter extends Disposable {\n\tprivate readonly _menu;\n\tprivate readonly _actions;\n\tprivate readonly _hasActions;\n\tprivate readonly _showSash;\n\n\tpublic readonly width;\n\n\tprivate readonly elements;\n\n\tconstructor(\n\t\tdiffEditorRoot: HTMLDivElement,\n\t\tprivate readonly _diffModel: IObservable<DiffEditorViewModel | undefined>,\n\t\tprivate readonly _editors: DiffEditorEditors,\n\t\tprivate readonly _options: DiffEditorOptions,\n\t\tprivate readonly _sashLayout: SashLayout,\n\t\tprivate readonly _boundarySashes: IObservable<IBoundarySashes | undefined>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t\t@IMenuService private readonly _menuService: IMenuService,\n\t) {\n\t\tsuper();\n\t\tthis._menu = this._register(this._menuService.createMenu(MenuId.DiffEditorHunkToolbar, this._contextKeyService));\n\t\tthis._actions = observableFromEvent(this, this._menu.onDidChange, () => this._menu.getActions());\n\t\tthis._hasActions = this._actions.map(a => a.length > 0);\n\t\tthis._showSash = derived(this, reader => this._options.renderSideBySide.read(reader) && this._hasActions.read(reader));\n\t\tthis.width = derived(this, reader => this._hasActions.read(reader) ? width : 0);\n\t\tthis.elements = h('div.gutter@gutter', { style: { position: 'absolute', height: '100%', width: width + 'px' } }, []);\n\t\tthis._currentDiff = derived(this, (reader) => {\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tif (!model) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst mappings = model.diff.read(reader)?.mappings;\n\n\t\t\tconst cursorPosition = this._editors.modifiedCursor.read(reader);\n\t\t\tif (!cursorPosition) { return undefined; }\n\n\t\t\treturn mappings?.find(m => m.lineRangeMapping.modified.contains(cursorPosition.lineNumber));\n\t\t});\n\t\tthis._selectedDiffs = derived(this, (reader) => {\n\t\t\t/** @description selectedDiffs */\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tconst diff = model?.diff.read(reader);\n\t\t\t// Return `emptyArr` because it is a constant. [] is always a new array and would trigger a change.\n\t\t\tif (!diff) { return emptyArr; }\n\n\t\t\tconst selections = this._editors.modifiedSelections.read(reader);\n\t\t\tif (selections.every(s => s.isEmpty())) { return emptyArr; }\n\n\t\t\tconst selectedLineNumbers = new LineRangeSet(selections.map(s => LineRange.fromRangeInclusive(s)));\n\n\t\t\tconst selectedMappings = diff.mappings.filter(m =>\n\t\t\t\tm.lineRangeMapping.innerChanges && selectedLineNumbers.intersects(m.lineRangeMapping.modified)\n\t\t\t);\n\t\t\tconst result = selectedMappings.map(mapping => ({\n\t\t\t\tmapping,\n\t\t\t\trangeMappings: mapping.lineRangeMapping.innerChanges!.filter(\n\t\t\t\t\tc => selections.some(s => Range.areIntersecting(c.modifiedRange, s))\n\t\t\t\t)\n\t\t\t}));\n\t\t\tif (result.length === 0 || result.every(r => r.rangeMappings.length === 0)) { return emptyArr; }\n\t\t\treturn result;\n\t\t});\n\n\t\tthis._register(prependRemoveOnDispose(diffEditorRoot, this.elements.root));\n\n\t\tthis._register(addDisposableListener(this.elements.root, 'click', () => {\n\t\t\tthis._editors.modified.focus();\n\t\t}));\n\n\t\tthis._register(applyStyle(this.elements.root, { display: this._hasActions.map(a => a ? 'block' : 'none') }));\n\n\t\tderivedDisposable(this, reader => {\n\t\t\tconst showSash = this._showSash.read(reader);\n\t\t\treturn !showSash ? undefined : new DiffEditorSash(\n\t\t\t\tdiffEditorRoot,\n\t\t\t\tthis._sashLayout.dimensions,\n\t\t\t\tthis._options.enableSplitViewResizing,\n\t\t\t\tthis._boundarySashes,\n\t\t\t\tderivedWithSetter(\n\t\t\t\t\tthis, reader => this._sashLayout.sashLeft.read(reader) - width,\n\t\t\t\t\t(v, tx) => this._sashLayout.sashLeft.set(v + width, tx)\n\t\t\t\t),\n\t\t\t\t() => this._sashLayout.resetSash(),\n\t\t\t);\n\t\t}).recomputeInitiallyAndOnChange(this._store);\n\n\t\tconst gutterItems = derived(this, reader => {\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tif (!model) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst diffs = model.diff.read(reader);\n\t\t\tif (!diffs) { return []; }\n\n\t\t\tconst selection = this._selectedDiffs.read(reader);\n\t\t\tif (selection.length > 0) {\n\t\t\t\tconst m = DetailedLineRangeMapping.fromRangeMappings(selection.flatMap(s => s.rangeMappings));\n\t\t\t\treturn [\n\t\t\t\t\tnew DiffGutterItem(\n\t\t\t\t\t\tm,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tMenuId.DiffEditorSelectionToolbar,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tmodel.model.original.uri,\n\t\t\t\t\t\tmodel.model.modified.uri,\n\t\t\t\t\t)];\n\t\t\t}\n\n\t\t\tconst currentDiff = this._currentDiff.read(reader);\n\n\t\t\treturn diffs.mappings.map(m => new DiffGutterItem(\n\t\t\t\tm.lineRangeMapping.withInnerChangesFromLineRanges(),\n\t\t\t\tm.lineRangeMapping === currentDiff?.lineRangeMapping,\n\t\t\t\tMenuId.DiffEditorHunkToolbar,\n\t\t\t\tundefined,\n\t\t\t\tmodel.model.original.uri,\n\t\t\t\tmodel.model.modified.uri,\n\t\t\t));\n\t\t});\n\n\t\tthis._register(new EditorGutter<DiffGutterItem>(this._editors.modified, this.elements.root, {\n\t\t\tgetIntersectingGutterItems: (range, reader) => gutterItems.read(reader),\n\t\t\tcreateView: (item, target) => {\n\t\t\t\treturn this._instantiationService.createInstance(DiffToolBar, item, target, this);\n\t\t\t},\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.elements.gutter, EventType.MOUSE_WHEEL, (e: IMouseWheelEvent) => {\n\t\t\tif (this._editors.modified.getOption(EditorOption.scrollbar).handleMouseWheel) {\n\t\t\t\tthis._editors.modified.delegateScrollFromMouseWheelEvent(e);\n\t\t\t}\n\t\t}, { passive: false }));\n\t}\n\n\tpublic computeStagedValue(mapping: DetailedLineRangeMapping): string {\n\t\tconst c = mapping.innerChanges ?? [];\n\t\tconst modified = new TextModelText(this._editors.modifiedModel.get()!);\n\t\tconst original = new TextModelText(this._editors.original.getModel()!);\n\n\t\tconst edit = new TextEdit(c.map(c => c.toTextEdit(modified)));\n\t\tconst value = edit.apply(original);\n\t\treturn value;\n\t}\n\n\tprivate readonly _currentDiff;\n\n\tprivate readonly _selectedDiffs;\n\n\tlayout(left: number) {\n\t\tthis.elements.gutter.style.left = left + 'px';\n\t}\n}\n\nclass DiffGutterItem implements IGutterItemInfo {\n\tconstructor(\n\t\tpublic readonly mapping: DetailedLineRangeMapping,\n\t\tpublic readonly showAlways: boolean,\n\t\tpublic readonly menuId: MenuId,\n\t\tpublic readonly rangeOverride: LineRange | undefined,\n\t\tpublic readonly originalUri: URI,\n\t\tpublic readonly modifiedUri: URI,\n\t) {\n\t}\n\tget id(): string { return this.mapping.modified.toString(); }\n\tget range(): LineRange { return this.rangeOverride ?? this.mapping.modified; }\n}\n\n\nclass DiffToolBar extends Disposable implements IGutterItemView {\n\tprivate readonly _elements;\n\n\tprivate readonly _showAlways;\n\tprivate readonly _menuId;\n\n\tprivate readonly _isSmall;\n\n\tconstructor(\n\t\tprivate readonly _item: IObservable<DiffGutterItem>,\n\t\ttarget: HTMLElement,\n\t\tgutter: DiffEditorGutter,\n\t\t@IInstantiationService instantiationService: IInstantiationService\n\t) {\n\t\tsuper();\n\t\tthis._elements = h('div.gutterItem', { style: { height: '20px', width: '34px' } }, [\n\t\t\th('div.background@background', {}, []),\n\t\t\th('div.buttons@buttons', {}, []),\n\t\t]);\n\t\tthis._showAlways = this._item.map(this, item => item.showAlways);\n\t\tthis._menuId = this._item.map(this, item => item.menuId);\n\t\tthis._isSmall = observableValue(this, false);\n\t\tthis._lastItemRange = undefined;\n\t\tthis._lastViewRange = undefined;\n\n\t\tconst hoverDelegate = this._register(instantiationService.createInstance(\n\t\t\tWorkbenchHoverDelegate,\n\t\t\t'element',\n\t\t\t{ instantHover: true },\n\t\t\t{ position: { hoverPosition: HoverPosition.RIGHT } }\n\t\t));\n\n\t\tthis._register(appendRemoveOnDispose(target, this._elements.root));\n\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description update showAlways */\n\t\t\tconst showAlways = this._showAlways.read(reader);\n\t\t\tthis._elements.root.classList.toggle('noTransition', true);\n\t\t\tthis._elements.root.classList.toggle('showAlways', showAlways);\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis._elements.root.classList.toggle('noTransition', false);\n\t\t\t}, 0);\n\t\t}));\n\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tthis._elements.buttons.replaceChildren();\n\t\t\tconst i = store.add(instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.buttons, this._menuId.read(reader), {\n\t\t\t\torientation: ActionsOrientation.VERTICAL,\n\t\t\t\thoverDelegate,\n\t\t\t\ttoolbarOptions: {\n\t\t\t\t\tprimaryGroup: g => g.startsWith('primary'),\n\t\t\t\t},\n\t\t\t\toverflowBehavior: { maxItems: this._isSmall.read(reader) ? 1 : 3 },\n\t\t\t\thiddenItemStrategy: HiddenItemStrategy.Ignore,\n\t\t\t\tactionRunner: store.add(new ActionRunnerWithContext(() => {\n\t\t\t\t\tconst item = this._item.read(undefined);\n\t\t\t\t\tconst mapping = item.mapping;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmapping,\n\t\t\t\t\t\toriginalWithModifiedChanges: gutter.computeStagedValue(mapping),\n\t\t\t\t\t\toriginalUri: item.originalUri,\n\t\t\t\t\t\tmodifiedUri: item.modifiedUri,\n\t\t\t\t\t} satisfies DiffEditorSelectionHunkToolbarContext;\n\t\t\t\t})),\n\t\t\t\tmenuOptions: {\n\t\t\t\t\tshouldForwardArgs: true,\n\t\t\t\t},\n\t\t\t}));\n\t\t\tstore.add(i.onDidChangeMenuItems(() => {\n\t\t\t\tif (this._lastItemRange) {\n\t\t\t\t\tthis.layout(this._lastItemRange, this._lastViewRange!);\n\t\t\t\t}\n\t\t\t}));\n\t\t}));\n\t}\n\n\tprivate _lastItemRange: OffsetRange | undefined;\n\tprivate _lastViewRange: OffsetRange | undefined;\n\n\tlayout(itemRange: OffsetRange, viewRange: OffsetRange): void {\n\t\tthis._lastItemRange = itemRange;\n\t\tthis._lastViewRange = viewRange;\n\n\t\tlet itemHeight = this._elements.buttons.clientHeight;\n\t\tthis._isSmall.set(this._item.get().mapping.original.startLineNumber === 1 && itemRange.length < 30, undefined);\n\t\t// Item might have changed\n\t\titemHeight = this._elements.buttons.clientHeight;\n\n\t\tconst middleHeight = itemRange.length / 2 - itemHeight / 2;\n\n\t\tconst margin = itemHeight;\n\n\t\tlet effectiveCheckboxTop = itemRange.start + middleHeight;\n\n\t\tconst preferredViewPortRange = OffsetRange.tryCreate(\n\t\t\tmargin,\n\t\t\tviewRange.endExclusive - margin - itemHeight\n\t\t);\n\n\t\tconst preferredParentRange = OffsetRange.tryCreate(\n\t\t\titemRange.start + margin,\n\t\t\titemRange.endExclusive - itemHeight - margin\n\t\t);\n\n\t\tif (preferredParentRange && preferredViewPortRange && preferredParentRange.start < preferredParentRange.endExclusive) {\n\t\t\teffectiveCheckboxTop = preferredViewPortRange!.clip(effectiveCheckboxTop);\n\t\t\teffectiveCheckboxTop = preferredParentRange!.clip(effectiveCheckboxTop);\n\t\t}\n\n\t\tthis._elements.buttons.style.top = `${effectiveCheckboxTop - itemRange.start}px`;\n\t}\n}\n\nexport interface DiffEditorSelectionHunkToolbarContext {\n\tmapping: DetailedLineRangeMapping;\n\n\t/**\n\t * The original text with the selected modified changes applied.\n\t*/\n\toriginalWithModifiedChanges: string;\n\n\tmodifiedUri: URI;\n\toriginalUri: URI;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/widget/diffEditor/features/gutterFeature.ts","vs/editor/browser/widget/diffEditor/features/gutterFeature.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG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xB,SAAS,CAAC,YAAY,GAAG,UAAU,GAAG,MAAM,CAC5C,CAAC;QAEF,IAAI,oBAAoB,IAAI,sBAAsB,IAAI,oBAAoB,CAAC,KAAK,GAAG,oBAAoB,CAAC,YAAY,EAAE,CAAC;YACtH,oBAAoB,GAAG,sBAAsB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YACzE,oBAAoB,GAAG,oBAAoB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACxE,CAAC;QAED,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,GAAG,oBAAoB,GAAG,SAAS,CAAC,KAAK,IAAI,CAAC;IAClF,CAAC;CACD,CAAA;AAhHK,WAAW;IAYd,WAAA,qBAAqB,CAAA;GAZlB,WAAW,CAgHhB","file":"gutterFeature.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { EventType, addDisposableListener, h } from '../../../../../base/browser/dom.js';\nimport { IMouseWheelEvent } from '../../../../../base/browser/mouseEvent.js';\nimport { ActionsOrientation } from '../../../../../base/browser/ui/actionbar/actionbar.js';\nimport { HoverPosition } from '../../../../../base/browser/ui/hover/hoverWidget.js';\nimport { IBoundarySashes } from '../../../../../base/browser/ui/sash/sash.js';\nimport { Disposable } from '../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, autorunWithStore, derived, derivedDisposable, derivedWithSetter, observableFromEvent, observableValue } from '../../../../../base/common/observable.js';\nimport { URI } from '../../../../../base/common/uri.js';\nimport { HiddenItemStrategy, MenuWorkbenchToolBar } from '../../../../../platform/actions/browser/toolbar.js';\nimport { IMenuService, MenuId } from '../../../../../platform/actions/common/actions.js';\nimport { IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.js';\nimport { WorkbenchHoverDelegate } from '../../../../../platform/hover/browser/hover.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { EditorOption } from '../../../../common/config/editorOptions.js';\nimport { LineRange, LineRangeSet } from '../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../common/core/ranges/offsetRange.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { TextEdit } from '../../../../common/core/edits/textEdit.js';\nimport { DetailedLineRangeMapping } from '../../../../common/diff/rangeMapping.js';\nimport { TextModelText } from '../../../../common/model/textModelText.js';\nimport { ActionRunnerWithContext } from '../../multiDiffEditor/utils.js';\nimport { DiffEditorEditors } from '../components/diffEditorEditors.js';\nimport { DiffEditorSash, SashLayout } from '../components/diffEditorSash.js';\nimport { DiffEditorOptions } from '../diffEditorOptions.js';\nimport { DiffEditorViewModel } from '../diffEditorViewModel.js';\nimport { appendRemoveOnDispose, applyStyle, prependRemoveOnDispose } from '../utils.js';\nimport { EditorGutter, IGutterItemInfo, IGutterItemView } from '../utils/editorGutter.js';\n\nconst emptyArr: never[] = [];\nconst width = 35;\n\nexport class DiffEditorGutter extends Disposable {\n\tprivate readonly _menu;\n\tprivate readonly _actions;\n\tprivate readonly _hasActions;\n\tprivate readonly _showSash;\n\n\tpublic readonly width;\n\n\tprivate readonly elements;\n\n\tconstructor(\n\t\tdiffEditorRoot: HTMLDivElement,\n\t\tprivate readonly _diffModel: IObservable<DiffEditorViewModel | undefined>,\n\t\tprivate readonly _editors: DiffEditorEditors,\n\t\tprivate readonly _options: DiffEditorOptions,\n\t\tprivate readonly _sashLayout: SashLayout,\n\t\tprivate readonly _boundarySashes: IObservable<IBoundarySashes | undefined>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t\t@IMenuService private readonly _menuService: IMenuService,\n\t) {\n\t\tsuper();\n\t\tthis._menu = this._register(this._menuService.createMenu(MenuId.DiffEditorHunkToolbar, this._contextKeyService));\n\t\tthis._actions = observableFromEvent(this, this._menu.onDidChange, () => this._menu.getActions());\n\t\tthis._hasActions = this._actions.map(a => a.length > 0);\n\t\tthis._showSash = derived(this, reader => this._options.renderSideBySide.read(reader) && this._hasActions.read(reader));\n\t\tthis.width = derived(this, reader => this._hasActions.read(reader) ? width : 0);\n\t\tthis.elements = h('div.gutter@gutter', { style: { position: 'absolute', height: '100%', width: width + 'px' } }, []);\n\t\tthis._currentDiff = derived(this, (reader) => {\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tif (!model) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst mappings = model.diff.read(reader)?.mappings;\n\n\t\t\tconst cursorPosition = this._editors.modifiedCursor.read(reader);\n\t\t\tif (!cursorPosition) { return undefined; }\n\n\t\t\treturn mappings?.find(m => m.lineRangeMapping.modified.contains(cursorPosition.lineNumber));\n\t\t});\n\t\tthis._selectedDiffs = derived(this, (reader) => {\n\t\t\t/** @description selectedDiffs */\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tconst diff = model?.diff.read(reader);\n\t\t\t// Return `emptyArr` because it is a constant. [] is always a new array and would trigger a change.\n\t\t\tif (!diff) { return emptyArr; }\n\n\t\t\tconst selections = this._editors.modifiedSelections.read(reader);\n\t\t\tif (selections.every(s => s.isEmpty())) { return emptyArr; }\n\n\t\t\tconst selectedLineNumbers = new LineRangeSet(selections.map(s => LineRange.fromRangeInclusive(s)));\n\n\t\t\tconst selectedMappings = diff.mappings.filter(m =>\n\t\t\t\tm.lineRangeMapping.innerChanges && selectedLineNumbers.intersects(m.lineRangeMapping.modified)\n\t\t\t);\n\t\t\tconst result = selectedMappings.map(mapping => ({\n\t\t\t\tmapping,\n\t\t\t\trangeMappings: mapping.lineRangeMapping.innerChanges!.filter(\n\t\t\t\t\tc => selections.some(s => Range.areIntersecting(c.modifiedRange, s))\n\t\t\t\t)\n\t\t\t}));\n\t\t\tif (result.length === 0 || result.every(r => r.rangeMappings.length === 0)) { return emptyArr; }\n\t\t\treturn result;\n\t\t});\n\n\t\tthis._register(prependRemoveOnDispose(diffEditorRoot, this.elements.root));\n\n\t\tthis._register(addDisposableListener(this.elements.root, 'click', () => {\n\t\t\tthis._editors.modified.focus();\n\t\t}));\n\n\t\tthis._register(applyStyle(this.elements.root, { display: this._hasActions.map(a => a ? 'block' : 'none') }));\n\n\t\tderivedDisposable(this, reader => {\n\t\t\tconst showSash = this._showSash.read(reader);\n\t\t\treturn !showSash ? undefined : new DiffEditorSash(\n\t\t\t\tdiffEditorRoot,\n\t\t\t\tthis._sashLayout.dimensions,\n\t\t\t\tthis._options.enableSplitViewResizing,\n\t\t\t\tthis._boundarySashes,\n\t\t\t\tderivedWithSetter(\n\t\t\t\t\tthis, reader => this._sashLayout.sashLeft.read(reader) - width,\n\t\t\t\t\t(v, tx) => this._sashLayout.sashLeft.set(v + width, tx)\n\t\t\t\t),\n\t\t\t\t() => this._sashLayout.resetSash(),\n\t\t\t);\n\t\t}).recomputeInitiallyAndOnChange(this._store);\n\n\t\tconst gutterItems = derived(this, reader => {\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tif (!model) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst diffs = model.diff.read(reader);\n\t\t\tif (!diffs) { return []; }\n\n\t\t\tconst selection = this._selectedDiffs.read(reader);\n\t\t\tif (selection.length > 0) {\n\t\t\t\tconst m = DetailedLineRangeMapping.fromRangeMappings(selection.flatMap(s => s.rangeMappings));\n\t\t\t\treturn [\n\t\t\t\t\tnew DiffGutterItem(\n\t\t\t\t\t\tm,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tMenuId.DiffEditorSelectionToolbar,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tmodel.model.original.uri,\n\t\t\t\t\t\tmodel.model.modified.uri,\n\t\t\t\t\t)];\n\t\t\t}\n\n\t\t\tconst currentDiff = this._currentDiff.read(reader);\n\n\t\t\treturn diffs.mappings.map(m => new DiffGutterItem(\n\t\t\t\tm.lineRangeMapping.withInnerChangesFromLineRanges(),\n\t\t\t\tm.lineRangeMapping === currentDiff?.lineRangeMapping,\n\t\t\t\tMenuId.DiffEditorHunkToolbar,\n\t\t\t\tundefined,\n\t\t\t\tmodel.model.original.uri,\n\t\t\t\tmodel.model.modified.uri,\n\t\t\t));\n\t\t});\n\n\t\tthis._register(new EditorGutter<DiffGutterItem>(this._editors.modified, this.elements.root, {\n\t\t\tgetIntersectingGutterItems: (range, reader) => gutterItems.read(reader),\n\t\t\tcreateView: (item, target) => {\n\t\t\t\treturn this._instantiationService.createInstance(DiffToolBar, item, target, this);\n\t\t\t},\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.elements.gutter, EventType.MOUSE_WHEEL, (e: IMouseWheelEvent) => {\n\t\t\tif (this._editors.modified.getOption(EditorOption.scrollbar).handleMouseWheel) {\n\t\t\t\tthis._editors.modified.delegateScrollFromMouseWheelEvent(e);\n\t\t\t}\n\t\t}, { passive: false }));\n\t}\n\n\tpublic computeStagedValue(mapping: DetailedLineRangeMapping): string {\n\t\tconst c = mapping.innerChanges ?? [];\n\t\tconst modified = new TextModelText(this._editors.modifiedModel.get()!);\n\t\tconst original = new TextModelText(this._editors.original.getModel()!);\n\n\t\tconst edit = new TextEdit(c.map(c => c.toTextEdit(modified)));\n\t\tconst value = edit.apply(original);\n\t\treturn value;\n\t}\n\n\tprivate readonly _currentDiff;\n\n\tprivate readonly _selectedDiffs;\n\n\tlayout(left: number) {\n\t\tthis.elements.gutter.style.left = left + 'px';\n\t}\n}\n\nclass DiffGutterItem implements IGutterItemInfo {\n\tconstructor(\n\t\tpublic readonly mapping: DetailedLineRangeMapping,\n\t\tpublic readonly showAlways: boolean,\n\t\tpublic readonly menuId: MenuId,\n\t\tpublic readonly rangeOverride: LineRange | undefined,\n\t\tpublic readonly originalUri: URI,\n\t\tpublic readonly modifiedUri: URI,\n\t) {\n\t}\n\tget id(): string { return this.mapping.modified.toString(); }\n\tget range(): LineRange { return this.rangeOverride ?? this.mapping.modified; }\n}\n\n\nclass DiffToolBar extends Disposable implements IGutterItemView {\n\tprivate readonly _elements;\n\n\tprivate readonly _showAlways;\n\tprivate readonly _menuId;\n\n\tprivate readonly _isSmall;\n\n\tconstructor(\n\t\tprivate readonly _item: IObservable<DiffGutterItem>,\n\t\ttarget: HTMLElement,\n\t\tgutter: DiffEditorGutter,\n\t\t@IInstantiationService instantiationService: IInstantiationService\n\t) {\n\t\tsuper();\n\t\tthis._elements = h('div.gutterItem', { style: { height: '20px', width: '34px' } }, [\n\t\t\th('div.background@background', {}, []),\n\t\t\th('div.buttons@buttons', {}, []),\n\t\t]);\n\t\tthis._showAlways = this._item.map(this, item => item.showAlways);\n\t\tthis._menuId = this._item.map(this, item => item.menuId);\n\t\tthis._isSmall = observableValue(this, false);\n\t\tthis._lastItemRange = undefined;\n\t\tthis._lastViewRange = undefined;\n\n\t\tconst hoverDelegate = this._register(instantiationService.createInstance(\n\t\t\tWorkbenchHoverDelegate,\n\t\t\t'element',\n\t\t\t{ instantHover: true },\n\t\t\t{ position: { hoverPosition: HoverPosition.RIGHT } }\n\t\t));\n\n\t\tthis._register(appendRemoveOnDispose(target, this._elements.root));\n\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description update showAlways */\n\t\t\tconst showAlways = this._showAlways.read(reader);\n\t\t\tthis._elements.root.classList.toggle('noTransition', true);\n\t\t\tthis._elements.root.classList.toggle('showAlways', showAlways);\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis._elements.root.classList.toggle('noTransition', false);\n\t\t\t}, 0);\n\t\t}));\n\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tthis._elements.buttons.replaceChildren();\n\t\t\tconst i = store.add(instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.buttons, this._menuId.read(reader), {\n\t\t\t\torientation: ActionsOrientation.VERTICAL,\n\t\t\t\thoverDelegate,\n\t\t\t\ttoolbarOptions: {\n\t\t\t\t\tprimaryGroup: g => g.startsWith('primary'),\n\t\t\t\t},\n\t\t\t\toverflowBehavior: { maxItems: this._isSmall.read(reader) ? 1 : 3 },\n\t\t\t\thiddenItemStrategy: HiddenItemStrategy.Ignore,\n\t\t\t\tactionRunner: store.add(new ActionRunnerWithContext(() => {\n\t\t\t\t\tconst item = this._item.read(undefined);\n\t\t\t\t\tconst mapping = item.mapping;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmapping,\n\t\t\t\t\t\toriginalWithModifiedChanges: gutter.computeStagedValue(mapping),\n\t\t\t\t\t\toriginalUri: item.originalUri,\n\t\t\t\t\t\tmodifiedUri: item.modifiedUri,\n\t\t\t\t\t} satisfies DiffEditorSelectionHunkToolbarContext;\n\t\t\t\t})),\n\t\t\t\tmenuOptions: {\n\t\t\t\t\tshouldForwardArgs: true,\n\t\t\t\t},\n\t\t\t}));\n\t\t\tstore.add(i.onDidChangeMenuItems(() => {\n\t\t\t\tif (this._lastItemRange) {\n\t\t\t\t\tthis.layout(this._lastItemRange, this._lastViewRange!);\n\t\t\t\t}\n\t\t\t}));\n\t\t}));\n\t}\n\n\tprivate _lastItemRange: OffsetRange | undefined;\n\tprivate _lastViewRange: OffsetRange | undefined;\n\n\tlayout(itemRange: OffsetRange, viewRange: OffsetRange): void {\n\t\tthis._lastItemRange = itemRange;\n\t\tthis._lastViewRange = viewRange;\n\n\t\tlet itemHeight = this._elements.buttons.clientHeight;\n\t\tthis._isSmall.set(this._item.get().mapping.original.startLineNumber === 1 && itemRange.length < 30, undefined);\n\t\t// Item might have changed\n\t\titemHeight = this._elements.buttons.clientHeight;\n\n\t\tconst middleHeight = itemRange.length / 2 - itemHeight / 2;\n\n\t\tconst margin = itemHeight;\n\n\t\tlet effectiveCheckboxTop = itemRange.start + middleHeight;\n\n\t\tconst preferredViewPortRange = OffsetRange.tryCreate(\n\t\t\tmargin,\n\t\t\tviewRange.endExclusive - margin - itemHeight\n\t\t);\n\n\t\tconst preferredParentRange = OffsetRange.tryCreate(\n\t\t\titemRange.start + margin,\n\t\t\titemRange.endExclusive - itemHeight - margin\n\t\t);\n\n\t\tif (preferredParentRange && preferredViewPortRange && preferredParentRange.start < preferredParentRange.endExclusive) {\n\t\t\teffectiveCheckboxTop = preferredViewPortRange.clip(effectiveCheckboxTop);\n\t\t\teffectiveCheckboxTop = preferredParentRange.clip(effectiveCheckboxTop);\n\t\t}\n\n\t\tthis._elements.buttons.style.top = `${effectiveCheckboxTop - itemRange.start}px`;\n\t}\n}\n\nexport interface DiffEditorSelectionHunkToolbarContext {\n\tmapping: DetailedLineRangeMapping;\n\n\t/**\n\t * The original text with the selected modified changes applied.\n\t*/\n\toriginalWithModifiedChanges: string;\n\n\tmodifiedUri: URI;\n\toriginalUri: URI;\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { EventType, addDisposableListener, h } from '../../../../../base/browser/dom.js';\nimport { IMouseWheelEvent } from '../../../../../base/browser/mouseEvent.js';\nimport { ActionsOrientation } from '../../../../../base/browser/ui/actionbar/actionbar.js';\nimport { HoverPosition } from '../../../../../base/browser/ui/hover/hoverWidget.js';\nimport { IBoundarySashes } from '../../../../../base/browser/ui/sash/sash.js';\nimport { Disposable } from '../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, autorunWithStore, derived, derivedDisposable, derivedWithSetter, observableFromEvent, observableValue } from '../../../../../base/common/observable.js';\nimport { URI } from '../../../../../base/common/uri.js';\nimport { HiddenItemStrategy, MenuWorkbenchToolBar } from '../../../../../platform/actions/browser/toolbar.js';\nimport { IMenuService, MenuId } from '../../../../../platform/actions/common/actions.js';\nimport { IContextKeyService } from '../../../../../platform/contextkey/common/contextkey.js';\nimport { WorkbenchHoverDelegate } from '../../../../../platform/hover/browser/hover.js';\nimport { IInstantiationService } from '../../../../../platform/instantiation/common/instantiation.js';\nimport { EditorOption } from '../../../../common/config/editorOptions.js';\nimport { LineRange, LineRangeSet } from '../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../../../../common/core/ranges/offsetRange.js';\nimport { Range } from '../../../../common/core/range.js';\nimport { TextEdit } from '../../../../common/core/edits/textEdit.js';\nimport { DetailedLineRangeMapping } from '../../../../common/diff/rangeMapping.js';\nimport { TextModelText } from '../../../../common/model/textModelText.js';\nimport { ActionRunnerWithContext } from '../../multiDiffEditor/utils.js';\nimport { DiffEditorEditors } from '../components/diffEditorEditors.js';\nimport { DiffEditorSash, SashLayout } from '../components/diffEditorSash.js';\nimport { DiffEditorOptions } from '../diffEditorOptions.js';\nimport { DiffEditorViewModel } from '../diffEditorViewModel.js';\nimport { appendRemoveOnDispose, applyStyle, prependRemoveOnDispose } from '../utils.js';\nimport { EditorGutter, IGutterItemInfo, IGutterItemView } from '../utils/editorGutter.js';\n\nconst emptyArr: never[] = [];\nconst width = 35;\n\nexport class DiffEditorGutter extends Disposable {\n\tprivate readonly _menu;\n\tprivate readonly _actions;\n\tprivate readonly _hasActions;\n\tprivate readonly _showSash;\n\n\tpublic readonly width;\n\n\tprivate readonly elements;\n\n\tconstructor(\n\t\tdiffEditorRoot: HTMLDivElement,\n\t\tprivate readonly _diffModel: IObservable<DiffEditorViewModel | undefined>,\n\t\tprivate readonly _editors: DiffEditorEditors,\n\t\tprivate readonly _options: DiffEditorOptions,\n\t\tprivate readonly _sashLayout: SashLayout,\n\t\tprivate readonly _boundarySashes: IObservable<IBoundarySashes | undefined>,\n\t\t@IInstantiationService private readonly _instantiationService: IInstantiationService,\n\t\t@IContextKeyService private readonly _contextKeyService: IContextKeyService,\n\t\t@IMenuService private readonly _menuService: IMenuService,\n\t) {\n\t\tsuper();\n\t\tthis._menu = this._register(this._menuService.createMenu(MenuId.DiffEditorHunkToolbar, this._contextKeyService));\n\t\tthis._actions = observableFromEvent(this, this._menu.onDidChange, () => this._menu.getActions());\n\t\tthis._hasActions = this._actions.map(a => a.length > 0);\n\t\tthis._showSash = derived(this, reader => this._options.renderSideBySide.read(reader) && this._hasActions.read(reader));\n\t\tthis.width = derived(this, reader => this._hasActions.read(reader) ? width : 0);\n\t\tthis.elements = h('div.gutter@gutter', { style: { position: 'absolute', height: '100%', width: width + 'px' } }, []);\n\t\tthis._currentDiff = derived(this, (reader) => {\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tif (!model) {\n\t\t\t\treturn undefined;\n\t\t\t}\n\t\t\tconst mappings = model.diff.read(reader)?.mappings;\n\n\t\t\tconst cursorPosition = this._editors.modifiedCursor.read(reader);\n\t\t\tif (!cursorPosition) { return undefined; }\n\n\t\t\treturn mappings?.find(m => m.lineRangeMapping.modified.contains(cursorPosition.lineNumber));\n\t\t});\n\t\tthis._selectedDiffs = derived(this, (reader) => {\n\t\t\t/** @description selectedDiffs */\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tconst diff = model?.diff.read(reader);\n\t\t\t// Return `emptyArr` because it is a constant. [] is always a new array and would trigger a change.\n\t\t\tif (!diff) { return emptyArr; }\n\n\t\t\tconst selections = this._editors.modifiedSelections.read(reader);\n\t\t\tif (selections.every(s => s.isEmpty())) { return emptyArr; }\n\n\t\t\tconst selectedLineNumbers = new LineRangeSet(selections.map(s => LineRange.fromRangeInclusive(s)));\n\n\t\t\tconst selectedMappings = diff.mappings.filter(m =>\n\t\t\t\tm.lineRangeMapping.innerChanges && selectedLineNumbers.intersects(m.lineRangeMapping.modified)\n\t\t\t);\n\t\t\tconst result = selectedMappings.map(mapping => ({\n\t\t\t\tmapping,\n\t\t\t\trangeMappings: mapping.lineRangeMapping.innerChanges!.filter(\n\t\t\t\t\tc => selections.some(s => Range.areIntersecting(c.modifiedRange, s))\n\t\t\t\t)\n\t\t\t}));\n\t\t\tif (result.length === 0 || result.every(r => r.rangeMappings.length === 0)) { return emptyArr; }\n\t\t\treturn result;\n\t\t});\n\n\t\tthis._register(prependRemoveOnDispose(diffEditorRoot, this.elements.root));\n\n\t\tthis._register(addDisposableListener(this.elements.root, 'click', () => {\n\t\t\tthis._editors.modified.focus();\n\t\t}));\n\n\t\tthis._register(applyStyle(this.elements.root, { display: this._hasActions.map(a => a ? 'block' : 'none') }));\n\n\t\tderivedDisposable(this, reader => {\n\t\t\tconst showSash = this._showSash.read(reader);\n\t\t\treturn !showSash ? undefined : new DiffEditorSash(\n\t\t\t\tdiffEditorRoot,\n\t\t\t\tthis._sashLayout.dimensions,\n\t\t\t\tthis._options.enableSplitViewResizing,\n\t\t\t\tthis._boundarySashes,\n\t\t\t\tderivedWithSetter(\n\t\t\t\t\tthis, reader => this._sashLayout.sashLeft.read(reader) - width,\n\t\t\t\t\t(v, tx) => this._sashLayout.sashLeft.set(v + width, tx)\n\t\t\t\t),\n\t\t\t\t() => this._sashLayout.resetSash(),\n\t\t\t);\n\t\t}).recomputeInitiallyAndOnChange(this._store);\n\n\t\tconst gutterItems = derived(this, reader => {\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tif (!model) {\n\t\t\t\treturn [];\n\t\t\t}\n\t\t\tconst diffs = model.diff.read(reader);\n\t\t\tif (!diffs) { return []; }\n\n\t\t\tconst selection = this._selectedDiffs.read(reader);\n\t\t\tif (selection.length > 0) {\n\t\t\t\tconst m = DetailedLineRangeMapping.fromRangeMappings(selection.flatMap(s => s.rangeMappings));\n\t\t\t\treturn [\n\t\t\t\t\tnew DiffGutterItem(\n\t\t\t\t\t\tm,\n\t\t\t\t\t\ttrue,\n\t\t\t\t\t\tMenuId.DiffEditorSelectionToolbar,\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tmodel.model.original.uri,\n\t\t\t\t\t\tmodel.model.modified.uri,\n\t\t\t\t\t)];\n\t\t\t}\n\n\t\t\tconst currentDiff = this._currentDiff.read(reader);\n\n\t\t\treturn diffs.mappings.map(m => new DiffGutterItem(\n\t\t\t\tm.lineRangeMapping.withInnerChangesFromLineRanges(),\n\t\t\t\tm.lineRangeMapping === currentDiff?.lineRangeMapping,\n\t\t\t\tMenuId.DiffEditorHunkToolbar,\n\t\t\t\tundefined,\n\t\t\t\tmodel.model.original.uri,\n\t\t\t\tmodel.model.modified.uri,\n\t\t\t));\n\t\t});\n\n\t\tthis._register(new EditorGutter<DiffGutterItem>(this._editors.modified, this.elements.root, {\n\t\t\tgetIntersectingGutterItems: (range, reader) => gutterItems.read(reader),\n\t\t\tcreateView: (item, target) => {\n\t\t\t\treturn this._instantiationService.createInstance(DiffToolBar, item, target, this);\n\t\t\t},\n\t\t}));\n\n\t\tthis._register(addDisposableListener(this.elements.gutter, EventType.MOUSE_WHEEL, (e: IMouseWheelEvent) => {\n\t\t\tif (this._editors.modified.getOption(EditorOption.scrollbar).handleMouseWheel) {\n\t\t\t\tthis._editors.modified.delegateScrollFromMouseWheelEvent(e);\n\t\t\t}\n\t\t}, { passive: false }));\n\t}\n\n\tpublic computeStagedValue(mapping: DetailedLineRangeMapping): string {\n\t\tconst c = mapping.innerChanges ?? [];\n\t\tconst modified = new TextModelText(this._editors.modifiedModel.get()!);\n\t\tconst original = new TextModelText(this._editors.original.getModel()!);\n\n\t\tconst edit = new TextEdit(c.map(c => c.toTextEdit(modified)));\n\t\tconst value = edit.apply(original);\n\t\treturn value;\n\t}\n\n\tprivate readonly _currentDiff;\n\n\tprivate readonly _selectedDiffs;\n\n\tlayout(left: number) {\n\t\tthis.elements.gutter.style.left = left + 'px';\n\t}\n}\n\nclass DiffGutterItem implements IGutterItemInfo {\n\tconstructor(\n\t\tpublic readonly mapping: DetailedLineRangeMapping,\n\t\tpublic readonly showAlways: boolean,\n\t\tpublic readonly menuId: MenuId,\n\t\tpublic readonly rangeOverride: LineRange | undefined,\n\t\tpublic readonly originalUri: URI,\n\t\tpublic readonly modifiedUri: URI,\n\t) {\n\t}\n\tget id(): string { return this.mapping.modified.toString(); }\n\tget range(): LineRange { return this.rangeOverride ?? this.mapping.modified; }\n}\n\n\nclass DiffToolBar extends Disposable implements IGutterItemView {\n\tprivate readonly _elements;\n\n\tprivate readonly _showAlways;\n\tprivate readonly _menuId;\n\n\tprivate readonly _isSmall;\n\n\tconstructor(\n\t\tprivate readonly _item: IObservable<DiffGutterItem>,\n\t\ttarget: HTMLElement,\n\t\tgutter: DiffEditorGutter,\n\t\t@IInstantiationService instantiationService: IInstantiationService\n\t) {\n\t\tsuper();\n\t\tthis._elements = h('div.gutterItem', { style: { height: '20px', width: '34px' } }, [\n\t\t\th('div.background@background', {}, []),\n\t\t\th('div.buttons@buttons', {}, []),\n\t\t]);\n\t\tthis._showAlways = this._item.map(this, item => item.showAlways);\n\t\tthis._menuId = this._item.map(this, item => item.menuId);\n\t\tthis._isSmall = observableValue(this, false);\n\t\tthis._lastItemRange = undefined;\n\t\tthis._lastViewRange = undefined;\n\n\t\tconst hoverDelegate = this._register(instantiationService.createInstance(\n\t\t\tWorkbenchHoverDelegate,\n\t\t\t'element',\n\t\t\t{ instantHover: true },\n\t\t\t{ position: { hoverPosition: HoverPosition.RIGHT } }\n\t\t));\n\n\t\tthis._register(appendRemoveOnDispose(target, this._elements.root));\n\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description update showAlways */\n\t\t\tconst showAlways = this._showAlways.read(reader);\n\t\t\tthis._elements.root.classList.toggle('noTransition', true);\n\t\t\tthis._elements.root.classList.toggle('showAlways', showAlways);\n\t\t\tsetTimeout(() => {\n\t\t\t\tthis._elements.root.classList.toggle('noTransition', false);\n\t\t\t}, 0);\n\t\t}));\n\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tthis._elements.buttons.replaceChildren();\n\t\t\tconst i = store.add(instantiationService.createInstance(MenuWorkbenchToolBar, this._elements.buttons, this._menuId.read(reader), {\n\t\t\t\torientation: ActionsOrientation.VERTICAL,\n\t\t\t\thoverDelegate,\n\t\t\t\ttoolbarOptions: {\n\t\t\t\t\tprimaryGroup: g => g.startsWith('primary'),\n\t\t\t\t},\n\t\t\t\toverflowBehavior: { maxItems: this._isSmall.read(reader) ? 1 : 3 },\n\t\t\t\thiddenItemStrategy: HiddenItemStrategy.Ignore,\n\t\t\t\tactionRunner: store.add(new ActionRunnerWithContext(() => {\n\t\t\t\t\tconst item = this._item.read(undefined);\n\t\t\t\t\tconst mapping = item.mapping;\n\t\t\t\t\treturn {\n\t\t\t\t\t\tmapping,\n\t\t\t\t\t\toriginalWithModifiedChanges: gutter.computeStagedValue(mapping),\n\t\t\t\t\t\toriginalUri: item.originalUri,\n\t\t\t\t\t\tmodifiedUri: item.modifiedUri,\n\t\t\t\t\t} satisfies DiffEditorSelectionHunkToolbarContext;\n\t\t\t\t})),\n\t\t\t\tmenuOptions: {\n\t\t\t\t\tshouldForwardArgs: true,\n\t\t\t\t},\n\t\t\t}));\n\t\t\tstore.add(i.onDidChangeMenuItems(() => {\n\t\t\t\tif (this._lastItemRange) {\n\t\t\t\t\tthis.layout(this._lastItemRange, this._lastViewRange!);\n\t\t\t\t}\n\t\t\t}));\n\t\t}));\n\t}\n\n\tprivate _lastItemRange: OffsetRange | undefined;\n\tprivate _lastViewRange: OffsetRange | undefined;\n\n\tlayout(itemRange: OffsetRange, viewRange: OffsetRange): void {\n\t\tthis._lastItemRange = itemRange;\n\t\tthis._lastViewRange = viewRange;\n\n\t\tlet itemHeight = this._elements.buttons.clientHeight;\n\t\tthis._isSmall.set(this._item.get().mapping.original.startLineNumber === 1 && itemRange.length < 30, undefined);\n\t\t// Item might have changed\n\t\titemHeight = this._elements.buttons.clientHeight;\n\n\t\tconst middleHeight = itemRange.length / 2 - itemHeight / 2;\n\n\t\tconst margin = itemHeight;\n\n\t\tlet effectiveCheckboxTop = itemRange.start + middleHeight;\n\n\t\tconst preferredViewPortRange = OffsetRange.tryCreate(\n\t\t\tmargin,\n\t\t\tviewRange.endExclusive - margin - itemHeight\n\t\t);\n\n\t\tconst preferredParentRange = OffsetRange.tryCreate(\n\t\t\titemRange.start + margin,\n\t\t\titemRange.endExclusive - itemHeight - margin\n\t\t);\n\n\t\tif (preferredParentRange && preferredViewPortRange && preferredParentRange.start < preferredParentRange.endExclusive) {\n\t\t\teffectiveCheckboxTop = preferredViewPortRange.clip(effectiveCheckboxTop);\n\t\t\teffectiveCheckboxTop = preferredParentRange.clip(effectiveCheckboxTop);\n\t\t}\n\n\t\tthis._elements.buttons.style.top = `${effectiveCheckboxTop - itemRange.start}px`;\n\t}\n}\n\nexport interface DiffEditorSelectionHunkToolbarContext {\n\tmapping: DetailedLineRangeMapping;\n\n\t/**\n\t * The original text with the selected modified changes applied.\n\t*/\n\toriginalWithModifiedChanges: string;\n\n\tmodifiedUri: URI;\n\toriginalUri: URI;\n}\n"]}
|