monaco-editor-core 0.54.0-dev-20250918 → 0.54.0-dev-20250921
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.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/diffEditorViewZones.js +8 -8
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/diffEditorViewZones.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorViewModel.js +3 -3
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorViewModel.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/gutterFeature.js +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/gutterFeature.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature.js +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature.js.map +1 -1
- package/esm/vs/editor/common/core/ranges/lineRange.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +8 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +5 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js.map +1 -1
- package/esm/vs/editor/contrib/middleScroll/browser/middleScrollController.js +3 -3
- package/esm/vs/editor/contrib/middleScroll/browser/middleScrollController.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,MAAM,+DAA+D,CAAC;AAEtG,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AACtF,OAAO,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAC5E,OAAO,EAAE,KAAK,EAAE,MAAM,kCAAkC,C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SAAS,CAAC,MAAM,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC;QAC/G,0BAA0B;QAC1B,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC;QAEjD,MAAM,YAAY,GAAG,SAAS,CAAC,MAAM,GAAG,CAAC,GAAG,UAAU,GAAG,CAAC,CAAC;QAE3D,MAAM,MAAM,GAAG,UAAU,CAAC;QAE1B,IAAI,oBAAoB,GAAG,SAAS,CAAC,KAAK,GAAG,YAAY,CAAC;QAE1D,MAAM,sBAAsB,GAAG,WAAW,CAAC,SAAS,CACnD,MAAM,EACN,SAAS,CAAC,YAAY,GAAG,MAAM,GAAG,UAAU,CAC5C,CAAC;QAEF,MAAM,oBAAoB,GAAG,WAAW,CAAC,SAAS,CACjD,SAAS,CAAC,KAAK,GAAG,MAAM,EACxB,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,sBAAuB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YAC1E,oBAAoB,GAAG,oBAAqB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACzE,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.get();\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.get();\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,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,iBA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,CAAC,oBAAoB,CAAC,CAAC;YAC1E,oBAAoB,GAAG,oBAAqB,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACzE,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"]}
|
|
@@ -186,7 +186,7 @@ export class MovedBlocksLinesFeature extends Disposable {
|
|
|
186
186
|
movedText = diff.movedTexts.find(m => m.lineRangeMapping.modified.contains(modifiedPos.lineNumber));
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
if (movedText !== m.movedTextToCompare.
|
|
189
|
+
if (movedText !== m.movedTextToCompare.read(undefined)) {
|
|
190
190
|
m.movedTextToCompare.set(undefined, undefined);
|
|
191
191
|
}
|
|
192
192
|
m.setActiveMovedText(movedText);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,CAAC,EAAE,MAAM,oCAAoC,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,uDAAuD,CAAC;AAClF,OAAO,EAAE,MAAM,EAAE,MAAM,uCAAuC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3H,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AACtE,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAe,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,eAAe,EAAE,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,eAAe,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AAClP,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAIpE,OAAO,EAAE,mBAAmB,EAAE,qBA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AAS,EACT,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC,cAAc,CAAC,EAC7C,IAAI,EACJ,GAAG,EAAE;YACJ,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACrB,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,GAAG,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;QAChI,CAAC,CACD,CAAC;QACF,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YAC/B,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC;YAC3E,aAAa,CAAC,OAAO,GAAG,QAAQ,CAAC;QAClC,CAAC,CAAC,CAAC,CAAC;QAEJ,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC;CACD","file":"movedBlocksLinesFeature.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 { h } from '../../../../../base/browser/dom.js';\nimport { ActionBar } from '../../../../../base/browser/ui/actionbar/actionbar.js';\nimport { Action } from '../../../../../base/common/actions.js';\nimport { booleanComparator, compareBy, numberComparator, tieBreakComparators } from '../../../../../base/common/arrays.js';\nimport { findMaxIdx } from '../../../../../base/common/arraysFind.js';\nimport { Codicon } from '../../../../../base/common/codicons.js';\nimport { Disposable, toDisposable } from '../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, autorunHandleChanges, autorunWithStore, constObservable, derived, observableFromEvent, observableSignalFromEvent, observableValue, recomputeInitiallyAndOnChange } from '../../../../../base/common/observable.js';\nimport { ThemeIcon } from '../../../../../base/common/themables.js';\nimport { ICodeEditor } from '../../../editorBrowser.js';\nimport { DiffEditorEditors } from '../components/diffEditorEditors.js';\nimport { DiffEditorViewModel } from '../diffEditorViewModel.js';\nimport { PlaceholderViewZone, ViewZoneOverlayWidget, applyStyle, applyViewZones } from '../utils.js';\nimport { EditorLayoutInfo } from '../../../../common/config/editorOptions.js';\nimport { LineRange } from '../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange, OffsetRangeSet } from '../../../../common/core/ranges/offsetRange.js';\nimport { MovedText } from '../../../../common/diff/linesDiffComputer.js';\nimport { localize } from '../../../../../nls.js';\n\nexport class MovedBlocksLinesFeature extends Disposable {\n\tpublic static readonly movedCodeBlockPadding = 4;\n\n\tprivate readonly _element: SVGElement;\n\tprivate readonly _originalScrollTop;\n\tprivate readonly _modifiedScrollTop;\n\tprivate readonly _viewZonesChanged;\n\n\tpublic readonly width;\n\n\tconstructor(\n\t\tprivate readonly _rootElement: HTMLElement,\n\t\tprivate readonly _diffModel: IObservable<DiffEditorViewModel | undefined>,\n\t\tprivate readonly _originalEditorLayoutInfo: IObservable<EditorLayoutInfo | null>,\n\t\tprivate readonly _modifiedEditorLayoutInfo: IObservable<EditorLayoutInfo | null>,\n\t\tprivate readonly _editors: DiffEditorEditors,\n\t) {\n\t\tsuper();\n\t\tthis._originalScrollTop = observableFromEvent(this, this._editors.original.onDidScrollChange, () => this._editors.original.getScrollTop());\n\t\tthis._modifiedScrollTop = observableFromEvent(this, this._editors.modified.onDidScrollChange, () => this._editors.modified.getScrollTop());\n\t\tthis._viewZonesChanged = observableSignalFromEvent('onDidChangeViewZones', this._editors.modified.onDidChangeViewZones);\n\t\tthis.width = observableValue(this, 0);\n\t\tthis._modifiedViewZonesChangedSignal = observableSignalFromEvent('modified.onDidChangeViewZones', this._editors.modified.onDidChangeViewZones);\n\t\tthis._originalViewZonesChangedSignal = observableSignalFromEvent('original.onDidChangeViewZones', this._editors.original.onDidChangeViewZones);\n\t\tthis._state = derived(this, (reader) => {\n\t\t\t/** @description state */\n\n\t\t\tthis._element.replaceChildren();\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tconst moves = model?.diff.read(reader)?.movedTexts;\n\t\t\tif (!moves || moves.length === 0) {\n\t\t\t\tthis.width.set(0, undefined);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._viewZonesChanged.read(reader);\n\n\t\t\tconst infoOrig = this._originalEditorLayoutInfo.read(reader);\n\t\t\tconst infoMod = this._modifiedEditorLayoutInfo.read(reader);\n\t\t\tif (!infoOrig || !infoMod) {\n\t\t\t\tthis.width.set(0, undefined);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._modifiedViewZonesChangedSignal.read(reader);\n\t\t\tthis._originalViewZonesChangedSignal.read(reader);\n\n\t\t\tconst lines = moves.map((move) => {\n\t\t\t\tfunction computeLineStart(range: LineRange, editor: ICodeEditor) {\n\t\t\t\t\tconst t1 = editor.getTopForLineNumber(range.startLineNumber, true);\n\t\t\t\t\tconst t2 = editor.getTopForLineNumber(range.endLineNumberExclusive, true);\n\t\t\t\t\treturn (t1 + t2) / 2;\n\t\t\t\t}\n\n\t\t\t\tconst start = computeLineStart(move.lineRangeMapping.original, this._editors.original);\n\t\t\t\tconst startOffset = this._originalScrollTop.read(reader);\n\t\t\t\tconst end = computeLineStart(move.lineRangeMapping.modified, this._editors.modified);\n\t\t\t\tconst endOffset = this._modifiedScrollTop.read(reader);\n\n\t\t\t\tconst from = start - startOffset;\n\t\t\t\tconst to = end - endOffset;\n\n\t\t\t\tconst top = Math.min(start, end);\n\t\t\t\tconst bottom = Math.max(start, end);\n\n\t\t\t\treturn { range: new OffsetRange(top, bottom), from, to, fromWithoutScroll: start, toWithoutScroll: end, move };\n\t\t\t});\n\n\t\t\tlines.sort(tieBreakComparators(\n\t\t\t\tcompareBy(l => l.fromWithoutScroll > l.toWithoutScroll, booleanComparator),\n\t\t\t\tcompareBy(l => l.fromWithoutScroll > l.toWithoutScroll ? l.fromWithoutScroll : -l.toWithoutScroll, numberComparator)\n\t\t\t));\n\n\t\t\tconst layout = LinesLayout.compute(lines.map(l => l.range));\n\n\t\t\tconst padding = 10;\n\t\t\tconst lineAreaLeft = infoOrig.verticalScrollbarWidth;\n\t\t\tconst lineAreaWidth = (layout.getTrackCount() - 1) * 10 + padding * 2;\n\t\t\tconst width = lineAreaLeft + lineAreaWidth + (infoMod.contentLeft - MovedBlocksLinesFeature.movedCodeBlockPadding);\n\n\t\t\tlet idx = 0;\n\t\t\tfor (const line of lines) {\n\t\t\t\tconst track = layout.getTrack(idx);\n\t\t\t\tconst verticalY = lineAreaLeft + padding + track * 10;\n\n\t\t\t\tconst arrowHeight = 15;\n\t\t\t\tconst arrowWidth = 15;\n\t\t\t\tconst right = width;\n\n\t\t\t\tconst rectWidth = infoMod.glyphMarginWidth + infoMod.lineNumbersWidth;\n\t\t\t\tconst rectHeight = 18;\n\t\t\t\tconst rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n\t\t\t\trect.classList.add('arrow-rectangle');\n\t\t\t\trect.setAttribute('x', `${right - rectWidth}`);\n\t\t\t\trect.setAttribute('y', `${line.to - rectHeight / 2}`);\n\t\t\t\trect.setAttribute('width', `${rectWidth}`);\n\t\t\t\trect.setAttribute('height', `${rectHeight}`);\n\t\t\t\tthis._element.appendChild(rect);\n\n\t\t\t\tconst g = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n\n\t\t\t\tconst path = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n\n\t\t\t\tpath.setAttribute('d', `M ${0} ${line.from} L ${verticalY} ${line.from} L ${verticalY} ${line.to} L ${right - arrowWidth} ${line.to}`);\n\t\t\t\tpath.setAttribute('fill', 'none');\n\t\t\t\tg.appendChild(path);\n\n\t\t\t\tconst arrowRight = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');\n\t\t\t\tarrowRight.classList.add('arrow');\n\n\t\t\t\treader.store.add(autorun(reader => {\n\t\t\t\t\tpath.classList.toggle('currentMove', line.move === model.activeMovedText.read(reader));\n\t\t\t\t\tarrowRight.classList.toggle('currentMove', line.move === model.activeMovedText.read(reader));\n\t\t\t\t}));\n\n\t\t\t\tarrowRight.setAttribute('points', `${right - arrowWidth},${line.to - arrowHeight / 2} ${right},${line.to} ${right - arrowWidth},${line.to + arrowHeight / 2}`);\n\t\t\t\tg.appendChild(arrowRight);\n\n\t\t\t\tthis._element.appendChild(g);\n\n\t\t\t\t/*\n\t\t\t\tTODO@hediet\n\t\t\t\tpath.addEventListener('mouseenter', () => {\n\t\t\t\t\tmodel.setHoveredMovedText(line.move);\n\t\t\t\t});\n\t\t\t\tpath.addEventListener('mouseleave', () => {\n\t\t\t\t\tmodel.setHoveredMovedText(undefined);\n\t\t\t\t});*/\n\n\t\t\t\tidx++;\n\t\t\t}\n\n\t\t\tthis.width.set(lineAreaWidth, undefined);\n\t\t});\n\n\t\tthis._element = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n\t\tthis._element.setAttribute('class', 'moved-blocks-lines');\n\t\tthis._rootElement.appendChild(this._element);\n\t\tthis._register(toDisposable(() => this._element.remove()));\n\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description update moved blocks lines positioning */\n\t\t\tconst info = this._originalEditorLayoutInfo.read(reader);\n\t\t\tconst info2 = this._modifiedEditorLayoutInfo.read(reader);\n\t\t\tif (!info || !info2) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._element.style.left = `${info.width - info.verticalScrollbarWidth}px`;\n\t\t\tthis._element.style.height = `${info.height}px`;\n\t\t\tthis._element.style.width = `${info.verticalScrollbarWidth + info.contentLeft - MovedBlocksLinesFeature.movedCodeBlockPadding + this.width.read(reader)}px`;\n\t\t}));\n\n\t\tthis._register(recomputeInitiallyAndOnChange(this._state));\n\n\t\tconst movedBlockViewZones = derived(reader => {\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tconst d = model?.diff.read(reader);\n\t\t\tif (!d) { return []; }\n\t\t\treturn d.movedTexts.map(move => ({\n\t\t\t\tmove,\n\t\t\t\toriginal: new PlaceholderViewZone(constObservable(move.lineRangeMapping.original.startLineNumber - 1), 18),\n\t\t\t\tmodified: new PlaceholderViewZone(constObservable(move.lineRangeMapping.modified.startLineNumber - 1), 18),\n\t\t\t}));\n\t\t});\n\n\t\tthis._register(applyViewZones(this._editors.original, movedBlockViewZones.map(zones => /** @description movedBlockViewZones.original */ zones.map(z => z.original))));\n\t\tthis._register(applyViewZones(this._editors.modified, movedBlockViewZones.map(zones => /** @description movedBlockViewZones.modified */ zones.map(z => z.modified))));\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tconst blocks = movedBlockViewZones.read(reader);\n\t\t\tfor (const b of blocks) {\n\t\t\t\tstore.add(new MovedBlockOverlayWidget(this._editors.original, b.original, b.move, 'original', this._diffModel.get()!));\n\t\t\t\tstore.add(new MovedBlockOverlayWidget(this._editors.modified, b.modified, b.move, 'modified', this._diffModel.get()!));\n\t\t\t}\n\t\t}));\n\n\t\tconst originalHasFocus = observableSignalFromEvent(\n\t\t\t'original.onDidFocusEditorWidget',\n\t\t\te => this._editors.original.onDidFocusEditorWidget(() => setTimeout(() => e(undefined), 0))\n\t\t);\n\t\tconst modifiedHasFocus = observableSignalFromEvent(\n\t\t\t'modified.onDidFocusEditorWidget',\n\t\t\te => this._editors.modified.onDidFocusEditorWidget(() => setTimeout(() => e(undefined), 0))\n\t\t);\n\n\t\tlet lastChangedEditor: 'original' | 'modified' = 'modified';\n\n\t\tthis._register(autorunHandleChanges({\n\t\t\tchangeTracker: {\n\t\t\t\tcreateChangeSummary: () => undefined,\n\t\t\t\thandleChange: (ctx, summary) => {\n\t\t\t\t\tif (ctx.didChange(originalHasFocus)) { lastChangedEditor = 'original'; }\n\t\t\t\t\tif (ctx.didChange(modifiedHasFocus)) { lastChangedEditor = 'modified'; }\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}, reader => {\n\t\t\t/** @description MovedBlocksLines.setActiveMovedTextFromCursor */\n\t\t\toriginalHasFocus.read(reader);\n\t\t\tmodifiedHasFocus.read(reader);\n\n\t\t\tconst m = this._diffModel.read(reader);\n\t\t\tif (!m) { return; }\n\t\t\tconst diff = m.diff.read(reader);\n\n\t\t\tlet movedText: MovedText | undefined = undefined;\n\n\t\t\tif (diff && lastChangedEditor === 'original') {\n\t\t\t\tconst originalPos = this._editors.originalCursor.read(reader);\n\t\t\t\tif (originalPos) {\n\t\t\t\t\tmovedText = diff.movedTexts.find(m => m.lineRangeMapping.original.contains(originalPos.lineNumber));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (diff && lastChangedEditor === 'modified') {\n\t\t\t\tconst modifiedPos = this._editors.modifiedCursor.read(reader);\n\t\t\t\tif (modifiedPos) {\n\t\t\t\t\tmovedText = diff.movedTexts.find(m => m.lineRangeMapping.modified.contains(modifiedPos.lineNumber));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (movedText !== m.movedTextToCompare.get()) {\n\t\t\t\tm.movedTextToCompare.set(undefined, undefined);\n\t\t\t}\n\t\t\tm.setActiveMovedText(movedText);\n\t\t}));\n\t}\n\n\tprivate readonly _modifiedViewZonesChangedSignal;\n\tprivate readonly _originalViewZonesChangedSignal;\n\n\tprivate readonly _state;\n}\n\nclass LinesLayout {\n\tpublic static compute(lines: OffsetRange[]): LinesLayout {\n\t\tconst setsPerTrack: OffsetRangeSet[] = [];\n\t\tconst trackPerLineIdx: number[] = [];\n\n\t\tfor (const line of lines) {\n\t\t\tlet trackIdx = setsPerTrack.findIndex(set => !set.intersectsStrict(line));\n\t\t\tif (trackIdx === -1) {\n\t\t\t\tconst maxTrackCount = 6;\n\t\t\t\tif (setsPerTrack.length >= maxTrackCount) {\n\t\t\t\t\ttrackIdx = findMaxIdx(setsPerTrack, compareBy(set => set.intersectWithRangeLength(line), numberComparator));\n\t\t\t\t} else {\n\t\t\t\t\ttrackIdx = setsPerTrack.length;\n\t\t\t\t\tsetsPerTrack.push(new OffsetRangeSet());\n\t\t\t\t}\n\t\t\t}\n\t\t\tsetsPerTrack[trackIdx].addRange(line);\n\t\t\ttrackPerLineIdx.push(trackIdx);\n\t\t}\n\n\t\treturn new LinesLayout(setsPerTrack.length, trackPerLineIdx);\n\t}\n\n\tprivate constructor(\n\t\tprivate readonly _trackCount: number,\n\t\tprivate readonly trackPerLineIdx: number[]\n\t) { }\n\n\tgetTrack(lineIdx: number): number {\n\t\treturn this.trackPerLineIdx[lineIdx];\n\t}\n\n\tgetTrackCount(): number {\n\t\treturn this._trackCount;\n\t}\n}\n\nclass MovedBlockOverlayWidget extends ViewZoneOverlayWidget {\n\tprivate readonly _nodes = h('div.diff-moved-code-block', { style: { marginRight: '4px' } }, [\n\t\th('div.text-content@textContent'),\n\t\th('div.action-bar@actionBar'),\n\t]);\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\t_viewZone: PlaceholderViewZone,\n\t\tprivate readonly _move: MovedText,\n\t\tprivate readonly _kind: 'original' | 'modified',\n\t\tprivate readonly _diffModel: DiffEditorViewModel,\n\t) {\n\t\tconst root = h('div.diff-hidden-lines-widget');\n\t\tsuper(_editor, _viewZone, root.root);\n\t\troot.root.appendChild(this._nodes.root);\n\n\t\tconst editorLayout = observableFromEvent(this._editor.onDidLayoutChange, () => this._editor.getLayoutInfo());\n\n\t\tthis._register(applyStyle(this._nodes.root, {\n\t\t\tpaddingRight: editorLayout.map(l => l.verticalScrollbarWidth)\n\t\t}));\n\n\t\tlet text: string;\n\n\t\tif (_move.changes.length > 0) {\n\t\t\ttext = this._kind === 'original' ? localize(\n\t\t\t\t'codeMovedToWithChanges',\n\t\t\t\t'Code moved with changes to line {0}-{1}',\n\t\t\t\tthis._move.lineRangeMapping.modified.startLineNumber,\n\t\t\t\tthis._move.lineRangeMapping.modified.endLineNumberExclusive - 1,\n\t\t\t) : localize(\n\t\t\t\t'codeMovedFromWithChanges',\n\t\t\t\t'Code moved with changes from line {0}-{1}',\n\t\t\t\tthis._move.lineRangeMapping.original.startLineNumber,\n\t\t\t\tthis._move.lineRangeMapping.original.endLineNumberExclusive - 1,\n\t\t\t);\n\t\t} else {\n\t\t\ttext = this._kind === 'original' ? localize(\n\t\t\t\t'codeMovedTo',\n\t\t\t\t'Code moved to line {0}-{1}',\n\t\t\t\tthis._move.lineRangeMapping.modified.startLineNumber,\n\t\t\t\tthis._move.lineRangeMapping.modified.endLineNumberExclusive - 1,\n\t\t\t) : localize(\n\t\t\t\t'codeMovedFrom',\n\t\t\t\t'Code moved from line {0}-{1}',\n\t\t\t\tthis._move.lineRangeMapping.original.startLineNumber,\n\t\t\t\tthis._move.lineRangeMapping.original.endLineNumberExclusive - 1,\n\t\t\t);\n\t\t}\n\n\t\tconst actionBar = this._register(new ActionBar(this._nodes.actionBar, {\n\t\t\thighlightToggledItems: true,\n\t\t}));\n\n\t\tconst caption = new Action(\n\t\t\t'',\n\t\t\ttext,\n\t\t\t'',\n\t\t\tfalse,\n\t\t);\n\t\tactionBar.push(caption, { icon: false, label: true });\n\n\t\tconst actionCompare = new Action(\n\t\t\t'',\n\t\t\t'Compare',\n\t\t\tThemeIcon.asClassName(Codicon.compareChanges),\n\t\t\ttrue,\n\t\t\t() => {\n\t\t\t\tthis._editor.focus();\n\t\t\t\tthis._diffModel.movedTextToCompare.set(this._diffModel.movedTextToCompare.get() === _move ? undefined : this._move, undefined);\n\t\t\t},\n\t\t);\n\t\tthis._register(autorun(reader => {\n\t\t\tconst isActive = this._diffModel.movedTextToCompare.read(reader) === _move;\n\t\t\tactionCompare.checked = isActive;\n\t\t}));\n\n\t\tactionBar.push(actionCompare, { icon: false, label: true });\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;A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AQ,CAAC;QAClC,CAAC,CAAC,CAAC,CAAC;QAEJ,SAAS,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC;CACD","file":"movedBlocksLinesFeature.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 { h } from '../../../../../base/browser/dom.js';\nimport { ActionBar } from '../../../../../base/browser/ui/actionbar/actionbar.js';\nimport { Action } from '../../../../../base/common/actions.js';\nimport { booleanComparator, compareBy, numberComparator, tieBreakComparators } from '../../../../../base/common/arrays.js';\nimport { findMaxIdx } from '../../../../../base/common/arraysFind.js';\nimport { Codicon } from '../../../../../base/common/codicons.js';\nimport { Disposable, toDisposable } from '../../../../../base/common/lifecycle.js';\nimport { IObservable, autorun, autorunHandleChanges, autorunWithStore, constObservable, derived, observableFromEvent, observableSignalFromEvent, observableValue, recomputeInitiallyAndOnChange } from '../../../../../base/common/observable.js';\nimport { ThemeIcon } from '../../../../../base/common/themables.js';\nimport { ICodeEditor } from '../../../editorBrowser.js';\nimport { DiffEditorEditors } from '../components/diffEditorEditors.js';\nimport { DiffEditorViewModel } from '../diffEditorViewModel.js';\nimport { PlaceholderViewZone, ViewZoneOverlayWidget, applyStyle, applyViewZones } from '../utils.js';\nimport { EditorLayoutInfo } from '../../../../common/config/editorOptions.js';\nimport { LineRange } from '../../../../common/core/ranges/lineRange.js';\nimport { OffsetRange, OffsetRangeSet } from '../../../../common/core/ranges/offsetRange.js';\nimport { MovedText } from '../../../../common/diff/linesDiffComputer.js';\nimport { localize } from '../../../../../nls.js';\n\nexport class MovedBlocksLinesFeature extends Disposable {\n\tpublic static readonly movedCodeBlockPadding = 4;\n\n\tprivate readonly _element: SVGElement;\n\tprivate readonly _originalScrollTop;\n\tprivate readonly _modifiedScrollTop;\n\tprivate readonly _viewZonesChanged;\n\n\tpublic readonly width;\n\n\tconstructor(\n\t\tprivate readonly _rootElement: HTMLElement,\n\t\tprivate readonly _diffModel: IObservable<DiffEditorViewModel | undefined>,\n\t\tprivate readonly _originalEditorLayoutInfo: IObservable<EditorLayoutInfo | null>,\n\t\tprivate readonly _modifiedEditorLayoutInfo: IObservable<EditorLayoutInfo | null>,\n\t\tprivate readonly _editors: DiffEditorEditors,\n\t) {\n\t\tsuper();\n\t\tthis._originalScrollTop = observableFromEvent(this, this._editors.original.onDidScrollChange, () => this._editors.original.getScrollTop());\n\t\tthis._modifiedScrollTop = observableFromEvent(this, this._editors.modified.onDidScrollChange, () => this._editors.modified.getScrollTop());\n\t\tthis._viewZonesChanged = observableSignalFromEvent('onDidChangeViewZones', this._editors.modified.onDidChangeViewZones);\n\t\tthis.width = observableValue(this, 0);\n\t\tthis._modifiedViewZonesChangedSignal = observableSignalFromEvent('modified.onDidChangeViewZones', this._editors.modified.onDidChangeViewZones);\n\t\tthis._originalViewZonesChangedSignal = observableSignalFromEvent('original.onDidChangeViewZones', this._editors.original.onDidChangeViewZones);\n\t\tthis._state = derived(this, (reader) => {\n\t\t\t/** @description state */\n\n\t\t\tthis._element.replaceChildren();\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tconst moves = model?.diff.read(reader)?.movedTexts;\n\t\t\tif (!moves || moves.length === 0) {\n\t\t\t\tthis.width.set(0, undefined);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._viewZonesChanged.read(reader);\n\n\t\t\tconst infoOrig = this._originalEditorLayoutInfo.read(reader);\n\t\t\tconst infoMod = this._modifiedEditorLayoutInfo.read(reader);\n\t\t\tif (!infoOrig || !infoMod) {\n\t\t\t\tthis.width.set(0, undefined);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._modifiedViewZonesChangedSignal.read(reader);\n\t\t\tthis._originalViewZonesChangedSignal.read(reader);\n\n\t\t\tconst lines = moves.map((move) => {\n\t\t\t\tfunction computeLineStart(range: LineRange, editor: ICodeEditor) {\n\t\t\t\t\tconst t1 = editor.getTopForLineNumber(range.startLineNumber, true);\n\t\t\t\t\tconst t2 = editor.getTopForLineNumber(range.endLineNumberExclusive, true);\n\t\t\t\t\treturn (t1 + t2) / 2;\n\t\t\t\t}\n\n\t\t\t\tconst start = computeLineStart(move.lineRangeMapping.original, this._editors.original);\n\t\t\t\tconst startOffset = this._originalScrollTop.read(reader);\n\t\t\t\tconst end = computeLineStart(move.lineRangeMapping.modified, this._editors.modified);\n\t\t\t\tconst endOffset = this._modifiedScrollTop.read(reader);\n\n\t\t\t\tconst from = start - startOffset;\n\t\t\t\tconst to = end - endOffset;\n\n\t\t\t\tconst top = Math.min(start, end);\n\t\t\t\tconst bottom = Math.max(start, end);\n\n\t\t\t\treturn { range: new OffsetRange(top, bottom), from, to, fromWithoutScroll: start, toWithoutScroll: end, move };\n\t\t\t});\n\n\t\t\tlines.sort(tieBreakComparators(\n\t\t\t\tcompareBy(l => l.fromWithoutScroll > l.toWithoutScroll, booleanComparator),\n\t\t\t\tcompareBy(l => l.fromWithoutScroll > l.toWithoutScroll ? l.fromWithoutScroll : -l.toWithoutScroll, numberComparator)\n\t\t\t));\n\n\t\t\tconst layout = LinesLayout.compute(lines.map(l => l.range));\n\n\t\t\tconst padding = 10;\n\t\t\tconst lineAreaLeft = infoOrig.verticalScrollbarWidth;\n\t\t\tconst lineAreaWidth = (layout.getTrackCount() - 1) * 10 + padding * 2;\n\t\t\tconst width = lineAreaLeft + lineAreaWidth + (infoMod.contentLeft - MovedBlocksLinesFeature.movedCodeBlockPadding);\n\n\t\t\tlet idx = 0;\n\t\t\tfor (const line of lines) {\n\t\t\t\tconst track = layout.getTrack(idx);\n\t\t\t\tconst verticalY = lineAreaLeft + padding + track * 10;\n\n\t\t\t\tconst arrowHeight = 15;\n\t\t\t\tconst arrowWidth = 15;\n\t\t\t\tconst right = width;\n\n\t\t\t\tconst rectWidth = infoMod.glyphMarginWidth + infoMod.lineNumbersWidth;\n\t\t\t\tconst rectHeight = 18;\n\t\t\t\tconst rect = document.createElementNS('http://www.w3.org/2000/svg', 'rect');\n\t\t\t\trect.classList.add('arrow-rectangle');\n\t\t\t\trect.setAttribute('x', `${right - rectWidth}`);\n\t\t\t\trect.setAttribute('y', `${line.to - rectHeight / 2}`);\n\t\t\t\trect.setAttribute('width', `${rectWidth}`);\n\t\t\t\trect.setAttribute('height', `${rectHeight}`);\n\t\t\t\tthis._element.appendChild(rect);\n\n\t\t\t\tconst g = document.createElementNS('http://www.w3.org/2000/svg', 'g');\n\n\t\t\t\tconst path = document.createElementNS('http://www.w3.org/2000/svg', 'path');\n\n\t\t\t\tpath.setAttribute('d', `M ${0} ${line.from} L ${verticalY} ${line.from} L ${verticalY} ${line.to} L ${right - arrowWidth} ${line.to}`);\n\t\t\t\tpath.setAttribute('fill', 'none');\n\t\t\t\tg.appendChild(path);\n\n\t\t\t\tconst arrowRight = document.createElementNS('http://www.w3.org/2000/svg', 'polygon');\n\t\t\t\tarrowRight.classList.add('arrow');\n\n\t\t\t\treader.store.add(autorun(reader => {\n\t\t\t\t\tpath.classList.toggle('currentMove', line.move === model.activeMovedText.read(reader));\n\t\t\t\t\tarrowRight.classList.toggle('currentMove', line.move === model.activeMovedText.read(reader));\n\t\t\t\t}));\n\n\t\t\t\tarrowRight.setAttribute('points', `${right - arrowWidth},${line.to - arrowHeight / 2} ${right},${line.to} ${right - arrowWidth},${line.to + arrowHeight / 2}`);\n\t\t\t\tg.appendChild(arrowRight);\n\n\t\t\t\tthis._element.appendChild(g);\n\n\t\t\t\t/*\n\t\t\t\tTODO@hediet\n\t\t\t\tpath.addEventListener('mouseenter', () => {\n\t\t\t\t\tmodel.setHoveredMovedText(line.move);\n\t\t\t\t});\n\t\t\t\tpath.addEventListener('mouseleave', () => {\n\t\t\t\t\tmodel.setHoveredMovedText(undefined);\n\t\t\t\t});*/\n\n\t\t\t\tidx++;\n\t\t\t}\n\n\t\t\tthis.width.set(lineAreaWidth, undefined);\n\t\t});\n\n\t\tthis._element = document.createElementNS('http://www.w3.org/2000/svg', 'svg');\n\t\tthis._element.setAttribute('class', 'moved-blocks-lines');\n\t\tthis._rootElement.appendChild(this._element);\n\t\tthis._register(toDisposable(() => this._element.remove()));\n\n\t\tthis._register(autorun(reader => {\n\t\t\t/** @description update moved blocks lines positioning */\n\t\t\tconst info = this._originalEditorLayoutInfo.read(reader);\n\t\t\tconst info2 = this._modifiedEditorLayoutInfo.read(reader);\n\t\t\tif (!info || !info2) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tthis._element.style.left = `${info.width - info.verticalScrollbarWidth}px`;\n\t\t\tthis._element.style.height = `${info.height}px`;\n\t\t\tthis._element.style.width = `${info.verticalScrollbarWidth + info.contentLeft - MovedBlocksLinesFeature.movedCodeBlockPadding + this.width.read(reader)}px`;\n\t\t}));\n\n\t\tthis._register(recomputeInitiallyAndOnChange(this._state));\n\n\t\tconst movedBlockViewZones = derived(reader => {\n\t\t\tconst model = this._diffModel.read(reader);\n\t\t\tconst d = model?.diff.read(reader);\n\t\t\tif (!d) { return []; }\n\t\t\treturn d.movedTexts.map(move => ({\n\t\t\t\tmove,\n\t\t\t\toriginal: new PlaceholderViewZone(constObservable(move.lineRangeMapping.original.startLineNumber - 1), 18),\n\t\t\t\tmodified: new PlaceholderViewZone(constObservable(move.lineRangeMapping.modified.startLineNumber - 1), 18),\n\t\t\t}));\n\t\t});\n\n\t\tthis._register(applyViewZones(this._editors.original, movedBlockViewZones.map(zones => /** @description movedBlockViewZones.original */ zones.map(z => z.original))));\n\t\tthis._register(applyViewZones(this._editors.modified, movedBlockViewZones.map(zones => /** @description movedBlockViewZones.modified */ zones.map(z => z.modified))));\n\n\t\tthis._register(autorunWithStore((reader, store) => {\n\t\t\tconst blocks = movedBlockViewZones.read(reader);\n\t\t\tfor (const b of blocks) {\n\t\t\t\tstore.add(new MovedBlockOverlayWidget(this._editors.original, b.original, b.move, 'original', this._diffModel.get()!));\n\t\t\t\tstore.add(new MovedBlockOverlayWidget(this._editors.modified, b.modified, b.move, 'modified', this._diffModel.get()!));\n\t\t\t}\n\t\t}));\n\n\t\tconst originalHasFocus = observableSignalFromEvent(\n\t\t\t'original.onDidFocusEditorWidget',\n\t\t\te => this._editors.original.onDidFocusEditorWidget(() => setTimeout(() => e(undefined), 0))\n\t\t);\n\t\tconst modifiedHasFocus = observableSignalFromEvent(\n\t\t\t'modified.onDidFocusEditorWidget',\n\t\t\te => this._editors.modified.onDidFocusEditorWidget(() => setTimeout(() => e(undefined), 0))\n\t\t);\n\n\t\tlet lastChangedEditor: 'original' | 'modified' = 'modified';\n\n\t\tthis._register(autorunHandleChanges({\n\t\t\tchangeTracker: {\n\t\t\t\tcreateChangeSummary: () => undefined,\n\t\t\t\thandleChange: (ctx, summary) => {\n\t\t\t\t\tif (ctx.didChange(originalHasFocus)) { lastChangedEditor = 'original'; }\n\t\t\t\t\tif (ctx.didChange(modifiedHasFocus)) { lastChangedEditor = 'modified'; }\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}, reader => {\n\t\t\t/** @description MovedBlocksLines.setActiveMovedTextFromCursor */\n\t\t\toriginalHasFocus.read(reader);\n\t\t\tmodifiedHasFocus.read(reader);\n\n\t\t\tconst m = this._diffModel.read(reader);\n\t\t\tif (!m) { return; }\n\t\t\tconst diff = m.diff.read(reader);\n\n\t\t\tlet movedText: MovedText | undefined = undefined;\n\n\t\t\tif (diff && lastChangedEditor === 'original') {\n\t\t\t\tconst originalPos = this._editors.originalCursor.read(reader);\n\t\t\t\tif (originalPos) {\n\t\t\t\t\tmovedText = diff.movedTexts.find(m => m.lineRangeMapping.original.contains(originalPos.lineNumber));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (diff && lastChangedEditor === 'modified') {\n\t\t\t\tconst modifiedPos = this._editors.modifiedCursor.read(reader);\n\t\t\t\tif (modifiedPos) {\n\t\t\t\t\tmovedText = diff.movedTexts.find(m => m.lineRangeMapping.modified.contains(modifiedPos.lineNumber));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (movedText !== m.movedTextToCompare.read(undefined)) {\n\t\t\t\tm.movedTextToCompare.set(undefined, undefined);\n\t\t\t}\n\t\t\tm.setActiveMovedText(movedText);\n\t\t}));\n\t}\n\n\tprivate readonly _modifiedViewZonesChangedSignal;\n\tprivate readonly _originalViewZonesChangedSignal;\n\n\tprivate readonly _state;\n}\n\nclass LinesLayout {\n\tpublic static compute(lines: OffsetRange[]): LinesLayout {\n\t\tconst setsPerTrack: OffsetRangeSet[] = [];\n\t\tconst trackPerLineIdx: number[] = [];\n\n\t\tfor (const line of lines) {\n\t\t\tlet trackIdx = setsPerTrack.findIndex(set => !set.intersectsStrict(line));\n\t\t\tif (trackIdx === -1) {\n\t\t\t\tconst maxTrackCount = 6;\n\t\t\t\tif (setsPerTrack.length >= maxTrackCount) {\n\t\t\t\t\ttrackIdx = findMaxIdx(setsPerTrack, compareBy(set => set.intersectWithRangeLength(line), numberComparator));\n\t\t\t\t} else {\n\t\t\t\t\ttrackIdx = setsPerTrack.length;\n\t\t\t\t\tsetsPerTrack.push(new OffsetRangeSet());\n\t\t\t\t}\n\t\t\t}\n\t\t\tsetsPerTrack[trackIdx].addRange(line);\n\t\t\ttrackPerLineIdx.push(trackIdx);\n\t\t}\n\n\t\treturn new LinesLayout(setsPerTrack.length, trackPerLineIdx);\n\t}\n\n\tprivate constructor(\n\t\tprivate readonly _trackCount: number,\n\t\tprivate readonly trackPerLineIdx: number[]\n\t) { }\n\n\tgetTrack(lineIdx: number): number {\n\t\treturn this.trackPerLineIdx[lineIdx];\n\t}\n\n\tgetTrackCount(): number {\n\t\treturn this._trackCount;\n\t}\n}\n\nclass MovedBlockOverlayWidget extends ViewZoneOverlayWidget {\n\tprivate readonly _nodes = h('div.diff-moved-code-block', { style: { marginRight: '4px' } }, [\n\t\th('div.text-content@textContent'),\n\t\th('div.action-bar@actionBar'),\n\t]);\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\t_viewZone: PlaceholderViewZone,\n\t\tprivate readonly _move: MovedText,\n\t\tprivate readonly _kind: 'original' | 'modified',\n\t\tprivate readonly _diffModel: DiffEditorViewModel,\n\t) {\n\t\tconst root = h('div.diff-hidden-lines-widget');\n\t\tsuper(_editor, _viewZone, root.root);\n\t\troot.root.appendChild(this._nodes.root);\n\n\t\tconst editorLayout = observableFromEvent(this._editor.onDidLayoutChange, () => this._editor.getLayoutInfo());\n\n\t\tthis._register(applyStyle(this._nodes.root, {\n\t\t\tpaddingRight: editorLayout.map(l => l.verticalScrollbarWidth)\n\t\t}));\n\n\t\tlet text: string;\n\n\t\tif (_move.changes.length > 0) {\n\t\t\ttext = this._kind === 'original' ? localize(\n\t\t\t\t'codeMovedToWithChanges',\n\t\t\t\t'Code moved with changes to line {0}-{1}',\n\t\t\t\tthis._move.lineRangeMapping.modified.startLineNumber,\n\t\t\t\tthis._move.lineRangeMapping.modified.endLineNumberExclusive - 1,\n\t\t\t) : localize(\n\t\t\t\t'codeMovedFromWithChanges',\n\t\t\t\t'Code moved with changes from line {0}-{1}',\n\t\t\t\tthis._move.lineRangeMapping.original.startLineNumber,\n\t\t\t\tthis._move.lineRangeMapping.original.endLineNumberExclusive - 1,\n\t\t\t);\n\t\t} else {\n\t\t\ttext = this._kind === 'original' ? localize(\n\t\t\t\t'codeMovedTo',\n\t\t\t\t'Code moved to line {0}-{1}',\n\t\t\t\tthis._move.lineRangeMapping.modified.startLineNumber,\n\t\t\t\tthis._move.lineRangeMapping.modified.endLineNumberExclusive - 1,\n\t\t\t) : localize(\n\t\t\t\t'codeMovedFrom',\n\t\t\t\t'Code moved from line {0}-{1}',\n\t\t\t\tthis._move.lineRangeMapping.original.startLineNumber,\n\t\t\t\tthis._move.lineRangeMapping.original.endLineNumberExclusive - 1,\n\t\t\t);\n\t\t}\n\n\t\tconst actionBar = this._register(new ActionBar(this._nodes.actionBar, {\n\t\t\thighlightToggledItems: true,\n\t\t}));\n\n\t\tconst caption = new Action(\n\t\t\t'',\n\t\t\ttext,\n\t\t\t'',\n\t\t\tfalse,\n\t\t);\n\t\tactionBar.push(caption, { icon: false, label: true });\n\n\t\tconst actionCompare = new Action(\n\t\t\t'',\n\t\t\t'Compare',\n\t\t\tThemeIcon.asClassName(Codicon.compareChanges),\n\t\t\ttrue,\n\t\t\t() => {\n\t\t\t\tthis._editor.focus();\n\t\t\t\tthis._diffModel.movedTextToCompare.set(this._diffModel.movedTextToCompare.get() === _move ? undefined : this._move, undefined);\n\t\t\t},\n\t\t);\n\t\tthis._register(autorun(reader => {\n\t\t\tconst isActive = this._diffModel.movedTextToCompare.read(reader) === _move;\n\t\t\tactionCompare.checked = isActive;\n\t\t}));\n\n\t\tactionBar.push(actionCompare, { icon: false, label: true });\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/core/ranges/lineRange.ts","vs/editor/common/core/ranges/lineRange.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,8BAA8B,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAClI,OAAO,EAAc,SAAS,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAE5F;;GAEG;AACH,MAAM,OAAO,SAAS;IACd,MAAM,CAAC,QAAQ,CAAC,eAAuB,EAAE,MAAc;QAC7D,OAAO,IAAI,SAAS,CAAC,eAAe,EAAE,eAAe,GAAG,MAAM,CAAC,CAAC;IACjE,CAAC;IAEM,MAAM,CAA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C;iBAAM,CAAC;gBACP,EAAE,EAAE,CAAC;YACN,CAAC;QACF,CAAC;QAED,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,YAAY,CAAC,KAAa;QACzB,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;CACD","file":"lineRange.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 { BugIndicatingError } from '../../../../base/common/errors.js';\nimport { OffsetRange } from './offsetRange.js';\nimport { Range } from '../range.js';\nimport { findFirstIdxMonotonousOrArrLen, findLastIdxMonotonous, findLastMonotonous } from '../../../../base/common/arraysFind.js';\nimport { Comparator, compareBy, numberComparator } from '../../../../base/common/arrays.js';\n\n/**\n * A range of lines (1-based).\n */\nexport class LineRange {\n\tpublic static ofLength(startLineNumber: number, length: number): LineRange {\n\t\treturn new LineRange(startLineNumber, startLineNumber + length);\n\t}\n\n\tpublic static fromRange(range: Range): LineRange {\n\t\treturn new LineRange(range.startLineNumber, range.endLineNumber);\n\t}\n\n\tpublic static fromRangeInclusive(range: Range): LineRange {\n\t\treturn new LineRange(range.startLineNumber, range.endLineNumber + 1);\n\t}\n\n\tpublic static readonly compareByStart: Comparator<LineRange> = compareBy(l => l.startLineNumber, numberComparator);\n\n\t/**\n\t * @param lineRanges An array of arrays of of sorted line ranges.\n\t */\n\tpublic static joinMany(lineRanges: readonly (readonly LineRange[])[]): readonly LineRange[] {\n\t\tif (lineRanges.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tlet result = new LineRangeSet(lineRanges[0].slice());\n\t\tfor (let i = 1; i < lineRanges.length; i++) {\n\t\t\tresult = result.getUnion(new LineRangeSet(lineRanges[i].slice()));\n\t\t}\n\t\treturn result.ranges;\n\t}\n\n\tpublic static join(lineRanges: LineRange[]): LineRange {\n\t\tif (lineRanges.length === 0) {\n\t\t\tthrow new BugIndicatingError('lineRanges cannot be empty');\n\t\t}\n\t\tlet startLineNumber = lineRanges[0].startLineNumber;\n\t\tlet endLineNumberExclusive = lineRanges[0].endLineNumberExclusive;\n\t\tfor (let i = 1; i < lineRanges.length; i++) {\n\t\t\tstartLineNumber = Math.min(startLineNumber, lineRanges[i].startLineNumber);\n\t\t\tendLineNumberExclusive = Math.max(endLineNumberExclusive, lineRanges[i].endLineNumberExclusive);\n\t\t}\n\t\treturn new LineRange(startLineNumber, endLineNumberExclusive);\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tpublic static deserialize(lineRange: ISerializedLineRange): LineRange {\n\t\treturn new LineRange(lineRange[0], lineRange[1]);\n\t}\n\n\t/**\n\t * The start line number.\n\t */\n\tpublic readonly startLineNumber: number;\n\n\t/**\n\t * The end line number (exclusive).\n\t */\n\tpublic readonly endLineNumberExclusive: number;\n\n\tconstructor(\n\t\tstartLineNumber: number,\n\t\tendLineNumberExclusive: number,\n\t) {\n\t\tif (startLineNumber > endLineNumberExclusive) {\n\t\t\tthrow new BugIndicatingError(`startLineNumber ${startLineNumber} cannot be after endLineNumberExclusive ${endLineNumberExclusive}`);\n\t\t}\n\t\tthis.startLineNumber = startLineNumber;\n\t\tthis.endLineNumberExclusive = endLineNumberExclusive;\n\t}\n\n\t/**\n\t * Indicates if this line range contains the given line number.\n\t */\n\tpublic contains(lineNumber: number): boolean {\n\t\treturn this.startLineNumber <= lineNumber && lineNumber < this.endLineNumberExclusive;\n\t}\n\n\t/**\n\t * Indicates if this line range is empty.\n\t */\n\tget isEmpty(): boolean {\n\t\treturn this.startLineNumber === this.endLineNumberExclusive;\n\t}\n\n\t/**\n\t * Moves this line range by the given offset of line numbers.\n\t */\n\tpublic delta(offset: number): LineRange {\n\t\treturn new LineRange(this.startLineNumber + offset, this.endLineNumberExclusive + offset);\n\t}\n\n\tpublic deltaLength(offset: number): LineRange {\n\t\treturn new LineRange(this.startLineNumber, this.endLineNumberExclusive + offset);\n\t}\n\n\t/**\n\t * The number of lines this line range spans.\n\t */\n\tpublic get length(): number {\n\t\treturn this.endLineNumberExclusive - this.startLineNumber;\n\t}\n\n\t/**\n\t * Creates a line range that combines this and the given line range.\n\t */\n\tpublic join(other: LineRange): LineRange {\n\t\treturn new LineRange(\n\t\t\tMath.min(this.startLineNumber, other.startLineNumber),\n\t\t\tMath.max(this.endLineNumberExclusive, other.endLineNumberExclusive)\n\t\t);\n\t}\n\n\tpublic toString(): string {\n\t\treturn `[${this.startLineNumber},${this.endLineNumberExclusive})`;\n\t}\n\n\t/**\n\t * The resulting range is empty if the ranges do not intersect, but touch.\n\t * If the ranges don't even touch, the result is undefined.\n\t */\n\tpublic intersect(other: LineRange): LineRange | undefined {\n\t\tconst startLineNumber = Math.max(this.startLineNumber, other.startLineNumber);\n\t\tconst endLineNumberExclusive = Math.min(this.endLineNumberExclusive, other.endLineNumberExclusive);\n\t\tif (startLineNumber <= endLineNumberExclusive) {\n\t\t\treturn new LineRange(startLineNumber, endLineNumberExclusive);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tpublic intersectsStrict(other: LineRange): boolean {\n\t\treturn this.startLineNumber < other.endLineNumberExclusive && other.startLineNumber < this.endLineNumberExclusive;\n\t}\n\n\tpublic intersectsOrTouches(other: LineRange): boolean {\n\t\treturn this.startLineNumber <= other.endLineNumberExclusive && other.startLineNumber <= this.endLineNumberExclusive;\n\t}\n\n\tpublic equals(b: LineRange): boolean {\n\t\treturn this.startLineNumber === b.startLineNumber && this.endLineNumberExclusive === b.endLineNumberExclusive;\n\t}\n\n\tpublic toInclusiveRange(): Range | null {\n\t\tif (this.isEmpty) {\n\t\t\treturn null;\n\t\t}\n\t\treturn new Range(this.startLineNumber, 1, this.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER);\n\t}\n\n\t/**\n\t * @deprecated Using this function is discouraged because it might lead to bugs: The end position is not guaranteed to be a valid position!\n\t*/\n\tpublic toExclusiveRange(): Range {\n\t\treturn new Range(this.startLineNumber, 1, this.endLineNumberExclusive, 1);\n\t}\n\n\tpublic mapToLineArray<T>(f: (lineNumber: number) => T): T[] {\n\t\tconst result: T[] = [];\n\t\tfor (let lineNumber = this.startLineNumber; lineNumber < this.endLineNumberExclusive; lineNumber++) {\n\t\t\tresult.push(f(lineNumber));\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic forEach(f: (lineNumber: number) => void): void {\n\t\tfor (let lineNumber = this.startLineNumber; lineNumber < this.endLineNumberExclusive; lineNumber++) {\n\t\t\tf(lineNumber);\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tpublic serialize(): ISerializedLineRange {\n\t\treturn [this.startLineNumber, this.endLineNumberExclusive];\n\t}\n\n\t/**\n\t * Converts this 1-based line range to a 0-based offset range (subtracts 1!).\n\t * @internal\n\t */\n\tpublic toOffsetRange(): OffsetRange {\n\t\treturn new OffsetRange(this.startLineNumber - 1, this.endLineNumberExclusive - 1);\n\t}\n\n\tpublic addMargin(marginTop: number, marginBottom: number): LineRange {\n\t\treturn new LineRange(\n\t\t\tthis.startLineNumber - marginTop,\n\t\t\tthis.endLineNumberExclusive + marginBottom\n\t\t);\n\t}\n}\n\nexport type ISerializedLineRange = [startLineNumber: number, endLineNumberExclusive: number];\n\n\nexport class LineRangeSet {\n\tconstructor(\n\t\t/**\n\t\t * Sorted by start line number.\n\t\t * No two line ranges are touching or intersecting.\n\t\t */\n\t\tprivate readonly _normalizedRanges: LineRange[] = []\n\t) {\n\t}\n\n\tget ranges(): readonly LineRange[] {\n\t\treturn this._normalizedRanges;\n\t}\n\n\taddRange(range: LineRange): void {\n\t\tif (range.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Idea: Find joinRange such that:\n\t\t// replaceRange = _normalizedRanges.replaceRange(joinRange, range.joinAll(joinRange.map(idx => this._normalizedRanges[idx])))\n\n\t\t// idx of first element that touches range or that is after range\n\t\tconst joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, r => r.endLineNumberExclusive >= range.startLineNumber);\n\t\t// idx of element after { last element that touches range or that is before range }\n\t\tconst joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, r => r.startLineNumber <= range.endLineNumberExclusive) + 1;\n\n\t\tif (joinRangeStartIdx === joinRangeEndIdxExclusive) {\n\t\t\t// If there is no element that touches range, then joinRangeStartIdx === joinRangeEndIdxExclusive and that value is the index of the element after range\n\t\t\tthis._normalizedRanges.splice(joinRangeStartIdx, 0, range);\n\t\t} else if (joinRangeStartIdx === joinRangeEndIdxExclusive - 1) {\n\t\t\t// Else, there is an element that touches range and in this case it is both the first and last element. Thus we can replace it\n\t\t\tconst joinRange = this._normalizedRanges[joinRangeStartIdx];\n\t\t\tthis._normalizedRanges[joinRangeStartIdx] = joinRange.join(range);\n\t\t} else {\n\t\t\t// First and last element are different - we need to replace the entire range\n\t\t\tconst joinRange = this._normalizedRanges[joinRangeStartIdx].join(this._normalizedRanges[joinRangeEndIdxExclusive - 1]).join(range);\n\t\t\tthis._normalizedRanges.splice(joinRangeStartIdx, joinRangeEndIdxExclusive - joinRangeStartIdx, joinRange);\n\t\t}\n\t}\n\n\tcontains(lineNumber: number): boolean {\n\t\tconst rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, r => r.startLineNumber <= lineNumber);\n\t\treturn !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > lineNumber;\n\t}\n\n\tintersects(range: LineRange): boolean {\n\t\tconst rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, r => r.startLineNumber < range.endLineNumberExclusive);\n\t\treturn !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > range.startLineNumber;\n\t}\n\n\tgetUnion(other: LineRangeSet): LineRangeSet {\n\t\tif (this._normalizedRanges.length === 0) {\n\t\t\treturn other;\n\t\t}\n\t\tif (other._normalizedRanges.length === 0) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst result: LineRange[] = [];\n\t\tlet i1 = 0;\n\t\tlet i2 = 0;\n\t\tlet current: LineRange | null = null;\n\t\twhile (i1 < this._normalizedRanges.length || i2 < other._normalizedRanges.length) {\n\t\t\tlet next: LineRange | null = null;\n\t\t\tif (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {\n\t\t\t\tconst lineRange1 = this._normalizedRanges[i1];\n\t\t\t\tconst lineRange2 = other._normalizedRanges[i2];\n\t\t\t\tif (lineRange1.startLineNumber < lineRange2.startLineNumber) {\n\t\t\t\t\tnext = lineRange1;\n\t\t\t\t\ti1++;\n\t\t\t\t} else {\n\t\t\t\t\tnext = lineRange2;\n\t\t\t\t\ti2++;\n\t\t\t\t}\n\t\t\t} else if (i1 < this._normalizedRanges.length) {\n\t\t\t\tnext = this._normalizedRanges[i1];\n\t\t\t\ti1++;\n\t\t\t} else {\n\t\t\t\tnext = other._normalizedRanges[i2];\n\t\t\t\ti2++;\n\t\t\t}\n\n\t\t\tif (current === null) {\n\t\t\t\tcurrent = next;\n\t\t\t} else {\n\t\t\t\tif (current.endLineNumberExclusive >= next.startLineNumber) {\n\t\t\t\t\t// merge\n\t\t\t\t\tcurrent = new LineRange(current.startLineNumber, Math.max(current.endLineNumberExclusive, next.endLineNumberExclusive));\n\t\t\t\t} else {\n\t\t\t\t\t// push\n\t\t\t\t\tresult.push(current);\n\t\t\t\t\tcurrent = next;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (current !== null) {\n\t\t\tresult.push(current);\n\t\t}\n\t\treturn new LineRangeSet(result);\n\t}\n\n\t/**\n\t * Subtracts all ranges in this set from `range` and returns the result.\n\t */\n\tsubtractFrom(range: LineRange): LineRangeSet {\n\t\t// idx of first element that touches range or that is after range\n\t\tconst joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, r => r.endLineNumberExclusive >= range.startLineNumber);\n\t\t// idx of element after { last element that touches range or that is before range }\n\t\tconst joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, r => r.startLineNumber <= range.endLineNumberExclusive) + 1;\n\n\t\tif (joinRangeStartIdx === joinRangeEndIdxExclusive) {\n\t\t\treturn new LineRangeSet([range]);\n\t\t}\n\n\t\tconst result: LineRange[] = [];\n\t\tlet startLineNumber = range.startLineNumber;\n\t\tfor (let i = joinRangeStartIdx; i < joinRangeEndIdxExclusive; i++) {\n\t\t\tconst r = this._normalizedRanges[i];\n\t\t\tif (r.startLineNumber > startLineNumber) {\n\t\t\t\tresult.push(new LineRange(startLineNumber, r.startLineNumber));\n\t\t\t}\n\t\t\tstartLineNumber = r.endLineNumberExclusive;\n\t\t}\n\t\tif (startLineNumber < range.endLineNumberExclusive) {\n\t\t\tresult.push(new LineRange(startLineNumber, range.endLineNumberExclusive));\n\t\t}\n\n\t\treturn new LineRangeSet(result);\n\t}\n\n\ttoString() {\n\t\treturn this._normalizedRanges.map(r => r.toString()).join(', ');\n\t}\n\n\tgetIntersection(other: LineRangeSet): LineRangeSet {\n\t\tconst result: LineRange[] = [];\n\n\t\tlet i1 = 0;\n\t\tlet i2 = 0;\n\t\twhile (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {\n\t\t\tconst r1 = this._normalizedRanges[i1];\n\t\t\tconst r2 = other._normalizedRanges[i2];\n\n\t\t\tconst i = r1.intersect(r2);\n\t\t\tif (i && !i.isEmpty) {\n\t\t\t\tresult.push(i);\n\t\t\t}\n\n\t\t\tif (r1.endLineNumberExclusive < r2.endLineNumberExclusive) {\n\t\t\t\ti1++;\n\t\t\t} else {\n\t\t\t\ti2++;\n\t\t\t}\n\t\t}\n\n\t\treturn new LineRangeSet(result);\n\t}\n\n\tgetWithDelta(value: number): LineRangeSet {\n\t\treturn new LineRangeSet(this._normalizedRanges.map(r => r.delta(value)));\n\t}\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 { BugIndicatingError } from '../../../../base/common/errors.js';\nimport { OffsetRange } from './offsetRange.js';\nimport { Range } from '../range.js';\nimport { findFirstIdxMonotonousOrArrLen, findLastIdxMonotonous, findLastMonotonous } from '../../../../base/common/arraysFind.js';\nimport { Comparator, compareBy, numberComparator } from '../../../../base/common/arrays.js';\n\n/**\n * A range of lines (1-based).\n */\nexport class LineRange {\n\tpublic static ofLength(startLineNumber: number, length: number): LineRange {\n\t\treturn new LineRange(startLineNumber, startLineNumber + length);\n\t}\n\n\tpublic static fromRange(range: Range): LineRange {\n\t\treturn new LineRange(range.startLineNumber, range.endLineNumber);\n\t}\n\n\tpublic static fromRangeInclusive(range: Range): LineRange {\n\t\treturn new LineRange(range.startLineNumber, range.endLineNumber + 1);\n\t}\n\n\tpublic static readonly compareByStart: Comparator<LineRange> = compareBy(l => l.startLineNumber, numberComparator);\n\n\t/**\n\t * @param lineRanges An array of arrays of of sorted line ranges.\n\t */\n\tpublic static joinMany(lineRanges: readonly (readonly LineRange[])[]): readonly LineRange[] {\n\t\tif (lineRanges.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tlet result = new LineRangeSet(lineRanges[0].slice());\n\t\tfor (let i = 1; i < lineRanges.length; i++) {\n\t\t\tresult = result.getUnion(new LineRangeSet(lineRanges[i].slice()));\n\t\t}\n\t\treturn result.ranges;\n\t}\n\n\tpublic static join(lineRanges: LineRange[]): LineRange {\n\t\tif (lineRanges.length === 0) {\n\t\t\tthrow new BugIndicatingError('lineRanges cannot be empty');\n\t\t}\n\t\tlet startLineNumber = lineRanges[0].startLineNumber;\n\t\tlet endLineNumberExclusive = lineRanges[0].endLineNumberExclusive;\n\t\tfor (let i = 1; i < lineRanges.length; i++) {\n\t\t\tstartLineNumber = Math.min(startLineNumber, lineRanges[i].startLineNumber);\n\t\t\tendLineNumberExclusive = Math.max(endLineNumberExclusive, lineRanges[i].endLineNumberExclusive);\n\t\t}\n\t\treturn new LineRange(startLineNumber, endLineNumberExclusive);\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tpublic static deserialize(lineRange: ISerializedLineRange): LineRange {\n\t\treturn new LineRange(lineRange[0], lineRange[1]);\n\t}\n\n\t/**\n\t * The start line number.\n\t */\n\tpublic readonly startLineNumber: number;\n\n\t/**\n\t * The end line number (exclusive).\n\t */\n\tpublic readonly endLineNumberExclusive: number;\n\n\tconstructor(\n\t\tstartLineNumber: number,\n\t\tendLineNumberExclusive: number,\n\t) {\n\t\tif (startLineNumber > endLineNumberExclusive) {\n\t\t\tthrow new BugIndicatingError(`startLineNumber ${startLineNumber} cannot be after endLineNumberExclusive ${endLineNumberExclusive}`);\n\t\t}\n\t\tthis.startLineNumber = startLineNumber;\n\t\tthis.endLineNumberExclusive = endLineNumberExclusive;\n\t}\n\n\t/**\n\t * Indicates if this line range contains the given line number.\n\t */\n\tpublic contains(lineNumber: number): boolean {\n\t\treturn this.startLineNumber <= lineNumber && lineNumber < this.endLineNumberExclusive;\n\t}\n\n\t/**\n\t * Indicates if this line range is empty.\n\t */\n\tget isEmpty(): boolean {\n\t\treturn this.startLineNumber === this.endLineNumberExclusive;\n\t}\n\n\t/**\n\t * Moves this line range by the given offset of line numbers.\n\t */\n\tpublic delta(offset: number): LineRange {\n\t\treturn new LineRange(this.startLineNumber + offset, this.endLineNumberExclusive + offset);\n\t}\n\n\tpublic deltaLength(offset: number): LineRange {\n\t\treturn new LineRange(this.startLineNumber, this.endLineNumberExclusive + offset);\n\t}\n\n\t/**\n\t * The number of lines this line range spans.\n\t */\n\tpublic get length(): number {\n\t\treturn this.endLineNumberExclusive - this.startLineNumber;\n\t}\n\n\t/**\n\t * Creates a line range that combines this and the given line range.\n\t */\n\tpublic join(other: LineRange): LineRange {\n\t\treturn new LineRange(\n\t\t\tMath.min(this.startLineNumber, other.startLineNumber),\n\t\t\tMath.max(this.endLineNumberExclusive, other.endLineNumberExclusive)\n\t\t);\n\t}\n\n\tpublic toString(): string {\n\t\treturn `[${this.startLineNumber},${this.endLineNumberExclusive})`;\n\t}\n\n\t/**\n\t * The resulting range is empty if the ranges do not intersect, but touch.\n\t * If the ranges don't even touch, the result is undefined.\n\t */\n\tpublic intersect(other: LineRange): LineRange | undefined {\n\t\tconst startLineNumber = Math.max(this.startLineNumber, other.startLineNumber);\n\t\tconst endLineNumberExclusive = Math.min(this.endLineNumberExclusive, other.endLineNumberExclusive);\n\t\tif (startLineNumber <= endLineNumberExclusive) {\n\t\t\treturn new LineRange(startLineNumber, endLineNumberExclusive);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tpublic intersectsStrict(other: LineRange): boolean {\n\t\treturn this.startLineNumber < other.endLineNumberExclusive && other.startLineNumber < this.endLineNumberExclusive;\n\t}\n\n\tpublic intersectsOrTouches(other: LineRange): boolean {\n\t\treturn this.startLineNumber <= other.endLineNumberExclusive && other.startLineNumber <= this.endLineNumberExclusive;\n\t}\n\n\tpublic equals(b: LineRange): boolean {\n\t\treturn this.startLineNumber === b.startLineNumber && this.endLineNumberExclusive === b.endLineNumberExclusive;\n\t}\n\n\tpublic toInclusiveRange(): Range | null {\n\t\tif (this.isEmpty) {\n\t\t\treturn null;\n\t\t}\n\t\treturn new Range(this.startLineNumber, 1, this.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER);\n\t}\n\n\t/**\n\t * @deprecated Using this function is discouraged because it might lead to bugs: The end position is not guaranteed to be a valid position!\n\t*/\n\tpublic toExclusiveRange(): Range {\n\t\treturn new Range(this.startLineNumber, 1, this.endLineNumberExclusive, 1);\n\t}\n\n\tpublic mapToLineArray<T>(f: (lineNumber: number) => T): T[] {\n\t\tconst result: T[] = [];\n\t\tfor (let lineNumber = this.startLineNumber; lineNumber < this.endLineNumberExclusive; lineNumber++) {\n\t\t\tresult.push(f(lineNumber));\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic forEach(f: (lineNumber: number) => void): void {\n\t\tfor (let lineNumber = this.startLineNumber; lineNumber < this.endLineNumberExclusive; lineNumber++) {\n\t\t\tf(lineNumber);\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tpublic serialize(): ISerializedLineRange {\n\t\treturn [this.startLineNumber, this.endLineNumberExclusive];\n\t}\n\n\t/**\n\t * Converts this 1-based line range to a 0-based offset range (subtracts 1!).\n\t * @internal\n\t */\n\tpublic toOffsetRange(): OffsetRange {\n\t\treturn new OffsetRange(this.startLineNumber - 1, this.endLineNumberExclusive - 1);\n\t}\n\n\tpublic addMargin(marginTop: number, marginBottom: number): LineRange {\n\t\treturn new LineRange(\n\t\t\tthis.startLineNumber - marginTop,\n\t\t\tthis.endLineNumberExclusive + marginBottom\n\t\t);\n\t}\n}\n\nexport type ISerializedLineRange = [startLineNumber: number, endLineNumberExclusive: number];\n\n\nexport class LineRangeSet {\n\tconstructor(\n\t\t/**\n\t\t * Sorted by start line number.\n\t\t * No two line ranges are touching or intersecting.\n\t\t */\n\t\tprivate readonly _normalizedRanges: LineRange[] = []\n\t) {\n\t}\n\n\tget ranges(): readonly LineRange[] {\n\t\treturn this._normalizedRanges;\n\t}\n\n\taddRange(range: LineRange): void {\n\t\tif (range.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Idea: Find joinRange such that:\n\t\t// replaceRange = _normalizedRanges.replaceRange(joinRange, range.joinAll(joinRange.map(idx => this._normalizedRanges[idx])))\n\n\t\t// idx of first element that touches range or that is after range\n\t\tconst joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, r => r.endLineNumberExclusive >= range.startLineNumber);\n\t\t// idx of element after { last element that touches range or that is before range }\n\t\tconst joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, r => r.startLineNumber <= range.endLineNumberExclusive) + 1;\n\n\t\tif (joinRangeStartIdx === joinRangeEndIdxExclusive) {\n\t\t\t// If there is no element that touches range, then joinRangeStartIdx === joinRangeEndIdxExclusive and that value is the index of the element after range\n\t\t\tthis._normalizedRanges.splice(joinRangeStartIdx, 0, range);\n\t\t} else if (joinRangeStartIdx === joinRangeEndIdxExclusive - 1) {\n\t\t\t// Else, there is an element that touches range and in this case it is both the first and last element. Thus we can replace it\n\t\t\tconst joinRange = this._normalizedRanges[joinRangeStartIdx];\n\t\t\tthis._normalizedRanges[joinRangeStartIdx] = joinRange.join(range);\n\t\t} else {\n\t\t\t// First and last element are different - we need to replace the entire range\n\t\t\tconst joinRange = this._normalizedRanges[joinRangeStartIdx].join(this._normalizedRanges[joinRangeEndIdxExclusive - 1]).join(range);\n\t\t\tthis._normalizedRanges.splice(joinRangeStartIdx, joinRangeEndIdxExclusive - joinRangeStartIdx, joinRange);\n\t\t}\n\t}\n\n\tcontains(lineNumber: number): boolean {\n\t\tconst rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, r => r.startLineNumber <= lineNumber);\n\t\treturn !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > lineNumber;\n\t}\n\n\tintersects(range: LineRange): boolean {\n\t\tconst rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, r => r.startLineNumber < range.endLineNumberExclusive);\n\t\treturn !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > range.startLineNumber;\n\t}\n\n\tgetUnion(other: LineRangeSet): LineRangeSet {\n\t\tif (this._normalizedRanges.length === 0) {\n\t\t\treturn other;\n\t\t}\n\t\tif (other._normalizedRanges.length === 0) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst result: LineRange[] = [];\n\t\tlet i1 = 0;\n\t\tlet i2 = 0;\n\t\tlet current: LineRange | null = null;\n\t\twhile (i1 < this._normalizedRanges.length || i2 < other._normalizedRanges.length) {\n\t\t\tlet next: LineRange | null = null;\n\t\t\tif (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {\n\t\t\t\tconst lineRange1 = this._normalizedRanges[i1];\n\t\t\t\tconst lineRange2 = other._normalizedRanges[i2];\n\t\t\t\tif (lineRange1.startLineNumber < lineRange2.startLineNumber) {\n\t\t\t\t\tnext = lineRange1;\n\t\t\t\t\ti1++;\n\t\t\t\t} else {\n\t\t\t\t\tnext = lineRange2;\n\t\t\t\t\ti2++;\n\t\t\t\t}\n\t\t\t} else if (i1 < this._normalizedRanges.length) {\n\t\t\t\tnext = this._normalizedRanges[i1];\n\t\t\t\ti1++;\n\t\t\t} else {\n\t\t\t\tnext = other._normalizedRanges[i2];\n\t\t\t\ti2++;\n\t\t\t}\n\n\t\t\tif (current === null) {\n\t\t\t\tcurrent = next;\n\t\t\t} else {\n\t\t\t\tif (current.endLineNumberExclusive >= next.startLineNumber) {\n\t\t\t\t\t// merge\n\t\t\t\t\tcurrent = new LineRange(current.startLineNumber, Math.max(current.endLineNumberExclusive, next.endLineNumberExclusive));\n\t\t\t\t} else {\n\t\t\t\t\t// push\n\t\t\t\t\tresult.push(current);\n\t\t\t\t\tcurrent = next;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (current !== null) {\n\t\t\tresult.push(current);\n\t\t}\n\t\treturn new LineRangeSet(result);\n\t}\n\n\t/**\n\t * Subtracts all ranges in this set from `range` and returns the result.\n\t */\n\tsubtractFrom(range: LineRange): LineRangeSet {\n\t\t// idx of first element that touches range or that is after range\n\t\tconst joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, r => r.endLineNumberExclusive >= range.startLineNumber);\n\t\t// idx of element after { last element that touches range or that is before range }\n\t\tconst joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, r => r.startLineNumber <= range.endLineNumberExclusive) + 1;\n\n\t\tif (joinRangeStartIdx === joinRangeEndIdxExclusive) {\n\t\t\treturn new LineRangeSet([range]);\n\t\t}\n\n\t\tconst result: LineRange[] = [];\n\t\tlet startLineNumber = range.startLineNumber;\n\t\tfor (let i = joinRangeStartIdx; i < joinRangeEndIdxExclusive; i++) {\n\t\t\tconst r = this._normalizedRanges[i];\n\t\t\tif (r.startLineNumber > startLineNumber) {\n\t\t\t\tresult.push(new LineRange(startLineNumber, r.startLineNumber));\n\t\t\t}\n\t\t\tstartLineNumber = r.endLineNumberExclusive;\n\t\t}\n\t\tif (startLineNumber < range.endLineNumberExclusive) {\n\t\t\tresult.push(new LineRange(startLineNumber, range.endLineNumberExclusive));\n\t\t}\n\n\t\treturn new LineRangeSet(result);\n\t}\n\n\ttoString() {\n\t\treturn this._normalizedRanges.map(r => r.toString()).join(', ');\n\t}\n\n\tgetIntersection(other: LineRangeSet): LineRangeSet {\n\t\tconst result: LineRange[] = [];\n\n\t\tlet i1 = 0;\n\t\tlet i2 = 0;\n\t\twhile (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {\n\t\t\tconst r1 = this._normalizedRanges[i1];\n\t\t\tconst r2 = other._normalizedRanges[i2];\n\n\t\t\tconst i = r1.intersect(r2);\n\t\t\tif (i && !i.isEmpty) {\n\t\t\t\tresult.push(i);\n\t\t\t}\n\n\t\t\tif (r1.endLineNumberExclusive < r2.endLineNumberExclusive) {\n\t\t\t\ti1++;\n\t\t\t} else {\n\t\t\t\ti2++;\n\t\t\t}\n\t\t}\n\n\t\treturn new LineRangeSet(result);\n\t}\n\n\tgetWithDelta(value: number): LineRangeSet {\n\t\treturn new LineRangeSet(this._normalizedRanges.map(r => r.delta(value)));\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/core/ranges/lineRange.ts","vs/editor/common/core/ranges/lineRange.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAU,KAAK,EAAE,MAAM,aAAa,CAAC;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K,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC;YAEvC,MAAM,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;YAC3B,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;gBACrB,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAChB,CAAC;YAED,IAAI,EAAE,CAAC,sBAAsB,GAAG,EAAE,CAAC,sBAAsB,EAAE,CAAC;gBAC3D,EAAE,EAAE,CAAC;YACN,CAAC;iBAAM,CAAC;gBACP,EAAE,EAAE,CAAC;YACN,CAAC;QACF,CAAC;QAED,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,YAAY,CAAC,KAAa;QACzB,OAAO,IAAI,YAAY,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC1E,CAAC;CACD","file":"lineRange.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 { BugIndicatingError } from '../../../../base/common/errors.js';\nimport { OffsetRange } from './offsetRange.js';\nimport { IRange, Range } from '../range.js';\nimport { findFirstIdxMonotonousOrArrLen, findLastIdxMonotonous, findLastMonotonous } from '../../../../base/common/arraysFind.js';\nimport { Comparator, compareBy, numberComparator } from '../../../../base/common/arrays.js';\n\n/**\n * A range of lines (1-based).\n */\nexport class LineRange {\n\tpublic static ofLength(startLineNumber: number, length: number): LineRange {\n\t\treturn new LineRange(startLineNumber, startLineNumber + length);\n\t}\n\n\tpublic static fromRange(range: IRange): LineRange {\n\t\treturn new LineRange(range.startLineNumber, range.endLineNumber);\n\t}\n\n\tpublic static fromRangeInclusive(range: IRange): LineRange {\n\t\treturn new LineRange(range.startLineNumber, range.endLineNumber + 1);\n\t}\n\n\tpublic static readonly compareByStart: Comparator<LineRange> = compareBy(l => l.startLineNumber, numberComparator);\n\n\t/**\n\t * @param lineRanges An array of arrays of of sorted line ranges.\n\t */\n\tpublic static joinMany(lineRanges: readonly (readonly LineRange[])[]): readonly LineRange[] {\n\t\tif (lineRanges.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tlet result = new LineRangeSet(lineRanges[0].slice());\n\t\tfor (let i = 1; i < lineRanges.length; i++) {\n\t\t\tresult = result.getUnion(new LineRangeSet(lineRanges[i].slice()));\n\t\t}\n\t\treturn result.ranges;\n\t}\n\n\tpublic static join(lineRanges: LineRange[]): LineRange {\n\t\tif (lineRanges.length === 0) {\n\t\t\tthrow new BugIndicatingError('lineRanges cannot be empty');\n\t\t}\n\t\tlet startLineNumber = lineRanges[0].startLineNumber;\n\t\tlet endLineNumberExclusive = lineRanges[0].endLineNumberExclusive;\n\t\tfor (let i = 1; i < lineRanges.length; i++) {\n\t\t\tstartLineNumber = Math.min(startLineNumber, lineRanges[i].startLineNumber);\n\t\t\tendLineNumberExclusive = Math.max(endLineNumberExclusive, lineRanges[i].endLineNumberExclusive);\n\t\t}\n\t\treturn new LineRange(startLineNumber, endLineNumberExclusive);\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tpublic static deserialize(lineRange: ISerializedLineRange): LineRange {\n\t\treturn new LineRange(lineRange[0], lineRange[1]);\n\t}\n\n\t/**\n\t * The start line number.\n\t */\n\tpublic readonly startLineNumber: number;\n\n\t/**\n\t * The end line number (exclusive).\n\t */\n\tpublic readonly endLineNumberExclusive: number;\n\n\tconstructor(\n\t\tstartLineNumber: number,\n\t\tendLineNumberExclusive: number,\n\t) {\n\t\tif (startLineNumber > endLineNumberExclusive) {\n\t\t\tthrow new BugIndicatingError(`startLineNumber ${startLineNumber} cannot be after endLineNumberExclusive ${endLineNumberExclusive}`);\n\t\t}\n\t\tthis.startLineNumber = startLineNumber;\n\t\tthis.endLineNumberExclusive = endLineNumberExclusive;\n\t}\n\n\t/**\n\t * Indicates if this line range contains the given line number.\n\t */\n\tpublic contains(lineNumber: number): boolean {\n\t\treturn this.startLineNumber <= lineNumber && lineNumber < this.endLineNumberExclusive;\n\t}\n\n\t/**\n\t * Indicates if this line range is empty.\n\t */\n\tget isEmpty(): boolean {\n\t\treturn this.startLineNumber === this.endLineNumberExclusive;\n\t}\n\n\t/**\n\t * Moves this line range by the given offset of line numbers.\n\t */\n\tpublic delta(offset: number): LineRange {\n\t\treturn new LineRange(this.startLineNumber + offset, this.endLineNumberExclusive + offset);\n\t}\n\n\tpublic deltaLength(offset: number): LineRange {\n\t\treturn new LineRange(this.startLineNumber, this.endLineNumberExclusive + offset);\n\t}\n\n\t/**\n\t * The number of lines this line range spans.\n\t */\n\tpublic get length(): number {\n\t\treturn this.endLineNumberExclusive - this.startLineNumber;\n\t}\n\n\t/**\n\t * Creates a line range that combines this and the given line range.\n\t */\n\tpublic join(other: LineRange): LineRange {\n\t\treturn new LineRange(\n\t\t\tMath.min(this.startLineNumber, other.startLineNumber),\n\t\t\tMath.max(this.endLineNumberExclusive, other.endLineNumberExclusive)\n\t\t);\n\t}\n\n\tpublic toString(): string {\n\t\treturn `[${this.startLineNumber},${this.endLineNumberExclusive})`;\n\t}\n\n\t/**\n\t * The resulting range is empty if the ranges do not intersect, but touch.\n\t * If the ranges don't even touch, the result is undefined.\n\t */\n\tpublic intersect(other: LineRange): LineRange | undefined {\n\t\tconst startLineNumber = Math.max(this.startLineNumber, other.startLineNumber);\n\t\tconst endLineNumberExclusive = Math.min(this.endLineNumberExclusive, other.endLineNumberExclusive);\n\t\tif (startLineNumber <= endLineNumberExclusive) {\n\t\t\treturn new LineRange(startLineNumber, endLineNumberExclusive);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tpublic intersectsStrict(other: LineRange): boolean {\n\t\treturn this.startLineNumber < other.endLineNumberExclusive && other.startLineNumber < this.endLineNumberExclusive;\n\t}\n\n\tpublic intersectsOrTouches(other: LineRange): boolean {\n\t\treturn this.startLineNumber <= other.endLineNumberExclusive && other.startLineNumber <= this.endLineNumberExclusive;\n\t}\n\n\tpublic equals(b: LineRange): boolean {\n\t\treturn this.startLineNumber === b.startLineNumber && this.endLineNumberExclusive === b.endLineNumberExclusive;\n\t}\n\n\tpublic toInclusiveRange(): Range | null {\n\t\tif (this.isEmpty) {\n\t\t\treturn null;\n\t\t}\n\t\treturn new Range(this.startLineNumber, 1, this.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER);\n\t}\n\n\t/**\n\t * @deprecated Using this function is discouraged because it might lead to bugs: The end position is not guaranteed to be a valid position!\n\t*/\n\tpublic toExclusiveRange(): Range {\n\t\treturn new Range(this.startLineNumber, 1, this.endLineNumberExclusive, 1);\n\t}\n\n\tpublic mapToLineArray<T>(f: (lineNumber: number) => T): T[] {\n\t\tconst result: T[] = [];\n\t\tfor (let lineNumber = this.startLineNumber; lineNumber < this.endLineNumberExclusive; lineNumber++) {\n\t\t\tresult.push(f(lineNumber));\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic forEach(f: (lineNumber: number) => void): void {\n\t\tfor (let lineNumber = this.startLineNumber; lineNumber < this.endLineNumberExclusive; lineNumber++) {\n\t\t\tf(lineNumber);\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tpublic serialize(): ISerializedLineRange {\n\t\treturn [this.startLineNumber, this.endLineNumberExclusive];\n\t}\n\n\t/**\n\t * Converts this 1-based line range to a 0-based offset range (subtracts 1!).\n\t * @internal\n\t */\n\tpublic toOffsetRange(): OffsetRange {\n\t\treturn new OffsetRange(this.startLineNumber - 1, this.endLineNumberExclusive - 1);\n\t}\n\n\tpublic addMargin(marginTop: number, marginBottom: number): LineRange {\n\t\treturn new LineRange(\n\t\t\tthis.startLineNumber - marginTop,\n\t\t\tthis.endLineNumberExclusive + marginBottom\n\t\t);\n\t}\n}\n\nexport type ISerializedLineRange = [startLineNumber: number, endLineNumberExclusive: number];\n\n\nexport class LineRangeSet {\n\tconstructor(\n\t\t/**\n\t\t * Sorted by start line number.\n\t\t * No two line ranges are touching or intersecting.\n\t\t */\n\t\tprivate readonly _normalizedRanges: LineRange[] = []\n\t) {\n\t}\n\n\tget ranges(): readonly LineRange[] {\n\t\treturn this._normalizedRanges;\n\t}\n\n\taddRange(range: LineRange): void {\n\t\tif (range.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Idea: Find joinRange such that:\n\t\t// replaceRange = _normalizedRanges.replaceRange(joinRange, range.joinAll(joinRange.map(idx => this._normalizedRanges[idx])))\n\n\t\t// idx of first element that touches range or that is after range\n\t\tconst joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, r => r.endLineNumberExclusive >= range.startLineNumber);\n\t\t// idx of element after { last element that touches range or that is before range }\n\t\tconst joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, r => r.startLineNumber <= range.endLineNumberExclusive) + 1;\n\n\t\tif (joinRangeStartIdx === joinRangeEndIdxExclusive) {\n\t\t\t// If there is no element that touches range, then joinRangeStartIdx === joinRangeEndIdxExclusive and that value is the index of the element after range\n\t\t\tthis._normalizedRanges.splice(joinRangeStartIdx, 0, range);\n\t\t} else if (joinRangeStartIdx === joinRangeEndIdxExclusive - 1) {\n\t\t\t// Else, there is an element that touches range and in this case it is both the first and last element. Thus we can replace it\n\t\t\tconst joinRange = this._normalizedRanges[joinRangeStartIdx];\n\t\t\tthis._normalizedRanges[joinRangeStartIdx] = joinRange.join(range);\n\t\t} else {\n\t\t\t// First and last element are different - we need to replace the entire range\n\t\t\tconst joinRange = this._normalizedRanges[joinRangeStartIdx].join(this._normalizedRanges[joinRangeEndIdxExclusive - 1]).join(range);\n\t\t\tthis._normalizedRanges.splice(joinRangeStartIdx, joinRangeEndIdxExclusive - joinRangeStartIdx, joinRange);\n\t\t}\n\t}\n\n\tcontains(lineNumber: number): boolean {\n\t\tconst rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, r => r.startLineNumber <= lineNumber);\n\t\treturn !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > lineNumber;\n\t}\n\n\tintersects(range: LineRange): boolean {\n\t\tconst rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, r => r.startLineNumber < range.endLineNumberExclusive);\n\t\treturn !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > range.startLineNumber;\n\t}\n\n\tgetUnion(other: LineRangeSet): LineRangeSet {\n\t\tif (this._normalizedRanges.length === 0) {\n\t\t\treturn other;\n\t\t}\n\t\tif (other._normalizedRanges.length === 0) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst result: LineRange[] = [];\n\t\tlet i1 = 0;\n\t\tlet i2 = 0;\n\t\tlet current: LineRange | null = null;\n\t\twhile (i1 < this._normalizedRanges.length || i2 < other._normalizedRanges.length) {\n\t\t\tlet next: LineRange | null = null;\n\t\t\tif (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {\n\t\t\t\tconst lineRange1 = this._normalizedRanges[i1];\n\t\t\t\tconst lineRange2 = other._normalizedRanges[i2];\n\t\t\t\tif (lineRange1.startLineNumber < lineRange2.startLineNumber) {\n\t\t\t\t\tnext = lineRange1;\n\t\t\t\t\ti1++;\n\t\t\t\t} else {\n\t\t\t\t\tnext = lineRange2;\n\t\t\t\t\ti2++;\n\t\t\t\t}\n\t\t\t} else if (i1 < this._normalizedRanges.length) {\n\t\t\t\tnext = this._normalizedRanges[i1];\n\t\t\t\ti1++;\n\t\t\t} else {\n\t\t\t\tnext = other._normalizedRanges[i2];\n\t\t\t\ti2++;\n\t\t\t}\n\n\t\t\tif (current === null) {\n\t\t\t\tcurrent = next;\n\t\t\t} else {\n\t\t\t\tif (current.endLineNumberExclusive >= next.startLineNumber) {\n\t\t\t\t\t// merge\n\t\t\t\t\tcurrent = new LineRange(current.startLineNumber, Math.max(current.endLineNumberExclusive, next.endLineNumberExclusive));\n\t\t\t\t} else {\n\t\t\t\t\t// push\n\t\t\t\t\tresult.push(current);\n\t\t\t\t\tcurrent = next;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (current !== null) {\n\t\t\tresult.push(current);\n\t\t}\n\t\treturn new LineRangeSet(result);\n\t}\n\n\t/**\n\t * Subtracts all ranges in this set from `range` and returns the result.\n\t */\n\tsubtractFrom(range: LineRange): LineRangeSet {\n\t\t// idx of first element that touches range or that is after range\n\t\tconst joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, r => r.endLineNumberExclusive >= range.startLineNumber);\n\t\t// idx of element after { last element that touches range or that is before range }\n\t\tconst joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, r => r.startLineNumber <= range.endLineNumberExclusive) + 1;\n\n\t\tif (joinRangeStartIdx === joinRangeEndIdxExclusive) {\n\t\t\treturn new LineRangeSet([range]);\n\t\t}\n\n\t\tconst result: LineRange[] = [];\n\t\tlet startLineNumber = range.startLineNumber;\n\t\tfor (let i = joinRangeStartIdx; i < joinRangeEndIdxExclusive; i++) {\n\t\t\tconst r = this._normalizedRanges[i];\n\t\t\tif (r.startLineNumber > startLineNumber) {\n\t\t\t\tresult.push(new LineRange(startLineNumber, r.startLineNumber));\n\t\t\t}\n\t\t\tstartLineNumber = r.endLineNumberExclusive;\n\t\t}\n\t\tif (startLineNumber < range.endLineNumberExclusive) {\n\t\t\tresult.push(new LineRange(startLineNumber, range.endLineNumberExclusive));\n\t\t}\n\n\t\treturn new LineRangeSet(result);\n\t}\n\n\ttoString() {\n\t\treturn this._normalizedRanges.map(r => r.toString()).join(', ');\n\t}\n\n\tgetIntersection(other: LineRangeSet): LineRangeSet {\n\t\tconst result: LineRange[] = [];\n\n\t\tlet i1 = 0;\n\t\tlet i2 = 0;\n\t\twhile (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {\n\t\t\tconst r1 = this._normalizedRanges[i1];\n\t\t\tconst r2 = other._normalizedRanges[i2];\n\n\t\t\tconst i = r1.intersect(r2);\n\t\t\tif (i && !i.isEmpty) {\n\t\t\t\tresult.push(i);\n\t\t\t}\n\n\t\t\tif (r1.endLineNumberExclusive < r2.endLineNumberExclusive) {\n\t\t\t\ti1++;\n\t\t\t} else {\n\t\t\t\ti2++;\n\t\t\t}\n\t\t}\n\n\t\treturn new LineRangeSet(result);\n\t}\n\n\tgetWithDelta(value: number): LineRangeSet {\n\t\treturn new LineRangeSet(this._normalizedRanges.map(r => r.delta(value)));\n\t}\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 { BugIndicatingError } from '../../../../base/common/errors.js';\nimport { OffsetRange } from './offsetRange.js';\nimport { IRange, Range } from '../range.js';\nimport { findFirstIdxMonotonousOrArrLen, findLastIdxMonotonous, findLastMonotonous } from '../../../../base/common/arraysFind.js';\nimport { Comparator, compareBy, numberComparator } from '../../../../base/common/arrays.js';\n\n/**\n * A range of lines (1-based).\n */\nexport class LineRange {\n\tpublic static ofLength(startLineNumber: number, length: number): LineRange {\n\t\treturn new LineRange(startLineNumber, startLineNumber + length);\n\t}\n\n\tpublic static fromRange(range: IRange): LineRange {\n\t\treturn new LineRange(range.startLineNumber, range.endLineNumber);\n\t}\n\n\tpublic static fromRangeInclusive(range: IRange): LineRange {\n\t\treturn new LineRange(range.startLineNumber, range.endLineNumber + 1);\n\t}\n\n\tpublic static readonly compareByStart: Comparator<LineRange> = compareBy(l => l.startLineNumber, numberComparator);\n\n\t/**\n\t * @param lineRanges An array of arrays of of sorted line ranges.\n\t */\n\tpublic static joinMany(lineRanges: readonly (readonly LineRange[])[]): readonly LineRange[] {\n\t\tif (lineRanges.length === 0) {\n\t\t\treturn [];\n\t\t}\n\t\tlet result = new LineRangeSet(lineRanges[0].slice());\n\t\tfor (let i = 1; i < lineRanges.length; i++) {\n\t\t\tresult = result.getUnion(new LineRangeSet(lineRanges[i].slice()));\n\t\t}\n\t\treturn result.ranges;\n\t}\n\n\tpublic static join(lineRanges: LineRange[]): LineRange {\n\t\tif (lineRanges.length === 0) {\n\t\t\tthrow new BugIndicatingError('lineRanges cannot be empty');\n\t\t}\n\t\tlet startLineNumber = lineRanges[0].startLineNumber;\n\t\tlet endLineNumberExclusive = lineRanges[0].endLineNumberExclusive;\n\t\tfor (let i = 1; i < lineRanges.length; i++) {\n\t\t\tstartLineNumber = Math.min(startLineNumber, lineRanges[i].startLineNumber);\n\t\t\tendLineNumberExclusive = Math.max(endLineNumberExclusive, lineRanges[i].endLineNumberExclusive);\n\t\t}\n\t\treturn new LineRange(startLineNumber, endLineNumberExclusive);\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tpublic static deserialize(lineRange: ISerializedLineRange): LineRange {\n\t\treturn new LineRange(lineRange[0], lineRange[1]);\n\t}\n\n\t/**\n\t * The start line number.\n\t */\n\tpublic readonly startLineNumber: number;\n\n\t/**\n\t * The end line number (exclusive).\n\t */\n\tpublic readonly endLineNumberExclusive: number;\n\n\tconstructor(\n\t\tstartLineNumber: number,\n\t\tendLineNumberExclusive: number,\n\t) {\n\t\tif (startLineNumber > endLineNumberExclusive) {\n\t\t\tthrow new BugIndicatingError(`startLineNumber ${startLineNumber} cannot be after endLineNumberExclusive ${endLineNumberExclusive}`);\n\t\t}\n\t\tthis.startLineNumber = startLineNumber;\n\t\tthis.endLineNumberExclusive = endLineNumberExclusive;\n\t}\n\n\t/**\n\t * Indicates if this line range contains the given line number.\n\t */\n\tpublic contains(lineNumber: number): boolean {\n\t\treturn this.startLineNumber <= lineNumber && lineNumber < this.endLineNumberExclusive;\n\t}\n\n\t/**\n\t * Indicates if this line range is empty.\n\t */\n\tget isEmpty(): boolean {\n\t\treturn this.startLineNumber === this.endLineNumberExclusive;\n\t}\n\n\t/**\n\t * Moves this line range by the given offset of line numbers.\n\t */\n\tpublic delta(offset: number): LineRange {\n\t\treturn new LineRange(this.startLineNumber + offset, this.endLineNumberExclusive + offset);\n\t}\n\n\tpublic deltaLength(offset: number): LineRange {\n\t\treturn new LineRange(this.startLineNumber, this.endLineNumberExclusive + offset);\n\t}\n\n\t/**\n\t * The number of lines this line range spans.\n\t */\n\tpublic get length(): number {\n\t\treturn this.endLineNumberExclusive - this.startLineNumber;\n\t}\n\n\t/**\n\t * Creates a line range that combines this and the given line range.\n\t */\n\tpublic join(other: LineRange): LineRange {\n\t\treturn new LineRange(\n\t\t\tMath.min(this.startLineNumber, other.startLineNumber),\n\t\t\tMath.max(this.endLineNumberExclusive, other.endLineNumberExclusive)\n\t\t);\n\t}\n\n\tpublic toString(): string {\n\t\treturn `[${this.startLineNumber},${this.endLineNumberExclusive})`;\n\t}\n\n\t/**\n\t * The resulting range is empty if the ranges do not intersect, but touch.\n\t * If the ranges don't even touch, the result is undefined.\n\t */\n\tpublic intersect(other: LineRange): LineRange | undefined {\n\t\tconst startLineNumber = Math.max(this.startLineNumber, other.startLineNumber);\n\t\tconst endLineNumberExclusive = Math.min(this.endLineNumberExclusive, other.endLineNumberExclusive);\n\t\tif (startLineNumber <= endLineNumberExclusive) {\n\t\t\treturn new LineRange(startLineNumber, endLineNumberExclusive);\n\t\t}\n\t\treturn undefined;\n\t}\n\n\tpublic intersectsStrict(other: LineRange): boolean {\n\t\treturn this.startLineNumber < other.endLineNumberExclusive && other.startLineNumber < this.endLineNumberExclusive;\n\t}\n\n\tpublic intersectsOrTouches(other: LineRange): boolean {\n\t\treturn this.startLineNumber <= other.endLineNumberExclusive && other.startLineNumber <= this.endLineNumberExclusive;\n\t}\n\n\tpublic equals(b: LineRange): boolean {\n\t\treturn this.startLineNumber === b.startLineNumber && this.endLineNumberExclusive === b.endLineNumberExclusive;\n\t}\n\n\tpublic toInclusiveRange(): Range | null {\n\t\tif (this.isEmpty) {\n\t\t\treturn null;\n\t\t}\n\t\treturn new Range(this.startLineNumber, 1, this.endLineNumberExclusive - 1, Number.MAX_SAFE_INTEGER);\n\t}\n\n\t/**\n\t * @deprecated Using this function is discouraged because it might lead to bugs: The end position is not guaranteed to be a valid position!\n\t*/\n\tpublic toExclusiveRange(): Range {\n\t\treturn new Range(this.startLineNumber, 1, this.endLineNumberExclusive, 1);\n\t}\n\n\tpublic mapToLineArray<T>(f: (lineNumber: number) => T): T[] {\n\t\tconst result: T[] = [];\n\t\tfor (let lineNumber = this.startLineNumber; lineNumber < this.endLineNumberExclusive; lineNumber++) {\n\t\t\tresult.push(f(lineNumber));\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic forEach(f: (lineNumber: number) => void): void {\n\t\tfor (let lineNumber = this.startLineNumber; lineNumber < this.endLineNumberExclusive; lineNumber++) {\n\t\t\tf(lineNumber);\n\t\t}\n\t}\n\n\t/**\n\t * @internal\n\t */\n\tpublic serialize(): ISerializedLineRange {\n\t\treturn [this.startLineNumber, this.endLineNumberExclusive];\n\t}\n\n\t/**\n\t * Converts this 1-based line range to a 0-based offset range (subtracts 1!).\n\t * @internal\n\t */\n\tpublic toOffsetRange(): OffsetRange {\n\t\treturn new OffsetRange(this.startLineNumber - 1, this.endLineNumberExclusive - 1);\n\t}\n\n\tpublic addMargin(marginTop: number, marginBottom: number): LineRange {\n\t\treturn new LineRange(\n\t\t\tthis.startLineNumber - marginTop,\n\t\t\tthis.endLineNumberExclusive + marginBottom\n\t\t);\n\t}\n}\n\nexport type ISerializedLineRange = [startLineNumber: number, endLineNumberExclusive: number];\n\n\nexport class LineRangeSet {\n\tconstructor(\n\t\t/**\n\t\t * Sorted by start line number.\n\t\t * No two line ranges are touching or intersecting.\n\t\t */\n\t\tprivate readonly _normalizedRanges: LineRange[] = []\n\t) {\n\t}\n\n\tget ranges(): readonly LineRange[] {\n\t\treturn this._normalizedRanges;\n\t}\n\n\taddRange(range: LineRange): void {\n\t\tif (range.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\t// Idea: Find joinRange such that:\n\t\t// replaceRange = _normalizedRanges.replaceRange(joinRange, range.joinAll(joinRange.map(idx => this._normalizedRanges[idx])))\n\n\t\t// idx of first element that touches range or that is after range\n\t\tconst joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, r => r.endLineNumberExclusive >= range.startLineNumber);\n\t\t// idx of element after { last element that touches range or that is before range }\n\t\tconst joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, r => r.startLineNumber <= range.endLineNumberExclusive) + 1;\n\n\t\tif (joinRangeStartIdx === joinRangeEndIdxExclusive) {\n\t\t\t// If there is no element that touches range, then joinRangeStartIdx === joinRangeEndIdxExclusive and that value is the index of the element after range\n\t\t\tthis._normalizedRanges.splice(joinRangeStartIdx, 0, range);\n\t\t} else if (joinRangeStartIdx === joinRangeEndIdxExclusive - 1) {\n\t\t\t// Else, there is an element that touches range and in this case it is both the first and last element. Thus we can replace it\n\t\t\tconst joinRange = this._normalizedRanges[joinRangeStartIdx];\n\t\t\tthis._normalizedRanges[joinRangeStartIdx] = joinRange.join(range);\n\t\t} else {\n\t\t\t// First and last element are different - we need to replace the entire range\n\t\t\tconst joinRange = this._normalizedRanges[joinRangeStartIdx].join(this._normalizedRanges[joinRangeEndIdxExclusive - 1]).join(range);\n\t\t\tthis._normalizedRanges.splice(joinRangeStartIdx, joinRangeEndIdxExclusive - joinRangeStartIdx, joinRange);\n\t\t}\n\t}\n\n\tcontains(lineNumber: number): boolean {\n\t\tconst rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, r => r.startLineNumber <= lineNumber);\n\t\treturn !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > lineNumber;\n\t}\n\n\tintersects(range: LineRange): boolean {\n\t\tconst rangeThatStartsBeforeEnd = findLastMonotonous(this._normalizedRanges, r => r.startLineNumber < range.endLineNumberExclusive);\n\t\treturn !!rangeThatStartsBeforeEnd && rangeThatStartsBeforeEnd.endLineNumberExclusive > range.startLineNumber;\n\t}\n\n\tgetUnion(other: LineRangeSet): LineRangeSet {\n\t\tif (this._normalizedRanges.length === 0) {\n\t\t\treturn other;\n\t\t}\n\t\tif (other._normalizedRanges.length === 0) {\n\t\t\treturn this;\n\t\t}\n\n\t\tconst result: LineRange[] = [];\n\t\tlet i1 = 0;\n\t\tlet i2 = 0;\n\t\tlet current: LineRange | null = null;\n\t\twhile (i1 < this._normalizedRanges.length || i2 < other._normalizedRanges.length) {\n\t\t\tlet next: LineRange | null = null;\n\t\t\tif (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {\n\t\t\t\tconst lineRange1 = this._normalizedRanges[i1];\n\t\t\t\tconst lineRange2 = other._normalizedRanges[i2];\n\t\t\t\tif (lineRange1.startLineNumber < lineRange2.startLineNumber) {\n\t\t\t\t\tnext = lineRange1;\n\t\t\t\t\ti1++;\n\t\t\t\t} else {\n\t\t\t\t\tnext = lineRange2;\n\t\t\t\t\ti2++;\n\t\t\t\t}\n\t\t\t} else if (i1 < this._normalizedRanges.length) {\n\t\t\t\tnext = this._normalizedRanges[i1];\n\t\t\t\ti1++;\n\t\t\t} else {\n\t\t\t\tnext = other._normalizedRanges[i2];\n\t\t\t\ti2++;\n\t\t\t}\n\n\t\t\tif (current === null) {\n\t\t\t\tcurrent = next;\n\t\t\t} else {\n\t\t\t\tif (current.endLineNumberExclusive >= next.startLineNumber) {\n\t\t\t\t\t// merge\n\t\t\t\t\tcurrent = new LineRange(current.startLineNumber, Math.max(current.endLineNumberExclusive, next.endLineNumberExclusive));\n\t\t\t\t} else {\n\t\t\t\t\t// push\n\t\t\t\t\tresult.push(current);\n\t\t\t\t\tcurrent = next;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (current !== null) {\n\t\t\tresult.push(current);\n\t\t}\n\t\treturn new LineRangeSet(result);\n\t}\n\n\t/**\n\t * Subtracts all ranges in this set from `range` and returns the result.\n\t */\n\tsubtractFrom(range: LineRange): LineRangeSet {\n\t\t// idx of first element that touches range or that is after range\n\t\tconst joinRangeStartIdx = findFirstIdxMonotonousOrArrLen(this._normalizedRanges, r => r.endLineNumberExclusive >= range.startLineNumber);\n\t\t// idx of element after { last element that touches range or that is before range }\n\t\tconst joinRangeEndIdxExclusive = findLastIdxMonotonous(this._normalizedRanges, r => r.startLineNumber <= range.endLineNumberExclusive) + 1;\n\n\t\tif (joinRangeStartIdx === joinRangeEndIdxExclusive) {\n\t\t\treturn new LineRangeSet([range]);\n\t\t}\n\n\t\tconst result: LineRange[] = [];\n\t\tlet startLineNumber = range.startLineNumber;\n\t\tfor (let i = joinRangeStartIdx; i < joinRangeEndIdxExclusive; i++) {\n\t\t\tconst r = this._normalizedRanges[i];\n\t\t\tif (r.startLineNumber > startLineNumber) {\n\t\t\t\tresult.push(new LineRange(startLineNumber, r.startLineNumber));\n\t\t\t}\n\t\t\tstartLineNumber = r.endLineNumberExclusive;\n\t\t}\n\t\tif (startLineNumber < range.endLineNumberExclusive) {\n\t\t\tresult.push(new LineRange(startLineNumber, range.endLineNumberExclusive));\n\t\t}\n\n\t\treturn new LineRangeSet(result);\n\t}\n\n\ttoString() {\n\t\treturn this._normalizedRanges.map(r => r.toString()).join(', ');\n\t}\n\n\tgetIntersection(other: LineRangeSet): LineRangeSet {\n\t\tconst result: LineRange[] = [];\n\n\t\tlet i1 = 0;\n\t\tlet i2 = 0;\n\t\twhile (i1 < this._normalizedRanges.length && i2 < other._normalizedRanges.length) {\n\t\t\tconst r1 = this._normalizedRanges[i1];\n\t\t\tconst r2 = other._normalizedRanges[i2];\n\n\t\t\tconst i = r1.intersect(r2);\n\t\t\tif (i && !i.isEmpty) {\n\t\t\t\tresult.push(i);\n\t\t\t}\n\n\t\t\tif (r1.endLineNumberExclusive < r2.endLineNumberExclusive) {\n\t\t\t\ti1++;\n\t\t\t} else {\n\t\t\t\ti2++;\n\t\t\t}\n\t\t}\n\n\t\treturn new LineRangeSet(result);\n\t}\n\n\tgetWithDelta(value: number): LineRangeSet {\n\t\treturn new LineRangeSet(this._normalizedRanges.map(r => r.delta(value)));\n\t}\n}\n"]}
|