monaco-editor-core 0.55.0-dev-20251102 → 0.55.0-dev-20251103

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/esm/nls.messages.cs.js +1 -1
  2. package/esm/nls.messages.de.js +1 -1
  3. package/esm/nls.messages.es.js +1 -1
  4. package/esm/nls.messages.fr.js +1 -1
  5. package/esm/nls.messages.it.js +1 -1
  6. package/esm/nls.messages.ja.js +1 -1
  7. package/esm/nls.messages.ko.js +1 -1
  8. package/esm/nls.messages.pl.js +1 -1
  9. package/esm/nls.messages.pt-br.js +1 -1
  10. package/esm/nls.messages.ru.js +1 -1
  11. package/esm/nls.messages.tr.js +1 -1
  12. package/esm/nls.messages.zh-cn.js +1 -1
  13. package/esm/nls.messages.zh-tw.js +1 -1
  14. package/esm/vs/base/browser/dom.js.map +1 -1
  15. package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
  16. package/esm/vs/base/browser/ui/list/listView.js.map +1 -1
  17. package/esm/vs/base/browser/ui/tree/abstractTree.js +2 -0
  18. package/esm/vs/base/browser/ui/tree/abstractTree.js.map +1 -1
  19. package/esm/vs/base/browser/ui/tree/asyncDataTree.js +2 -0
  20. package/esm/vs/base/browser/ui/tree/asyncDataTree.js.map +1 -1
  21. package/esm/vs/base/common/arrays.js.map +1 -1
  22. package/esm/vs/base/common/event.js.map +1 -1
  23. package/esm/vs/base/common/glob.js.map +1 -1
  24. package/esm/vs/base/common/lifecycle.js.map +1 -1
  25. package/esm/vs/base/common/network.js.map +1 -1
  26. package/esm/vs/base/common/ternarySearchTree.js.map +1 -1
  27. package/esm/vs/editor/browser/controller/mouseHandler.js.map +1 -1
  28. package/esm/vs/editor/browser/controller/mouseTarget.js.map +1 -1
  29. package/esm/vs/editor/browser/dataTransfer.js.map +1 -1
  30. package/esm/vs/editor/browser/viewParts/viewLines/viewLine.js.map +1 -1
  31. package/esm/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.js.map +1 -1
  32. package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
  33. package/esm/vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer.js.map +1 -1
  34. package/esm/vs/editor/browser/widget/diffEditor/diffEditorViewModel.js.map +1 -1
  35. package/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js.map +1 -1
  36. package/esm/vs/editor/browser/widget/diffEditor/features/gutterFeature.js.map +1 -1
  37. package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
  38. package/esm/vs/editor/common/core/edits/edit.js.map +1 -1
  39. package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js.map +1 -1
  40. package/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/ast.js.map +1 -1
  41. package/esm/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsTree/concat23Trees.js.map +1 -1
  42. package/esm/vs/editor/common/model/tokens/treeSitter/tokenStore.js.map +1 -1
  43. package/esm/vs/editor/common/model/tokens/treeSitter/treeSitterTree.js.map +1 -1
  44. package/esm/vs/editor/common/viewModel/viewModelLines.js.map +1 -1
  45. package/esm/vs/editor/contrib/editorState/browser/editorState.js.map +1 -1
  46. package/esm/vs/editor/contrib/find/browser/findDecorations.js.map +1 -1
  47. package/esm/vs/editor/contrib/find/browser/findModel.js.map +1 -1
  48. package/esm/vs/editor/contrib/folding/browser/folding.js.map +1 -1
  49. package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js.map +1 -1
  50. package/esm/vs/editor/contrib/inlineCompletions/browser/model/suggestWidgetAdapter.js.map +1 -1
  51. package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js.map +1 -1
  52. package/esm/vs/editor/contrib/links/browser/links.js.map +1 -1
  53. package/esm/vs/editor/contrib/rename/browser/renameWidget.js.map +1 -1
  54. package/esm/vs/editor/contrib/snippet/browser/snippetParser.js.map +1 -1
  55. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js.map +1 -1
  56. package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollModelProvider.js.map +1 -1
  57. package/esm/vs/editor/standalone/browser/standaloneEditor.js.map +1 -1
  58. package/esm/vs/editor/standalone/common/monarch/monarchCompile.js.map +1 -1
  59. package/esm/vs/platform/configuration/common/configurationRegistry.js.map +1 -1
  60. package/esm/vs/platform/contextkey/common/contextkey.js +0 -4
  61. package/esm/vs/platform/contextkey/common/contextkey.js.map +1 -1
  62. package/esm/vs/platform/hover/browser/hoverService.js.map +1 -1
  63. package/esm/vs/platform/observable/common/wrapInHotClass.js.map +1 -1
  64. package/esm/vs/platform/observable/common/wrapInReloadableClass.js +0 -1
  65. package/esm/vs/platform/observable/common/wrapInReloadableClass.js.map +1 -1
  66. package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js.map +1 -1
  67. package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
  68. package/esm/vs/platform/quickinput/browser/quickInputController.js.map +1 -1
  69. package/esm/vs/platform/quickinput/browser/quickInputList.js.map +1 -1
  70. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/editorState/browser/editorState.ts","vs/editor/contrib/editorState/browser/editorState.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,OAAO,MAAM,oCAAoC,CAAC;AAG9D,OAAO,EAAE,KAAK,EAAU,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAqB,MAAM,yCAAyC,CAAC;AACrG,OAAO,EAAe,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEpF,OAAO,EAAE,uCAAuC,EAAE,MAAM,6BAA6B,CAAC;AAStF,MAAM,OAAO,WAAW;IAUvB,YAAY,MAAmB,EAAE,KAAa;QAC7C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC,IAAI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CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,KAAK,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;CACD;AAED;;GAEG;AACH,MAAM,OAAO,gCAAiC,SAAQ,uBAAuB;IAI5E,YAAY,KAAiB,EAAE,MAA0B;QACxD,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IAChE,CAAC;IAEQ,OAAO;QACf,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACzB,KAAK,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;CACD","file":"editorState.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 * as strings from '../../../../base/common/strings.js';\nimport { ICodeEditor, IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range, IRange } from '../../../common/core/range.js';\nimport { CancellationTokenSource, CancellationToken } from '../../../../base/common/cancellation.js';\nimport { IDisposable, DisposableStore } from '../../../../base/common/lifecycle.js';\nimport { ITextModel } from '../../../common/model.js';\nimport { EditorKeybindingCancellationTokenSource } from './keybindingCancellation.js';\n\nexport const enum CodeEditorStateFlag {\n\tValue = 1,\n\tSelection = 2,\n\tPosition = 4,\n\tScroll = 8\n}\n\nexport class EditorState {\n\n\tprivate readonly flags: number;\n\n\tprivate readonly position: Position | null;\n\tprivate readonly selection: Range | null;\n\tprivate readonly modelVersionId: string | null;\n\tprivate readonly scrollLeft: number;\n\tprivate readonly scrollTop: number;\n\n\tconstructor(editor: ICodeEditor, flags: number) {\n\t\tthis.flags = flags;\n\n\t\tif ((this.flags & CodeEditorStateFlag.Value) !== 0) {\n\t\t\tconst model = editor.getModel();\n\t\t\tthis.modelVersionId = model ? strings.format('{0}#{1}', model.uri.toString(), model.getVersionId()) : null;\n\t\t} else {\n\t\t\tthis.modelVersionId = null;\n\t\t}\n\t\tif ((this.flags & CodeEditorStateFlag.Position) !== 0) {\n\t\t\tthis.position = editor.getPosition();\n\t\t} else {\n\t\t\tthis.position = null;\n\t\t}\n\t\tif ((this.flags & CodeEditorStateFlag.Selection) !== 0) {\n\t\t\tthis.selection = editor.getSelection();\n\t\t} else {\n\t\t\tthis.selection = null;\n\t\t}\n\t\tif ((this.flags & CodeEditorStateFlag.Scroll) !== 0) {\n\t\t\tthis.scrollLeft = editor.getScrollLeft();\n\t\t\tthis.scrollTop = editor.getScrollTop();\n\t\t} else {\n\t\t\tthis.scrollLeft = -1;\n\t\t\tthis.scrollTop = -1;\n\t\t}\n\t}\n\n\tprivate _equals(other: unknown): boolean {\n\n\t\tif (!(other instanceof EditorState)) {\n\t\t\treturn false;\n\t\t}\n\t\tconst state = <EditorState>other;\n\n\t\tif (this.modelVersionId !== state.modelVersionId) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.scrollLeft !== state.scrollLeft || this.scrollTop !== state.scrollTop) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!this.position && state.position || this.position && !state.position || this.position && state.position && !this.position.equals(state.position)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!this.selection && state.selection || this.selection && !state.selection || this.selection && state.selection && !this.selection.equalsRange(state.selection)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic validate(editor: ICodeEditor): boolean {\n\t\treturn this._equals(new EditorState(editor, this.flags));\n\t}\n}\n\n/**\n * A cancellation token source that cancels when the editor changes as expressed\n * by the provided flags\n * @param range If provided, changes in position and selection within this range will not trigger cancellation\n */\nexport class EditorStateCancellationTokenSource extends EditorKeybindingCancellationTokenSource implements IDisposable {\n\n\tprivate readonly _listener = new DisposableStore();\n\n\tconstructor(editor: IActiveCodeEditor, flags: CodeEditorStateFlag, range?: IRange, parent?: CancellationToken) {\n\t\tsuper(editor, parent);\n\n\t\tif (flags & CodeEditorStateFlag.Position) {\n\t\t\tthis._listener.add(editor.onDidChangeCursorPosition(e => {\n\t\t\t\tif (!range || !Range.containsPosition(range, e.position)) {\n\t\t\t\t\tthis.cancel();\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t\tif (flags & CodeEditorStateFlag.Selection) {\n\t\t\tthis._listener.add(editor.onDidChangeCursorSelection(e => {\n\t\t\t\tif (!range || !Range.containsRange(range, e.selection)) {\n\t\t\t\t\tthis.cancel();\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t\tif (flags & CodeEditorStateFlag.Scroll) {\n\t\t\tthis._listener.add(editor.onDidScrollChange(_ => this.cancel()));\n\t\t}\n\t\tif (flags & CodeEditorStateFlag.Value) {\n\t\t\tthis._listener.add(editor.onDidChangeModel(_ => this.cancel()));\n\t\t\tthis._listener.add(editor.onDidChangeModelContent(_ => this.cancel()));\n\t\t}\n\t}\n\n\toverride dispose() {\n\t\tthis._listener.dispose();\n\t\tsuper.dispose();\n\t}\n}\n\n/**\n * A cancellation token source that cancels when the provided model changes\n */\nexport class TextModelCancellationTokenSource extends CancellationTokenSource implements IDisposable {\n\n\tprivate _listener: IDisposable;\n\n\tconstructor(model: ITextModel, parent?: CancellationToken) {\n\t\tsuper(parent);\n\t\tthis._listener = model.onDidChangeContent(() => this.cancel());\n\t}\n\n\toverride dispose() {\n\t\tthis._listener.dispose();\n\t\tsuper.dispose();\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 * as strings from '../../../../base/common/strings.js';\nimport { ICodeEditor, IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range, IRange } from '../../../common/core/range.js';\nimport { CancellationTokenSource, CancellationToken } from '../../../../base/common/cancellation.js';\nimport { IDisposable, DisposableStore } from '../../../../base/common/lifecycle.js';\nimport { ITextModel } from '../../../common/model.js';\nimport { EditorKeybindingCancellationTokenSource } from './keybindingCancellation.js';\n\nexport const enum CodeEditorStateFlag {\n\tValue = 1,\n\tSelection = 2,\n\tPosition = 4,\n\tScroll = 8\n}\n\nexport class EditorState {\n\n\tprivate readonly flags: number;\n\n\tprivate readonly position: Position | null;\n\tprivate readonly selection: Range | null;\n\tprivate readonly modelVersionId: string | null;\n\tprivate readonly scrollLeft: number;\n\tprivate readonly scrollTop: number;\n\n\tconstructor(editor: ICodeEditor, flags: number) {\n\t\tthis.flags = flags;\n\n\t\tif ((this.flags & CodeEditorStateFlag.Value) !== 0) {\n\t\t\tconst model = editor.getModel();\n\t\t\tthis.modelVersionId = model ? strings.format('{0}#{1}', model.uri.toString(), model.getVersionId()) : null;\n\t\t} else {\n\t\t\tthis.modelVersionId = null;\n\t\t}\n\t\tif ((this.flags & CodeEditorStateFlag.Position) !== 0) {\n\t\t\tthis.position = editor.getPosition();\n\t\t} else {\n\t\t\tthis.position = null;\n\t\t}\n\t\tif ((this.flags & CodeEditorStateFlag.Selection) !== 0) {\n\t\t\tthis.selection = editor.getSelection();\n\t\t} else {\n\t\t\tthis.selection = null;\n\t\t}\n\t\tif ((this.flags & CodeEditorStateFlag.Scroll) !== 0) {\n\t\t\tthis.scrollLeft = editor.getScrollLeft();\n\t\t\tthis.scrollTop = editor.getScrollTop();\n\t\t} else {\n\t\t\tthis.scrollLeft = -1;\n\t\t\tthis.scrollTop = -1;\n\t\t}\n\t}\n\n\tprivate _equals(other: unknown): boolean {\n\n\t\tif (!(other instanceof EditorState)) {\n\t\t\treturn false;\n\t\t}\n\t\tconst state = <EditorState>other;\n\n\t\tif (this.modelVersionId !== state.modelVersionId) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.scrollLeft !== state.scrollLeft || this.scrollTop !== state.scrollTop) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!this.position && state.position || this.position && !state.position || this.position && state.position && !this.position.equals(state.position)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!this.selection && state.selection || this.selection && !state.selection || this.selection && state.selection && !this.selection.equalsRange(state.selection)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic validate(editor: ICodeEditor): boolean {\n\t\treturn this._equals(new EditorState(editor, this.flags));\n\t}\n}\n\n/**\n * A cancellation token source that cancels when the editor changes as expressed\n * by the provided flags\n * @param range If provided, changes in position and selection within this range will not trigger cancellation\n */\nexport class EditorStateCancellationTokenSource extends EditorKeybindingCancellationTokenSource implements IDisposable {\n\n\tprivate readonly _listener = new DisposableStore();\n\n\tconstructor(editor: IActiveCodeEditor, flags: CodeEditorStateFlag, range?: IRange, parent?: CancellationToken) {\n\t\tsuper(editor, parent);\n\n\t\tif (flags & CodeEditorStateFlag.Position) {\n\t\t\tthis._listener.add(editor.onDidChangeCursorPosition(e => {\n\t\t\t\tif (!range || !Range.containsPosition(range, e.position)) {\n\t\t\t\t\tthis.cancel();\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t\tif (flags & CodeEditorStateFlag.Selection) {\n\t\t\tthis._listener.add(editor.onDidChangeCursorSelection(e => {\n\t\t\t\tif (!range || !Range.containsRange(range, e.selection)) {\n\t\t\t\t\tthis.cancel();\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t\tif (flags & CodeEditorStateFlag.Scroll) {\n\t\t\tthis._listener.add(editor.onDidScrollChange(_ => this.cancel()));\n\t\t}\n\t\tif (flags & CodeEditorStateFlag.Value) {\n\t\t\tthis._listener.add(editor.onDidChangeModel(_ => this.cancel()));\n\t\t\tthis._listener.add(editor.onDidChangeModelContent(_ => this.cancel()));\n\t\t}\n\t}\n\n\toverride dispose() {\n\t\tthis._listener.dispose();\n\t\tsuper.dispose();\n\t}\n}\n\n/**\n * A cancellation token source that cancels when the provided model changes\n */\nexport class TextModelCancellationTokenSource extends CancellationTokenSource implements IDisposable {\n\n\tprivate _listener: IDisposable;\n\n\tconstructor(model: ITextModel, parent?: CancellationToken) {\n\t\tsuper(parent);\n\t\tthis._listener = model.onDidChangeContent(() => this.cancel());\n\t}\n\n\toverride dispose() {\n\t\tthis._listener.dispose();\n\t\tsuper.dispose();\n\t}\n}\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/editorState/browser/editorState.ts","vs/editor/contrib/editorState/browser/editorState.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,OAAO,MAAM,oCAAoC,CAAC;AAG9D,OAAO,EAAE,KAAK,EAAU,MAAM,+BAA+B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAqB,MAAM,yCAAyC,CAAC;AACrG,OAAO,EAAe,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAEpF,OAAO,EAAE,uCAAuC,EAAE,MAAM,6BAA6B,CAAC;AAStF,MAAM,OAAO,WAAW;IAUvB,YAAY,MAAmB,EAAE,KAAa;QAC7C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QAEnB,IAAI,CAAC,IAAI,CAAC,KAAK,oCAA4B,CAAC,KAAK,CAAC,EAAE,CAAC;YACpD,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;YAChC,IAAI,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,EAAE,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;QAC5G,CAAC;aAAM,CAAC;YACP,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,KAAK,uCAA+B,CAAC,KAAK,CAAC,EAAE,CAAC;YACvD,IAAI,CAAC,QAAQ,GAAG,MA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ependencies/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 * as strings from '../../../../base/common/strings.js';\nimport { ICodeEditor, IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range, IRange } from '../../../common/core/range.js';\nimport { CancellationTokenSource, CancellationToken } from '../../../../base/common/cancellation.js';\nimport { IDisposable, DisposableStore } from '../../../../base/common/lifecycle.js';\nimport { ITextModel } from '../../../common/model.js';\nimport { EditorKeybindingCancellationTokenSource } from './keybindingCancellation.js';\n\nexport const enum CodeEditorStateFlag {\n\tValue = 1,\n\tSelection = 2,\n\tPosition = 4,\n\tScroll = 8\n}\n\nexport class EditorState {\n\n\tprivate readonly flags: number;\n\n\tprivate readonly position: Position | null;\n\tprivate readonly selection: Range | null;\n\tprivate readonly modelVersionId: string | null;\n\tprivate readonly scrollLeft: number;\n\tprivate readonly scrollTop: number;\n\n\tconstructor(editor: ICodeEditor, flags: number) {\n\t\tthis.flags = flags;\n\n\t\tif ((this.flags & CodeEditorStateFlag.Value) !== 0) {\n\t\t\tconst model = editor.getModel();\n\t\t\tthis.modelVersionId = model ? strings.format('{0}#{1}', model.uri.toString(), model.getVersionId()) : null;\n\t\t} else {\n\t\t\tthis.modelVersionId = null;\n\t\t}\n\t\tif ((this.flags & CodeEditorStateFlag.Position) !== 0) {\n\t\t\tthis.position = editor.getPosition();\n\t\t} else {\n\t\t\tthis.position = null;\n\t\t}\n\t\tif ((this.flags & CodeEditorStateFlag.Selection) !== 0) {\n\t\t\tthis.selection = editor.getSelection();\n\t\t} else {\n\t\t\tthis.selection = null;\n\t\t}\n\t\tif ((this.flags & CodeEditorStateFlag.Scroll) !== 0) {\n\t\t\tthis.scrollLeft = editor.getScrollLeft();\n\t\t\tthis.scrollTop = editor.getScrollTop();\n\t\t} else {\n\t\t\tthis.scrollLeft = -1;\n\t\t\tthis.scrollTop = -1;\n\t\t}\n\t}\n\n\tprivate _equals(other: unknown): boolean {\n\n\t\tif (!(other instanceof EditorState)) {\n\t\t\treturn false;\n\t\t}\n\t\tconst state = other;\n\n\t\tif (this.modelVersionId !== state.modelVersionId) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.scrollLeft !== state.scrollLeft || this.scrollTop !== state.scrollTop) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!this.position && state.position || this.position && !state.position || this.position && state.position && !this.position.equals(state.position)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!this.selection && state.selection || this.selection && !state.selection || this.selection && state.selection && !this.selection.equalsRange(state.selection)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic validate(editor: ICodeEditor): boolean {\n\t\treturn this._equals(new EditorState(editor, this.flags));\n\t}\n}\n\n/**\n * A cancellation token source that cancels when the editor changes as expressed\n * by the provided flags\n * @param range If provided, changes in position and selection within this range will not trigger cancellation\n */\nexport class EditorStateCancellationTokenSource extends EditorKeybindingCancellationTokenSource implements IDisposable {\n\n\tprivate readonly _listener = new DisposableStore();\n\n\tconstructor(editor: IActiveCodeEditor, flags: CodeEditorStateFlag, range?: IRange, parent?: CancellationToken) {\n\t\tsuper(editor, parent);\n\n\t\tif (flags & CodeEditorStateFlag.Position) {\n\t\t\tthis._listener.add(editor.onDidChangeCursorPosition(e => {\n\t\t\t\tif (!range || !Range.containsPosition(range, e.position)) {\n\t\t\t\t\tthis.cancel();\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t\tif (flags & CodeEditorStateFlag.Selection) {\n\t\t\tthis._listener.add(editor.onDidChangeCursorSelection(e => {\n\t\t\t\tif (!range || !Range.containsRange(range, e.selection)) {\n\t\t\t\t\tthis.cancel();\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t\tif (flags & CodeEditorStateFlag.Scroll) {\n\t\t\tthis._listener.add(editor.onDidScrollChange(_ => this.cancel()));\n\t\t}\n\t\tif (flags & CodeEditorStateFlag.Value) {\n\t\t\tthis._listener.add(editor.onDidChangeModel(_ => this.cancel()));\n\t\t\tthis._listener.add(editor.onDidChangeModelContent(_ => this.cancel()));\n\t\t}\n\t}\n\n\toverride dispose() {\n\t\tthis._listener.dispose();\n\t\tsuper.dispose();\n\t}\n}\n\n/**\n * A cancellation token source that cancels when the provided model changes\n */\nexport class TextModelCancellationTokenSource extends CancellationTokenSource implements IDisposable {\n\n\tprivate _listener: IDisposable;\n\n\tconstructor(model: ITextModel, parent?: CancellationToken) {\n\t\tsuper(parent);\n\t\tthis._listener = model.onDidChangeContent(() => this.cancel());\n\t}\n\n\toverride dispose() {\n\t\tthis._listener.dispose();\n\t\tsuper.dispose();\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 * as strings from '../../../../base/common/strings.js';\nimport { ICodeEditor, IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range, IRange } from '../../../common/core/range.js';\nimport { CancellationTokenSource, CancellationToken } from '../../../../base/common/cancellation.js';\nimport { IDisposable, DisposableStore } from '../../../../base/common/lifecycle.js';\nimport { ITextModel } from '../../../common/model.js';\nimport { EditorKeybindingCancellationTokenSource } from './keybindingCancellation.js';\n\nexport const enum CodeEditorStateFlag {\n\tValue = 1,\n\tSelection = 2,\n\tPosition = 4,\n\tScroll = 8\n}\n\nexport class EditorState {\n\n\tprivate readonly flags: number;\n\n\tprivate readonly position: Position | null;\n\tprivate readonly selection: Range | null;\n\tprivate readonly modelVersionId: string | null;\n\tprivate readonly scrollLeft: number;\n\tprivate readonly scrollTop: number;\n\n\tconstructor(editor: ICodeEditor, flags: number) {\n\t\tthis.flags = flags;\n\n\t\tif ((this.flags & CodeEditorStateFlag.Value) !== 0) {\n\t\t\tconst model = editor.getModel();\n\t\t\tthis.modelVersionId = model ? strings.format('{0}#{1}', model.uri.toString(), model.getVersionId()) : null;\n\t\t} else {\n\t\t\tthis.modelVersionId = null;\n\t\t}\n\t\tif ((this.flags & CodeEditorStateFlag.Position) !== 0) {\n\t\t\tthis.position = editor.getPosition();\n\t\t} else {\n\t\t\tthis.position = null;\n\t\t}\n\t\tif ((this.flags & CodeEditorStateFlag.Selection) !== 0) {\n\t\t\tthis.selection = editor.getSelection();\n\t\t} else {\n\t\t\tthis.selection = null;\n\t\t}\n\t\tif ((this.flags & CodeEditorStateFlag.Scroll) !== 0) {\n\t\t\tthis.scrollLeft = editor.getScrollLeft();\n\t\t\tthis.scrollTop = editor.getScrollTop();\n\t\t} else {\n\t\t\tthis.scrollLeft = -1;\n\t\t\tthis.scrollTop = -1;\n\t\t}\n\t}\n\n\tprivate _equals(other: unknown): boolean {\n\n\t\tif (!(other instanceof EditorState)) {\n\t\t\treturn false;\n\t\t}\n\t\tconst state = other;\n\n\t\tif (this.modelVersionId !== state.modelVersionId) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.scrollLeft !== state.scrollLeft || this.scrollTop !== state.scrollTop) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!this.position && state.position || this.position && !state.position || this.position && state.position && !this.position.equals(state.position)) {\n\t\t\treturn false;\n\t\t}\n\t\tif (!this.selection && state.selection || this.selection && !state.selection || this.selection && state.selection && !this.selection.equalsRange(state.selection)) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic validate(editor: ICodeEditor): boolean {\n\t\treturn this._equals(new EditorState(editor, this.flags));\n\t}\n}\n\n/**\n * A cancellation token source that cancels when the editor changes as expressed\n * by the provided flags\n * @param range If provided, changes in position and selection within this range will not trigger cancellation\n */\nexport class EditorStateCancellationTokenSource extends EditorKeybindingCancellationTokenSource implements IDisposable {\n\n\tprivate readonly _listener = new DisposableStore();\n\n\tconstructor(editor: IActiveCodeEditor, flags: CodeEditorStateFlag, range?: IRange, parent?: CancellationToken) {\n\t\tsuper(editor, parent);\n\n\t\tif (flags & CodeEditorStateFlag.Position) {\n\t\t\tthis._listener.add(editor.onDidChangeCursorPosition(e => {\n\t\t\t\tif (!range || !Range.containsPosition(range, e.position)) {\n\t\t\t\t\tthis.cancel();\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t\tif (flags & CodeEditorStateFlag.Selection) {\n\t\t\tthis._listener.add(editor.onDidChangeCursorSelection(e => {\n\t\t\t\tif (!range || !Range.containsRange(range, e.selection)) {\n\t\t\t\t\tthis.cancel();\n\t\t\t\t}\n\t\t\t}));\n\t\t}\n\t\tif (flags & CodeEditorStateFlag.Scroll) {\n\t\t\tthis._listener.add(editor.onDidScrollChange(_ => this.cancel()));\n\t\t}\n\t\tif (flags & CodeEditorStateFlag.Value) {\n\t\t\tthis._listener.add(editor.onDidChangeModel(_ => this.cancel()));\n\t\t\tthis._listener.add(editor.onDidChangeModelContent(_ => this.cancel()));\n\t\t}\n\t}\n\n\toverride dispose() {\n\t\tthis._listener.dispose();\n\t\tsuper.dispose();\n\t}\n}\n\n/**\n * A cancellation token source that cancels when the provided model changes\n */\nexport class TextModelCancellationTokenSource extends CancellationTokenSource implements IDisposable {\n\n\tprivate _listener: IDisposable;\n\n\tconstructor(model: ITextModel, parent?: CancellationToken) {\n\t\tsuper(parent);\n\t\tthis._listener = model.onDidChangeContent(() => this.cancel());\n\t}\n\n\toverride dispose() {\n\t\tthis._listener.dispose();\n\t\tsuper.dispose();\n\t}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/find/browser/findDecorations.ts","vs/editor/contrib/find/browser/findDecorations.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAKhG,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAsF,iBAAiB,EAA0B,MAAM,0BAA0B,CAAC;AACzK,OAAO,EAAE,s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Y;QACzB,UAAU,4DAAoD;QAC9D,MAAM,EAAE,EAAE;QACV,SAAS,EAAE,WAAW;QACtB,eAAe,EAAE,iBAAiB;QAClC,eAAe,EAAE,IAAI;QACrB,aAAa,EAAE;YACd,KAAK,EAAE,gBAAgB,CAAC,gCAAgC,CAAC;YACzD,QAAQ,EAAE,iBAAiB,CAAC,MAAM;SAClC;QACD,OAAO,EAAE;YACR,KAAK,EAAE,gBAAgB,CAAC,gBAAgB,CAAC;YACzC,QAAQ,gCAAwB;SAChC;KACD,CAAC,CAAC;aAEoB,uCAAkC,GAAG,sBAAsB,CAAC,QAAQ,CAAC;QAC3F,WAAW,EAAE,wBAAwB;QACrC,UAAU,4DAAoD;QAC9D,SAAS,EAAE,WAAW;QACtB,eAAe,EAAE,IAAI;KACrB,CAAC,CAAC;aAEqB,yCAAoC,GAAG,sBAAsB,CAAC,QAAQ,CAAC;QAC9F,WAAW,EAAE,0BAA0B;QACvC,UAAU,4DAAoD;QAC9D,aAAa,EAAE;YACd,KAAK,EAAE,gBAAgB,CAAC,gCAAgC,CAAC;YACzD,QAAQ,EAAE,iBAAiB,CAAC,MAAM;SAClC;KACD,CAAC,CAAC;aAEqB,gCAA2B,GAAG,sBAAsB,CAAC,QAAQ,CAAC;QACrF,WAAW,EAAE,sBAAsB;QACnC,UAAU,4DAAoD;QAC9D,SAAS,EAAE,gBAAgB;QAC3B,WAAW,EAAE,IAAI;KACjB,CAAC,CAAC;aAEqB,2BAAsB,GAAG,sBAAsB,CAAC,QAAQ,CAAC;QAChF,WAAW,EAAE,YAAY;QACzB,SAAS,EAAE,WAAW;QACtB,WAAW,EAAE,IAAI;KACjB,CAAC,CAAC","file":"findDecorations.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 { IDisposable } from '../../../../base/common/lifecycle.js';\nimport { IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { FindMatch, IModelDecorationsChangeAccessor, IModelDeltaDecoration, MinimapPosition, OverviewRulerLane, TrackedRangeStickiness } from '../../../common/model.js';\nimport { ModelDecorationOptions } from '../../../common/model/textModel.js';\nimport { minimapFindMatch, overviewRulerFindMatchForeground } from '../../../../platform/theme/common/colorRegistry.js';\nimport { themeColorFromId } from '../../../../platform/theme/common/themeService.js';\n\nexport class FindDecorations implements IDisposable {\n\n\tprivate readonly _editor: IActiveCodeEditor;\n\tprivate _decorations: string[];\n\tprivate _overviewRulerApproximateDecorations: string[];\n\tprivate _findScopeDecorationIds: string[];\n\tprivate _rangeHighlightDecorationId: string | null;\n\tprivate _highlightedDecorationId: string | null;\n\tprivate _startPosition: Position;\n\n\tconstructor(editor: IActiveCodeEditor) {\n\t\tthis._editor = editor;\n\t\tthis._decorations = [];\n\t\tthis._overviewRulerApproximateDecorations = [];\n\t\tthis._findScopeDecorationIds = [];\n\t\tthis._rangeHighlightDecorationId = null;\n\t\tthis._highlightedDecorationId = null;\n\t\tthis._startPosition = this._editor.getPosition();\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._editor.removeDecorations(this._allDecorations());\n\n\t\tthis._decorations = [];\n\t\tthis._overviewRulerApproximateDecorations = [];\n\t\tthis._findScopeDecorationIds = [];\n\t\tthis._rangeHighlightDecorationId = null;\n\t\tthis._highlightedDecorationId = null;\n\t}\n\n\tpublic reset(): void {\n\t\tthis._decorations = [];\n\t\tthis._overviewRulerApproximateDecorations = [];\n\t\tthis._findScopeDecorationIds = [];\n\t\tthis._rangeHighlightDecorationId = null;\n\t\tthis._highlightedDecorationId = null;\n\t}\n\n\tpublic getCount(): number {\n\t\treturn this._decorations.length;\n\t}\n\n\t/** @deprecated use getFindScopes to support multiple selections */\n\tpublic getFindScope(): Range | null {\n\t\tif (this._findScopeDecorationIds[0]) {\n\t\t\treturn this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]);\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic getFindScopes(): Range[] | null {\n\t\tif (this._findScopeDecorationIds.length) {\n\t\t\tconst scopes = this._findScopeDecorationIds.map(findScopeDecorationId =>\n\t\t\t\tthis._editor.getModel().getDecorationRange(findScopeDecorationId)\n\t\t\t).filter(element => !!element);\n\t\t\tif (scopes.length) {\n\t\t\t\treturn scopes as Range[];\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic getStartPosition(): Position {\n\t\treturn this._startPosition;\n\t}\n\n\tpublic setStartPosition(newStartPosition: Position): void {\n\t\tthis._startPosition = newStartPosition;\n\t\tthis.setCurrentFindMatch(null);\n\t}\n\n\tprivate _getDecorationIndex(decorationId: string): number {\n\t\tconst index = this._decorations.indexOf(decorationId);\n\t\tif (index >= 0) {\n\t\t\treturn index + 1;\n\t\t}\n\t\treturn 1;\n\t}\n\n\tpublic getDecorationRangeAt(index: number): Range | null {\n\t\tconst decorationId = index < this._decorations.length ? this._decorations[index] : null;\n\t\tif (decorationId) {\n\t\t\treturn this._editor.getModel().getDecorationRange(decorationId);\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic getCurrentMatchesPosition(desiredRange: Range): number {\n\t\tconst candidates = this._editor.getModel().getDecorationsInRange(desiredRange);\n\t\tfor (const candidate of candidates) {\n\t\t\tconst candidateOpts = candidate.options;\n\t\t\tif (candidateOpts === FindDecorations._FIND_MATCH_DECORATION || candidateOpts === FindDecorations._CURRENT_FIND_MATCH_DECORATION) {\n\t\t\t\treturn this._getDecorationIndex(candidate.id);\n\t\t\t}\n\t\t}\n\t\t// We don't know the current match position, so returns zero to show '?' in find widget\n\t\treturn 0;\n\t}\n\n\tpublic setCurrentFindMatch(nextMatch: Range | null): number {\n\t\tlet newCurrentDecorationId: string | null = null;\n\t\tlet matchPosition = 0;\n\t\tif (nextMatch) {\n\t\t\tfor (let i = 0, len = this._decorations.length; i < len; i++) {\n\t\t\t\tconst range = this._editor.getModel().getDecorationRange(this._decorations[i]);\n\t\t\t\tif (nextMatch.equalsRange(range)) {\n\t\t\t\t\tnewCurrentDecorationId = this._decorations[i];\n\t\t\t\t\tmatchPosition = (i + 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (this._highlightedDecorationId !== null || newCurrentDecorationId !== null) {\n\t\t\tthis._editor.changeDecorations((changeAccessor: IModelDecorationsChangeAccessor) => {\n\t\t\t\tif (this._highlightedDecorationId !== null) {\n\t\t\t\t\tchangeAccessor.changeDecorationOptions(this._highlightedDecorationId, FindDecorations._FIND_MATCH_DECORATION);\n\t\t\t\t\tthis._highlightedDecorationId = null;\n\t\t\t\t}\n\t\t\t\tif (newCurrentDecorationId !== null) {\n\t\t\t\t\tthis._highlightedDecorationId = newCurrentDecorationId;\n\t\t\t\t\tchangeAccessor.changeDecorationOptions(this._highlightedDecorationId, FindDecorations._CURRENT_FIND_MATCH_DECORATION);\n\t\t\t\t}\n\t\t\t\tif (this._rangeHighlightDecorationId !== null) {\n\t\t\t\t\tchangeAccessor.removeDecoration(this._rangeHighlightDecorationId);\n\t\t\t\t\tthis._rangeHighlightDecorationId = null;\n\t\t\t\t}\n\t\t\t\tif (newCurrentDecorationId !== null) {\n\t\t\t\t\tlet rng = this._editor.getModel().getDecorationRange(newCurrentDecorationId)!;\n\t\t\t\t\tif (rng.startLineNumber !== rng.endLineNumber && rng.endColumn === 1) {\n\t\t\t\t\t\tconst lineBeforeEnd = rng.endLineNumber - 1;\n\t\t\t\t\t\tconst lineBeforeEndMaxColumn = this._editor.getModel().getLineMaxColumn(lineBeforeEnd);\n\t\t\t\t\t\trng = new Range(rng.startLineNumber, rng.startColumn, lineBeforeEnd, lineBeforeEndMaxColumn);\n\t\t\t\t\t}\n\t\t\t\t\tthis._rangeHighlightDecorationId = changeAccessor.addDecoration(rng, FindDecorations._RANGE_HIGHLIGHT_DECORATION);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn matchPosition;\n\t}\n\n\tpublic set(findMatches: FindMatch[], findScopes: Range[] | null): void {\n\t\tthis._editor.changeDecorations((accessor) => {\n\n\t\t\tlet findMatchesOptions: ModelDecorationOptions = FindDecorations._FIND_MATCH_DECORATION;\n\t\t\tconst newOverviewRulerApproximateDecorations: IModelDeltaDecoration[] = [];\n\n\t\t\tif (findMatches.length > 1000) {\n\t\t\t\t// we go into a mode where the overview ruler gets \"approximate\" decorations\n\t\t\t\t// the reason is that the overview ruler paints all the decorations in the file and we don't want to cause freezes\n\t\t\t\tfindMatchesOptions = FindDecorations._FIND_MATCH_NO_OVERVIEW_DECORATION;\n\n\t\t\t\t// approximate a distance in lines where matches should be merged\n\t\t\t\tconst lineCount = this._editor.getModel().getLineCount();\n\t\t\t\tconst height = this._editor.getLayoutInfo().height;\n\t\t\t\tconst approxPixelsPerLine = height / lineCount;\n\t\t\t\tconst mergeLinesDelta = Math.max(2, Math.ceil(3 / approxPixelsPerLine));\n\n\t\t\t\t// merge decorations as much as possible\n\t\t\t\tlet prevStartLineNumber = findMatches[0].range.startLineNumber;\n\t\t\t\tlet prevEndLineNumber = findMatches[0].range.endLineNumber;\n\t\t\t\tfor (let i = 1, len = findMatches.length; i < len; i++) {\n\t\t\t\t\tconst range = findMatches[i].range;\n\t\t\t\t\tif (prevEndLineNumber + mergeLinesDelta >= range.startLineNumber) {\n\t\t\t\t\t\tif (range.endLineNumber > prevEndLineNumber) {\n\t\t\t\t\t\t\tprevEndLineNumber = range.endLineNumber;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnewOverviewRulerApproximateDecorations.push({\n\t\t\t\t\t\t\trange: new Range(prevStartLineNumber, 1, prevEndLineNumber, 1),\n\t\t\t\t\t\t\toptions: FindDecorations._FIND_MATCH_ONLY_OVERVIEW_DECORATION\n\t\t\t\t\t\t});\n\t\t\t\t\t\tprevStartLineNumber = range.startLineNumber;\n\t\t\t\t\t\tprevEndLineNumber = range.endLineNumber;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tnewOverviewRulerApproximateDecorations.push({\n\t\t\t\t\trange: new Range(prevStartLineNumber, 1, prevEndLineNumber, 1),\n\t\t\t\t\toptions: FindDecorations._FIND_MATCH_ONLY_OVERVIEW_DECORATION\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Find matches\n\t\t\tconst newFindMatchesDecorations: IModelDeltaDecoration[] = new Array<IModelDeltaDecoration>(findMatches.length);\n\t\t\tfor (let i = 0, len = findMatches.length; i < len; i++) {\n\t\t\t\tnewFindMatchesDecorations[i] = {\n\t\t\t\t\trange: findMatches[i].range,\n\t\t\t\t\toptions: findMatchesOptions\n\t\t\t\t};\n\t\t\t}\n\t\t\tthis._decorations = accessor.deltaDecorations(this._decorations, newFindMatchesDecorations);\n\n\t\t\t// Overview ruler approximate decorations\n\t\t\tthis._overviewRulerApproximateDecorations = accessor.deltaDecorations(this._overviewRulerApproximateDecorations, newOverviewRulerApproximateDecorations);\n\n\t\t\t// Range highlight\n\t\t\tif (this._rangeHighlightDecorationId) {\n\t\t\t\taccessor.removeDecoration(this._rangeHighlightDecorationId);\n\t\t\t\tthis._rangeHighlightDecorationId = null;\n\t\t\t}\n\n\t\t\t// Find scope\n\t\t\tif (this._findScopeDecorationIds.length) {\n\t\t\t\tthis._findScopeDecorationIds.forEach(findScopeDecorationId => accessor.removeDecoration(findScopeDecorationId));\n\t\t\t\tthis._findScopeDecorationIds = [];\n\t\t\t}\n\t\t\tif (findScopes?.length) {\n\t\t\t\tthis._findScopeDecorationIds = findScopes.map(findScope => accessor.addDecoration(findScope, FindDecorations._FIND_SCOPE_DECORATION));\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic matchBeforePosition(position: Position): Range | null {\n\t\tif (this._decorations.length === 0) {\n\t\t\treturn null;\n\t\t}\n\t\tfor (let i = this._decorations.length - 1; i >= 0; i--) {\n\t\t\tconst decorationId = this._decorations[i];\n\t\t\tconst r = this._editor.getModel().getDecorationRange(decorationId);\n\t\t\tif (!r || r.endLineNumber > position.lineNumber) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (r.endLineNumber < position.lineNumber) {\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tif (r.endColumn > position.column) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn r;\n\t\t}\n\n\t\treturn this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length - 1]);\n\t}\n\n\tpublic matchAfterPosition(position: Position): Range | null {\n\t\tif (this._decorations.length === 0) {\n\t\t\treturn null;\n\t\t}\n\t\tfor (let i = 0, len = this._decorations.length; i < len; i++) {\n\t\t\tconst decorationId = this._decorations[i];\n\t\t\tconst r = this._editor.getModel().getDecorationRange(decorationId);\n\t\t\tif (!r || r.startLineNumber < position.lineNumber) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (r.startLineNumber > position.lineNumber) {\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tif (r.startColumn < position.column) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn r;\n\t\t}\n\n\t\treturn this._editor.getModel().getDecorationRange(this._decorations[0]);\n\t}\n\n\tprivate _allDecorations(): string[] {\n\t\tlet result: string[] = [];\n\t\tresult = result.concat(this._decorations);\n\t\tresult = result.concat(this._overviewRulerApproximateDecorations);\n\t\tif (this._findScopeDecorationIds.length) {\n\t\t\tresult.push(...this._findScopeDecorationIds);\n\t\t}\n\t\tif (this._rangeHighlightDecorationId) {\n\t\t\tresult.push(this._rangeHighlightDecorationId);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static readonly _CURRENT_FIND_MATCH_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'current-find-match',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tzIndex: 13,\n\t\tclassName: 'currentFindMatch',\n\t\tinlineClassName: 'currentFindMatchInline',\n\t\tshowIfCollapsed: true,\n\t\toverviewRuler: {\n\t\t\tcolor: themeColorFromId(overviewRulerFindMatchForeground),\n\t\t\tposition: OverviewRulerLane.Center\n\t\t},\n\t\tminimap: {\n\t\t\tcolor: themeColorFromId(minimapFindMatch),\n\t\t\tposition: MinimapPosition.Inline\n\t\t}\n\t});\n\n\tpublic static readonly _FIND_MATCH_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-match',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tzIndex: 10,\n\t\tclassName: 'findMatch',\n\t\tinlineClassName: 'findMatchInline',\n\t\tshowIfCollapsed: true,\n\t\toverviewRuler: {\n\t\t\tcolor: themeColorFromId(overviewRulerFindMatchForeground),\n\t\t\tposition: OverviewRulerLane.Center\n\t\t},\n\t\tminimap: {\n\t\t\tcolor: themeColorFromId(minimapFindMatch),\n\t\t\tposition: MinimapPosition.Inline\n\t\t}\n\t});\n\n\tpublic static readonly _FIND_MATCH_NO_OVERVIEW_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-match-no-overview',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tclassName: 'findMatch',\n\t\tshowIfCollapsed: true\n\t});\n\n\tprivate static readonly _FIND_MATCH_ONLY_OVERVIEW_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-match-only-overview',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\toverviewRuler: {\n\t\t\tcolor: themeColorFromId(overviewRulerFindMatchForeground),\n\t\t\tposition: OverviewRulerLane.Center\n\t\t}\n\t});\n\n\tprivate static readonly _RANGE_HIGHLIGHT_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-range-highlight',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tclassName: 'rangeHighlight',\n\t\tisWholeLine: true\n\t});\n\n\tprivate static readonly _FIND_SCOPE_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-scope',\n\t\tclassName: 'findScope',\n\t\tisWholeLine: true\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 { IDisposable } from '../../../../base/common/lifecycle.js';\nimport { IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { FindMatch, IModelDecorationsChangeAccessor, IModelDeltaDecoration, MinimapPosition, OverviewRulerLane, TrackedRangeStickiness } from '../../../common/model.js';\nimport { ModelDecorationOptions } from '../../../common/model/textModel.js';\nimport { minimapFindMatch, overviewRulerFindMatchForeground } from '../../../../platform/theme/common/colorRegistry.js';\nimport { themeColorFromId } from '../../../../platform/theme/common/themeService.js';\n\nexport class FindDecorations implements IDisposable {\n\n\tprivate readonly _editor: IActiveCodeEditor;\n\tprivate _decorations: string[];\n\tprivate _overviewRulerApproximateDecorations: string[];\n\tprivate _findScopeDecorationIds: string[];\n\tprivate _rangeHighlightDecorationId: string | null;\n\tprivate _highlightedDecorationId: string | null;\n\tprivate _startPosition: Position;\n\n\tconstructor(editor: IActiveCodeEditor) {\n\t\tthis._editor = editor;\n\t\tthis._decorations = [];\n\t\tthis._overviewRulerApproximateDecorations = [];\n\t\tthis._findScopeDecorationIds = [];\n\t\tthis._rangeHighlightDecorationId = null;\n\t\tthis._highlightedDecorationId = null;\n\t\tthis._startPosition = this._editor.getPosition();\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._editor.removeDecorations(this._allDecorations());\n\n\t\tthis._decorations = [];\n\t\tthis._overviewRulerApproximateDecorations = [];\n\t\tthis._findScopeDecorationIds = [];\n\t\tthis._rangeHighlightDecorationId = null;\n\t\tthis._highlightedDecorationId = null;\n\t}\n\n\tpublic reset(): void {\n\t\tthis._decorations = [];\n\t\tthis._overviewRulerApproximateDecorations = [];\n\t\tthis._findScopeDecorationIds = [];\n\t\tthis._rangeHighlightDecorationId = null;\n\t\tthis._highlightedDecorationId = null;\n\t}\n\n\tpublic getCount(): number {\n\t\treturn this._decorations.length;\n\t}\n\n\t/** @deprecated use getFindScopes to support multiple selections */\n\tpublic getFindScope(): Range | null {\n\t\tif (this._findScopeDecorationIds[0]) {\n\t\t\treturn this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]);\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic getFindScopes(): Range[] | null {\n\t\tif (this._findScopeDecorationIds.length) {\n\t\t\tconst scopes = this._findScopeDecorationIds.map(findScopeDecorationId =>\n\t\t\t\tthis._editor.getModel().getDecorationRange(findScopeDecorationId)\n\t\t\t).filter(element => !!element);\n\t\t\tif (scopes.length) {\n\t\t\t\treturn scopes as Range[];\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic getStartPosition(): Position {\n\t\treturn this._startPosition;\n\t}\n\n\tpublic setStartPosition(newStartPosition: Position): void {\n\t\tthis._startPosition = newStartPosition;\n\t\tthis.setCurrentFindMatch(null);\n\t}\n\n\tprivate _getDecorationIndex(decorationId: string): number {\n\t\tconst index = this._decorations.indexOf(decorationId);\n\t\tif (index >= 0) {\n\t\t\treturn index + 1;\n\t\t}\n\t\treturn 1;\n\t}\n\n\tpublic getDecorationRangeAt(index: number): Range | null {\n\t\tconst decorationId = index < this._decorations.length ? this._decorations[index] : null;\n\t\tif (decorationId) {\n\t\t\treturn this._editor.getModel().getDecorationRange(decorationId);\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic getCurrentMatchesPosition(desiredRange: Range): number {\n\t\tconst candidates = this._editor.getModel().getDecorationsInRange(desiredRange);\n\t\tfor (const candidate of candidates) {\n\t\t\tconst candidateOpts = candidate.options;\n\t\t\tif (candidateOpts === FindDecorations._FIND_MATCH_DECORATION || candidateOpts === FindDecorations._CURRENT_FIND_MATCH_DECORATION) {\n\t\t\t\treturn this._getDecorationIndex(candidate.id);\n\t\t\t}\n\t\t}\n\t\t// We don't know the current match position, so returns zero to show '?' in find widget\n\t\treturn 0;\n\t}\n\n\tpublic setCurrentFindMatch(nextMatch: Range | null): number {\n\t\tlet newCurrentDecorationId: string | null = null;\n\t\tlet matchPosition = 0;\n\t\tif (nextMatch) {\n\t\t\tfor (let i = 0, len = this._decorations.length; i < len; i++) {\n\t\t\t\tconst range = this._editor.getModel().getDecorationRange(this._decorations[i]);\n\t\t\t\tif (nextMatch.equalsRange(range)) {\n\t\t\t\t\tnewCurrentDecorationId = this._decorations[i];\n\t\t\t\t\tmatchPosition = (i + 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (this._highlightedDecorationId !== null || newCurrentDecorationId !== null) {\n\t\t\tthis._editor.changeDecorations((changeAccessor: IModelDecorationsChangeAccessor) => {\n\t\t\t\tif (this._highlightedDecorationId !== null) {\n\t\t\t\t\tchangeAccessor.changeDecorationOptions(this._highlightedDecorationId, FindDecorations._FIND_MATCH_DECORATION);\n\t\t\t\t\tthis._highlightedDecorationId = null;\n\t\t\t\t}\n\t\t\t\tif (newCurrentDecorationId !== null) {\n\t\t\t\t\tthis._highlightedDecorationId = newCurrentDecorationId;\n\t\t\t\t\tchangeAccessor.changeDecorationOptions(this._highlightedDecorationId, FindDecorations._CURRENT_FIND_MATCH_DECORATION);\n\t\t\t\t}\n\t\t\t\tif (this._rangeHighlightDecorationId !== null) {\n\t\t\t\t\tchangeAccessor.removeDecoration(this._rangeHighlightDecorationId);\n\t\t\t\t\tthis._rangeHighlightDecorationId = null;\n\t\t\t\t}\n\t\t\t\tif (newCurrentDecorationId !== null) {\n\t\t\t\t\tlet rng = this._editor.getModel().getDecorationRange(newCurrentDecorationId)!;\n\t\t\t\t\tif (rng.startLineNumber !== rng.endLineNumber && rng.endColumn === 1) {\n\t\t\t\t\t\tconst lineBeforeEnd = rng.endLineNumber - 1;\n\t\t\t\t\t\tconst lineBeforeEndMaxColumn = this._editor.getModel().getLineMaxColumn(lineBeforeEnd);\n\t\t\t\t\t\trng = new Range(rng.startLineNumber, rng.startColumn, lineBeforeEnd, lineBeforeEndMaxColumn);\n\t\t\t\t\t}\n\t\t\t\t\tthis._rangeHighlightDecorationId = changeAccessor.addDecoration(rng, FindDecorations._RANGE_HIGHLIGHT_DECORATION);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn matchPosition;\n\t}\n\n\tpublic set(findMatches: FindMatch[], findScopes: Range[] | null): void {\n\t\tthis._editor.changeDecorations((accessor) => {\n\n\t\t\tlet findMatchesOptions: ModelDecorationOptions = FindDecorations._FIND_MATCH_DECORATION;\n\t\t\tconst newOverviewRulerApproximateDecorations: IModelDeltaDecoration[] = [];\n\n\t\t\tif (findMatches.length > 1000) {\n\t\t\t\t// we go into a mode where the overview ruler gets \"approximate\" decorations\n\t\t\t\t// the reason is that the overview ruler paints all the decorations in the file and we don't want to cause freezes\n\t\t\t\tfindMatchesOptions = FindDecorations._FIND_MATCH_NO_OVERVIEW_DECORATION;\n\n\t\t\t\t// approximate a distance in lines where matches should be merged\n\t\t\t\tconst lineCount = this._editor.getModel().getLineCount();\n\t\t\t\tconst height = this._editor.getLayoutInfo().height;\n\t\t\t\tconst approxPixelsPerLine = height / lineCount;\n\t\t\t\tconst mergeLinesDelta = Math.max(2, Math.ceil(3 / approxPixelsPerLine));\n\n\t\t\t\t// merge decorations as much as possible\n\t\t\t\tlet prevStartLineNumber = findMatches[0].range.startLineNumber;\n\t\t\t\tlet prevEndLineNumber = findMatches[0].range.endLineNumber;\n\t\t\t\tfor (let i = 1, len = findMatches.length; i < len; i++) {\n\t\t\t\t\tconst range = findMatches[i].range;\n\t\t\t\t\tif (prevEndLineNumber + mergeLinesDelta >= range.startLineNumber) {\n\t\t\t\t\t\tif (range.endLineNumber > prevEndLineNumber) {\n\t\t\t\t\t\t\tprevEndLineNumber = range.endLineNumber;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnewOverviewRulerApproximateDecorations.push({\n\t\t\t\t\t\t\trange: new Range(prevStartLineNumber, 1, prevEndLineNumber, 1),\n\t\t\t\t\t\t\toptions: FindDecorations._FIND_MATCH_ONLY_OVERVIEW_DECORATION\n\t\t\t\t\t\t});\n\t\t\t\t\t\tprevStartLineNumber = range.startLineNumber;\n\t\t\t\t\t\tprevEndLineNumber = range.endLineNumber;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tnewOverviewRulerApproximateDecorations.push({\n\t\t\t\t\trange: new Range(prevStartLineNumber, 1, prevEndLineNumber, 1),\n\t\t\t\t\toptions: FindDecorations._FIND_MATCH_ONLY_OVERVIEW_DECORATION\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Find matches\n\t\t\tconst newFindMatchesDecorations: IModelDeltaDecoration[] = new Array<IModelDeltaDecoration>(findMatches.length);\n\t\t\tfor (let i = 0, len = findMatches.length; i < len; i++) {\n\t\t\t\tnewFindMatchesDecorations[i] = {\n\t\t\t\t\trange: findMatches[i].range,\n\t\t\t\t\toptions: findMatchesOptions\n\t\t\t\t};\n\t\t\t}\n\t\t\tthis._decorations = accessor.deltaDecorations(this._decorations, newFindMatchesDecorations);\n\n\t\t\t// Overview ruler approximate decorations\n\t\t\tthis._overviewRulerApproximateDecorations = accessor.deltaDecorations(this._overviewRulerApproximateDecorations, newOverviewRulerApproximateDecorations);\n\n\t\t\t// Range highlight\n\t\t\tif (this._rangeHighlightDecorationId) {\n\t\t\t\taccessor.removeDecoration(this._rangeHighlightDecorationId);\n\t\t\t\tthis._rangeHighlightDecorationId = null;\n\t\t\t}\n\n\t\t\t// Find scope\n\t\t\tif (this._findScopeDecorationIds.length) {\n\t\t\t\tthis._findScopeDecorationIds.forEach(findScopeDecorationId => accessor.removeDecoration(findScopeDecorationId));\n\t\t\t\tthis._findScopeDecorationIds = [];\n\t\t\t}\n\t\t\tif (findScopes?.length) {\n\t\t\t\tthis._findScopeDecorationIds = findScopes.map(findScope => accessor.addDecoration(findScope, FindDecorations._FIND_SCOPE_DECORATION));\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic matchBeforePosition(position: Position): Range | null {\n\t\tif (this._decorations.length === 0) {\n\t\t\treturn null;\n\t\t}\n\t\tfor (let i = this._decorations.length - 1; i >= 0; i--) {\n\t\t\tconst decorationId = this._decorations[i];\n\t\t\tconst r = this._editor.getModel().getDecorationRange(decorationId);\n\t\t\tif (!r || r.endLineNumber > position.lineNumber) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (r.endLineNumber < position.lineNumber) {\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tif (r.endColumn > position.column) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn r;\n\t\t}\n\n\t\treturn this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length - 1]);\n\t}\n\n\tpublic matchAfterPosition(position: Position): Range | null {\n\t\tif (this._decorations.length === 0) {\n\t\t\treturn null;\n\t\t}\n\t\tfor (let i = 0, len = this._decorations.length; i < len; i++) {\n\t\t\tconst decorationId = this._decorations[i];\n\t\t\tconst r = this._editor.getModel().getDecorationRange(decorationId);\n\t\t\tif (!r || r.startLineNumber < position.lineNumber) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (r.startLineNumber > position.lineNumber) {\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tif (r.startColumn < position.column) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn r;\n\t\t}\n\n\t\treturn this._editor.getModel().getDecorationRange(this._decorations[0]);\n\t}\n\n\tprivate _allDecorations(): string[] {\n\t\tlet result: string[] = [];\n\t\tresult = result.concat(this._decorations);\n\t\tresult = result.concat(this._overviewRulerApproximateDecorations);\n\t\tif (this._findScopeDecorationIds.length) {\n\t\t\tresult.push(...this._findScopeDecorationIds);\n\t\t}\n\t\tif (this._rangeHighlightDecorationId) {\n\t\t\tresult.push(this._rangeHighlightDecorationId);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static readonly _CURRENT_FIND_MATCH_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'current-find-match',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tzIndex: 13,\n\t\tclassName: 'currentFindMatch',\n\t\tinlineClassName: 'currentFindMatchInline',\n\t\tshowIfCollapsed: true,\n\t\toverviewRuler: {\n\t\t\tcolor: themeColorFromId(overviewRulerFindMatchForeground),\n\t\t\tposition: OverviewRulerLane.Center\n\t\t},\n\t\tminimap: {\n\t\t\tcolor: themeColorFromId(minimapFindMatch),\n\t\t\tposition: MinimapPosition.Inline\n\t\t}\n\t});\n\n\tpublic static readonly _FIND_MATCH_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-match',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tzIndex: 10,\n\t\tclassName: 'findMatch',\n\t\tinlineClassName: 'findMatchInline',\n\t\tshowIfCollapsed: true,\n\t\toverviewRuler: {\n\t\t\tcolor: themeColorFromId(overviewRulerFindMatchForeground),\n\t\t\tposition: OverviewRulerLane.Center\n\t\t},\n\t\tminimap: {\n\t\t\tcolor: themeColorFromId(minimapFindMatch),\n\t\t\tposition: MinimapPosition.Inline\n\t\t}\n\t});\n\n\tpublic static readonly _FIND_MATCH_NO_OVERVIEW_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-match-no-overview',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tclassName: 'findMatch',\n\t\tshowIfCollapsed: true\n\t});\n\n\tprivate static readonly _FIND_MATCH_ONLY_OVERVIEW_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-match-only-overview',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\toverviewRuler: {\n\t\t\tcolor: themeColorFromId(overviewRulerFindMatchForeground),\n\t\t\tposition: OverviewRulerLane.Center\n\t\t}\n\t});\n\n\tprivate static readonly _RANGE_HIGHLIGHT_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-range-highlight',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tclassName: 'rangeHighlight',\n\t\tisWholeLine: true\n\t});\n\n\tprivate static readonly _FIND_SCOPE_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-scope',\n\t\tclassName: 'findScope',\n\t\tisWholeLine: true\n\t});\n}\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/find/browser/findDecorations.ts","vs/editor/contrib/find/browser/findDecorations.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAKhG,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAsF,iBAAiB,EAA0B,MAAM,0BAA0B,CAAC;AACzK,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC;AAC5E,OAAO,EAAE,gBAAgB,EAAE,gCAAgC,EAAE,MAAM,oDAAoD,CAAC;AACxH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mDAAmD,CAAC;AAErF,MAAM,OAAO,eAAe;IAU3B,YAAY,MAAyB;QACpC,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,oCAAoC,GAAG,EAAE,CAAC;QAC/C,IAAI,CAAC,uBAAuB,GAAG,EAAE,CAAC;QAClC,IAAI,CAAC,2BAA2B,GAAG,IAAI,CAAC;QACxC,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC;QACrC,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAClD,CAAC;IAEM,OAAO;QACb,IAAI,CAAC,OAAO,CAAC,iBAAiB,CAAC,IAAI,CAAC,eAAe,EAAE,CAAC,CAAC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gB,CAAC,gCAAgC,CAAC;YACzD,QAAQ,EAAE,iBAAiB,CAAC,MAAM;SAClC;KACD,CAAC,CAAC;aAEqB,gCAA2B,GAAG,sBAAsB,CAAC,QAAQ,CAAC;QACrF,WAAW,EAAE,sBAAsB;QACnC,UAAU,4DAAoD;QAC9D,SAAS,EAAE,gBAAgB;QAC3B,WAAW,EAAE,IAAI;KACjB,CAAC,CAAC;aAEqB,2BAAsB,GAAG,sBAAsB,CAAC,QAAQ,CAAC;QAChF,WAAW,EAAE,YAAY;QACzB,SAAS,EAAE,WAAW;QACtB,WAAW,EAAE,IAAI;KACjB,CAAC,CAAC","file":"findDecorations.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 { IDisposable } from '../../../../base/common/lifecycle.js';\nimport { IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { FindMatch, IModelDecorationsChangeAccessor, IModelDeltaDecoration, MinimapPosition, OverviewRulerLane, TrackedRangeStickiness } from '../../../common/model.js';\nimport { ModelDecorationOptions } from '../../../common/model/textModel.js';\nimport { minimapFindMatch, overviewRulerFindMatchForeground } from '../../../../platform/theme/common/colorRegistry.js';\nimport { themeColorFromId } from '../../../../platform/theme/common/themeService.js';\n\nexport class FindDecorations implements IDisposable {\n\n\tprivate readonly _editor: IActiveCodeEditor;\n\tprivate _decorations: string[];\n\tprivate _overviewRulerApproximateDecorations: string[];\n\tprivate _findScopeDecorationIds: string[];\n\tprivate _rangeHighlightDecorationId: string | null;\n\tprivate _highlightedDecorationId: string | null;\n\tprivate _startPosition: Position;\n\n\tconstructor(editor: IActiveCodeEditor) {\n\t\tthis._editor = editor;\n\t\tthis._decorations = [];\n\t\tthis._overviewRulerApproximateDecorations = [];\n\t\tthis._findScopeDecorationIds = [];\n\t\tthis._rangeHighlightDecorationId = null;\n\t\tthis._highlightedDecorationId = null;\n\t\tthis._startPosition = this._editor.getPosition();\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._editor.removeDecorations(this._allDecorations());\n\n\t\tthis._decorations = [];\n\t\tthis._overviewRulerApproximateDecorations = [];\n\t\tthis._findScopeDecorationIds = [];\n\t\tthis._rangeHighlightDecorationId = null;\n\t\tthis._highlightedDecorationId = null;\n\t}\n\n\tpublic reset(): void {\n\t\tthis._decorations = [];\n\t\tthis._overviewRulerApproximateDecorations = [];\n\t\tthis._findScopeDecorationIds = [];\n\t\tthis._rangeHighlightDecorationId = null;\n\t\tthis._highlightedDecorationId = null;\n\t}\n\n\tpublic getCount(): number {\n\t\treturn this._decorations.length;\n\t}\n\n\t/** @deprecated use getFindScopes to support multiple selections */\n\tpublic getFindScope(): Range | null {\n\t\tif (this._findScopeDecorationIds[0]) {\n\t\t\treturn this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]);\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic getFindScopes(): Range[] | null {\n\t\tif (this._findScopeDecorationIds.length) {\n\t\t\tconst scopes = this._findScopeDecorationIds.map(findScopeDecorationId =>\n\t\t\t\tthis._editor.getModel().getDecorationRange(findScopeDecorationId)\n\t\t\t).filter(element => !!element);\n\t\t\tif (scopes.length) {\n\t\t\t\treturn scopes;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic getStartPosition(): Position {\n\t\treturn this._startPosition;\n\t}\n\n\tpublic setStartPosition(newStartPosition: Position): void {\n\t\tthis._startPosition = newStartPosition;\n\t\tthis.setCurrentFindMatch(null);\n\t}\n\n\tprivate _getDecorationIndex(decorationId: string): number {\n\t\tconst index = this._decorations.indexOf(decorationId);\n\t\tif (index >= 0) {\n\t\t\treturn index + 1;\n\t\t}\n\t\treturn 1;\n\t}\n\n\tpublic getDecorationRangeAt(index: number): Range | null {\n\t\tconst decorationId = index < this._decorations.length ? this._decorations[index] : null;\n\t\tif (decorationId) {\n\t\t\treturn this._editor.getModel().getDecorationRange(decorationId);\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic getCurrentMatchesPosition(desiredRange: Range): number {\n\t\tconst candidates = this._editor.getModel().getDecorationsInRange(desiredRange);\n\t\tfor (const candidate of candidates) {\n\t\t\tconst candidateOpts = candidate.options;\n\t\t\tif (candidateOpts === FindDecorations._FIND_MATCH_DECORATION || candidateOpts === FindDecorations._CURRENT_FIND_MATCH_DECORATION) {\n\t\t\t\treturn this._getDecorationIndex(candidate.id);\n\t\t\t}\n\t\t}\n\t\t// We don't know the current match position, so returns zero to show '?' in find widget\n\t\treturn 0;\n\t}\n\n\tpublic setCurrentFindMatch(nextMatch: Range | null): number {\n\t\tlet newCurrentDecorationId: string | null = null;\n\t\tlet matchPosition = 0;\n\t\tif (nextMatch) {\n\t\t\tfor (let i = 0, len = this._decorations.length; i < len; i++) {\n\t\t\t\tconst range = this._editor.getModel().getDecorationRange(this._decorations[i]);\n\t\t\t\tif (nextMatch.equalsRange(range)) {\n\t\t\t\t\tnewCurrentDecorationId = this._decorations[i];\n\t\t\t\t\tmatchPosition = (i + 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (this._highlightedDecorationId !== null || newCurrentDecorationId !== null) {\n\t\t\tthis._editor.changeDecorations((changeAccessor: IModelDecorationsChangeAccessor) => {\n\t\t\t\tif (this._highlightedDecorationId !== null) {\n\t\t\t\t\tchangeAccessor.changeDecorationOptions(this._highlightedDecorationId, FindDecorations._FIND_MATCH_DECORATION);\n\t\t\t\t\tthis._highlightedDecorationId = null;\n\t\t\t\t}\n\t\t\t\tif (newCurrentDecorationId !== null) {\n\t\t\t\t\tthis._highlightedDecorationId = newCurrentDecorationId;\n\t\t\t\t\tchangeAccessor.changeDecorationOptions(this._highlightedDecorationId, FindDecorations._CURRENT_FIND_MATCH_DECORATION);\n\t\t\t\t}\n\t\t\t\tif (this._rangeHighlightDecorationId !== null) {\n\t\t\t\t\tchangeAccessor.removeDecoration(this._rangeHighlightDecorationId);\n\t\t\t\t\tthis._rangeHighlightDecorationId = null;\n\t\t\t\t}\n\t\t\t\tif (newCurrentDecorationId !== null) {\n\t\t\t\t\tlet rng = this._editor.getModel().getDecorationRange(newCurrentDecorationId)!;\n\t\t\t\t\tif (rng.startLineNumber !== rng.endLineNumber && rng.endColumn === 1) {\n\t\t\t\t\t\tconst lineBeforeEnd = rng.endLineNumber - 1;\n\t\t\t\t\t\tconst lineBeforeEndMaxColumn = this._editor.getModel().getLineMaxColumn(lineBeforeEnd);\n\t\t\t\t\t\trng = new Range(rng.startLineNumber, rng.startColumn, lineBeforeEnd, lineBeforeEndMaxColumn);\n\t\t\t\t\t}\n\t\t\t\t\tthis._rangeHighlightDecorationId = changeAccessor.addDecoration(rng, FindDecorations._RANGE_HIGHLIGHT_DECORATION);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn matchPosition;\n\t}\n\n\tpublic set(findMatches: FindMatch[], findScopes: Range[] | null): void {\n\t\tthis._editor.changeDecorations((accessor) => {\n\n\t\t\tlet findMatchesOptions: ModelDecorationOptions = FindDecorations._FIND_MATCH_DECORATION;\n\t\t\tconst newOverviewRulerApproximateDecorations: IModelDeltaDecoration[] = [];\n\n\t\t\tif (findMatches.length > 1000) {\n\t\t\t\t// we go into a mode where the overview ruler gets \"approximate\" decorations\n\t\t\t\t// the reason is that the overview ruler paints all the decorations in the file and we don't want to cause freezes\n\t\t\t\tfindMatchesOptions = FindDecorations._FIND_MATCH_NO_OVERVIEW_DECORATION;\n\n\t\t\t\t// approximate a distance in lines where matches should be merged\n\t\t\t\tconst lineCount = this._editor.getModel().getLineCount();\n\t\t\t\tconst height = this._editor.getLayoutInfo().height;\n\t\t\t\tconst approxPixelsPerLine = height / lineCount;\n\t\t\t\tconst mergeLinesDelta = Math.max(2, Math.ceil(3 / approxPixelsPerLine));\n\n\t\t\t\t// merge decorations as much as possible\n\t\t\t\tlet prevStartLineNumber = findMatches[0].range.startLineNumber;\n\t\t\t\tlet prevEndLineNumber = findMatches[0].range.endLineNumber;\n\t\t\t\tfor (let i = 1, len = findMatches.length; i < len; i++) {\n\t\t\t\t\tconst range = findMatches[i].range;\n\t\t\t\t\tif (prevEndLineNumber + mergeLinesDelta >= range.startLineNumber) {\n\t\t\t\t\t\tif (range.endLineNumber > prevEndLineNumber) {\n\t\t\t\t\t\t\tprevEndLineNumber = range.endLineNumber;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnewOverviewRulerApproximateDecorations.push({\n\t\t\t\t\t\t\trange: new Range(prevStartLineNumber, 1, prevEndLineNumber, 1),\n\t\t\t\t\t\t\toptions: FindDecorations._FIND_MATCH_ONLY_OVERVIEW_DECORATION\n\t\t\t\t\t\t});\n\t\t\t\t\t\tprevStartLineNumber = range.startLineNumber;\n\t\t\t\t\t\tprevEndLineNumber = range.endLineNumber;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tnewOverviewRulerApproximateDecorations.push({\n\t\t\t\t\trange: new Range(prevStartLineNumber, 1, prevEndLineNumber, 1),\n\t\t\t\t\toptions: FindDecorations._FIND_MATCH_ONLY_OVERVIEW_DECORATION\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Find matches\n\t\t\tconst newFindMatchesDecorations: IModelDeltaDecoration[] = new Array<IModelDeltaDecoration>(findMatches.length);\n\t\t\tfor (let i = 0, len = findMatches.length; i < len; i++) {\n\t\t\t\tnewFindMatchesDecorations[i] = {\n\t\t\t\t\trange: findMatches[i].range,\n\t\t\t\t\toptions: findMatchesOptions\n\t\t\t\t};\n\t\t\t}\n\t\t\tthis._decorations = accessor.deltaDecorations(this._decorations, newFindMatchesDecorations);\n\n\t\t\t// Overview ruler approximate decorations\n\t\t\tthis._overviewRulerApproximateDecorations = accessor.deltaDecorations(this._overviewRulerApproximateDecorations, newOverviewRulerApproximateDecorations);\n\n\t\t\t// Range highlight\n\t\t\tif (this._rangeHighlightDecorationId) {\n\t\t\t\taccessor.removeDecoration(this._rangeHighlightDecorationId);\n\t\t\t\tthis._rangeHighlightDecorationId = null;\n\t\t\t}\n\n\t\t\t// Find scope\n\t\t\tif (this._findScopeDecorationIds.length) {\n\t\t\t\tthis._findScopeDecorationIds.forEach(findScopeDecorationId => accessor.removeDecoration(findScopeDecorationId));\n\t\t\t\tthis._findScopeDecorationIds = [];\n\t\t\t}\n\t\t\tif (findScopes?.length) {\n\t\t\t\tthis._findScopeDecorationIds = findScopes.map(findScope => accessor.addDecoration(findScope, FindDecorations._FIND_SCOPE_DECORATION));\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic matchBeforePosition(position: Position): Range | null {\n\t\tif (this._decorations.length === 0) {\n\t\t\treturn null;\n\t\t}\n\t\tfor (let i = this._decorations.length - 1; i >= 0; i--) {\n\t\t\tconst decorationId = this._decorations[i];\n\t\t\tconst r = this._editor.getModel().getDecorationRange(decorationId);\n\t\t\tif (!r || r.endLineNumber > position.lineNumber) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (r.endLineNumber < position.lineNumber) {\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tif (r.endColumn > position.column) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn r;\n\t\t}\n\n\t\treturn this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length - 1]);\n\t}\n\n\tpublic matchAfterPosition(position: Position): Range | null {\n\t\tif (this._decorations.length === 0) {\n\t\t\treturn null;\n\t\t}\n\t\tfor (let i = 0, len = this._decorations.length; i < len; i++) {\n\t\t\tconst decorationId = this._decorations[i];\n\t\t\tconst r = this._editor.getModel().getDecorationRange(decorationId);\n\t\t\tif (!r || r.startLineNumber < position.lineNumber) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (r.startLineNumber > position.lineNumber) {\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tif (r.startColumn < position.column) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn r;\n\t\t}\n\n\t\treturn this._editor.getModel().getDecorationRange(this._decorations[0]);\n\t}\n\n\tprivate _allDecorations(): string[] {\n\t\tlet result: string[] = [];\n\t\tresult = result.concat(this._decorations);\n\t\tresult = result.concat(this._overviewRulerApproximateDecorations);\n\t\tif (this._findScopeDecorationIds.length) {\n\t\t\tresult.push(...this._findScopeDecorationIds);\n\t\t}\n\t\tif (this._rangeHighlightDecorationId) {\n\t\t\tresult.push(this._rangeHighlightDecorationId);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static readonly _CURRENT_FIND_MATCH_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'current-find-match',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tzIndex: 13,\n\t\tclassName: 'currentFindMatch',\n\t\tinlineClassName: 'currentFindMatchInline',\n\t\tshowIfCollapsed: true,\n\t\toverviewRuler: {\n\t\t\tcolor: themeColorFromId(overviewRulerFindMatchForeground),\n\t\t\tposition: OverviewRulerLane.Center\n\t\t},\n\t\tminimap: {\n\t\t\tcolor: themeColorFromId(minimapFindMatch),\n\t\t\tposition: MinimapPosition.Inline\n\t\t}\n\t});\n\n\tpublic static readonly _FIND_MATCH_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-match',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tzIndex: 10,\n\t\tclassName: 'findMatch',\n\t\tinlineClassName: 'findMatchInline',\n\t\tshowIfCollapsed: true,\n\t\toverviewRuler: {\n\t\t\tcolor: themeColorFromId(overviewRulerFindMatchForeground),\n\t\t\tposition: OverviewRulerLane.Center\n\t\t},\n\t\tminimap: {\n\t\t\tcolor: themeColorFromId(minimapFindMatch),\n\t\t\tposition: MinimapPosition.Inline\n\t\t}\n\t});\n\n\tpublic static readonly _FIND_MATCH_NO_OVERVIEW_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-match-no-overview',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tclassName: 'findMatch',\n\t\tshowIfCollapsed: true\n\t});\n\n\tprivate static readonly _FIND_MATCH_ONLY_OVERVIEW_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-match-only-overview',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\toverviewRuler: {\n\t\t\tcolor: themeColorFromId(overviewRulerFindMatchForeground),\n\t\t\tposition: OverviewRulerLane.Center\n\t\t}\n\t});\n\n\tprivate static readonly _RANGE_HIGHLIGHT_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-range-highlight',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tclassName: 'rangeHighlight',\n\t\tisWholeLine: true\n\t});\n\n\tprivate static readonly _FIND_SCOPE_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-scope',\n\t\tclassName: 'findScope',\n\t\tisWholeLine: true\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 { IDisposable } from '../../../../base/common/lifecycle.js';\nimport { IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { FindMatch, IModelDecorationsChangeAccessor, IModelDeltaDecoration, MinimapPosition, OverviewRulerLane, TrackedRangeStickiness } from '../../../common/model.js';\nimport { ModelDecorationOptions } from '../../../common/model/textModel.js';\nimport { minimapFindMatch, overviewRulerFindMatchForeground } from '../../../../platform/theme/common/colorRegistry.js';\nimport { themeColorFromId } from '../../../../platform/theme/common/themeService.js';\n\nexport class FindDecorations implements IDisposable {\n\n\tprivate readonly _editor: IActiveCodeEditor;\n\tprivate _decorations: string[];\n\tprivate _overviewRulerApproximateDecorations: string[];\n\tprivate _findScopeDecorationIds: string[];\n\tprivate _rangeHighlightDecorationId: string | null;\n\tprivate _highlightedDecorationId: string | null;\n\tprivate _startPosition: Position;\n\n\tconstructor(editor: IActiveCodeEditor) {\n\t\tthis._editor = editor;\n\t\tthis._decorations = [];\n\t\tthis._overviewRulerApproximateDecorations = [];\n\t\tthis._findScopeDecorationIds = [];\n\t\tthis._rangeHighlightDecorationId = null;\n\t\tthis._highlightedDecorationId = null;\n\t\tthis._startPosition = this._editor.getPosition();\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._editor.removeDecorations(this._allDecorations());\n\n\t\tthis._decorations = [];\n\t\tthis._overviewRulerApproximateDecorations = [];\n\t\tthis._findScopeDecorationIds = [];\n\t\tthis._rangeHighlightDecorationId = null;\n\t\tthis._highlightedDecorationId = null;\n\t}\n\n\tpublic reset(): void {\n\t\tthis._decorations = [];\n\t\tthis._overviewRulerApproximateDecorations = [];\n\t\tthis._findScopeDecorationIds = [];\n\t\tthis._rangeHighlightDecorationId = null;\n\t\tthis._highlightedDecorationId = null;\n\t}\n\n\tpublic getCount(): number {\n\t\treturn this._decorations.length;\n\t}\n\n\t/** @deprecated use getFindScopes to support multiple selections */\n\tpublic getFindScope(): Range | null {\n\t\tif (this._findScopeDecorationIds[0]) {\n\t\t\treturn this._editor.getModel().getDecorationRange(this._findScopeDecorationIds[0]);\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic getFindScopes(): Range[] | null {\n\t\tif (this._findScopeDecorationIds.length) {\n\t\t\tconst scopes = this._findScopeDecorationIds.map(findScopeDecorationId =>\n\t\t\t\tthis._editor.getModel().getDecorationRange(findScopeDecorationId)\n\t\t\t).filter(element => !!element);\n\t\t\tif (scopes.length) {\n\t\t\t\treturn scopes;\n\t\t\t}\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic getStartPosition(): Position {\n\t\treturn this._startPosition;\n\t}\n\n\tpublic setStartPosition(newStartPosition: Position): void {\n\t\tthis._startPosition = newStartPosition;\n\t\tthis.setCurrentFindMatch(null);\n\t}\n\n\tprivate _getDecorationIndex(decorationId: string): number {\n\t\tconst index = this._decorations.indexOf(decorationId);\n\t\tif (index >= 0) {\n\t\t\treturn index + 1;\n\t\t}\n\t\treturn 1;\n\t}\n\n\tpublic getDecorationRangeAt(index: number): Range | null {\n\t\tconst decorationId = index < this._decorations.length ? this._decorations[index] : null;\n\t\tif (decorationId) {\n\t\t\treturn this._editor.getModel().getDecorationRange(decorationId);\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic getCurrentMatchesPosition(desiredRange: Range): number {\n\t\tconst candidates = this._editor.getModel().getDecorationsInRange(desiredRange);\n\t\tfor (const candidate of candidates) {\n\t\t\tconst candidateOpts = candidate.options;\n\t\t\tif (candidateOpts === FindDecorations._FIND_MATCH_DECORATION || candidateOpts === FindDecorations._CURRENT_FIND_MATCH_DECORATION) {\n\t\t\t\treturn this._getDecorationIndex(candidate.id);\n\t\t\t}\n\t\t}\n\t\t// We don't know the current match position, so returns zero to show '?' in find widget\n\t\treturn 0;\n\t}\n\n\tpublic setCurrentFindMatch(nextMatch: Range | null): number {\n\t\tlet newCurrentDecorationId: string | null = null;\n\t\tlet matchPosition = 0;\n\t\tif (nextMatch) {\n\t\t\tfor (let i = 0, len = this._decorations.length; i < len; i++) {\n\t\t\t\tconst range = this._editor.getModel().getDecorationRange(this._decorations[i]);\n\t\t\t\tif (nextMatch.equalsRange(range)) {\n\t\t\t\t\tnewCurrentDecorationId = this._decorations[i];\n\t\t\t\t\tmatchPosition = (i + 1);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (this._highlightedDecorationId !== null || newCurrentDecorationId !== null) {\n\t\t\tthis._editor.changeDecorations((changeAccessor: IModelDecorationsChangeAccessor) => {\n\t\t\t\tif (this._highlightedDecorationId !== null) {\n\t\t\t\t\tchangeAccessor.changeDecorationOptions(this._highlightedDecorationId, FindDecorations._FIND_MATCH_DECORATION);\n\t\t\t\t\tthis._highlightedDecorationId = null;\n\t\t\t\t}\n\t\t\t\tif (newCurrentDecorationId !== null) {\n\t\t\t\t\tthis._highlightedDecorationId = newCurrentDecorationId;\n\t\t\t\t\tchangeAccessor.changeDecorationOptions(this._highlightedDecorationId, FindDecorations._CURRENT_FIND_MATCH_DECORATION);\n\t\t\t\t}\n\t\t\t\tif (this._rangeHighlightDecorationId !== null) {\n\t\t\t\t\tchangeAccessor.removeDecoration(this._rangeHighlightDecorationId);\n\t\t\t\t\tthis._rangeHighlightDecorationId = null;\n\t\t\t\t}\n\t\t\t\tif (newCurrentDecorationId !== null) {\n\t\t\t\t\tlet rng = this._editor.getModel().getDecorationRange(newCurrentDecorationId)!;\n\t\t\t\t\tif (rng.startLineNumber !== rng.endLineNumber && rng.endColumn === 1) {\n\t\t\t\t\t\tconst lineBeforeEnd = rng.endLineNumber - 1;\n\t\t\t\t\t\tconst lineBeforeEndMaxColumn = this._editor.getModel().getLineMaxColumn(lineBeforeEnd);\n\t\t\t\t\t\trng = new Range(rng.startLineNumber, rng.startColumn, lineBeforeEnd, lineBeforeEndMaxColumn);\n\t\t\t\t\t}\n\t\t\t\t\tthis._rangeHighlightDecorationId = changeAccessor.addDecoration(rng, FindDecorations._RANGE_HIGHLIGHT_DECORATION);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\treturn matchPosition;\n\t}\n\n\tpublic set(findMatches: FindMatch[], findScopes: Range[] | null): void {\n\t\tthis._editor.changeDecorations((accessor) => {\n\n\t\t\tlet findMatchesOptions: ModelDecorationOptions = FindDecorations._FIND_MATCH_DECORATION;\n\t\t\tconst newOverviewRulerApproximateDecorations: IModelDeltaDecoration[] = [];\n\n\t\t\tif (findMatches.length > 1000) {\n\t\t\t\t// we go into a mode where the overview ruler gets \"approximate\" decorations\n\t\t\t\t// the reason is that the overview ruler paints all the decorations in the file and we don't want to cause freezes\n\t\t\t\tfindMatchesOptions = FindDecorations._FIND_MATCH_NO_OVERVIEW_DECORATION;\n\n\t\t\t\t// approximate a distance in lines where matches should be merged\n\t\t\t\tconst lineCount = this._editor.getModel().getLineCount();\n\t\t\t\tconst height = this._editor.getLayoutInfo().height;\n\t\t\t\tconst approxPixelsPerLine = height / lineCount;\n\t\t\t\tconst mergeLinesDelta = Math.max(2, Math.ceil(3 / approxPixelsPerLine));\n\n\t\t\t\t// merge decorations as much as possible\n\t\t\t\tlet prevStartLineNumber = findMatches[0].range.startLineNumber;\n\t\t\t\tlet prevEndLineNumber = findMatches[0].range.endLineNumber;\n\t\t\t\tfor (let i = 1, len = findMatches.length; i < len; i++) {\n\t\t\t\t\tconst range = findMatches[i].range;\n\t\t\t\t\tif (prevEndLineNumber + mergeLinesDelta >= range.startLineNumber) {\n\t\t\t\t\t\tif (range.endLineNumber > prevEndLineNumber) {\n\t\t\t\t\t\t\tprevEndLineNumber = range.endLineNumber;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tnewOverviewRulerApproximateDecorations.push({\n\t\t\t\t\t\t\trange: new Range(prevStartLineNumber, 1, prevEndLineNumber, 1),\n\t\t\t\t\t\t\toptions: FindDecorations._FIND_MATCH_ONLY_OVERVIEW_DECORATION\n\t\t\t\t\t\t});\n\t\t\t\t\t\tprevStartLineNumber = range.startLineNumber;\n\t\t\t\t\t\tprevEndLineNumber = range.endLineNumber;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tnewOverviewRulerApproximateDecorations.push({\n\t\t\t\t\trange: new Range(prevStartLineNumber, 1, prevEndLineNumber, 1),\n\t\t\t\t\toptions: FindDecorations._FIND_MATCH_ONLY_OVERVIEW_DECORATION\n\t\t\t\t});\n\t\t\t}\n\n\t\t\t// Find matches\n\t\t\tconst newFindMatchesDecorations: IModelDeltaDecoration[] = new Array<IModelDeltaDecoration>(findMatches.length);\n\t\t\tfor (let i = 0, len = findMatches.length; i < len; i++) {\n\t\t\t\tnewFindMatchesDecorations[i] = {\n\t\t\t\t\trange: findMatches[i].range,\n\t\t\t\t\toptions: findMatchesOptions\n\t\t\t\t};\n\t\t\t}\n\t\t\tthis._decorations = accessor.deltaDecorations(this._decorations, newFindMatchesDecorations);\n\n\t\t\t// Overview ruler approximate decorations\n\t\t\tthis._overviewRulerApproximateDecorations = accessor.deltaDecorations(this._overviewRulerApproximateDecorations, newOverviewRulerApproximateDecorations);\n\n\t\t\t// Range highlight\n\t\t\tif (this._rangeHighlightDecorationId) {\n\t\t\t\taccessor.removeDecoration(this._rangeHighlightDecorationId);\n\t\t\t\tthis._rangeHighlightDecorationId = null;\n\t\t\t}\n\n\t\t\t// Find scope\n\t\t\tif (this._findScopeDecorationIds.length) {\n\t\t\t\tthis._findScopeDecorationIds.forEach(findScopeDecorationId => accessor.removeDecoration(findScopeDecorationId));\n\t\t\t\tthis._findScopeDecorationIds = [];\n\t\t\t}\n\t\t\tif (findScopes?.length) {\n\t\t\t\tthis._findScopeDecorationIds = findScopes.map(findScope => accessor.addDecoration(findScope, FindDecorations._FIND_SCOPE_DECORATION));\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic matchBeforePosition(position: Position): Range | null {\n\t\tif (this._decorations.length === 0) {\n\t\t\treturn null;\n\t\t}\n\t\tfor (let i = this._decorations.length - 1; i >= 0; i--) {\n\t\t\tconst decorationId = this._decorations[i];\n\t\t\tconst r = this._editor.getModel().getDecorationRange(decorationId);\n\t\t\tif (!r || r.endLineNumber > position.lineNumber) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (r.endLineNumber < position.lineNumber) {\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tif (r.endColumn > position.column) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn r;\n\t\t}\n\n\t\treturn this._editor.getModel().getDecorationRange(this._decorations[this._decorations.length - 1]);\n\t}\n\n\tpublic matchAfterPosition(position: Position): Range | null {\n\t\tif (this._decorations.length === 0) {\n\t\t\treturn null;\n\t\t}\n\t\tfor (let i = 0, len = this._decorations.length; i < len; i++) {\n\t\t\tconst decorationId = this._decorations[i];\n\t\t\tconst r = this._editor.getModel().getDecorationRange(decorationId);\n\t\t\tif (!r || r.startLineNumber < position.lineNumber) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (r.startLineNumber > position.lineNumber) {\n\t\t\t\treturn r;\n\t\t\t}\n\t\t\tif (r.startColumn < position.column) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\treturn r;\n\t\t}\n\n\t\treturn this._editor.getModel().getDecorationRange(this._decorations[0]);\n\t}\n\n\tprivate _allDecorations(): string[] {\n\t\tlet result: string[] = [];\n\t\tresult = result.concat(this._decorations);\n\t\tresult = result.concat(this._overviewRulerApproximateDecorations);\n\t\tif (this._findScopeDecorationIds.length) {\n\t\t\tresult.push(...this._findScopeDecorationIds);\n\t\t}\n\t\tif (this._rangeHighlightDecorationId) {\n\t\t\tresult.push(this._rangeHighlightDecorationId);\n\t\t}\n\t\treturn result;\n\t}\n\n\tpublic static readonly _CURRENT_FIND_MATCH_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'current-find-match',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tzIndex: 13,\n\t\tclassName: 'currentFindMatch',\n\t\tinlineClassName: 'currentFindMatchInline',\n\t\tshowIfCollapsed: true,\n\t\toverviewRuler: {\n\t\t\tcolor: themeColorFromId(overviewRulerFindMatchForeground),\n\t\t\tposition: OverviewRulerLane.Center\n\t\t},\n\t\tminimap: {\n\t\t\tcolor: themeColorFromId(minimapFindMatch),\n\t\t\tposition: MinimapPosition.Inline\n\t\t}\n\t});\n\n\tpublic static readonly _FIND_MATCH_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-match',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tzIndex: 10,\n\t\tclassName: 'findMatch',\n\t\tinlineClassName: 'findMatchInline',\n\t\tshowIfCollapsed: true,\n\t\toverviewRuler: {\n\t\t\tcolor: themeColorFromId(overviewRulerFindMatchForeground),\n\t\t\tposition: OverviewRulerLane.Center\n\t\t},\n\t\tminimap: {\n\t\t\tcolor: themeColorFromId(minimapFindMatch),\n\t\t\tposition: MinimapPosition.Inline\n\t\t}\n\t});\n\n\tpublic static readonly _FIND_MATCH_NO_OVERVIEW_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-match-no-overview',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tclassName: 'findMatch',\n\t\tshowIfCollapsed: true\n\t});\n\n\tprivate static readonly _FIND_MATCH_ONLY_OVERVIEW_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-match-only-overview',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\toverviewRuler: {\n\t\t\tcolor: themeColorFromId(overviewRulerFindMatchForeground),\n\t\t\tposition: OverviewRulerLane.Center\n\t\t}\n\t});\n\n\tprivate static readonly _RANGE_HIGHLIGHT_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-range-highlight',\n\t\tstickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,\n\t\tclassName: 'rangeHighlight',\n\t\tisWholeLine: true\n\t});\n\n\tprivate static readonly _FIND_SCOPE_DECORATION = ModelDecorationOptions.register({\n\t\tdescription: 'find-scope',\n\t\tclassName: 'findScope',\n\t\tisWholeLine: true\n\t});\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/find/browser/findModel.ts","vs/editor/contrib/find/browser/findModel.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,sCAAsC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AAG,CAAC,EAAE,GAAG,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;YACvD,MAAM,GAAG,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;YAC1B,IAAI,GAAG,CAAC,WAAW,CAAC,eAAe,CAAC,EAAE,CAAC;gBACtC,UAAU,GAAG,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC9F,MAAM;YACP,CAAC;QACF,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAEO,qBAAqB,CAAC,MAAc,EAAE,OAAiB;QAC9D,IAAI,CAAC;YACJ,IAAI,CAAC,0BAA0B,GAAG,IAAI,CAAC;YACvC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;YAC5B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC7C,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QAC7B,CAAC;gBAAS,CAAC;YACV,IAAI,CAAC,0BAA0B,GAAG,KAAK,CAAC;QACzC,CAAC;IACF,CAAC;CACD","file":"findModel.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 { findFirstIdxMonotonousOrArrLen } from '../../../../base/common/arraysFind.js';\nimport { RunOnceScheduler, TimeoutTimer } from '../../../../base/common/async.js';\nimport { KeyCode, KeyMod } from '../../../../base/common/keyCodes.js';\nimport { DisposableStore, dispose } from '../../../../base/common/lifecycle.js';\nimport { Constants } from '../../../../base/common/uint.js';\nimport { IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { ReplaceCommand, ReplaceCommandThatPreservesSelection } from '../../../common/commands/replaceCommand.js';\nimport { EditorOption } from '../../../common/config/editorOptions.js';\nimport { CursorChangeReason, ICursorPositionChangedEvent } from '../../../common/cursorEvents.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { Selection } from '../../../common/core/selection.js';\nimport { ICommand, ScrollType } from '../../../common/editorCommon.js';\nimport { EndOfLinePreference, FindMatch, ITextModel } from '../../../common/model.js';\nimport { SearchParams } from '../../../common/model/textModelSearch.js';\nimport { FindDecorations } from './findDecorations.js';\nimport { FindReplaceState, FindReplaceStateChangedEvent } from './findState.js';\nimport { ReplaceAllCommand } from './replaceAllCommand.js';\nimport { parseReplaceString, ReplacePattern } from './replacePattern.js';\nimport { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';\nimport { IKeybindings } from '../../../../platform/keybinding/common/keybindingsRegistry.js';\n\nexport const CONTEXT_FIND_WIDGET_VISIBLE = new RawContextKey<boolean>('findWidgetVisible', false);\nexport const CONTEXT_FIND_WIDGET_NOT_VISIBLE = CONTEXT_FIND_WIDGET_VISIBLE.toNegated();\n// Keep ContextKey use of 'Focussed' to not break when clauses\nexport const CONTEXT_FIND_INPUT_FOCUSED = new RawContextKey<boolean>('findInputFocussed', false);\nexport const CONTEXT_REPLACE_INPUT_FOCUSED = new RawContextKey<boolean>('replaceInputFocussed', false);\n\nexport const ToggleCaseSensitiveKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyC,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyC }\n};\nexport const ToggleWholeWordKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyW,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyW }\n};\nexport const ToggleRegexKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyR,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyR }\n};\nexport const ToggleSearchScopeKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyL,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyL }\n};\nexport const TogglePreserveCaseKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyP,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyP }\n};\n\nexport const FIND_IDS = {\n\tStartFindAction: 'actions.find',\n\tStartFindWithSelection: 'actions.findWithSelection',\n\tStartFindWithArgs: 'editor.actions.findWithArgs',\n\tNextMatchFindAction: 'editor.action.nextMatchFindAction',\n\tPreviousMatchFindAction: 'editor.action.previousMatchFindAction',\n\tGoToMatchFindAction: 'editor.action.goToMatchFindAction',\n\tNextSelectionMatchFindAction: 'editor.action.nextSelectionMatchFindAction',\n\tPreviousSelectionMatchFindAction: 'editor.action.previousSelectionMatchFindAction',\n\tStartFindReplaceAction: 'editor.action.startFindReplaceAction',\n\tCloseFindWidgetCommand: 'closeFindWidget',\n\tToggleCaseSensitiveCommand: 'toggleFindCaseSensitive',\n\tToggleWholeWordCommand: 'toggleFindWholeWord',\n\tToggleRegexCommand: 'toggleFindRegex',\n\tToggleSearchScopeCommand: 'toggleFindInSelection',\n\tTogglePreserveCaseCommand: 'togglePreserveCase',\n\tReplaceOneAction: 'editor.action.replaceOne',\n\tReplaceAllAction: 'editor.action.replaceAll',\n\tSelectAllMatchesAction: 'editor.action.selectAllMatches'\n};\n\nexport const MATCHES_LIMIT = 19999;\nconst RESEARCH_DELAY = 240;\n\nexport class FindModelBoundToEditorModel {\n\n\tprivate readonly _editor: IActiveCodeEditor;\n\tprivate readonly _state: FindReplaceState;\n\tprivate readonly _toDispose = new DisposableStore();\n\tprivate readonly _decorations: FindDecorations;\n\tprivate _ignoreModelContentChanged: boolean;\n\tprivate readonly _startSearchingTimer: TimeoutTimer;\n\n\tprivate readonly _updateDecorationsScheduler: RunOnceScheduler;\n\tprivate _isDisposed: boolean;\n\n\tconstructor(editor: IActiveCodeEditor, state: FindReplaceState) {\n\t\tthis._editor = editor;\n\t\tthis._state = state;\n\t\tthis._isDisposed = false;\n\t\tthis._startSearchingTimer = new TimeoutTimer();\n\n\t\tthis._decorations = new FindDecorations(editor);\n\t\tthis._toDispose.add(this._decorations);\n\n\t\tthis._updateDecorationsScheduler = new RunOnceScheduler(() => {\n\t\t\tif (!this._editor.hasModel()) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn this.research(false);\n\t\t}, 100);\n\t\tthis._toDispose.add(this._updateDecorationsScheduler);\n\n\t\tthis._toDispose.add(this._editor.onDidChangeCursorPosition((e: ICursorPositionChangedEvent) => {\n\t\t\tif (\n\t\t\t\te.reason === CursorChangeReason.Explicit\n\t\t\t\t|| e.reason === CursorChangeReason.Undo\n\t\t\t\t|| e.reason === CursorChangeReason.Redo\n\t\t\t) {\n\t\t\t\tthis._decorations.setStartPosition(this._editor.getPosition());\n\t\t\t}\n\t\t}));\n\n\t\tthis._ignoreModelContentChanged = false;\n\t\tthis._toDispose.add(this._editor.onDidChangeModelContent((e) => {\n\t\t\tif (this._ignoreModelContentChanged) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (e.isFlush) {\n\t\t\t\t// a model.setValue() was called\n\t\t\t\tthis._decorations.reset();\n\t\t\t}\n\t\t\tthis._decorations.setStartPosition(this._editor.getPosition());\n\t\t\tthis._updateDecorationsScheduler.schedule();\n\t\t}));\n\n\t\tthis._toDispose.add(this._state.onFindReplaceStateChange((e) => this._onStateChanged(e)));\n\n\t\tthis.research(false, this._state.searchScope);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._isDisposed = true;\n\t\tdispose(this._startSearchingTimer);\n\t\tthis._toDispose.dispose();\n\t}\n\n\tprivate _onStateChanged(e: FindReplaceStateChangedEvent): void {\n\t\tif (this._isDisposed) {\n\t\t\t// The find model is disposed during a find state changed event\n\t\t\treturn;\n\t\t}\n\t\tif (!this._editor.hasModel()) {\n\t\t\t// The find model will be disposed momentarily\n\t\t\treturn;\n\t\t}\n\t\tif (e.searchString || e.isReplaceRevealed || e.isRegex || e.wholeWord || e.matchCase || e.searchScope) {\n\t\t\tconst model = this._editor.getModel();\n\n\t\t\tif (model.isTooLargeForSyncing()) {\n\t\t\t\tthis._startSearchingTimer.cancel();\n\n\t\t\t\tthis._startSearchingTimer.setIfNotSet(() => {\n\t\t\t\t\tif (e.searchScope) {\n\t\t\t\t\t\tthis.research(e.moveCursor, this._state.searchScope);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.research(e.moveCursor);\n\t\t\t\t\t}\n\t\t\t\t}, RESEARCH_DELAY);\n\t\t\t} else {\n\t\t\t\tif (e.searchScope) {\n\t\t\t\t\tthis.research(e.moveCursor, this._state.searchScope);\n\t\t\t\t} else {\n\t\t\t\t\tthis.research(e.moveCursor);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static _getSearchRange(model: ITextModel, findScope: Range | null): Range {\n\t\t// If we have set now or before a find scope, use it for computing the search range\n\t\tif (findScope) {\n\t\t\treturn findScope;\n\t\t}\n\n\t\treturn model.getFullModelRange();\n\t}\n\n\tprivate research(moveCursor: boolean, newFindScope?: Range | Range[] | null): void {\n\t\tlet findScopes: Range[] | null = null;\n\t\tif (typeof newFindScope !== 'undefined') {\n\t\t\tif (newFindScope !== null) {\n\t\t\t\tif (!Array.isArray(newFindScope)) {\n\t\t\t\t\tfindScopes = [newFindScope as Range];\n\t\t\t\t} else {\n\t\t\t\t\tfindScopes = newFindScope;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfindScopes = this._decorations.getFindScopes();\n\t\t}\n\t\tif (findScopes !== null) {\n\t\t\tfindScopes = findScopes.map(findScope => {\n\t\t\t\tif (findScope.startLineNumber !== findScope.endLineNumber) {\n\t\t\t\t\tlet endLineNumber = findScope.endLineNumber;\n\n\t\t\t\t\tif (findScope.endColumn === 1) {\n\t\t\t\t\t\tendLineNumber = endLineNumber - 1;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn new Range(findScope.startLineNumber, 1, endLineNumber, this._editor.getModel().getLineMaxColumn(endLineNumber));\n\t\t\t\t}\n\t\t\t\treturn findScope;\n\t\t\t});\n\t\t}\n\n\t\tconst findMatches = this._findMatches(findScopes, false, MATCHES_LIMIT);\n\t\tthis._decorations.set(findMatches, findScopes);\n\n\t\tconst editorSelection = this._editor.getSelection();\n\t\tlet currentMatchesPosition = this._decorations.getCurrentMatchesPosition(editorSelection);\n\t\tif (currentMatchesPosition === 0 && findMatches.length > 0) {\n\t\t\t// current selection is not on top of a match\n\t\t\t// try to find its nearest result from the top of the document\n\t\t\tconst matchAfterSelection = findFirstIdxMonotonousOrArrLen(findMatches.map(match => match.range), range => Range.compareRangesUsingStarts(range, editorSelection) >= 0);\n\t\t\tcurrentMatchesPosition = matchAfterSelection > 0 ? matchAfterSelection - 1 + 1 /** match position is one based */ : currentMatchesPosition;\n\t\t}\n\n\t\tthis._state.changeMatchInfo(\n\t\t\tcurrentMatchesPosition,\n\t\t\tthis._decorations.getCount(),\n\t\t\tundefined\n\t\t);\n\n\t\tif (moveCursor && this._editor.getOption(EditorOption.find).cursorMoveOnType) {\n\t\t\tthis._moveToNextMatch(this._decorations.getStartPosition());\n\t\t}\n\t}\n\n\tprivate _hasMatches(): boolean {\n\t\treturn (this._state.matchesCount > 0);\n\t}\n\n\tprivate _cannotFind(): boolean {\n\t\tif (!this._hasMatches()) {\n\t\t\tconst findScope = this._decorations.getFindScope();\n\t\t\tif (findScope) {\n\t\t\t\t// Reveal the selection so user is reminded that 'selection find' is on.\n\t\t\t\tthis._editor.revealRangeInCenterIfOutsideViewport(findScope, ScrollType.Smooth);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate _setCurrentFindMatch(match: Range): void {\n\t\tconst matchesPosition = this._decorations.setCurrentFindMatch(match);\n\t\tthis._state.changeMatchInfo(\n\t\t\tmatchesPosition,\n\t\t\tthis._decorations.getCount(),\n\t\t\tmatch\n\t\t);\n\n\t\tthis._editor.setSelection(match);\n\t\tthis._editor.revealRangeInCenterIfOutsideViewport(match, ScrollType.Smooth);\n\t}\n\n\tprivate _prevSearchPosition(before: Position) {\n\t\tconst isUsingLineStops = this._state.isRegex && (\n\t\t\tthis._state.searchString.indexOf('^') >= 0\n\t\t\t|| this._state.searchString.indexOf('$') >= 0\n\t\t);\n\t\tlet { lineNumber, column } = before;\n\t\tconst model = this._editor.getModel();\n\n\t\tif (isUsingLineStops || column === 1) {\n\t\t\tif (lineNumber === 1) {\n\t\t\t\tlineNumber = model.getLineCount();\n\t\t\t} else {\n\t\t\t\tlineNumber--;\n\t\t\t}\n\t\t\tcolumn = model.getLineMaxColumn(lineNumber);\n\t\t} else {\n\t\t\tcolumn--;\n\t\t}\n\n\t\treturn new Position(lineNumber, column);\n\t}\n\n\tprivate _moveToPrevMatch(before: Position, isRecursed: boolean = false): void {\n\t\tif (!this._state.canNavigateBack()) {\n\t\t\t// we are beyond the first matched find result\n\t\t\t// instead of doing nothing, we should refocus the first item\n\t\t\tconst nextMatchRange = this._decorations.matchAfterPosition(before);\n\n\t\t\tif (nextMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(nextMatchRange);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (this._decorations.getCount() < MATCHES_LIMIT) {\n\t\t\tlet prevMatchRange = this._decorations.matchBeforePosition(before);\n\n\t\t\tif (prevMatchRange && prevMatchRange.isEmpty() && prevMatchRange.getStartPosition().equals(before)) {\n\t\t\t\tbefore = this._prevSearchPosition(before);\n\t\t\t\tprevMatchRange = this._decorations.matchBeforePosition(before);\n\t\t\t}\n\n\t\t\tif (prevMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(prevMatchRange);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._cannotFind()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst findScope = this._decorations.getFindScope();\n\t\tconst searchRange = FindModelBoundToEditorModel._getSearchRange(this._editor.getModel(), findScope);\n\n\t\t// ...(----)...|...\n\t\tif (searchRange.getEndPosition().isBefore(before)) {\n\t\t\tbefore = searchRange.getEndPosition();\n\t\t}\n\n\t\t// ...|...(----)...\n\t\tif (before.isBefore(searchRange.getStartPosition())) {\n\t\t\tbefore = searchRange.getEndPosition();\n\t\t}\n\n\t\tconst { lineNumber, column } = before;\n\t\tconst model = this._editor.getModel();\n\n\t\tlet position = new Position(lineNumber, column);\n\n\t\tlet prevMatch = model.findPreviousMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false);\n\n\t\tif (prevMatch && prevMatch.range.isEmpty() && prevMatch.range.getStartPosition().equals(position)) {\n\t\t\t// Looks like we're stuck at this position, unacceptable!\n\t\t\tposition = this._prevSearchPosition(position);\n\t\t\tprevMatch = model.findPreviousMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false);\n\t\t}\n\n\t\tif (!prevMatch) {\n\t\t\t// there is precisely one match and selection is on top of it\n\t\t\treturn;\n\t\t}\n\n\t\tif (!isRecursed && !searchRange.containsRange(prevMatch.range)) {\n\t\t\treturn this._moveToPrevMatch(prevMatch.range.getStartPosition(), true);\n\t\t}\n\n\t\tthis._setCurrentFindMatch(prevMatch.range);\n\t}\n\n\tpublic moveToPrevMatch(): void {\n\t\tthis._moveToPrevMatch(this._editor.getSelection().getStartPosition());\n\t}\n\n\tprivate _nextSearchPosition(after: Position) {\n\t\tconst isUsingLineStops = this._state.isRegex && (\n\t\t\tthis._state.searchString.indexOf('^') >= 0\n\t\t\t|| this._state.searchString.indexOf('$') >= 0\n\t\t);\n\n\t\tlet { lineNumber, column } = after;\n\t\tconst model = this._editor.getModel();\n\n\t\tif (isUsingLineStops || column === model.getLineMaxColumn(lineNumber)) {\n\t\t\tif (lineNumber === model.getLineCount()) {\n\t\t\t\tlineNumber = 1;\n\t\t\t} else {\n\t\t\t\tlineNumber++;\n\t\t\t}\n\t\t\tcolumn = 1;\n\t\t} else {\n\t\t\tcolumn++;\n\t\t}\n\n\t\treturn new Position(lineNumber, column);\n\t}\n\n\tprivate _moveToNextMatch(after: Position): void {\n\t\tif (!this._state.canNavigateForward()) {\n\t\t\t// we are beyond the last matched find result\n\t\t\t// instead of doing nothing, we should refocus the last item\n\t\t\tconst prevMatchRange = this._decorations.matchBeforePosition(after);\n\n\t\t\tif (prevMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(prevMatchRange);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (this._decorations.getCount() < MATCHES_LIMIT) {\n\t\t\tlet nextMatchRange = this._decorations.matchAfterPosition(after);\n\n\t\t\tif (nextMatchRange && nextMatchRange.isEmpty() && nextMatchRange.getStartPosition().equals(after)) {\n\t\t\t\t// Looks like we're stuck at this position, unacceptable!\n\t\t\t\tafter = this._nextSearchPosition(after);\n\t\t\t\tnextMatchRange = this._decorations.matchAfterPosition(after);\n\t\t\t}\n\t\t\tif (nextMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(nextMatchRange);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst nextMatch = this._getNextMatch(after, false, true);\n\t\tif (nextMatch) {\n\t\t\tthis._setCurrentFindMatch(nextMatch.range);\n\t\t}\n\t}\n\n\tprivate _getNextMatch(after: Position, captureMatches: boolean, forceMove: boolean, isRecursed: boolean = false): FindMatch | null {\n\t\tif (this._cannotFind()) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst findScope = this._decorations.getFindScope();\n\t\tconst searchRange = FindModelBoundToEditorModel._getSearchRange(this._editor.getModel(), findScope);\n\n\t\t// ...(----)...|...\n\t\tif (searchRange.getEndPosition().isBefore(after)) {\n\t\t\tafter = searchRange.getStartPosition();\n\t\t}\n\n\t\t// ...|...(----)...\n\t\tif (after.isBefore(searchRange.getStartPosition())) {\n\t\t\tafter = searchRange.getStartPosition();\n\t\t}\n\n\t\tconst { lineNumber, column } = after;\n\t\tconst model = this._editor.getModel();\n\n\t\tlet position = new Position(lineNumber, column);\n\n\t\tlet nextMatch = model.findNextMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, captureMatches);\n\n\t\tif (forceMove && nextMatch && nextMatch.range.isEmpty() && nextMatch.range.getStartPosition().equals(position)) {\n\t\t\t// Looks like we're stuck at this position, unacceptable!\n\t\t\tposition = this._nextSearchPosition(position);\n\t\t\tnextMatch = model.findNextMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, captureMatches);\n\t\t}\n\n\t\tif (!nextMatch) {\n\t\t\t// there is precisely one match and selection is on top of it\n\t\t\treturn null;\n\t\t}\n\n\t\tif (!isRecursed && !searchRange.containsRange(nextMatch.range)) {\n\t\t\treturn this._getNextMatch(nextMatch.range.getEndPosition(), captureMatches, forceMove, true);\n\t\t}\n\n\t\treturn nextMatch;\n\t}\n\n\tpublic moveToNextMatch(): void {\n\t\tthis._moveToNextMatch(this._editor.getSelection().getEndPosition());\n\t}\n\n\tprivate _moveToMatch(index: number): void {\n\t\tconst decorationRange = this._decorations.getDecorationRangeAt(index);\n\t\tif (decorationRange) {\n\t\t\tthis._setCurrentFindMatch(decorationRange);\n\t\t}\n\t}\n\n\tpublic moveToMatch(index: number): void {\n\t\tthis._moveToMatch(index);\n\t}\n\n\tprivate _getReplacePattern(): ReplacePattern {\n\t\tif (this._state.isRegex) {\n\t\t\treturn parseReplaceString(this._state.replaceString);\n\t\t}\n\t\treturn ReplacePattern.fromStaticValue(this._state.replaceString);\n\t}\n\n\tpublic replace(): void {\n\t\tif (!this._hasMatches()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst replacePattern = this._getReplacePattern();\n\t\tconst selection = this._editor.getSelection();\n\t\tconst nextMatch = this._getNextMatch(selection.getStartPosition(), true, false);\n\t\tif (nextMatch) {\n\t\t\tif (selection.equalsRange(nextMatch.range)) {\n\t\t\t\t// selection sits on a find match => replace it!\n\t\t\t\tconst replaceString = replacePattern.buildReplaceString(nextMatch.matches, this._state.preserveCase);\n\n\t\t\t\tconst command = new ReplaceCommand(selection, replaceString);\n\n\t\t\t\tthis._executeEditorCommand('replace', command);\n\n\t\t\t\tthis._decorations.setStartPosition(new Position(selection.startLineNumber, selection.startColumn + replaceString.length));\n\t\t\t\tthis.research(true);\n\t\t\t} else {\n\t\t\t\tthis._decorations.setStartPosition(this._editor.getPosition());\n\t\t\t\tthis._setCurrentFindMatch(nextMatch.range);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _findMatches(findScopes: Range[] | null, captureMatches: boolean, limitResultCount: number): FindMatch[] {\n\t\tconst searchRanges = (findScopes as [] || [null]).map((scope: Range | null) =>\n\t\t\tFindModelBoundToEditorModel._getSearchRange(this._editor.getModel(), scope)\n\t\t);\n\n\t\treturn this._editor.getModel().findMatches(this._state.searchString, searchRanges, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, captureMatches, limitResultCount);\n\t}\n\n\tpublic replaceAll(): void {\n\t\tif (!this._hasMatches()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst findScopes = this._decorations.getFindScopes();\n\n\t\tif (findScopes === null && this._state.matchesCount >= MATCHES_LIMIT) {\n\t\t\t// Doing a replace on the entire file that is over ${MATCHES_LIMIT} matches\n\t\t\tthis._largeReplaceAll();\n\t\t} else {\n\t\t\tthis._regularReplaceAll(findScopes);\n\t\t}\n\n\t\tthis.research(false);\n\t}\n\n\tprivate _largeReplaceAll(): void {\n\t\tconst searchParams = new SearchParams(this._state.searchString, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null);\n\t\tconst searchData = searchParams.parseSearchRequest();\n\t\tif (!searchData) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet searchRegex = searchData.regex;\n\t\tif (!searchRegex.multiline) {\n\t\t\tlet mod = 'mu';\n\t\t\tif (searchRegex.ignoreCase) {\n\t\t\t\tmod += 'i';\n\t\t\t}\n\t\t\tif (searchRegex.global) {\n\t\t\t\tmod += 'g';\n\t\t\t}\n\t\t\tsearchRegex = new RegExp(searchRegex.source, mod);\n\t\t}\n\n\t\tconst model = this._editor.getModel();\n\t\tconst modelText = model.getValue(EndOfLinePreference.LF);\n\t\tconst fullModelRange = model.getFullModelRange();\n\n\t\tconst replacePattern = this._getReplacePattern();\n\t\tlet resultText: string;\n\t\tconst preserveCase = this._state.preserveCase;\n\n\t\tif (replacePattern.hasReplacementPatterns || preserveCase) {\n\t\t\tresultText = modelText.replace(searchRegex, function () {\n\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\treturn replacePattern.buildReplaceString(<string[]><any>arguments, preserveCase);\n\t\t\t});\n\t\t} else {\n\t\t\tresultText = modelText.replace(searchRegex, replacePattern.buildReplaceString(null, preserveCase));\n\t\t}\n\n\t\tconst command = new ReplaceCommandThatPreservesSelection(fullModelRange, resultText, this._editor.getSelection());\n\t\tthis._executeEditorCommand('replaceAll', command);\n\t}\n\n\tprivate _regularReplaceAll(findScopes: Range[] | null): void {\n\t\tconst replacePattern = this._getReplacePattern();\n\t\t// Get all the ranges (even more than the highlighted ones)\n\t\tconst matches = this._findMatches(findScopes, replacePattern.hasReplacementPatterns || this._state.preserveCase, Constants.MAX_SAFE_SMALL_INTEGER);\n\n\t\tconst replaceStrings: string[] = [];\n\t\tfor (let i = 0, len = matches.length; i < len; i++) {\n\t\t\treplaceStrings[i] = replacePattern.buildReplaceString(matches[i].matches, this._state.preserveCase);\n\t\t}\n\n\t\tconst command = new ReplaceAllCommand(this._editor.getSelection(), matches.map(m => m.range), replaceStrings);\n\t\tthis._executeEditorCommand('replaceAll', command);\n\t}\n\n\tpublic selectAllMatches(): void {\n\t\tif (!this._hasMatches()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst findScopes = this._decorations.getFindScopes();\n\n\t\t// Get all the ranges (even more than the highlighted ones)\n\t\tconst matches = this._findMatches(findScopes, false, Constants.MAX_SAFE_SMALL_INTEGER);\n\t\tlet selections = matches.map(m => new Selection(m.range.startLineNumber, m.range.startColumn, m.range.endLineNumber, m.range.endColumn));\n\n\t\t// If one of the ranges is the editor selection, then maintain it as primary\n\t\tconst editorSelection = this._editor.getSelection();\n\t\tfor (let i = 0, len = selections.length; i < len; i++) {\n\t\t\tconst sel = selections[i];\n\t\t\tif (sel.equalsRange(editorSelection)) {\n\t\t\t\tselections = [editorSelection].concat(selections.slice(0, i)).concat(selections.slice(i + 1));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tthis._editor.setSelections(selections);\n\t}\n\n\tprivate _executeEditorCommand(source: string, command: ICommand): void {\n\t\ttry {\n\t\t\tthis._ignoreModelContentChanged = true;\n\t\t\tthis._editor.pushUndoStop();\n\t\t\tthis._editor.executeCommand(source, command);\n\t\t\tthis._editor.pushUndoStop();\n\t\t} finally {\n\t\t\tthis._ignoreModelContentChanged = false;\n\t\t}\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 { findFirstIdxMonotonousOrArrLen } from '../../../../base/common/arraysFind.js';\nimport { RunOnceScheduler, TimeoutTimer } from '../../../../base/common/async.js';\nimport { KeyCode, KeyMod } from '../../../../base/common/keyCodes.js';\nimport { DisposableStore, dispose } from '../../../../base/common/lifecycle.js';\nimport { Constants } from '../../../../base/common/uint.js';\nimport { IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { ReplaceCommand, ReplaceCommandThatPreservesSelection } from '../../../common/commands/replaceCommand.js';\nimport { EditorOption } from '../../../common/config/editorOptions.js';\nimport { CursorChangeReason, ICursorPositionChangedEvent } from '../../../common/cursorEvents.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { Selection } from '../../../common/core/selection.js';\nimport { ICommand, ScrollType } from '../../../common/editorCommon.js';\nimport { EndOfLinePreference, FindMatch, ITextModel } from '../../../common/model.js';\nimport { SearchParams } from '../../../common/model/textModelSearch.js';\nimport { FindDecorations } from './findDecorations.js';\nimport { FindReplaceState, FindReplaceStateChangedEvent } from './findState.js';\nimport { ReplaceAllCommand } from './replaceAllCommand.js';\nimport { parseReplaceString, ReplacePattern } from './replacePattern.js';\nimport { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';\nimport { IKeybindings } from '../../../../platform/keybinding/common/keybindingsRegistry.js';\n\nexport const CONTEXT_FIND_WIDGET_VISIBLE = new RawContextKey<boolean>('findWidgetVisible', false);\nexport const CONTEXT_FIND_WIDGET_NOT_VISIBLE = CONTEXT_FIND_WIDGET_VISIBLE.toNegated();\n// Keep ContextKey use of 'Focussed' to not break when clauses\nexport const CONTEXT_FIND_INPUT_FOCUSED = new RawContextKey<boolean>('findInputFocussed', false);\nexport const CONTEXT_REPLACE_INPUT_FOCUSED = new RawContextKey<boolean>('replaceInputFocussed', false);\n\nexport const ToggleCaseSensitiveKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyC,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyC }\n};\nexport const ToggleWholeWordKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyW,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyW }\n};\nexport const ToggleRegexKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyR,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyR }\n};\nexport const ToggleSearchScopeKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyL,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyL }\n};\nexport const TogglePreserveCaseKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyP,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyP }\n};\n\nexport const FIND_IDS = {\n\tStartFindAction: 'actions.find',\n\tStartFindWithSelection: 'actions.findWithSelection',\n\tStartFindWithArgs: 'editor.actions.findWithArgs',\n\tNextMatchFindAction: 'editor.action.nextMatchFindAction',\n\tPreviousMatchFindAction: 'editor.action.previousMatchFindAction',\n\tGoToMatchFindAction: 'editor.action.goToMatchFindAction',\n\tNextSelectionMatchFindAction: 'editor.action.nextSelectionMatchFindAction',\n\tPreviousSelectionMatchFindAction: 'editor.action.previousSelectionMatchFindAction',\n\tStartFindReplaceAction: 'editor.action.startFindReplaceAction',\n\tCloseFindWidgetCommand: 'closeFindWidget',\n\tToggleCaseSensitiveCommand: 'toggleFindCaseSensitive',\n\tToggleWholeWordCommand: 'toggleFindWholeWord',\n\tToggleRegexCommand: 'toggleFindRegex',\n\tToggleSearchScopeCommand: 'toggleFindInSelection',\n\tTogglePreserveCaseCommand: 'togglePreserveCase',\n\tReplaceOneAction: 'editor.action.replaceOne',\n\tReplaceAllAction: 'editor.action.replaceAll',\n\tSelectAllMatchesAction: 'editor.action.selectAllMatches'\n};\n\nexport const MATCHES_LIMIT = 19999;\nconst RESEARCH_DELAY = 240;\n\nexport class FindModelBoundToEditorModel {\n\n\tprivate readonly _editor: IActiveCodeEditor;\n\tprivate readonly _state: FindReplaceState;\n\tprivate readonly _toDispose = new DisposableStore();\n\tprivate readonly _decorations: FindDecorations;\n\tprivate _ignoreModelContentChanged: boolean;\n\tprivate readonly _startSearchingTimer: TimeoutTimer;\n\n\tprivate readonly _updateDecorationsScheduler: RunOnceScheduler;\n\tprivate _isDisposed: boolean;\n\n\tconstructor(editor: IActiveCodeEditor, state: FindReplaceState) {\n\t\tthis._editor = editor;\n\t\tthis._state = state;\n\t\tthis._isDisposed = false;\n\t\tthis._startSearchingTimer = new TimeoutTimer();\n\n\t\tthis._decorations = new FindDecorations(editor);\n\t\tthis._toDispose.add(this._decorations);\n\n\t\tthis._updateDecorationsScheduler = new RunOnceScheduler(() => {\n\t\t\tif (!this._editor.hasModel()) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn this.research(false);\n\t\t}, 100);\n\t\tthis._toDispose.add(this._updateDecorationsScheduler);\n\n\t\tthis._toDispose.add(this._editor.onDidChangeCursorPosition((e: ICursorPositionChangedEvent) => {\n\t\t\tif (\n\t\t\t\te.reason === CursorChangeReason.Explicit\n\t\t\t\t|| e.reason === CursorChangeReason.Undo\n\t\t\t\t|| e.reason === CursorChangeReason.Redo\n\t\t\t) {\n\t\t\t\tthis._decorations.setStartPosition(this._editor.getPosition());\n\t\t\t}\n\t\t}));\n\n\t\tthis._ignoreModelContentChanged = false;\n\t\tthis._toDispose.add(this._editor.onDidChangeModelContent((e) => {\n\t\t\tif (this._ignoreModelContentChanged) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (e.isFlush) {\n\t\t\t\t// a model.setValue() was called\n\t\t\t\tthis._decorations.reset();\n\t\t\t}\n\t\t\tthis._decorations.setStartPosition(this._editor.getPosition());\n\t\t\tthis._updateDecorationsScheduler.schedule();\n\t\t}));\n\n\t\tthis._toDispose.add(this._state.onFindReplaceStateChange((e) => this._onStateChanged(e)));\n\n\t\tthis.research(false, this._state.searchScope);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._isDisposed = true;\n\t\tdispose(this._startSearchingTimer);\n\t\tthis._toDispose.dispose();\n\t}\n\n\tprivate _onStateChanged(e: FindReplaceStateChangedEvent): void {\n\t\tif (this._isDisposed) {\n\t\t\t// The find model is disposed during a find state changed event\n\t\t\treturn;\n\t\t}\n\t\tif (!this._editor.hasModel()) {\n\t\t\t// The find model will be disposed momentarily\n\t\t\treturn;\n\t\t}\n\t\tif (e.searchString || e.isReplaceRevealed || e.isRegex || e.wholeWord || e.matchCase || e.searchScope) {\n\t\t\tconst model = this._editor.getModel();\n\n\t\t\tif (model.isTooLargeForSyncing()) {\n\t\t\t\tthis._startSearchingTimer.cancel();\n\n\t\t\t\tthis._startSearchingTimer.setIfNotSet(() => {\n\t\t\t\t\tif (e.searchScope) {\n\t\t\t\t\t\tthis.research(e.moveCursor, this._state.searchScope);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.research(e.moveCursor);\n\t\t\t\t\t}\n\t\t\t\t}, RESEARCH_DELAY);\n\t\t\t} else {\n\t\t\t\tif (e.searchScope) {\n\t\t\t\t\tthis.research(e.moveCursor, this._state.searchScope);\n\t\t\t\t} else {\n\t\t\t\t\tthis.research(e.moveCursor);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static _getSearchRange(model: ITextModel, findScope: Range | null): Range {\n\t\t// If we have set now or before a find scope, use it for computing the search range\n\t\tif (findScope) {\n\t\t\treturn findScope;\n\t\t}\n\n\t\treturn model.getFullModelRange();\n\t}\n\n\tprivate research(moveCursor: boolean, newFindScope?: Range | Range[] | null): void {\n\t\tlet findScopes: Range[] | null = null;\n\t\tif (typeof newFindScope !== 'undefined') {\n\t\t\tif (newFindScope !== null) {\n\t\t\t\tif (!Array.isArray(newFindScope)) {\n\t\t\t\t\tfindScopes = [newFindScope as Range];\n\t\t\t\t} else {\n\t\t\t\t\tfindScopes = newFindScope;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfindScopes = this._decorations.getFindScopes();\n\t\t}\n\t\tif (findScopes !== null) {\n\t\t\tfindScopes = findScopes.map(findScope => {\n\t\t\t\tif (findScope.startLineNumber !== findScope.endLineNumber) {\n\t\t\t\t\tlet endLineNumber = findScope.endLineNumber;\n\n\t\t\t\t\tif (findScope.endColumn === 1) {\n\t\t\t\t\t\tendLineNumber = endLineNumber - 1;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn new Range(findScope.startLineNumber, 1, endLineNumber, this._editor.getModel().getLineMaxColumn(endLineNumber));\n\t\t\t\t}\n\t\t\t\treturn findScope;\n\t\t\t});\n\t\t}\n\n\t\tconst findMatches = this._findMatches(findScopes, false, MATCHES_LIMIT);\n\t\tthis._decorations.set(findMatches, findScopes);\n\n\t\tconst editorSelection = this._editor.getSelection();\n\t\tlet currentMatchesPosition = this._decorations.getCurrentMatchesPosition(editorSelection);\n\t\tif (currentMatchesPosition === 0 && findMatches.length > 0) {\n\t\t\t// current selection is not on top of a match\n\t\t\t// try to find its nearest result from the top of the document\n\t\t\tconst matchAfterSelection = findFirstIdxMonotonousOrArrLen(findMatches.map(match => match.range), range => Range.compareRangesUsingStarts(range, editorSelection) >= 0);\n\t\t\tcurrentMatchesPosition = matchAfterSelection > 0 ? matchAfterSelection - 1 + 1 /** match position is one based */ : currentMatchesPosition;\n\t\t}\n\n\t\tthis._state.changeMatchInfo(\n\t\t\tcurrentMatchesPosition,\n\t\t\tthis._decorations.getCount(),\n\t\t\tundefined\n\t\t);\n\n\t\tif (moveCursor && this._editor.getOption(EditorOption.find).cursorMoveOnType) {\n\t\t\tthis._moveToNextMatch(this._decorations.getStartPosition());\n\t\t}\n\t}\n\n\tprivate _hasMatches(): boolean {\n\t\treturn (this._state.matchesCount > 0);\n\t}\n\n\tprivate _cannotFind(): boolean {\n\t\tif (!this._hasMatches()) {\n\t\t\tconst findScope = this._decorations.getFindScope();\n\t\t\tif (findScope) {\n\t\t\t\t// Reveal the selection so user is reminded that 'selection find' is on.\n\t\t\t\tthis._editor.revealRangeInCenterIfOutsideViewport(findScope, ScrollType.Smooth);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate _setCurrentFindMatch(match: Range): void {\n\t\tconst matchesPosition = this._decorations.setCurrentFindMatch(match);\n\t\tthis._state.changeMatchInfo(\n\t\t\tmatchesPosition,\n\t\t\tthis._decorations.getCount(),\n\t\t\tmatch\n\t\t);\n\n\t\tthis._editor.setSelection(match);\n\t\tthis._editor.revealRangeInCenterIfOutsideViewport(match, ScrollType.Smooth);\n\t}\n\n\tprivate _prevSearchPosition(before: Position) {\n\t\tconst isUsingLineStops = this._state.isRegex && (\n\t\t\tthis._state.searchString.indexOf('^') >= 0\n\t\t\t|| this._state.searchString.indexOf('$') >= 0\n\t\t);\n\t\tlet { lineNumber, column } = before;\n\t\tconst model = this._editor.getModel();\n\n\t\tif (isUsingLineStops || column === 1) {\n\t\t\tif (lineNumber === 1) {\n\t\t\t\tlineNumber = model.getLineCount();\n\t\t\t} else {\n\t\t\t\tlineNumber--;\n\t\t\t}\n\t\t\tcolumn = model.getLineMaxColumn(lineNumber);\n\t\t} else {\n\t\t\tcolumn--;\n\t\t}\n\n\t\treturn new Position(lineNumber, column);\n\t}\n\n\tprivate _moveToPrevMatch(before: Position, isRecursed: boolean = false): void {\n\t\tif (!this._state.canNavigateBack()) {\n\t\t\t// we are beyond the first matched find result\n\t\t\t// instead of doing nothing, we should refocus the first item\n\t\t\tconst nextMatchRange = this._decorations.matchAfterPosition(before);\n\n\t\t\tif (nextMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(nextMatchRange);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (this._decorations.getCount() < MATCHES_LIMIT) {\n\t\t\tlet prevMatchRange = this._decorations.matchBeforePosition(before);\n\n\t\t\tif (prevMatchRange && prevMatchRange.isEmpty() && prevMatchRange.getStartPosition().equals(before)) {\n\t\t\t\tbefore = this._prevSearchPosition(before);\n\t\t\t\tprevMatchRange = this._decorations.matchBeforePosition(before);\n\t\t\t}\n\n\t\t\tif (prevMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(prevMatchRange);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._cannotFind()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst findScope = this._decorations.getFindScope();\n\t\tconst searchRange = FindModelBoundToEditorModel._getSearchRange(this._editor.getModel(), findScope);\n\n\t\t// ...(----)...|...\n\t\tif (searchRange.getEndPosition().isBefore(before)) {\n\t\t\tbefore = searchRange.getEndPosition();\n\t\t}\n\n\t\t// ...|...(----)...\n\t\tif (before.isBefore(searchRange.getStartPosition())) {\n\t\t\tbefore = searchRange.getEndPosition();\n\t\t}\n\n\t\tconst { lineNumber, column } = before;\n\t\tconst model = this._editor.getModel();\n\n\t\tlet position = new Position(lineNumber, column);\n\n\t\tlet prevMatch = model.findPreviousMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false);\n\n\t\tif (prevMatch && prevMatch.range.isEmpty() && prevMatch.range.getStartPosition().equals(position)) {\n\t\t\t// Looks like we're stuck at this position, unacceptable!\n\t\t\tposition = this._prevSearchPosition(position);\n\t\t\tprevMatch = model.findPreviousMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false);\n\t\t}\n\n\t\tif (!prevMatch) {\n\t\t\t// there is precisely one match and selection is on top of it\n\t\t\treturn;\n\t\t}\n\n\t\tif (!isRecursed && !searchRange.containsRange(prevMatch.range)) {\n\t\t\treturn this._moveToPrevMatch(prevMatch.range.getStartPosition(), true);\n\t\t}\n\n\t\tthis._setCurrentFindMatch(prevMatch.range);\n\t}\n\n\tpublic moveToPrevMatch(): void {\n\t\tthis._moveToPrevMatch(this._editor.getSelection().getStartPosition());\n\t}\n\n\tprivate _nextSearchPosition(after: Position) {\n\t\tconst isUsingLineStops = this._state.isRegex && (\n\t\t\tthis._state.searchString.indexOf('^') >= 0\n\t\t\t|| this._state.searchString.indexOf('$') >= 0\n\t\t);\n\n\t\tlet { lineNumber, column } = after;\n\t\tconst model = this._editor.getModel();\n\n\t\tif (isUsingLineStops || column === model.getLineMaxColumn(lineNumber)) {\n\t\t\tif (lineNumber === model.getLineCount()) {\n\t\t\t\tlineNumber = 1;\n\t\t\t} else {\n\t\t\t\tlineNumber++;\n\t\t\t}\n\t\t\tcolumn = 1;\n\t\t} else {\n\t\t\tcolumn++;\n\t\t}\n\n\t\treturn new Position(lineNumber, column);\n\t}\n\n\tprivate _moveToNextMatch(after: Position): void {\n\t\tif (!this._state.canNavigateForward()) {\n\t\t\t// we are beyond the last matched find result\n\t\t\t// instead of doing nothing, we should refocus the last item\n\t\t\tconst prevMatchRange = this._decorations.matchBeforePosition(after);\n\n\t\t\tif (prevMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(prevMatchRange);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (this._decorations.getCount() < MATCHES_LIMIT) {\n\t\t\tlet nextMatchRange = this._decorations.matchAfterPosition(after);\n\n\t\t\tif (nextMatchRange && nextMatchRange.isEmpty() && nextMatchRange.getStartPosition().equals(after)) {\n\t\t\t\t// Looks like we're stuck at this position, unacceptable!\n\t\t\t\tafter = this._nextSearchPosition(after);\n\t\t\t\tnextMatchRange = this._decorations.matchAfterPosition(after);\n\t\t\t}\n\t\t\tif (nextMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(nextMatchRange);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst nextMatch = this._getNextMatch(after, false, true);\n\t\tif (nextMatch) {\n\t\t\tthis._setCurrentFindMatch(nextMatch.range);\n\t\t}\n\t}\n\n\tprivate _getNextMatch(after: Position, captureMatches: boolean, forceMove: boolean, isRecursed: boolean = false): FindMatch | null {\n\t\tif (this._cannotFind()) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst findScope = this._decorations.getFindScope();\n\t\tconst searchRange = FindModelBoundToEditorModel._getSearchRange(this._editor.getModel(), findScope);\n\n\t\t// ...(----)...|...\n\t\tif (searchRange.getEndPosition().isBefore(after)) {\n\t\t\tafter = searchRange.getStartPosition();\n\t\t}\n\n\t\t// ...|...(----)...\n\t\tif (after.isBefore(searchRange.getStartPosition())) {\n\t\t\tafter = searchRange.getStartPosition();\n\t\t}\n\n\t\tconst { lineNumber, column } = after;\n\t\tconst model = this._editor.getModel();\n\n\t\tlet position = new Position(lineNumber, column);\n\n\t\tlet nextMatch = model.findNextMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, captureMatches);\n\n\t\tif (forceMove && nextMatch && nextMatch.range.isEmpty() && nextMatch.range.getStartPosition().equals(position)) {\n\t\t\t// Looks like we're stuck at this position, unacceptable!\n\t\t\tposition = this._nextSearchPosition(position);\n\t\t\tnextMatch = model.findNextMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, captureMatches);\n\t\t}\n\n\t\tif (!nextMatch) {\n\t\t\t// there is precisely one match and selection is on top of it\n\t\t\treturn null;\n\t\t}\n\n\t\tif (!isRecursed && !searchRange.containsRange(nextMatch.range)) {\n\t\t\treturn this._getNextMatch(nextMatch.range.getEndPosition(), captureMatches, forceMove, true);\n\t\t}\n\n\t\treturn nextMatch;\n\t}\n\n\tpublic moveToNextMatch(): void {\n\t\tthis._moveToNextMatch(this._editor.getSelection().getEndPosition());\n\t}\n\n\tprivate _moveToMatch(index: number): void {\n\t\tconst decorationRange = this._decorations.getDecorationRangeAt(index);\n\t\tif (decorationRange) {\n\t\t\tthis._setCurrentFindMatch(decorationRange);\n\t\t}\n\t}\n\n\tpublic moveToMatch(index: number): void {\n\t\tthis._moveToMatch(index);\n\t}\n\n\tprivate _getReplacePattern(): ReplacePattern {\n\t\tif (this._state.isRegex) {\n\t\t\treturn parseReplaceString(this._state.replaceString);\n\t\t}\n\t\treturn ReplacePattern.fromStaticValue(this._state.replaceString);\n\t}\n\n\tpublic replace(): void {\n\t\tif (!this._hasMatches()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst replacePattern = this._getReplacePattern();\n\t\tconst selection = this._editor.getSelection();\n\t\tconst nextMatch = this._getNextMatch(selection.getStartPosition(), true, false);\n\t\tif (nextMatch) {\n\t\t\tif (selection.equalsRange(nextMatch.range)) {\n\t\t\t\t// selection sits on a find match => replace it!\n\t\t\t\tconst replaceString = replacePattern.buildReplaceString(nextMatch.matches, this._state.preserveCase);\n\n\t\t\t\tconst command = new ReplaceCommand(selection, replaceString);\n\n\t\t\t\tthis._executeEditorCommand('replace', command);\n\n\t\t\t\tthis._decorations.setStartPosition(new Position(selection.startLineNumber, selection.startColumn + replaceString.length));\n\t\t\t\tthis.research(true);\n\t\t\t} else {\n\t\t\t\tthis._decorations.setStartPosition(this._editor.getPosition());\n\t\t\t\tthis._setCurrentFindMatch(nextMatch.range);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _findMatches(findScopes: Range[] | null, captureMatches: boolean, limitResultCount: number): FindMatch[] {\n\t\tconst searchRanges = (findScopes as [] || [null]).map((scope: Range | null) =>\n\t\t\tFindModelBoundToEditorModel._getSearchRange(this._editor.getModel(), scope)\n\t\t);\n\n\t\treturn this._editor.getModel().findMatches(this._state.searchString, searchRanges, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, captureMatches, limitResultCount);\n\t}\n\n\tpublic replaceAll(): void {\n\t\tif (!this._hasMatches()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst findScopes = this._decorations.getFindScopes();\n\n\t\tif (findScopes === null && this._state.matchesCount >= MATCHES_LIMIT) {\n\t\t\t// Doing a replace on the entire file that is over ${MATCHES_LIMIT} matches\n\t\t\tthis._largeReplaceAll();\n\t\t} else {\n\t\t\tthis._regularReplaceAll(findScopes);\n\t\t}\n\n\t\tthis.research(false);\n\t}\n\n\tprivate _largeReplaceAll(): void {\n\t\tconst searchParams = new SearchParams(this._state.searchString, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null);\n\t\tconst searchData = searchParams.parseSearchRequest();\n\t\tif (!searchData) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet searchRegex = searchData.regex;\n\t\tif (!searchRegex.multiline) {\n\t\t\tlet mod = 'mu';\n\t\t\tif (searchRegex.ignoreCase) {\n\t\t\t\tmod += 'i';\n\t\t\t}\n\t\t\tif (searchRegex.global) {\n\t\t\t\tmod += 'g';\n\t\t\t}\n\t\t\tsearchRegex = new RegExp(searchRegex.source, mod);\n\t\t}\n\n\t\tconst model = this._editor.getModel();\n\t\tconst modelText = model.getValue(EndOfLinePreference.LF);\n\t\tconst fullModelRange = model.getFullModelRange();\n\n\t\tconst replacePattern = this._getReplacePattern();\n\t\tlet resultText: string;\n\t\tconst preserveCase = this._state.preserveCase;\n\n\t\tif (replacePattern.hasReplacementPatterns || preserveCase) {\n\t\t\tresultText = modelText.replace(searchRegex, function () {\n\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\treturn replacePattern.buildReplaceString(<string[]><any>arguments, preserveCase);\n\t\t\t});\n\t\t} else {\n\t\t\tresultText = modelText.replace(searchRegex, replacePattern.buildReplaceString(null, preserveCase));\n\t\t}\n\n\t\tconst command = new ReplaceCommandThatPreservesSelection(fullModelRange, resultText, this._editor.getSelection());\n\t\tthis._executeEditorCommand('replaceAll', command);\n\t}\n\n\tprivate _regularReplaceAll(findScopes: Range[] | null): void {\n\t\tconst replacePattern = this._getReplacePattern();\n\t\t// Get all the ranges (even more than the highlighted ones)\n\t\tconst matches = this._findMatches(findScopes, replacePattern.hasReplacementPatterns || this._state.preserveCase, Constants.MAX_SAFE_SMALL_INTEGER);\n\n\t\tconst replaceStrings: string[] = [];\n\t\tfor (let i = 0, len = matches.length; i < len; i++) {\n\t\t\treplaceStrings[i] = replacePattern.buildReplaceString(matches[i].matches, this._state.preserveCase);\n\t\t}\n\n\t\tconst command = new ReplaceAllCommand(this._editor.getSelection(), matches.map(m => m.range), replaceStrings);\n\t\tthis._executeEditorCommand('replaceAll', command);\n\t}\n\n\tpublic selectAllMatches(): void {\n\t\tif (!this._hasMatches()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst findScopes = this._decorations.getFindScopes();\n\n\t\t// Get all the ranges (even more than the highlighted ones)\n\t\tconst matches = this._findMatches(findScopes, false, Constants.MAX_SAFE_SMALL_INTEGER);\n\t\tlet selections = matches.map(m => new Selection(m.range.startLineNumber, m.range.startColumn, m.range.endLineNumber, m.range.endColumn));\n\n\t\t// If one of the ranges is the editor selection, then maintain it as primary\n\t\tconst editorSelection = this._editor.getSelection();\n\t\tfor (let i = 0, len = selections.length; i < len; i++) {\n\t\t\tconst sel = selections[i];\n\t\t\tif (sel.equalsRange(editorSelection)) {\n\t\t\t\tselections = [editorSelection].concat(selections.slice(0, i)).concat(selections.slice(i + 1));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tthis._editor.setSelections(selections);\n\t}\n\n\tprivate _executeEditorCommand(source: string, command: ICommand): void {\n\t\ttry {\n\t\t\tthis._ignoreModelContentChanged = true;\n\t\t\tthis._editor.pushUndoStop();\n\t\t\tthis._editor.executeCommand(source, command);\n\t\t\tthis._editor.pushUndoStop();\n\t\t} finally {\n\t\t\tthis._ignoreModelContentChanged = false;\n\t\t}\n\t}\n}\n"]}
1
+ {"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/find/browser/findModel.ts","vs/editor/contrib/find/browser/findModel.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,8BAA8B,EAAE,MAAM,uCAAuC,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAElF,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAGhF,OAAO,EAAE,cAAc,EAAE,oCAAoC,EAAE,MAAM,4CAA4C,CAAC;AAGlH,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE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AC1B,IAAI,GAAG,CAAC,WAAW,CAAC,eAAe,CAAC,EAAE,CAAC;gBACtC,UAAU,GAAG,CAAC,eAAe,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBAC9F,MAAM;YACP,CAAC;QACF,CAAC;QAED,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAEO,qBAAqB,CAAC,MAAc,EAAE,OAAiB;QAC9D,IAAI,CAAC;YACJ,IAAI,CAAC,0BAA0B,GAAG,IAAI,CAAC;YACvC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;YAC5B,IAAI,CAAC,OAAO,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC7C,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QAC7B,CAAC;gBAAS,CAAC;YACV,IAAI,CAAC,0BAA0B,GAAG,KAAK,CAAC;QACzC,CAAC;IACF,CAAC;CACD","file":"findModel.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 { findFirstIdxMonotonousOrArrLen } from '../../../../base/common/arraysFind.js';\nimport { RunOnceScheduler, TimeoutTimer } from '../../../../base/common/async.js';\nimport { KeyCode, KeyMod } from '../../../../base/common/keyCodes.js';\nimport { DisposableStore, dispose } from '../../../../base/common/lifecycle.js';\nimport { Constants } from '../../../../base/common/uint.js';\nimport { IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { ReplaceCommand, ReplaceCommandThatPreservesSelection } from '../../../common/commands/replaceCommand.js';\nimport { EditorOption } from '../../../common/config/editorOptions.js';\nimport { CursorChangeReason, ICursorPositionChangedEvent } from '../../../common/cursorEvents.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { Selection } from '../../../common/core/selection.js';\nimport { ICommand, ScrollType } from '../../../common/editorCommon.js';\nimport { EndOfLinePreference, FindMatch, ITextModel } from '../../../common/model.js';\nimport { SearchParams } from '../../../common/model/textModelSearch.js';\nimport { FindDecorations } from './findDecorations.js';\nimport { FindReplaceState, FindReplaceStateChangedEvent } from './findState.js';\nimport { ReplaceAllCommand } from './replaceAllCommand.js';\nimport { parseReplaceString, ReplacePattern } from './replacePattern.js';\nimport { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';\nimport { IKeybindings } from '../../../../platform/keybinding/common/keybindingsRegistry.js';\n\nexport const CONTEXT_FIND_WIDGET_VISIBLE = new RawContextKey<boolean>('findWidgetVisible', false);\nexport const CONTEXT_FIND_WIDGET_NOT_VISIBLE = CONTEXT_FIND_WIDGET_VISIBLE.toNegated();\n// Keep ContextKey use of 'Focussed' to not break when clauses\nexport const CONTEXT_FIND_INPUT_FOCUSED = new RawContextKey<boolean>('findInputFocussed', false);\nexport const CONTEXT_REPLACE_INPUT_FOCUSED = new RawContextKey<boolean>('replaceInputFocussed', false);\n\nexport const ToggleCaseSensitiveKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyC,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyC }\n};\nexport const ToggleWholeWordKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyW,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyW }\n};\nexport const ToggleRegexKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyR,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyR }\n};\nexport const ToggleSearchScopeKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyL,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyL }\n};\nexport const TogglePreserveCaseKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyP,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyP }\n};\n\nexport const FIND_IDS = {\n\tStartFindAction: 'actions.find',\n\tStartFindWithSelection: 'actions.findWithSelection',\n\tStartFindWithArgs: 'editor.actions.findWithArgs',\n\tNextMatchFindAction: 'editor.action.nextMatchFindAction',\n\tPreviousMatchFindAction: 'editor.action.previousMatchFindAction',\n\tGoToMatchFindAction: 'editor.action.goToMatchFindAction',\n\tNextSelectionMatchFindAction: 'editor.action.nextSelectionMatchFindAction',\n\tPreviousSelectionMatchFindAction: 'editor.action.previousSelectionMatchFindAction',\n\tStartFindReplaceAction: 'editor.action.startFindReplaceAction',\n\tCloseFindWidgetCommand: 'closeFindWidget',\n\tToggleCaseSensitiveCommand: 'toggleFindCaseSensitive',\n\tToggleWholeWordCommand: 'toggleFindWholeWord',\n\tToggleRegexCommand: 'toggleFindRegex',\n\tToggleSearchScopeCommand: 'toggleFindInSelection',\n\tTogglePreserveCaseCommand: 'togglePreserveCase',\n\tReplaceOneAction: 'editor.action.replaceOne',\n\tReplaceAllAction: 'editor.action.replaceAll',\n\tSelectAllMatchesAction: 'editor.action.selectAllMatches'\n};\n\nexport const MATCHES_LIMIT = 19999;\nconst RESEARCH_DELAY = 240;\n\nexport class FindModelBoundToEditorModel {\n\n\tprivate readonly _editor: IActiveCodeEditor;\n\tprivate readonly _state: FindReplaceState;\n\tprivate readonly _toDispose = new DisposableStore();\n\tprivate readonly _decorations: FindDecorations;\n\tprivate _ignoreModelContentChanged: boolean;\n\tprivate readonly _startSearchingTimer: TimeoutTimer;\n\n\tprivate readonly _updateDecorationsScheduler: RunOnceScheduler;\n\tprivate _isDisposed: boolean;\n\n\tconstructor(editor: IActiveCodeEditor, state: FindReplaceState) {\n\t\tthis._editor = editor;\n\t\tthis._state = state;\n\t\tthis._isDisposed = false;\n\t\tthis._startSearchingTimer = new TimeoutTimer();\n\n\t\tthis._decorations = new FindDecorations(editor);\n\t\tthis._toDispose.add(this._decorations);\n\n\t\tthis._updateDecorationsScheduler = new RunOnceScheduler(() => {\n\t\t\tif (!this._editor.hasModel()) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn this.research(false);\n\t\t}, 100);\n\t\tthis._toDispose.add(this._updateDecorationsScheduler);\n\n\t\tthis._toDispose.add(this._editor.onDidChangeCursorPosition((e: ICursorPositionChangedEvent) => {\n\t\t\tif (\n\t\t\t\te.reason === CursorChangeReason.Explicit\n\t\t\t\t|| e.reason === CursorChangeReason.Undo\n\t\t\t\t|| e.reason === CursorChangeReason.Redo\n\t\t\t) {\n\t\t\t\tthis._decorations.setStartPosition(this._editor.getPosition());\n\t\t\t}\n\t\t}));\n\n\t\tthis._ignoreModelContentChanged = false;\n\t\tthis._toDispose.add(this._editor.onDidChangeModelContent((e) => {\n\t\t\tif (this._ignoreModelContentChanged) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (e.isFlush) {\n\t\t\t\t// a model.setValue() was called\n\t\t\t\tthis._decorations.reset();\n\t\t\t}\n\t\t\tthis._decorations.setStartPosition(this._editor.getPosition());\n\t\t\tthis._updateDecorationsScheduler.schedule();\n\t\t}));\n\n\t\tthis._toDispose.add(this._state.onFindReplaceStateChange((e) => this._onStateChanged(e)));\n\n\t\tthis.research(false, this._state.searchScope);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._isDisposed = true;\n\t\tdispose(this._startSearchingTimer);\n\t\tthis._toDispose.dispose();\n\t}\n\n\tprivate _onStateChanged(e: FindReplaceStateChangedEvent): void {\n\t\tif (this._isDisposed) {\n\t\t\t// The find model is disposed during a find state changed event\n\t\t\treturn;\n\t\t}\n\t\tif (!this._editor.hasModel()) {\n\t\t\t// The find model will be disposed momentarily\n\t\t\treturn;\n\t\t}\n\t\tif (e.searchString || e.isReplaceRevealed || e.isRegex || e.wholeWord || e.matchCase || e.searchScope) {\n\t\t\tconst model = this._editor.getModel();\n\n\t\t\tif (model.isTooLargeForSyncing()) {\n\t\t\t\tthis._startSearchingTimer.cancel();\n\n\t\t\t\tthis._startSearchingTimer.setIfNotSet(() => {\n\t\t\t\t\tif (e.searchScope) {\n\t\t\t\t\t\tthis.research(e.moveCursor, this._state.searchScope);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.research(e.moveCursor);\n\t\t\t\t\t}\n\t\t\t\t}, RESEARCH_DELAY);\n\t\t\t} else {\n\t\t\t\tif (e.searchScope) {\n\t\t\t\t\tthis.research(e.moveCursor, this._state.searchScope);\n\t\t\t\t} else {\n\t\t\t\t\tthis.research(e.moveCursor);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static _getSearchRange(model: ITextModel, findScope: Range | null): Range {\n\t\t// If we have set now or before a find scope, use it for computing the search range\n\t\tif (findScope) {\n\t\t\treturn findScope;\n\t\t}\n\n\t\treturn model.getFullModelRange();\n\t}\n\n\tprivate research(moveCursor: boolean, newFindScope?: Range | Range[] | null): void {\n\t\tlet findScopes: Range[] | null = null;\n\t\tif (typeof newFindScope !== 'undefined') {\n\t\t\tif (newFindScope !== null) {\n\t\t\t\tif (!Array.isArray(newFindScope)) {\n\t\t\t\t\tfindScopes = [newFindScope];\n\t\t\t\t} else {\n\t\t\t\t\tfindScopes = newFindScope;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfindScopes = this._decorations.getFindScopes();\n\t\t}\n\t\tif (findScopes !== null) {\n\t\t\tfindScopes = findScopes.map(findScope => {\n\t\t\t\tif (findScope.startLineNumber !== findScope.endLineNumber) {\n\t\t\t\t\tlet endLineNumber = findScope.endLineNumber;\n\n\t\t\t\t\tif (findScope.endColumn === 1) {\n\t\t\t\t\t\tendLineNumber = endLineNumber - 1;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn new Range(findScope.startLineNumber, 1, endLineNumber, this._editor.getModel().getLineMaxColumn(endLineNumber));\n\t\t\t\t}\n\t\t\t\treturn findScope;\n\t\t\t});\n\t\t}\n\n\t\tconst findMatches = this._findMatches(findScopes, false, MATCHES_LIMIT);\n\t\tthis._decorations.set(findMatches, findScopes);\n\n\t\tconst editorSelection = this._editor.getSelection();\n\t\tlet currentMatchesPosition = this._decorations.getCurrentMatchesPosition(editorSelection);\n\t\tif (currentMatchesPosition === 0 && findMatches.length > 0) {\n\t\t\t// current selection is not on top of a match\n\t\t\t// try to find its nearest result from the top of the document\n\t\t\tconst matchAfterSelection = findFirstIdxMonotonousOrArrLen(findMatches.map(match => match.range), range => Range.compareRangesUsingStarts(range, editorSelection) >= 0);\n\t\t\tcurrentMatchesPosition = matchAfterSelection > 0 ? matchAfterSelection - 1 + 1 /** match position is one based */ : currentMatchesPosition;\n\t\t}\n\n\t\tthis._state.changeMatchInfo(\n\t\t\tcurrentMatchesPosition,\n\t\t\tthis._decorations.getCount(),\n\t\t\tundefined\n\t\t);\n\n\t\tif (moveCursor && this._editor.getOption(EditorOption.find).cursorMoveOnType) {\n\t\t\tthis._moveToNextMatch(this._decorations.getStartPosition());\n\t\t}\n\t}\n\n\tprivate _hasMatches(): boolean {\n\t\treturn (this._state.matchesCount > 0);\n\t}\n\n\tprivate _cannotFind(): boolean {\n\t\tif (!this._hasMatches()) {\n\t\t\tconst findScope = this._decorations.getFindScope();\n\t\t\tif (findScope) {\n\t\t\t\t// Reveal the selection so user is reminded that 'selection find' is on.\n\t\t\t\tthis._editor.revealRangeInCenterIfOutsideViewport(findScope, ScrollType.Smooth);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate _setCurrentFindMatch(match: Range): void {\n\t\tconst matchesPosition = this._decorations.setCurrentFindMatch(match);\n\t\tthis._state.changeMatchInfo(\n\t\t\tmatchesPosition,\n\t\t\tthis._decorations.getCount(),\n\t\t\tmatch\n\t\t);\n\n\t\tthis._editor.setSelection(match);\n\t\tthis._editor.revealRangeInCenterIfOutsideViewport(match, ScrollType.Smooth);\n\t}\n\n\tprivate _prevSearchPosition(before: Position) {\n\t\tconst isUsingLineStops = this._state.isRegex && (\n\t\t\tthis._state.searchString.indexOf('^') >= 0\n\t\t\t|| this._state.searchString.indexOf('$') >= 0\n\t\t);\n\t\tlet { lineNumber, column } = before;\n\t\tconst model = this._editor.getModel();\n\n\t\tif (isUsingLineStops || column === 1) {\n\t\t\tif (lineNumber === 1) {\n\t\t\t\tlineNumber = model.getLineCount();\n\t\t\t} else {\n\t\t\t\tlineNumber--;\n\t\t\t}\n\t\t\tcolumn = model.getLineMaxColumn(lineNumber);\n\t\t} else {\n\t\t\tcolumn--;\n\t\t}\n\n\t\treturn new Position(lineNumber, column);\n\t}\n\n\tprivate _moveToPrevMatch(before: Position, isRecursed: boolean = false): void {\n\t\tif (!this._state.canNavigateBack()) {\n\t\t\t// we are beyond the first matched find result\n\t\t\t// instead of doing nothing, we should refocus the first item\n\t\t\tconst nextMatchRange = this._decorations.matchAfterPosition(before);\n\n\t\t\tif (nextMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(nextMatchRange);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (this._decorations.getCount() < MATCHES_LIMIT) {\n\t\t\tlet prevMatchRange = this._decorations.matchBeforePosition(before);\n\n\t\t\tif (prevMatchRange && prevMatchRange.isEmpty() && prevMatchRange.getStartPosition().equals(before)) {\n\t\t\t\tbefore = this._prevSearchPosition(before);\n\t\t\t\tprevMatchRange = this._decorations.matchBeforePosition(before);\n\t\t\t}\n\n\t\t\tif (prevMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(prevMatchRange);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._cannotFind()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst findScope = this._decorations.getFindScope();\n\t\tconst searchRange = FindModelBoundToEditorModel._getSearchRange(this._editor.getModel(), findScope);\n\n\t\t// ...(----)...|...\n\t\tif (searchRange.getEndPosition().isBefore(before)) {\n\t\t\tbefore = searchRange.getEndPosition();\n\t\t}\n\n\t\t// ...|...(----)...\n\t\tif (before.isBefore(searchRange.getStartPosition())) {\n\t\t\tbefore = searchRange.getEndPosition();\n\t\t}\n\n\t\tconst { lineNumber, column } = before;\n\t\tconst model = this._editor.getModel();\n\n\t\tlet position = new Position(lineNumber, column);\n\n\t\tlet prevMatch = model.findPreviousMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false);\n\n\t\tif (prevMatch && prevMatch.range.isEmpty() && prevMatch.range.getStartPosition().equals(position)) {\n\t\t\t// Looks like we're stuck at this position, unacceptable!\n\t\t\tposition = this._prevSearchPosition(position);\n\t\t\tprevMatch = model.findPreviousMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false);\n\t\t}\n\n\t\tif (!prevMatch) {\n\t\t\t// there is precisely one match and selection is on top of it\n\t\t\treturn;\n\t\t}\n\n\t\tif (!isRecursed && !searchRange.containsRange(prevMatch.range)) {\n\t\t\treturn this._moveToPrevMatch(prevMatch.range.getStartPosition(), true);\n\t\t}\n\n\t\tthis._setCurrentFindMatch(prevMatch.range);\n\t}\n\n\tpublic moveToPrevMatch(): void {\n\t\tthis._moveToPrevMatch(this._editor.getSelection().getStartPosition());\n\t}\n\n\tprivate _nextSearchPosition(after: Position) {\n\t\tconst isUsingLineStops = this._state.isRegex && (\n\t\t\tthis._state.searchString.indexOf('^') >= 0\n\t\t\t|| this._state.searchString.indexOf('$') >= 0\n\t\t);\n\n\t\tlet { lineNumber, column } = after;\n\t\tconst model = this._editor.getModel();\n\n\t\tif (isUsingLineStops || column === model.getLineMaxColumn(lineNumber)) {\n\t\t\tif (lineNumber === model.getLineCount()) {\n\t\t\t\tlineNumber = 1;\n\t\t\t} else {\n\t\t\t\tlineNumber++;\n\t\t\t}\n\t\t\tcolumn = 1;\n\t\t} else {\n\t\t\tcolumn++;\n\t\t}\n\n\t\treturn new Position(lineNumber, column);\n\t}\n\n\tprivate _moveToNextMatch(after: Position): void {\n\t\tif (!this._state.canNavigateForward()) {\n\t\t\t// we are beyond the last matched find result\n\t\t\t// instead of doing nothing, we should refocus the last item\n\t\t\tconst prevMatchRange = this._decorations.matchBeforePosition(after);\n\n\t\t\tif (prevMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(prevMatchRange);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (this._decorations.getCount() < MATCHES_LIMIT) {\n\t\t\tlet nextMatchRange = this._decorations.matchAfterPosition(after);\n\n\t\t\tif (nextMatchRange && nextMatchRange.isEmpty() && nextMatchRange.getStartPosition().equals(after)) {\n\t\t\t\t// Looks like we're stuck at this position, unacceptable!\n\t\t\t\tafter = this._nextSearchPosition(after);\n\t\t\t\tnextMatchRange = this._decorations.matchAfterPosition(after);\n\t\t\t}\n\t\t\tif (nextMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(nextMatchRange);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst nextMatch = this._getNextMatch(after, false, true);\n\t\tif (nextMatch) {\n\t\t\tthis._setCurrentFindMatch(nextMatch.range);\n\t\t}\n\t}\n\n\tprivate _getNextMatch(after: Position, captureMatches: boolean, forceMove: boolean, isRecursed: boolean = false): FindMatch | null {\n\t\tif (this._cannotFind()) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst findScope = this._decorations.getFindScope();\n\t\tconst searchRange = FindModelBoundToEditorModel._getSearchRange(this._editor.getModel(), findScope);\n\n\t\t// ...(----)...|...\n\t\tif (searchRange.getEndPosition().isBefore(after)) {\n\t\t\tafter = searchRange.getStartPosition();\n\t\t}\n\n\t\t// ...|...(----)...\n\t\tif (after.isBefore(searchRange.getStartPosition())) {\n\t\t\tafter = searchRange.getStartPosition();\n\t\t}\n\n\t\tconst { lineNumber, column } = after;\n\t\tconst model = this._editor.getModel();\n\n\t\tlet position = new Position(lineNumber, column);\n\n\t\tlet nextMatch = model.findNextMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, captureMatches);\n\n\t\tif (forceMove && nextMatch && nextMatch.range.isEmpty() && nextMatch.range.getStartPosition().equals(position)) {\n\t\t\t// Looks like we're stuck at this position, unacceptable!\n\t\t\tposition = this._nextSearchPosition(position);\n\t\t\tnextMatch = model.findNextMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, captureMatches);\n\t\t}\n\n\t\tif (!nextMatch) {\n\t\t\t// there is precisely one match and selection is on top of it\n\t\t\treturn null;\n\t\t}\n\n\t\tif (!isRecursed && !searchRange.containsRange(nextMatch.range)) {\n\t\t\treturn this._getNextMatch(nextMatch.range.getEndPosition(), captureMatches, forceMove, true);\n\t\t}\n\n\t\treturn nextMatch;\n\t}\n\n\tpublic moveToNextMatch(): void {\n\t\tthis._moveToNextMatch(this._editor.getSelection().getEndPosition());\n\t}\n\n\tprivate _moveToMatch(index: number): void {\n\t\tconst decorationRange = this._decorations.getDecorationRangeAt(index);\n\t\tif (decorationRange) {\n\t\t\tthis._setCurrentFindMatch(decorationRange);\n\t\t}\n\t}\n\n\tpublic moveToMatch(index: number): void {\n\t\tthis._moveToMatch(index);\n\t}\n\n\tprivate _getReplacePattern(): ReplacePattern {\n\t\tif (this._state.isRegex) {\n\t\t\treturn parseReplaceString(this._state.replaceString);\n\t\t}\n\t\treturn ReplacePattern.fromStaticValue(this._state.replaceString);\n\t}\n\n\tpublic replace(): void {\n\t\tif (!this._hasMatches()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst replacePattern = this._getReplacePattern();\n\t\tconst selection = this._editor.getSelection();\n\t\tconst nextMatch = this._getNextMatch(selection.getStartPosition(), true, false);\n\t\tif (nextMatch) {\n\t\t\tif (selection.equalsRange(nextMatch.range)) {\n\t\t\t\t// selection sits on a find match => replace it!\n\t\t\t\tconst replaceString = replacePattern.buildReplaceString(nextMatch.matches, this._state.preserveCase);\n\n\t\t\t\tconst command = new ReplaceCommand(selection, replaceString);\n\n\t\t\t\tthis._executeEditorCommand('replace', command);\n\n\t\t\t\tthis._decorations.setStartPosition(new Position(selection.startLineNumber, selection.startColumn + replaceString.length));\n\t\t\t\tthis.research(true);\n\t\t\t} else {\n\t\t\t\tthis._decorations.setStartPosition(this._editor.getPosition());\n\t\t\t\tthis._setCurrentFindMatch(nextMatch.range);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _findMatches(findScopes: Range[] | null, captureMatches: boolean, limitResultCount: number): FindMatch[] {\n\t\tconst searchRanges = (findScopes as [] || [null]).map((scope: Range | null) =>\n\t\t\tFindModelBoundToEditorModel._getSearchRange(this._editor.getModel(), scope)\n\t\t);\n\n\t\treturn this._editor.getModel().findMatches(this._state.searchString, searchRanges, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, captureMatches, limitResultCount);\n\t}\n\n\tpublic replaceAll(): void {\n\t\tif (!this._hasMatches()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst findScopes = this._decorations.getFindScopes();\n\n\t\tif (findScopes === null && this._state.matchesCount >= MATCHES_LIMIT) {\n\t\t\t// Doing a replace on the entire file that is over ${MATCHES_LIMIT} matches\n\t\t\tthis._largeReplaceAll();\n\t\t} else {\n\t\t\tthis._regularReplaceAll(findScopes);\n\t\t}\n\n\t\tthis.research(false);\n\t}\n\n\tprivate _largeReplaceAll(): void {\n\t\tconst searchParams = new SearchParams(this._state.searchString, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null);\n\t\tconst searchData = searchParams.parseSearchRequest();\n\t\tif (!searchData) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet searchRegex = searchData.regex;\n\t\tif (!searchRegex.multiline) {\n\t\t\tlet mod = 'mu';\n\t\t\tif (searchRegex.ignoreCase) {\n\t\t\t\tmod += 'i';\n\t\t\t}\n\t\t\tif (searchRegex.global) {\n\t\t\t\tmod += 'g';\n\t\t\t}\n\t\t\tsearchRegex = new RegExp(searchRegex.source, mod);\n\t\t}\n\n\t\tconst model = this._editor.getModel();\n\t\tconst modelText = model.getValue(EndOfLinePreference.LF);\n\t\tconst fullModelRange = model.getFullModelRange();\n\n\t\tconst replacePattern = this._getReplacePattern();\n\t\tlet resultText: string;\n\t\tconst preserveCase = this._state.preserveCase;\n\n\t\tif (replacePattern.hasReplacementPatterns || preserveCase) {\n\t\t\tresultText = modelText.replace(searchRegex, function () {\n\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\treturn replacePattern.buildReplaceString(<string[]><any>arguments, preserveCase);\n\t\t\t});\n\t\t} else {\n\t\t\tresultText = modelText.replace(searchRegex, replacePattern.buildReplaceString(null, preserveCase));\n\t\t}\n\n\t\tconst command = new ReplaceCommandThatPreservesSelection(fullModelRange, resultText, this._editor.getSelection());\n\t\tthis._executeEditorCommand('replaceAll', command);\n\t}\n\n\tprivate _regularReplaceAll(findScopes: Range[] | null): void {\n\t\tconst replacePattern = this._getReplacePattern();\n\t\t// Get all the ranges (even more than the highlighted ones)\n\t\tconst matches = this._findMatches(findScopes, replacePattern.hasReplacementPatterns || this._state.preserveCase, Constants.MAX_SAFE_SMALL_INTEGER);\n\n\t\tconst replaceStrings: string[] = [];\n\t\tfor (let i = 0, len = matches.length; i < len; i++) {\n\t\t\treplaceStrings[i] = replacePattern.buildReplaceString(matches[i].matches, this._state.preserveCase);\n\t\t}\n\n\t\tconst command = new ReplaceAllCommand(this._editor.getSelection(), matches.map(m => m.range), replaceStrings);\n\t\tthis._executeEditorCommand('replaceAll', command);\n\t}\n\n\tpublic selectAllMatches(): void {\n\t\tif (!this._hasMatches()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst findScopes = this._decorations.getFindScopes();\n\n\t\t// Get all the ranges (even more than the highlighted ones)\n\t\tconst matches = this._findMatches(findScopes, false, Constants.MAX_SAFE_SMALL_INTEGER);\n\t\tlet selections = matches.map(m => new Selection(m.range.startLineNumber, m.range.startColumn, m.range.endLineNumber, m.range.endColumn));\n\n\t\t// If one of the ranges is the editor selection, then maintain it as primary\n\t\tconst editorSelection = this._editor.getSelection();\n\t\tfor (let i = 0, len = selections.length; i < len; i++) {\n\t\t\tconst sel = selections[i];\n\t\t\tif (sel.equalsRange(editorSelection)) {\n\t\t\t\tselections = [editorSelection].concat(selections.slice(0, i)).concat(selections.slice(i + 1));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tthis._editor.setSelections(selections);\n\t}\n\n\tprivate _executeEditorCommand(source: string, command: ICommand): void {\n\t\ttry {\n\t\t\tthis._ignoreModelContentChanged = true;\n\t\t\tthis._editor.pushUndoStop();\n\t\t\tthis._editor.executeCommand(source, command);\n\t\t\tthis._editor.pushUndoStop();\n\t\t} finally {\n\t\t\tthis._ignoreModelContentChanged = false;\n\t\t}\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 { findFirstIdxMonotonousOrArrLen } from '../../../../base/common/arraysFind.js';\nimport { RunOnceScheduler, TimeoutTimer } from '../../../../base/common/async.js';\nimport { KeyCode, KeyMod } from '../../../../base/common/keyCodes.js';\nimport { DisposableStore, dispose } from '../../../../base/common/lifecycle.js';\nimport { Constants } from '../../../../base/common/uint.js';\nimport { IActiveCodeEditor } from '../../../browser/editorBrowser.js';\nimport { ReplaceCommand, ReplaceCommandThatPreservesSelection } from '../../../common/commands/replaceCommand.js';\nimport { EditorOption } from '../../../common/config/editorOptions.js';\nimport { CursorChangeReason, ICursorPositionChangedEvent } from '../../../common/cursorEvents.js';\nimport { Position } from '../../../common/core/position.js';\nimport { Range } from '../../../common/core/range.js';\nimport { Selection } from '../../../common/core/selection.js';\nimport { ICommand, ScrollType } from '../../../common/editorCommon.js';\nimport { EndOfLinePreference, FindMatch, ITextModel } from '../../../common/model.js';\nimport { SearchParams } from '../../../common/model/textModelSearch.js';\nimport { FindDecorations } from './findDecorations.js';\nimport { FindReplaceState, FindReplaceStateChangedEvent } from './findState.js';\nimport { ReplaceAllCommand } from './replaceAllCommand.js';\nimport { parseReplaceString, ReplacePattern } from './replacePattern.js';\nimport { RawContextKey } from '../../../../platform/contextkey/common/contextkey.js';\nimport { IKeybindings } from '../../../../platform/keybinding/common/keybindingsRegistry.js';\n\nexport const CONTEXT_FIND_WIDGET_VISIBLE = new RawContextKey<boolean>('findWidgetVisible', false);\nexport const CONTEXT_FIND_WIDGET_NOT_VISIBLE = CONTEXT_FIND_WIDGET_VISIBLE.toNegated();\n// Keep ContextKey use of 'Focussed' to not break when clauses\nexport const CONTEXT_FIND_INPUT_FOCUSED = new RawContextKey<boolean>('findInputFocussed', false);\nexport const CONTEXT_REPLACE_INPUT_FOCUSED = new RawContextKey<boolean>('replaceInputFocussed', false);\n\nexport const ToggleCaseSensitiveKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyC,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyC }\n};\nexport const ToggleWholeWordKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyW,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyW }\n};\nexport const ToggleRegexKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyR,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyR }\n};\nexport const ToggleSearchScopeKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyL,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyL }\n};\nexport const TogglePreserveCaseKeybinding: IKeybindings = {\n\tprimary: KeyMod.Alt | KeyCode.KeyP,\n\tmac: { primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyP }\n};\n\nexport const FIND_IDS = {\n\tStartFindAction: 'actions.find',\n\tStartFindWithSelection: 'actions.findWithSelection',\n\tStartFindWithArgs: 'editor.actions.findWithArgs',\n\tNextMatchFindAction: 'editor.action.nextMatchFindAction',\n\tPreviousMatchFindAction: 'editor.action.previousMatchFindAction',\n\tGoToMatchFindAction: 'editor.action.goToMatchFindAction',\n\tNextSelectionMatchFindAction: 'editor.action.nextSelectionMatchFindAction',\n\tPreviousSelectionMatchFindAction: 'editor.action.previousSelectionMatchFindAction',\n\tStartFindReplaceAction: 'editor.action.startFindReplaceAction',\n\tCloseFindWidgetCommand: 'closeFindWidget',\n\tToggleCaseSensitiveCommand: 'toggleFindCaseSensitive',\n\tToggleWholeWordCommand: 'toggleFindWholeWord',\n\tToggleRegexCommand: 'toggleFindRegex',\n\tToggleSearchScopeCommand: 'toggleFindInSelection',\n\tTogglePreserveCaseCommand: 'togglePreserveCase',\n\tReplaceOneAction: 'editor.action.replaceOne',\n\tReplaceAllAction: 'editor.action.replaceAll',\n\tSelectAllMatchesAction: 'editor.action.selectAllMatches'\n};\n\nexport const MATCHES_LIMIT = 19999;\nconst RESEARCH_DELAY = 240;\n\nexport class FindModelBoundToEditorModel {\n\n\tprivate readonly _editor: IActiveCodeEditor;\n\tprivate readonly _state: FindReplaceState;\n\tprivate readonly _toDispose = new DisposableStore();\n\tprivate readonly _decorations: FindDecorations;\n\tprivate _ignoreModelContentChanged: boolean;\n\tprivate readonly _startSearchingTimer: TimeoutTimer;\n\n\tprivate readonly _updateDecorationsScheduler: RunOnceScheduler;\n\tprivate _isDisposed: boolean;\n\n\tconstructor(editor: IActiveCodeEditor, state: FindReplaceState) {\n\t\tthis._editor = editor;\n\t\tthis._state = state;\n\t\tthis._isDisposed = false;\n\t\tthis._startSearchingTimer = new TimeoutTimer();\n\n\t\tthis._decorations = new FindDecorations(editor);\n\t\tthis._toDispose.add(this._decorations);\n\n\t\tthis._updateDecorationsScheduler = new RunOnceScheduler(() => {\n\t\t\tif (!this._editor.hasModel()) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn this.research(false);\n\t\t}, 100);\n\t\tthis._toDispose.add(this._updateDecorationsScheduler);\n\n\t\tthis._toDispose.add(this._editor.onDidChangeCursorPosition((e: ICursorPositionChangedEvent) => {\n\t\t\tif (\n\t\t\t\te.reason === CursorChangeReason.Explicit\n\t\t\t\t|| e.reason === CursorChangeReason.Undo\n\t\t\t\t|| e.reason === CursorChangeReason.Redo\n\t\t\t) {\n\t\t\t\tthis._decorations.setStartPosition(this._editor.getPosition());\n\t\t\t}\n\t\t}));\n\n\t\tthis._ignoreModelContentChanged = false;\n\t\tthis._toDispose.add(this._editor.onDidChangeModelContent((e) => {\n\t\t\tif (this._ignoreModelContentChanged) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif (e.isFlush) {\n\t\t\t\t// a model.setValue() was called\n\t\t\t\tthis._decorations.reset();\n\t\t\t}\n\t\t\tthis._decorations.setStartPosition(this._editor.getPosition());\n\t\t\tthis._updateDecorationsScheduler.schedule();\n\t\t}));\n\n\t\tthis._toDispose.add(this._state.onFindReplaceStateChange((e) => this._onStateChanged(e)));\n\n\t\tthis.research(false, this._state.searchScope);\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._isDisposed = true;\n\t\tdispose(this._startSearchingTimer);\n\t\tthis._toDispose.dispose();\n\t}\n\n\tprivate _onStateChanged(e: FindReplaceStateChangedEvent): void {\n\t\tif (this._isDisposed) {\n\t\t\t// The find model is disposed during a find state changed event\n\t\t\treturn;\n\t\t}\n\t\tif (!this._editor.hasModel()) {\n\t\t\t// The find model will be disposed momentarily\n\t\t\treturn;\n\t\t}\n\t\tif (e.searchString || e.isReplaceRevealed || e.isRegex || e.wholeWord || e.matchCase || e.searchScope) {\n\t\t\tconst model = this._editor.getModel();\n\n\t\t\tif (model.isTooLargeForSyncing()) {\n\t\t\t\tthis._startSearchingTimer.cancel();\n\n\t\t\t\tthis._startSearchingTimer.setIfNotSet(() => {\n\t\t\t\t\tif (e.searchScope) {\n\t\t\t\t\t\tthis.research(e.moveCursor, this._state.searchScope);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.research(e.moveCursor);\n\t\t\t\t\t}\n\t\t\t\t}, RESEARCH_DELAY);\n\t\t\t} else {\n\t\t\t\tif (e.searchScope) {\n\t\t\t\t\tthis.research(e.moveCursor, this._state.searchScope);\n\t\t\t\t} else {\n\t\t\t\t\tthis.research(e.moveCursor);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate static _getSearchRange(model: ITextModel, findScope: Range | null): Range {\n\t\t// If we have set now or before a find scope, use it for computing the search range\n\t\tif (findScope) {\n\t\t\treturn findScope;\n\t\t}\n\n\t\treturn model.getFullModelRange();\n\t}\n\n\tprivate research(moveCursor: boolean, newFindScope?: Range | Range[] | null): void {\n\t\tlet findScopes: Range[] | null = null;\n\t\tif (typeof newFindScope !== 'undefined') {\n\t\t\tif (newFindScope !== null) {\n\t\t\t\tif (!Array.isArray(newFindScope)) {\n\t\t\t\t\tfindScopes = [newFindScope];\n\t\t\t\t} else {\n\t\t\t\t\tfindScopes = newFindScope;\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tfindScopes = this._decorations.getFindScopes();\n\t\t}\n\t\tif (findScopes !== null) {\n\t\t\tfindScopes = findScopes.map(findScope => {\n\t\t\t\tif (findScope.startLineNumber !== findScope.endLineNumber) {\n\t\t\t\t\tlet endLineNumber = findScope.endLineNumber;\n\n\t\t\t\t\tif (findScope.endColumn === 1) {\n\t\t\t\t\t\tendLineNumber = endLineNumber - 1;\n\t\t\t\t\t}\n\n\t\t\t\t\treturn new Range(findScope.startLineNumber, 1, endLineNumber, this._editor.getModel().getLineMaxColumn(endLineNumber));\n\t\t\t\t}\n\t\t\t\treturn findScope;\n\t\t\t});\n\t\t}\n\n\t\tconst findMatches = this._findMatches(findScopes, false, MATCHES_LIMIT);\n\t\tthis._decorations.set(findMatches, findScopes);\n\n\t\tconst editorSelection = this._editor.getSelection();\n\t\tlet currentMatchesPosition = this._decorations.getCurrentMatchesPosition(editorSelection);\n\t\tif (currentMatchesPosition === 0 && findMatches.length > 0) {\n\t\t\t// current selection is not on top of a match\n\t\t\t// try to find its nearest result from the top of the document\n\t\t\tconst matchAfterSelection = findFirstIdxMonotonousOrArrLen(findMatches.map(match => match.range), range => Range.compareRangesUsingStarts(range, editorSelection) >= 0);\n\t\t\tcurrentMatchesPosition = matchAfterSelection > 0 ? matchAfterSelection - 1 + 1 /** match position is one based */ : currentMatchesPosition;\n\t\t}\n\n\t\tthis._state.changeMatchInfo(\n\t\t\tcurrentMatchesPosition,\n\t\t\tthis._decorations.getCount(),\n\t\t\tundefined\n\t\t);\n\n\t\tif (moveCursor && this._editor.getOption(EditorOption.find).cursorMoveOnType) {\n\t\t\tthis._moveToNextMatch(this._decorations.getStartPosition());\n\t\t}\n\t}\n\n\tprivate _hasMatches(): boolean {\n\t\treturn (this._state.matchesCount > 0);\n\t}\n\n\tprivate _cannotFind(): boolean {\n\t\tif (!this._hasMatches()) {\n\t\t\tconst findScope = this._decorations.getFindScope();\n\t\t\tif (findScope) {\n\t\t\t\t// Reveal the selection so user is reminded that 'selection find' is on.\n\t\t\t\tthis._editor.revealRangeInCenterIfOutsideViewport(findScope, ScrollType.Smooth);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate _setCurrentFindMatch(match: Range): void {\n\t\tconst matchesPosition = this._decorations.setCurrentFindMatch(match);\n\t\tthis._state.changeMatchInfo(\n\t\t\tmatchesPosition,\n\t\t\tthis._decorations.getCount(),\n\t\t\tmatch\n\t\t);\n\n\t\tthis._editor.setSelection(match);\n\t\tthis._editor.revealRangeInCenterIfOutsideViewport(match, ScrollType.Smooth);\n\t}\n\n\tprivate _prevSearchPosition(before: Position) {\n\t\tconst isUsingLineStops = this._state.isRegex && (\n\t\t\tthis._state.searchString.indexOf('^') >= 0\n\t\t\t|| this._state.searchString.indexOf('$') >= 0\n\t\t);\n\t\tlet { lineNumber, column } = before;\n\t\tconst model = this._editor.getModel();\n\n\t\tif (isUsingLineStops || column === 1) {\n\t\t\tif (lineNumber === 1) {\n\t\t\t\tlineNumber = model.getLineCount();\n\t\t\t} else {\n\t\t\t\tlineNumber--;\n\t\t\t}\n\t\t\tcolumn = model.getLineMaxColumn(lineNumber);\n\t\t} else {\n\t\t\tcolumn--;\n\t\t}\n\n\t\treturn new Position(lineNumber, column);\n\t}\n\n\tprivate _moveToPrevMatch(before: Position, isRecursed: boolean = false): void {\n\t\tif (!this._state.canNavigateBack()) {\n\t\t\t// we are beyond the first matched find result\n\t\t\t// instead of doing nothing, we should refocus the first item\n\t\t\tconst nextMatchRange = this._decorations.matchAfterPosition(before);\n\n\t\t\tif (nextMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(nextMatchRange);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (this._decorations.getCount() < MATCHES_LIMIT) {\n\t\t\tlet prevMatchRange = this._decorations.matchBeforePosition(before);\n\n\t\t\tif (prevMatchRange && prevMatchRange.isEmpty() && prevMatchRange.getStartPosition().equals(before)) {\n\t\t\t\tbefore = this._prevSearchPosition(before);\n\t\t\t\tprevMatchRange = this._decorations.matchBeforePosition(before);\n\t\t\t}\n\n\t\t\tif (prevMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(prevMatchRange);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._cannotFind()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst findScope = this._decorations.getFindScope();\n\t\tconst searchRange = FindModelBoundToEditorModel._getSearchRange(this._editor.getModel(), findScope);\n\n\t\t// ...(----)...|...\n\t\tif (searchRange.getEndPosition().isBefore(before)) {\n\t\t\tbefore = searchRange.getEndPosition();\n\t\t}\n\n\t\t// ...|...(----)...\n\t\tif (before.isBefore(searchRange.getStartPosition())) {\n\t\t\tbefore = searchRange.getEndPosition();\n\t\t}\n\n\t\tconst { lineNumber, column } = before;\n\t\tconst model = this._editor.getModel();\n\n\t\tlet position = new Position(lineNumber, column);\n\n\t\tlet prevMatch = model.findPreviousMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false);\n\n\t\tif (prevMatch && prevMatch.range.isEmpty() && prevMatch.range.getStartPosition().equals(position)) {\n\t\t\t// Looks like we're stuck at this position, unacceptable!\n\t\t\tposition = this._prevSearchPosition(position);\n\t\t\tprevMatch = model.findPreviousMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, false);\n\t\t}\n\n\t\tif (!prevMatch) {\n\t\t\t// there is precisely one match and selection is on top of it\n\t\t\treturn;\n\t\t}\n\n\t\tif (!isRecursed && !searchRange.containsRange(prevMatch.range)) {\n\t\t\treturn this._moveToPrevMatch(prevMatch.range.getStartPosition(), true);\n\t\t}\n\n\t\tthis._setCurrentFindMatch(prevMatch.range);\n\t}\n\n\tpublic moveToPrevMatch(): void {\n\t\tthis._moveToPrevMatch(this._editor.getSelection().getStartPosition());\n\t}\n\n\tprivate _nextSearchPosition(after: Position) {\n\t\tconst isUsingLineStops = this._state.isRegex && (\n\t\t\tthis._state.searchString.indexOf('^') >= 0\n\t\t\t|| this._state.searchString.indexOf('$') >= 0\n\t\t);\n\n\t\tlet { lineNumber, column } = after;\n\t\tconst model = this._editor.getModel();\n\n\t\tif (isUsingLineStops || column === model.getLineMaxColumn(lineNumber)) {\n\t\t\tif (lineNumber === model.getLineCount()) {\n\t\t\t\tlineNumber = 1;\n\t\t\t} else {\n\t\t\t\tlineNumber++;\n\t\t\t}\n\t\t\tcolumn = 1;\n\t\t} else {\n\t\t\tcolumn++;\n\t\t}\n\n\t\treturn new Position(lineNumber, column);\n\t}\n\n\tprivate _moveToNextMatch(after: Position): void {\n\t\tif (!this._state.canNavigateForward()) {\n\t\t\t// we are beyond the last matched find result\n\t\t\t// instead of doing nothing, we should refocus the last item\n\t\t\tconst prevMatchRange = this._decorations.matchBeforePosition(after);\n\n\t\t\tif (prevMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(prevMatchRange);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tif (this._decorations.getCount() < MATCHES_LIMIT) {\n\t\t\tlet nextMatchRange = this._decorations.matchAfterPosition(after);\n\n\t\t\tif (nextMatchRange && nextMatchRange.isEmpty() && nextMatchRange.getStartPosition().equals(after)) {\n\t\t\t\t// Looks like we're stuck at this position, unacceptable!\n\t\t\t\tafter = this._nextSearchPosition(after);\n\t\t\t\tnextMatchRange = this._decorations.matchAfterPosition(after);\n\t\t\t}\n\t\t\tif (nextMatchRange) {\n\t\t\t\tthis._setCurrentFindMatch(nextMatchRange);\n\t\t\t}\n\n\t\t\treturn;\n\t\t}\n\n\t\tconst nextMatch = this._getNextMatch(after, false, true);\n\t\tif (nextMatch) {\n\t\t\tthis._setCurrentFindMatch(nextMatch.range);\n\t\t}\n\t}\n\n\tprivate _getNextMatch(after: Position, captureMatches: boolean, forceMove: boolean, isRecursed: boolean = false): FindMatch | null {\n\t\tif (this._cannotFind()) {\n\t\t\treturn null;\n\t\t}\n\n\t\tconst findScope = this._decorations.getFindScope();\n\t\tconst searchRange = FindModelBoundToEditorModel._getSearchRange(this._editor.getModel(), findScope);\n\n\t\t// ...(----)...|...\n\t\tif (searchRange.getEndPosition().isBefore(after)) {\n\t\t\tafter = searchRange.getStartPosition();\n\t\t}\n\n\t\t// ...|...(----)...\n\t\tif (after.isBefore(searchRange.getStartPosition())) {\n\t\t\tafter = searchRange.getStartPosition();\n\t\t}\n\n\t\tconst { lineNumber, column } = after;\n\t\tconst model = this._editor.getModel();\n\n\t\tlet position = new Position(lineNumber, column);\n\n\t\tlet nextMatch = model.findNextMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, captureMatches);\n\n\t\tif (forceMove && nextMatch && nextMatch.range.isEmpty() && nextMatch.range.getStartPosition().equals(position)) {\n\t\t\t// Looks like we're stuck at this position, unacceptable!\n\t\t\tposition = this._nextSearchPosition(position);\n\t\t\tnextMatch = model.findNextMatch(this._state.searchString, position, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, captureMatches);\n\t\t}\n\n\t\tif (!nextMatch) {\n\t\t\t// there is precisely one match and selection is on top of it\n\t\t\treturn null;\n\t\t}\n\n\t\tif (!isRecursed && !searchRange.containsRange(nextMatch.range)) {\n\t\t\treturn this._getNextMatch(nextMatch.range.getEndPosition(), captureMatches, forceMove, true);\n\t\t}\n\n\t\treturn nextMatch;\n\t}\n\n\tpublic moveToNextMatch(): void {\n\t\tthis._moveToNextMatch(this._editor.getSelection().getEndPosition());\n\t}\n\n\tprivate _moveToMatch(index: number): void {\n\t\tconst decorationRange = this._decorations.getDecorationRangeAt(index);\n\t\tif (decorationRange) {\n\t\t\tthis._setCurrentFindMatch(decorationRange);\n\t\t}\n\t}\n\n\tpublic moveToMatch(index: number): void {\n\t\tthis._moveToMatch(index);\n\t}\n\n\tprivate _getReplacePattern(): ReplacePattern {\n\t\tif (this._state.isRegex) {\n\t\t\treturn parseReplaceString(this._state.replaceString);\n\t\t}\n\t\treturn ReplacePattern.fromStaticValue(this._state.replaceString);\n\t}\n\n\tpublic replace(): void {\n\t\tif (!this._hasMatches()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst replacePattern = this._getReplacePattern();\n\t\tconst selection = this._editor.getSelection();\n\t\tconst nextMatch = this._getNextMatch(selection.getStartPosition(), true, false);\n\t\tif (nextMatch) {\n\t\t\tif (selection.equalsRange(nextMatch.range)) {\n\t\t\t\t// selection sits on a find match => replace it!\n\t\t\t\tconst replaceString = replacePattern.buildReplaceString(nextMatch.matches, this._state.preserveCase);\n\n\t\t\t\tconst command = new ReplaceCommand(selection, replaceString);\n\n\t\t\t\tthis._executeEditorCommand('replace', command);\n\n\t\t\t\tthis._decorations.setStartPosition(new Position(selection.startLineNumber, selection.startColumn + replaceString.length));\n\t\t\t\tthis.research(true);\n\t\t\t} else {\n\t\t\t\tthis._decorations.setStartPosition(this._editor.getPosition());\n\t\t\t\tthis._setCurrentFindMatch(nextMatch.range);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate _findMatches(findScopes: Range[] | null, captureMatches: boolean, limitResultCount: number): FindMatch[] {\n\t\tconst searchRanges = (findScopes as [] || [null]).map((scope: Range | null) =>\n\t\t\tFindModelBoundToEditorModel._getSearchRange(this._editor.getModel(), scope)\n\t\t);\n\n\t\treturn this._editor.getModel().findMatches(this._state.searchString, searchRanges, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null, captureMatches, limitResultCount);\n\t}\n\n\tpublic replaceAll(): void {\n\t\tif (!this._hasMatches()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst findScopes = this._decorations.getFindScopes();\n\n\t\tif (findScopes === null && this._state.matchesCount >= MATCHES_LIMIT) {\n\t\t\t// Doing a replace on the entire file that is over ${MATCHES_LIMIT} matches\n\t\t\tthis._largeReplaceAll();\n\t\t} else {\n\t\t\tthis._regularReplaceAll(findScopes);\n\t\t}\n\n\t\tthis.research(false);\n\t}\n\n\tprivate _largeReplaceAll(): void {\n\t\tconst searchParams = new SearchParams(this._state.searchString, this._state.isRegex, this._state.matchCase, this._state.wholeWord ? this._editor.getOption(EditorOption.wordSeparators) : null);\n\t\tconst searchData = searchParams.parseSearchRequest();\n\t\tif (!searchData) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet searchRegex = searchData.regex;\n\t\tif (!searchRegex.multiline) {\n\t\t\tlet mod = 'mu';\n\t\t\tif (searchRegex.ignoreCase) {\n\t\t\t\tmod += 'i';\n\t\t\t}\n\t\t\tif (searchRegex.global) {\n\t\t\t\tmod += 'g';\n\t\t\t}\n\t\t\tsearchRegex = new RegExp(searchRegex.source, mod);\n\t\t}\n\n\t\tconst model = this._editor.getModel();\n\t\tconst modelText = model.getValue(EndOfLinePreference.LF);\n\t\tconst fullModelRange = model.getFullModelRange();\n\n\t\tconst replacePattern = this._getReplacePattern();\n\t\tlet resultText: string;\n\t\tconst preserveCase = this._state.preserveCase;\n\n\t\tif (replacePattern.hasReplacementPatterns || preserveCase) {\n\t\t\tresultText = modelText.replace(searchRegex, function () {\n\t\t\t\t// eslint-disable-next-line local/code-no-any-casts\n\t\t\t\treturn replacePattern.buildReplaceString(<string[]><any>arguments, preserveCase);\n\t\t\t});\n\t\t} else {\n\t\t\tresultText = modelText.replace(searchRegex, replacePattern.buildReplaceString(null, preserveCase));\n\t\t}\n\n\t\tconst command = new ReplaceCommandThatPreservesSelection(fullModelRange, resultText, this._editor.getSelection());\n\t\tthis._executeEditorCommand('replaceAll', command);\n\t}\n\n\tprivate _regularReplaceAll(findScopes: Range[] | null): void {\n\t\tconst replacePattern = this._getReplacePattern();\n\t\t// Get all the ranges (even more than the highlighted ones)\n\t\tconst matches = this._findMatches(findScopes, replacePattern.hasReplacementPatterns || this._state.preserveCase, Constants.MAX_SAFE_SMALL_INTEGER);\n\n\t\tconst replaceStrings: string[] = [];\n\t\tfor (let i = 0, len = matches.length; i < len; i++) {\n\t\t\treplaceStrings[i] = replacePattern.buildReplaceString(matches[i].matches, this._state.preserveCase);\n\t\t}\n\n\t\tconst command = new ReplaceAllCommand(this._editor.getSelection(), matches.map(m => m.range), replaceStrings);\n\t\tthis._executeEditorCommand('replaceAll', command);\n\t}\n\n\tpublic selectAllMatches(): void {\n\t\tif (!this._hasMatches()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst findScopes = this._decorations.getFindScopes();\n\n\t\t// Get all the ranges (even more than the highlighted ones)\n\t\tconst matches = this._findMatches(findScopes, false, Constants.MAX_SAFE_SMALL_INTEGER);\n\t\tlet selections = matches.map(m => new Selection(m.range.startLineNumber, m.range.startColumn, m.range.endLineNumber, m.range.endColumn));\n\n\t\t// If one of the ranges is the editor selection, then maintain it as primary\n\t\tconst editorSelection = this._editor.getSelection();\n\t\tfor (let i = 0, len = selections.length; i < len; i++) {\n\t\t\tconst sel = selections[i];\n\t\t\tif (sel.equalsRange(editorSelection)) {\n\t\t\t\tselections = [editorSelection].concat(selections.slice(0, i)).concat(selections.slice(i + 1));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tthis._editor.setSelections(selections);\n\t}\n\n\tprivate _executeEditorCommand(source: string, command: ICommand): void {\n\t\ttry {\n\t\t\tthis._ignoreModelContentChanged = true;\n\t\t\tthis._editor.pushUndoStop();\n\t\t\tthis._editor.executeCommand(source, command);\n\t\t\tthis._editor.pushUndoStop();\n\t\t} finally {\n\t\t\tthis._ignoreModelContentChanged = false;\n\t\t}\n\t}\n}\n"]}