monaco-editor-core 0.56.0-dev-20251125 → 0.56.0-dev-20251218
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/nls.keys.json +1 -1
- package/esm/nls.messages.cs.js +2 -2
- package/esm/nls.messages.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.js +1 -1
- package/esm/nls.messages.json +1 -1
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.pl.js +2 -2
- package/esm/nls.messages.pt-br.js +2 -2
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.tr.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/nls.metadata.json +34 -6
- package/esm/vs/base/browser/dom.js +1 -4
- package/esm/vs/base/browser/dom.js.map +1 -1
- package/esm/vs/base/browser/markdownRenderer.js +25 -11
- package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
- package/esm/vs/base/browser/ui/actionbar/actionViewItems.js.map +1 -1
- package/esm/vs/base/browser/ui/button/button.js +15 -8
- package/esm/vs/base/browser/ui/button/button.js.map +1 -1
- package/esm/vs/base/browser/ui/codicons/codicon/codicon-modifiers.css +3 -8
- package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/esm/vs/base/browser/ui/findinput/findInput.js +6 -1
- package/esm/vs/base/browser/ui/findinput/findInput.js.map +1 -1
- package/esm/vs/base/browser/ui/inputbox/inputBox.js +17 -1
- package/esm/vs/base/browser/ui/inputbox/inputBox.js.map +1 -1
- package/esm/vs/base/browser/ui/list/list.css +1 -0
- package/esm/vs/base/browser/ui/toggle/toggle.js +78 -6
- package/esm/vs/base/browser/ui/toggle/toggle.js.map +1 -1
- package/esm/vs/base/browser/ui/toolbar/toolbar.js +3 -0
- package/esm/vs/base/browser/ui/toolbar/toolbar.js.map +1 -1
- package/esm/vs/base/common/codiconsLibrary.js +11 -2
- package/esm/vs/base/common/codiconsLibrary.js.map +1 -1
- package/esm/vs/base/common/defaultAccount.js +6 -0
- package/esm/vs/base/common/defaultAccount.js.map +1 -0
- package/esm/vs/base/common/equals.js +73 -24
- package/esm/vs/base/common/equals.js.map +1 -1
- package/esm/vs/base/common/event.js +14 -4
- package/esm/vs/base/common/event.js.map +1 -1
- package/esm/vs/base/common/iterator.js.map +1 -1
- package/esm/vs/base/common/keybindings.js +0 -8
- package/esm/vs/base/common/keybindings.js.map +1 -1
- package/esm/vs/base/common/lifecycle.js +2 -2
- package/esm/vs/base/common/lifecycle.js.map +1 -1
- package/esm/vs/base/common/marshallingIds.js.map +1 -1
- package/esm/vs/base/common/observableInternal/index.js +1 -1
- package/esm/vs/base/common/observableInternal/index.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js +1 -1
- package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js.map +1 -1
- package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js +16 -0
- package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js.map +1 -1
- package/esm/vs/base/common/observableInternal/utils/utils.js +11 -0
- package/esm/vs/base/common/observableInternal/utils/utils.js.map +1 -1
- package/esm/vs/base/common/product.js.map +1 -1
- package/esm/vs/base/common/strings.js +3 -1
- package/esm/vs/base/common/strings.js.map +1 -1
- package/esm/vs/editor/browser/controller/dragScrolling.js +2 -1
- package/esm/vs/editor/browser/controller/dragScrolling.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js +73 -2
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +7 -51
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/screenReaderUtils.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +7 -20
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js +14 -44
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.js +19 -0
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.js.map +1 -0
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextState.js +14 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextState.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js +5 -2
- package/esm/vs/editor/browser/controller/mouseHandler.js.map +1 -1
- package/esm/vs/editor/browser/editorBrowser.js.map +1 -1
- package/esm/vs/editor/browser/observableCodeEditor.js +32 -15
- package/esm/vs/editor/browser/observableCodeEditor.js.map +1 -1
- package/esm/vs/editor/browser/services/editorWorkerService.js +6 -2
- package/esm/vs/editor/browser/services/editorWorkerService.js.map +1 -1
- package/esm/vs/editor/browser/view.js +11 -2
- package/esm/vs/editor/browser/view.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +5 -2
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js.map +1 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +10 -0
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/style.css +48 -0
- package/esm/vs/editor/common/config/editorConfigurationSchema.js +49 -47
- package/esm/vs/editor/common/config/editorConfigurationSchema.js.map +1 -1
- package/esm/vs/editor/common/config/editorOptions.js +410 -410
- package/esm/vs/editor/common/config/fontInfo.js +1 -1
- package/esm/vs/editor/common/config/fontInfo.js.map +1 -1
- package/esm/vs/editor/common/core/editorColorRegistry.js +69 -69
- package/esm/vs/editor/common/core/edits/edit.js +19 -0
- package/esm/vs/editor/common/core/edits/edit.js.map +1 -1
- package/esm/vs/editor/common/core/edits/stringEdit.js +13 -0
- package/esm/vs/editor/common/core/edits/stringEdit.js.map +1 -1
- package/esm/vs/editor/common/core/edits/textEdit.js +0 -3
- package/esm/vs/editor/common/core/edits/textEdit.js.map +1 -1
- package/esm/vs/editor/common/core/text/positionToOffsetImpl.js +24 -10
- package/esm/vs/editor/common/core/text/positionToOffsetImpl.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorMoveCommands.js +4 -4
- package/esm/vs/editor/common/cursor/cursorMoveCommands.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorWordOperations.js +6 -3
- package/esm/vs/editor/common/cursor/cursorWordOperations.js.map +1 -1
- package/esm/vs/editor/common/editorContextKeys.js +47 -47
- package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js +2 -2
- package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js.map +1 -1
- package/esm/vs/editor/common/languages/modesRegistry.js +1 -1
- package/esm/vs/editor/common/languages/nullTokenize.js +1 -1
- package/esm/vs/editor/common/languages/nullTokenize.js.map +1 -1
- package/esm/vs/editor/common/languages/supports/tokenization.js +3 -0
- package/esm/vs/editor/common/languages/supports/tokenization.js.map +1 -1
- package/esm/vs/editor/common/languages.js +58 -57
- package/esm/vs/editor/common/languages.js.map +1 -1
- package/esm/vs/editor/common/model/decorationProvider.js +21 -1
- package/esm/vs/editor/common/model/decorationProvider.js.map +1 -1
- package/esm/vs/editor/common/model/editStack.js +1 -1
- package/esm/vs/editor/common/model/textModel.js +49 -30
- package/esm/vs/editor/common/model/textModel.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/abstractSyntaxTokenBackend.js +6 -3
- package/esm/vs/editor/common/model/tokens/abstractSyntaxTokenBackend.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/annotations.js +177 -0
- package/esm/vs/editor/common/model/tokens/annotations.js.map +1 -0
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js +131 -0
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js.map +1 -0
- package/esm/vs/editor/common/model/tokens/tokenizationTextModelPart.js +9 -0
- package/esm/vs/editor/common/model/tokens/tokenizationTextModelPart.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/tokenizerSyntaxTokenBackend.js +9 -0
- package/esm/vs/editor/common/model/tokens/tokenizerSyntaxTokenBackend.js.map +1 -1
- package/esm/vs/editor/common/standaloneStrings.js +11 -11
- package/esm/vs/editor/common/textModelEditSource.js +2 -0
- package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
- package/esm/vs/editor/common/textModelEvents.js.map +1 -1
- package/esm/vs/editor/common/viewLayout/lineDecorations.js.map +1 -1
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +3 -3
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js.map +1 -1
- package/esm/vs/editor/contrib/anchorSelect/browser/anchorSelect.js +6 -6
- package/esm/vs/editor/contrib/bracketMatching/browser/bracketMatching.js +6 -6
- package/esm/vs/editor/contrib/caretOperations/browser/caretOperations.js +2 -2
- package/esm/vs/editor/contrib/caretOperations/browser/transpose.js +1 -1
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +71 -53
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js.map +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeAction.js +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeActionCommands.js +29 -29
- package/esm/vs/editor/contrib/codeAction/browser/codeActionContributions.js +3 -3
- package/esm/vs/editor/contrib/codeAction/browser/codeActionController.js +3 -3
- package/esm/vs/editor/contrib/codeAction/browser/codeActionMenu.js +8 -8
- package/esm/vs/editor/contrib/codeAction/browser/lightBulbWidget.js +9 -9
- package/esm/vs/editor/contrib/codelens/browser/codelensController.js +2 -2
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerCloseButton.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerHeader.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerActions.js +7 -7
- package/esm/vs/editor/contrib/comment/browser/comment.js +6 -6
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js +10 -10
- package/esm/vs/editor/contrib/cursorUndo/browser/cursorUndo.js +2 -2
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +4 -4
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +23 -10
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js.map +1 -1
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +8 -8
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +3 -3
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js +2 -2
- package/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js +1 -1
- package/esm/vs/editor/contrib/find/browser/findController.js +16 -16
- package/esm/vs/editor/contrib/find/browser/findWidget.js +26 -26
- package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +1 -1
- package/esm/vs/editor/contrib/folding/browser/folding.js +20 -20
- package/esm/vs/editor/contrib/folding/browser/folding.js.map +1 -1
- package/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +9 -9
- package/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +3 -3
- package/esm/vs/editor/contrib/format/browser/formatActions.js +2 -2
- package/esm/vs/editor/contrib/gotoError/browser/gotoError.js +8 -8
- package/esm/vs/editor/contrib/gotoError/browser/gotoErrorWidget.js +14 -14
- package/esm/vs/editor/contrib/gotoSymbol/browser/goToCommands.js +39 -39
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesTree.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel.js +8 -8
- package/esm/vs/editor/contrib/gotoSymbol/browser/symbolNavigation.js +3 -3
- package/esm/vs/editor/contrib/gpu/browser/gpuActions.js +4 -4
- package/esm/vs/editor/contrib/hover/browser/hover.css +1 -1
- package/esm/vs/editor/contrib/hover/browser/hoverActionIds.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/hoverActions.js +24 -24
- package/esm/vs/editor/contrib/hover/browser/hoverCopyButton.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +10 -10
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/markerHoverParticipant.js +5 -5
- package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
- package/esm/vs/editor/contrib/indentation/browser/indentation.js +20 -20
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js +1 -0
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js.map +1 -1
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsHover.js +8 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +50 -21
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +13 -12
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +7 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +5 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js +2 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/InlineSuggestAlternativeAction.js +8 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/InlineSuggestAlternativeAction.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/editKind.js +198 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/editKind.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionIsVisible.js +40 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionIsVisible.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +128 -70
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +59 -11
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js +152 -95
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js +113 -54
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +317 -75
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/telemetry.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/utils.js +20 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/utils.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +59 -42
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +29 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +78 -46
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js +9 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +11 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js +81 -41
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js +48 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js +18 -15
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.js +3 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js +6 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js +4 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js +4 -3
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js +8 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js +9 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js +203 -41
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/jumpToView.js +189 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/jumpToView.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js +85 -102
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js +75 -32
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistnaceWidgetPlacement.js +121 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistnaceWidgetPlacement.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js +2 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +22 -20
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js +15 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/view.css +39 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js +10 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js.map +1 -1
- package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
- package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +32 -32
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js.map +1 -1
- package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +2 -2
- package/esm/vs/editor/contrib/links/browser/links.js +10 -10
- package/esm/vs/editor/contrib/message/browser/messageController.js +1 -1
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +22 -22
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
- package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
- package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +25 -27
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js.map +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
- package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
- package/esm/vs/editor/contrib/rename/browser/rename.js +19 -15
- package/esm/vs/editor/contrib/rename/browser/rename.js.map +1 -1
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
- package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js +3 -2
- package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js.map +1 -1
- package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetParser.js +33 -0
- package/esm/vs/editor/contrib/snippet/browser/snippetParser.js.map +1 -1
- package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js +12 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js.map +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js +1 -0
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggest.js +9 -8
- package/esm/vs/editor/contrib/suggest/browser/suggest.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js +39 -28
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js +1 -0
- package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +22 -18
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +28 -6
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +1 -1
- package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
- package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
- package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +24 -24
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
- package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -3
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +19 -2
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js.map +1 -1
- package/esm/vs/editor/editor.api.d.ts +34 -3
- package/esm/vs/editor/standalone/browser/standaloneLanguages.js +2 -2
- package/esm/vs/editor/standalone/browser/standaloneLanguages.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneServices.js +11 -1
- package/esm/vs/editor/standalone/browser/standaloneServices.js.map +1 -1
- package/esm/vs/editor/standalone/common/monarch/monarchLexer.js +1 -1
- package/esm/vs/editor/standalone/common/monarch/monarchLexer.js.map +1 -1
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +62 -62
- package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
- package/esm/vs/platform/actionWidget/browser/actionList.js +4 -4
- package/esm/vs/platform/actionWidget/browser/actionWidget.css +11 -8
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +7 -7
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +5 -5
- package/esm/vs/platform/actions/browser/toolbar.js +2 -2
- package/esm/vs/platform/actions/common/actions.js +11 -5
- package/esm/vs/platform/actions/common/actions.js.map +1 -1
- package/esm/vs/platform/actions/common/menuService.js +2 -2
- package/esm/vs/platform/configuration/common/configurationRegistry.js +10 -10
- package/esm/vs/platform/contextkey/browser/contextKeyService.js +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +9 -9
- package/esm/vs/platform/contextkey/common/contextkeys.js +9 -9
- package/esm/vs/platform/contextkey/common/scanner.js +5 -5
- package/esm/vs/platform/{product/common/productService.js → defaultAccount/common/defaultAccount.js} +2 -2
- package/esm/vs/platform/defaultAccount/common/defaultAccount.js.map +1 -0
- package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
- package/esm/vs/platform/hover/browser/hoverWidget.js +1 -1
- package/esm/vs/platform/hover/browser/updatableHoverWidget.js +1 -1
- package/esm/vs/platform/instantiation/common/instantiation.js.map +1 -1
- package/esm/vs/platform/instantiation/common/instantiationService.js +1 -8
- package/esm/vs/platform/instantiation/common/instantiationService.js.map +1 -1
- package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
- package/esm/vs/platform/list/browser/listService.js +27 -27
- package/esm/vs/platform/log/common/log.js +1 -1
- package/esm/vs/platform/log/common/log.js.map +1 -1
- package/esm/vs/platform/markers/common/markerService.js +6 -6
- package/esm/vs/platform/markers/common/markerService.js.map +1 -1
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +8 -8
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/media/quickInput.css +45 -7
- package/esm/vs/platform/quickinput/browser/quickInput.js +51 -15
- package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
- package/esm/vs/platform/quickinput/browser/quickInputBox.js +13 -1
- package/esm/vs/platform/quickinput/browser/quickInputBox.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputController.js +22 -12
- package/esm/vs/platform/quickinput/browser/quickInputController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputList.js +17 -12
- package/esm/vs/platform/quickinput/browser/quickInputList.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +36 -8
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeController.js +3 -3
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeRenderer.js +8 -4
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeRenderer.js.map +1 -1
- package/esm/vs/platform/quickinput/common/quickInput.js.map +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +2 -2
- package/esm/vs/platform/theme/common/colors/baseColors.js +18 -17
- package/esm/vs/platform/theme/common/colors/baseColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
- package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
- package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
- package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
- package/esm/vs/platform/theme/common/colors/minimapColors.js +13 -13
- package/esm/vs/platform/theme/common/colors/minimapColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
- package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
- package/esm/vs/platform/undoRedo/common/undoRedoService.js +21 -21
- package/esm/vs/platform/undoRedo/common/undoRedoService.js.map +1 -1
- package/esm/vs/platform/window/common/window.js +1 -1
- package/esm/vs/platform/window/common/window.js.map +1 -1
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/monaco.d.ts +34 -3
- package/package.json +2 -2
- package/version.txt +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js +0 -16
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js.map +0 -1
- package/esm/vs/platform/product/common/productService.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/observableCodeEditor.ts","vs/editor/browser/observableCodeEditor.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,eAAe,EAAe,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACxG,OAAO,EAAE,aAAa,EAA6D,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,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AC;YAC7B,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,eAAe,EAAE,CAAC,GAAG,KAAK,CAAC,sBAAsB,EAAE,CAAC,EAAE,EAAE,CAAC;gBAC3E,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YAC7D,CAAC;YACD,OAAO,OAAO,CAAC;QAChB,CAAC,CAAC,CAAC;IACJ,CAAC;IAMD;;OAEG;IACH,uBAAuB,CAAC,UAAkB;QACzC,OAAO,OAAO,CAAC,MAAM,CAAC,EAAE;YACvB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC7B,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACxC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC3C,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC1C,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACJ,CAAC","file":"observableCodeEditor.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 { equalsIfDefined, itemsEquals } from '../../base/common/equals.js';\nimport { Disposable, DisposableStore, IDisposable, toDisposable } from '../../base/common/lifecycle.js';\nimport { DebugLocation, IObservable, IObservableWithChange, IReader, ITransaction, TransactionImpl, autorun, autorunOpts, derived, derivedOpts, derivedWithSetter, observableFromEvent, observableSignal, observableSignalFromEvent, observableValue, observableValueOpts } from '../../base/common/observable.js';\nimport { EditorOption, FindComputedEditorOptionValueById } from '../common/config/editorOptions.js';\nimport { LineRange } from '../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../common/core/ranges/offsetRange.js';\nimport { Position } from '../common/core/position.js';\nimport { Selection } from '../common/core/selection.js';\nimport { ICursorSelectionChangedEvent } from '../common/cursorEvents.js';\nimport { IModelDeltaDecoration, ITextModel } from '../common/model.js';\nimport { IModelContentChangedEvent } from '../common/textModelEvents.js';\nimport { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition, IEditorMouseEvent, IOverlayWidget, IOverlayWidgetPosition, IPasteEvent } from './editorBrowser.js';\nimport { Point } from '../common/core/2d/point.js';\n\n/**\n * Returns a facade for the code editor that provides observables for various states/events.\n*/\nexport function observableCodeEditor(editor: ICodeEditor): ObservableCodeEditor {\n\treturn ObservableCodeEditor.get(editor);\n}\n\nexport class ObservableCodeEditor extends Disposable {\n\tprivate static readonly _map = new Map<ICodeEditor, ObservableCodeEditor>();\n\n\t/**\n\t * Make sure that editor is not disposed yet!\n\t*/\n\tpublic static get(editor: ICodeEditor): ObservableCodeEditor {\n\t\tlet result = ObservableCodeEditor._map.get(editor);\n\t\tif (!result) {\n\t\t\tresult = new ObservableCodeEditor(editor);\n\t\t\tObservableCodeEditor._map.set(editor, result);\n\t\t\tconst d = editor.onDidDispose(() => {\n\t\t\t\tconst item = ObservableCodeEditor._map.get(editor);\n\t\t\t\tif (item) {\n\t\t\t\t\tObservableCodeEditor._map.delete(editor);\n\t\t\t\t\titem.dispose();\n\t\t\t\t\td.dispose();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate _updateCounter;\n\tprivate _currentTransaction: TransactionImpl | undefined;\n\n\tprivate _beginUpdate(): void {\n\t\tthis._updateCounter++;\n\t\tif (this._updateCounter === 1) {\n\t\t\tthis._currentTransaction = new TransactionImpl(() => {\n\t\t\t\t/** @description Update editor state */\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate _endUpdate(): void {\n\t\tthis._updateCounter--;\n\t\tif (this._updateCounter === 0) {\n\t\t\tconst t = this._currentTransaction!;\n\t\t\tthis._currentTransaction = undefined;\n\t\t\tt.finish();\n\t\t}\n\t}\n\n\tprivate constructor(public readonly editor: ICodeEditor) {\n\t\tsuper();\n\t\tthis._updateCounter = 0;\n\t\tthis._currentTransaction = undefined;\n\t\tthis._model = observableValue(this, this.editor.getModel());\n\t\tthis.model = this._model;\n\t\tthis.isReadonly = observableFromEvent(this, this.editor.onDidChangeConfiguration, () => this.editor.getOption(EditorOption.readOnly));\n\t\tthis._versionId = observableValueOpts<number | null, IModelContentChangedEvent | undefined>({ owner: this, lazy: true }, this.editor.getModel()?.getVersionId() ?? null);\n\t\tthis.versionId = this._versionId;\n\t\tthis._selections = observableValueOpts<Selection[] | null, ICursorSelectionChangedEvent | undefined>(\n\t\t\t{ owner: this, equalsFn: equalsIfDefined(itemsEquals(Selection.selectionsEqual)), lazy: true },\n\t\t\tthis.editor.getSelections() ?? null\n\t\t);\n\t\tthis.selections = this._selections;\n\t\tthis.positions = derivedOpts<readonly Position[] | null>(\n\t\t\t{ owner: this, equalsFn: equalsIfDefined(itemsEquals(Position.equals)) },\n\t\t\treader => this.selections.read(reader)?.map(s => s.getStartPosition()) ?? null\n\t\t);\n\t\tthis.isFocused = observableFromEvent(this, e => {\n\t\t\tconst d1 = this.editor.onDidFocusEditorWidget(e);\n\t\t\tconst d2 = this.editor.onDidBlurEditorWidget(e);\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\td1.dispose();\n\t\t\t\t\td2.dispose();\n\t\t\t\t}\n\t\t\t};\n\t\t}, () => this.editor.hasWidgetFocus());\n\t\tthis.isTextFocused = observableFromEvent(this, e => {\n\t\t\tconst d1 = this.editor.onDidFocusEditorText(e);\n\t\t\tconst d2 = this.editor.onDidBlurEditorText(e);\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\td1.dispose();\n\t\t\t\t\td2.dispose();\n\t\t\t\t}\n\t\t\t};\n\t\t}, () => this.editor.hasTextFocus());\n\t\tthis.inComposition = observableFromEvent(this, e => {\n\t\t\tconst d1 = this.editor.onDidCompositionStart(() => {\n\t\t\t\te(undefined);\n\t\t\t});\n\t\t\tconst d2 = this.editor.onDidCompositionEnd(() => {\n\t\t\t\te(undefined);\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\td1.dispose();\n\t\t\t\t\td2.dispose();\n\t\t\t\t}\n\t\t\t};\n\t\t}, () => this.editor.inComposition);\n\t\tthis.value = derivedWithSetter(this,\n\t\t\treader => { this.versionId.read(reader); return this.model.read(reader)?.getValue() ?? ''; },\n\t\t\t(value, tx) => {\n\t\t\t\tconst model = this.model.get();\n\t\t\t\tif (model !== null) {\n\t\t\t\t\tif (value !== model.getValue()) {\n\t\t\t\t\t\tmodel.setValue(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\tthis.valueIsEmpty = derived(this, reader => { this.versionId.read(reader); return this.editor.getModel()?.getValueLength() === 0; });\n\t\tthis.cursorSelection = derivedOpts({ owner: this, equalsFn: equalsIfDefined(Selection.selectionsEqual) }, reader => this.selections.read(reader)?.[0] ?? null);\n\t\tthis.cursorPosition = derivedOpts({ owner: this, equalsFn: Position.equals }, reader => this.selections.read(reader)?.[0]?.getPosition() ?? null);\n\t\tthis.cursorLineNumber = derived<number | null>(this, reader => this.cursorPosition.read(reader)?.lineNumber ?? null);\n\t\tthis.onDidType = observableSignal<string>(this);\n\t\tthis.onDidPaste = observableSignal<IPasteEvent>(this);\n\t\tthis.scrollTop = observableFromEvent(this.editor.onDidScrollChange, () => this.editor.getScrollTop());\n\t\tthis.scrollLeft = observableFromEvent(this.editor.onDidScrollChange, () => this.editor.getScrollLeft());\n\t\tthis.layoutInfo = observableFromEvent(this.editor.onDidLayoutChange, () => this.editor.getLayoutInfo());\n\t\tthis.layoutInfoContentLeft = this.layoutInfo.map(l => l.contentLeft);\n\t\tthis.layoutInfoDecorationsLeft = this.layoutInfo.map(l => l.decorationsLeft);\n\t\tthis.layoutInfoWidth = this.layoutInfo.map(l => l.width);\n\t\tthis.layoutInfoHeight = this.layoutInfo.map(l => l.height);\n\t\tthis.layoutInfoMinimap = this.layoutInfo.map(l => l.minimap);\n\t\tthis.layoutInfoVerticalScrollbarWidth = this.layoutInfo.map(l => l.verticalScrollbarWidth);\n\t\tthis.contentWidth = observableFromEvent(this.editor.onDidContentSizeChange, () => this.editor.getContentWidth());\n\t\tthis.contentHeight = observableFromEvent(this.editor.onDidContentSizeChange, () => this.editor.getContentHeight());\n\t\tthis._onDidChangeViewZones = observableSignalFromEvent(this, this.editor.onDidChangeViewZones);\n\t\tthis._onDidHiddenAreasChanged = observableSignalFromEvent(this, this.editor.onDidChangeHiddenAreas);\n\t\tthis._onDidLineHeightChanged = observableSignalFromEvent(this, this.editor.onDidChangeLineHeight);\n\n\t\tthis._widgetCounter = 0;\n\t\tthis.openedPeekWidgets = observableValue(this, 0);\n\n\t\tthis._register(this.editor.onBeginUpdate(() => this._beginUpdate()));\n\t\tthis._register(this.editor.onEndUpdate(() => this._endUpdate()));\n\n\t\tthis._register(this.editor.onDidChangeModel(() => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._model.set(this.editor.getModel(), this._currentTransaction);\n\t\t\t\tthis._forceUpdate();\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidType((e) => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._forceUpdate();\n\t\t\t\tthis.onDidType.trigger(this._currentTransaction, e);\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidPaste((e) => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._forceUpdate();\n\t\t\t\tthis.onDidPaste.trigger(this._currentTransaction, e);\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidChangeModelContent(e => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._versionId.set(this.editor.getModel()?.getVersionId() ?? null, this._currentTransaction, e);\n\t\t\t\tthis._forceUpdate();\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidChangeCursorSelection(e => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._selections.set(this.editor.getSelections(), this._currentTransaction, e);\n\t\t\t\tthis._forceUpdate();\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis.domNode = derived(reader => {\n\t\t\tthis.model.read(reader);\n\t\t\treturn this.editor.getDomNode();\n\t\t});\n\t}\n\n\tpublic forceUpdate(): void;\n\tpublic forceUpdate<T>(cb: (tx: ITransaction) => T): T;\n\tpublic forceUpdate<T>(cb?: (tx: ITransaction) => T): T {\n\t\tthis._beginUpdate();\n\t\ttry {\n\t\t\tthis._forceUpdate();\n\t\t\tif (!cb) { return undefined as T; }\n\t\t\treturn cb(this._currentTransaction!);\n\t\t} finally {\n\t\t\tthis._endUpdate();\n\t\t}\n\t}\n\n\tprivate _forceUpdate(): void {\n\t\tthis._beginUpdate();\n\t\ttry {\n\t\t\tthis._model.set(this.editor.getModel(), this._currentTransaction);\n\t\t\tthis._versionId.set(this.editor.getModel()?.getVersionId() ?? null, this._currentTransaction, undefined);\n\t\t\tthis._selections.set(this.editor.getSelections(), this._currentTransaction, undefined);\n\t\t} finally {\n\t\t\tthis._endUpdate();\n\t\t}\n\t}\n\n\tprivate readonly _model;\n\tpublic readonly model: IObservable<ITextModel | null>;\n\n\tpublic readonly isReadonly;\n\n\tprivate readonly _versionId;\n\tpublic readonly versionId: IObservableWithChange<number | null, IModelContentChangedEvent | undefined>;\n\n\tprivate readonly _selections;\n\tpublic readonly selections: IObservableWithChange<Selection[] | null, ICursorSelectionChangedEvent | undefined>;\n\n\n\tpublic readonly positions;\n\n\tpublic readonly isFocused;\n\n\tpublic readonly isTextFocused;\n\n\tpublic readonly inComposition;\n\n\tpublic readonly value;\n\tpublic readonly valueIsEmpty;\n\tpublic readonly cursorSelection;\n\tpublic readonly cursorPosition;\n\tpublic readonly cursorLineNumber;\n\n\tpublic readonly onDidType;\n\tpublic readonly onDidPaste;\n\n\tpublic readonly scrollTop;\n\tpublic readonly scrollLeft;\n\n\tpublic readonly layoutInfo;\n\tpublic readonly layoutInfoContentLeft;\n\tpublic readonly layoutInfoDecorationsLeft;\n\tpublic readonly layoutInfoWidth;\n\tpublic readonly layoutInfoHeight;\n\tpublic readonly layoutInfoMinimap;\n\tpublic readonly layoutInfoVerticalScrollbarWidth;\n\n\tpublic readonly contentWidth;\n\tpublic readonly contentHeight;\n\n\tpublic readonly domNode;\n\n\tpublic getOption<T extends EditorOption>(id: T, debugLocation = DebugLocation.ofCaller()): IObservable<FindComputedEditorOptionValueById<T>> {\n\t\treturn observableFromEvent(this, cb => this.editor.onDidChangeConfiguration(e => {\n\t\t\tif (e.hasChanged(id)) { cb(undefined); }\n\t\t}), () => this.editor.getOption(id), debugLocation);\n\t}\n\n\tpublic setDecorations(decorations: IObservable<IModelDeltaDecoration[]>): IDisposable {\n\t\tconst d = new DisposableStore();\n\t\tconst decorationsCollection = this.editor.createDecorationsCollection();\n\t\td.add(autorunOpts({ owner: this, debugName: () => `Apply decorations from ${decorations.debugName}` }, reader => {\n\t\t\tconst d = decorations.read(reader);\n\t\t\tdecorationsCollection.set(d);\n\t\t}));\n\t\td.add({\n\t\t\tdispose: () => {\n\t\t\t\tdecorationsCollection.clear();\n\t\t\t}\n\t\t});\n\t\treturn d;\n\t}\n\n\tprivate _widgetCounter;\n\n\tpublic createOverlayWidget(widget: IObservableOverlayWidget): IDisposable {\n\t\tconst overlayWidgetId = 'observableOverlayWidget' + (this._widgetCounter++);\n\t\tconst w: IOverlayWidget = {\n\t\t\tgetDomNode: () => widget.domNode,\n\t\t\tgetPosition: () => widget.position.get(),\n\t\t\tgetId: () => overlayWidgetId,\n\t\t\tallowEditorOverflow: widget.allowEditorOverflow,\n\t\t\tgetMinContentWidthInPx: () => widget.minContentWidthInPx.get(),\n\t\t};\n\t\tthis.editor.addOverlayWidget(w);\n\t\tconst d = autorun(reader => {\n\t\t\twidget.position.read(reader);\n\t\t\twidget.minContentWidthInPx.read(reader);\n\t\t\tthis.editor.layoutOverlayWidget(w);\n\t\t});\n\t\treturn toDisposable(() => {\n\t\t\td.dispose();\n\t\t\tthis.editor.removeOverlayWidget(w);\n\t\t});\n\t}\n\n\tpublic createContentWidget(widget: IObservableContentWidget): IDisposable {\n\t\tconst contentWidgetId = 'observableContentWidget' + (this._widgetCounter++);\n\t\tconst w: IContentWidget = {\n\t\t\tgetDomNode: () => widget.domNode,\n\t\t\tgetPosition: () => widget.position.get(),\n\t\t\tgetId: () => contentWidgetId,\n\t\t\tallowEditorOverflow: widget.allowEditorOverflow,\n\t\t};\n\t\tthis.editor.addContentWidget(w);\n\t\tconst d = autorun(reader => {\n\t\t\twidget.position.read(reader);\n\t\t\tthis.editor.layoutContentWidget(w);\n\t\t});\n\t\treturn toDisposable(() => {\n\t\t\td.dispose();\n\t\t\tthis.editor.removeContentWidget(w);\n\t\t});\n\t}\n\n\tpublic observeLineOffsetRange(lineRange: IObservable<LineRange>, store: DisposableStore): IObservable<OffsetRange> {\n\t\tconst start = this.observePosition(lineRange.map(r => new Position(r.startLineNumber, 1)), store);\n\t\tconst end = this.observePosition(lineRange.map(r => new Position(r.endLineNumberExclusive + 1, 1)), store);\n\n\t\treturn derived(reader => {\n\t\t\tstart.read(reader);\n\t\t\tend.read(reader);\n\t\t\tconst range = lineRange.read(reader);\n\t\t\tconst lineCount = this.model.read(reader)?.getLineCount();\n\t\t\tconst s = (\n\t\t\t\t(typeof lineCount !== 'undefined' && range.startLineNumber > lineCount\n\t\t\t\t\t? this.editor.getBottomForLineNumber(lineCount)\n\t\t\t\t\t: this.editor.getTopForLineNumber(range.startLineNumber)\n\t\t\t\t)\n\t\t\t\t- this.scrollTop.read(reader)\n\t\t\t);\n\t\t\tconst e = range.isEmpty ? s : (this.editor.getBottomForLineNumber(range.endLineNumberExclusive - 1) - this.scrollTop.read(reader));\n\t\t\treturn new OffsetRange(s, e);\n\t\t});\n\t}\n\n\t/**\n\t * Uses an approximation if the exact position cannot be determined.\n\t */\n\tgetLeftOfPosition(position: Position, reader: IReader | undefined): number {\n\t\tthis.layoutInfo.read(reader);\n\t\tthis.value.read(reader);\n\n\t\tlet offset = this.editor.getOffsetForColumn(position.lineNumber, position.column);\n\t\tif (offset === -1) {\n\t\t\t// approximation\n\t\t\tconst typicalHalfwidthCharacterWidth = this.editor.getOption(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;\n\t\t\tconst approximation = position.column * typicalHalfwidthCharacterWidth;\n\t\t\toffset = approximation;\n\t\t}\n\t\treturn offset;\n\t}\n\n\tpublic observePosition(position: IObservable<Position | null>, store: DisposableStore): IObservable<Point | null> {\n\t\tlet pos = position.get();\n\t\tconst result = observableValueOpts<Point | null>({ owner: this, debugName: () => `topLeftOfPosition${pos?.toString()}`, equalsFn: equalsIfDefined(Point.equals) }, new Point(0, 0));\n\t\tconst contentWidgetId = `observablePositionWidget` + (this._widgetCounter++);\n\t\tconst domNode = document.createElement('div');\n\t\tconst w: IContentWidget = {\n\t\t\tgetDomNode: () => domNode,\n\t\t\tgetPosition: () => {\n\t\t\t\treturn pos ? { preference: [ContentWidgetPositionPreference.EXACT], position: position.get() } : null;\n\t\t\t},\n\t\t\tgetId: () => contentWidgetId,\n\t\t\tallowEditorOverflow: false,\n\t\t\tafterRender: (position, coordinate) => {\n\t\t\t\tconst model = this._model.get();\n\t\t\t\tif (model && pos && pos.lineNumber > model.getLineCount()) {\n\t\t\t\t\t// the position is after the last line\n\t\t\t\t\tresult.set(new Point(0, this.editor.getBottomForLineNumber(model.getLineCount()) - this.scrollTop.get()), undefined);\n\t\t\t\t} else {\n\t\t\t\t\tresult.set(coordinate ? new Point(coordinate.left, coordinate.top) : null, undefined);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t\tthis.editor.addContentWidget(w);\n\t\tstore.add(autorun(reader => {\n\t\t\tpos = position.read(reader);\n\t\t\tthis.editor.layoutContentWidget(w);\n\t\t}));\n\t\tstore.add(toDisposable(() => {\n\t\t\tthis.editor.removeContentWidget(w);\n\t\t}));\n\t\treturn result;\n\t}\n\n\tpublic readonly openedPeekWidgets;\n\n\tisTargetHovered(predicate: (target: IEditorMouseEvent) => boolean, store: DisposableStore): IObservable<boolean> {\n\t\tconst isHovered = observableValue('isInjectedTextHovered', false);\n\t\tstore.add(this.editor.onMouseMove(e => {\n\t\t\tconst val = predicate(e);\n\t\t\tisHovered.set(val, undefined);\n\t\t}));\n\n\t\tstore.add(this.editor.onMouseLeave(E => {\n\t\t\tisHovered.set(false, undefined);\n\t\t}));\n\t\treturn isHovered;\n\t}\n\n\tobserveLineHeightForPosition(position: IObservable<Position> | Position): IObservable<number>;\n\tobserveLineHeightForPosition(position: IObservable<null>): IObservable<null>;\n\tobserveLineHeightForPosition(position: IObservable<Position | null> | Position): IObservable<number | null> {\n\t\treturn derived(reader => {\n\t\t\tconst pos = position instanceof Position ? position : position.read(reader);\n\t\t\tif (pos === null) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tthis.getOption(EditorOption.lineHeight).read(reader);\n\n\t\t\treturn this.editor.getLineHeightForPosition(pos);\n\t\t});\n\t}\n\n\tobserveLineHeightForLine(lineNumber: IObservable<number> | number): IObservable<number>;\n\tobserveLineHeightForLine(lineNumber: IObservable<null>): IObservable<null>;\n\tobserveLineHeightForLine(lineNumber: IObservable<number | null> | number): IObservable<number | null> {\n\t\tif (typeof lineNumber === 'number') {\n\t\t\treturn this.observeLineHeightForPosition(new Position(lineNumber, 1));\n\t\t}\n\n\t\treturn derived(reader => {\n\t\t\tconst line = lineNumber.read(reader);\n\t\t\tif (line === null) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn this.observeLineHeightForPosition(new Position(line, 1)).read(reader);\n\t\t});\n\t}\n\n\tobserveLineHeightsForLineRange(lineNumber: IObservable<LineRange> | LineRange): IObservable<number[]> {\n\t\treturn derived(reader => {\n\t\t\tconst range = lineNumber instanceof LineRange ? lineNumber : lineNumber.read(reader);\n\n\t\t\tconst heights: number[] = [];\n\t\t\tfor (let i = range.startLineNumber; i < range.endLineNumberExclusive; i++) {\n\t\t\t\theights.push(this.observeLineHeightForLine(i).read(reader));\n\t\t\t}\n\t\t\treturn heights;\n\t\t});\n\t}\n\n\tprivate readonly _onDidChangeViewZones;\n\tprivate readonly _onDidHiddenAreasChanged;\n\tprivate readonly _onDidLineHeightChanged;\n\n\t/**\n\t * Get the vertical position (top offset) for the line's bottom w.r.t. to the first line.\n\t */\n\tobserveTopForLineNumber(lineNumber: number): IObservable<number> {\n\t\treturn derived(reader => {\n\t\t\tthis.layoutInfo.read(reader);\n\t\t\tthis._onDidChangeViewZones.read(reader);\n\t\t\tthis._onDidHiddenAreasChanged.read(reader);\n\t\t\tthis._onDidLineHeightChanged.read(reader);\n\t\t\tthis._versionId.read(reader);\n\t\t\treturn this.editor.getTopForLineNumber(lineNumber);\n\t\t});\n\t}\n}\n\ninterface IObservableOverlayWidget {\n\tget domNode(): HTMLElement;\n\treadonly position: IObservable<IOverlayWidgetPosition | null>;\n\treadonly minContentWidthInPx: IObservable<number>;\n\tget allowEditorOverflow(): boolean;\n}\n\ninterface IObservableContentWidget {\n\tget domNode(): HTMLElement;\n\treadonly position: IObservable<IContentWidgetPosition | null>;\n\tget allowEditorOverflow(): boolean;\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 { equalsIfDefined, itemsEquals } from '../../base/common/equals.js';\nimport { Disposable, DisposableStore, IDisposable, toDisposable } from '../../base/common/lifecycle.js';\nimport { DebugLocation, IObservable, IObservableWithChange, IReader, ITransaction, TransactionImpl, autorun, autorunOpts, derived, derivedOpts, derivedWithSetter, observableFromEvent, observableSignal, observableSignalFromEvent, observableValue, observableValueOpts } from '../../base/common/observable.js';\nimport { EditorOption, FindComputedEditorOptionValueById } from '../common/config/editorOptions.js';\nimport { LineRange } from '../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../common/core/ranges/offsetRange.js';\nimport { Position } from '../common/core/position.js';\nimport { Selection } from '../common/core/selection.js';\nimport { ICursorSelectionChangedEvent } from '../common/cursorEvents.js';\nimport { IModelDeltaDecoration, ITextModel } from '../common/model.js';\nimport { IModelContentChangedEvent } from '../common/textModelEvents.js';\nimport { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition, IEditorMouseEvent, IOverlayWidget, IOverlayWidgetPosition, IPasteEvent } from './editorBrowser.js';\nimport { Point } from '../common/core/2d/point.js';\n\n/**\n * Returns a facade for the code editor that provides observables for various states/events.\n*/\nexport function observableCodeEditor(editor: ICodeEditor): ObservableCodeEditor {\n\treturn ObservableCodeEditor.get(editor);\n}\n\nexport class ObservableCodeEditor extends Disposable {\n\tprivate static readonly _map = new Map<ICodeEditor, ObservableCodeEditor>();\n\n\t/**\n\t * Make sure that editor is not disposed yet!\n\t*/\n\tpublic static get(editor: ICodeEditor): ObservableCodeEditor {\n\t\tlet result = ObservableCodeEditor._map.get(editor);\n\t\tif (!result) {\n\t\t\tresult = new ObservableCodeEditor(editor);\n\t\t\tObservableCodeEditor._map.set(editor, result);\n\t\t\tconst d = editor.onDidDispose(() => {\n\t\t\t\tconst item = ObservableCodeEditor._map.get(editor);\n\t\t\t\tif (item) {\n\t\t\t\t\tObservableCodeEditor._map.delete(editor);\n\t\t\t\t\titem.dispose();\n\t\t\t\t\td.dispose();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate _updateCounter;\n\tprivate _currentTransaction: TransactionImpl | undefined;\n\n\tprivate _beginUpdate(): void {\n\t\tthis._updateCounter++;\n\t\tif (this._updateCounter === 1) {\n\t\t\tthis._currentTransaction = new TransactionImpl(() => {\n\t\t\t\t/** @description Update editor state */\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate _endUpdate(): void {\n\t\tthis._updateCounter--;\n\t\tif (this._updateCounter === 0) {\n\t\t\tconst t = this._currentTransaction!;\n\t\t\tthis._currentTransaction = undefined;\n\t\t\tt.finish();\n\t\t}\n\t}\n\n\tprivate constructor(public readonly editor: ICodeEditor) {\n\t\tsuper();\n\t\tthis._updateCounter = 0;\n\t\tthis._currentTransaction = undefined;\n\t\tthis._model = observableValue(this, this.editor.getModel());\n\t\tthis.model = this._model;\n\t\tthis.isReadonly = observableFromEvent(this, this.editor.onDidChangeConfiguration, () => this.editor.getOption(EditorOption.readOnly));\n\t\tthis._versionId = observableValueOpts<number | null, IModelContentChangedEvent | undefined>({ owner: this, lazy: true }, this.editor.getModel()?.getVersionId() ?? null);\n\t\tthis.versionId = this._versionId;\n\t\tthis._selections = observableValueOpts<Selection[] | null, ICursorSelectionChangedEvent | undefined>(\n\t\t\t{ owner: this, equalsFn: equalsIfDefined(itemsEquals(Selection.selectionsEqual)), lazy: true },\n\t\t\tthis.editor.getSelections() ?? null\n\t\t);\n\t\tthis.selections = this._selections;\n\t\tthis.positions = derivedOpts<readonly Position[] | null>(\n\t\t\t{ owner: this, equalsFn: equalsIfDefined(itemsEquals(Position.equals)) },\n\t\t\treader => this.selections.read(reader)?.map(s => s.getStartPosition()) ?? null\n\t\t);\n\t\tthis.isFocused = observableFromEvent(this, e => {\n\t\t\tconst d1 = this.editor.onDidFocusEditorWidget(e);\n\t\t\tconst d2 = this.editor.onDidBlurEditorWidget(e);\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\td1.dispose();\n\t\t\t\t\td2.dispose();\n\t\t\t\t}\n\t\t\t};\n\t\t}, () => this.editor.hasWidgetFocus());\n\t\tthis.isTextFocused = observableFromEvent(this, e => {\n\t\t\tconst d1 = this.editor.onDidFocusEditorText(e);\n\t\t\tconst d2 = this.editor.onDidBlurEditorText(e);\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\td1.dispose();\n\t\t\t\t\td2.dispose();\n\t\t\t\t}\n\t\t\t};\n\t\t}, () => this.editor.hasTextFocus());\n\t\tthis.inComposition = observableFromEvent(this, e => {\n\t\t\tconst d1 = this.editor.onDidCompositionStart(() => {\n\t\t\t\te(undefined);\n\t\t\t});\n\t\t\tconst d2 = this.editor.onDidCompositionEnd(() => {\n\t\t\t\te(undefined);\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\td1.dispose();\n\t\t\t\t\td2.dispose();\n\t\t\t\t}\n\t\t\t};\n\t\t}, () => this.editor.inComposition);\n\t\tthis.value = derivedWithSetter(this,\n\t\t\treader => { this.versionId.read(reader); return this.model.read(reader)?.getValue() ?? ''; },\n\t\t\t(value, tx) => {\n\t\t\t\tconst model = this.model.get();\n\t\t\t\tif (model !== null) {\n\t\t\t\t\tif (value !== model.getValue()) {\n\t\t\t\t\t\tmodel.setValue(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\tthis.valueIsEmpty = derived(this, reader => { this.versionId.read(reader); return this.editor.getModel()?.getValueLength() === 0; });\n\t\tthis.cursorSelection = derivedOpts({ owner: this, equalsFn: equalsIfDefined(Selection.selectionsEqual) }, reader => this.selections.read(reader)?.[0] ?? null);\n\t\tthis.cursorPosition = derivedOpts({ owner: this, equalsFn: Position.equals }, reader => this.selections.read(reader)?.[0]?.getPosition() ?? null);\n\t\tthis.cursorLineNumber = derived<number | null>(this, reader => this.cursorPosition.read(reader)?.lineNumber ?? null);\n\t\tthis.onDidType = observableSignal<string>(this);\n\t\tthis.onDidPaste = observableSignal<IPasteEvent>(this);\n\t\tthis.scrollTop = observableFromEvent(this.editor.onDidScrollChange, () => this.editor.getScrollTop());\n\t\tthis.scrollLeft = observableFromEvent(this.editor.onDidScrollChange, () => this.editor.getScrollLeft());\n\t\tthis.layoutInfo = observableFromEvent(this.editor.onDidLayoutChange, () => this.editor.getLayoutInfo());\n\t\tthis.layoutInfoContentLeft = this.layoutInfo.map(l => l.contentLeft);\n\t\tthis.layoutInfoDecorationsLeft = this.layoutInfo.map(l => l.decorationsLeft);\n\t\tthis.layoutInfoWidth = this.layoutInfo.map(l => l.width);\n\t\tthis.layoutInfoHeight = this.layoutInfo.map(l => l.height);\n\t\tthis.layoutInfoMinimap = this.layoutInfo.map(l => l.minimap);\n\t\tthis.layoutInfoVerticalScrollbarWidth = this.layoutInfo.map(l => l.verticalScrollbarWidth);\n\t\tthis.contentWidth = observableFromEvent(this.editor.onDidContentSizeChange, () => this.editor.getContentWidth());\n\t\tthis.contentHeight = observableFromEvent(this.editor.onDidContentSizeChange, () => this.editor.getContentHeight());\n\t\tthis._onDidChangeViewZones = observableSignalFromEvent(this, this.editor.onDidChangeViewZones);\n\t\tthis._onDidHiddenAreasChanged = observableSignalFromEvent(this, this.editor.onDidChangeHiddenAreas);\n\t\tthis._onDidLineHeightChanged = observableSignalFromEvent(this, this.editor.onDidChangeLineHeight);\n\n\t\tthis._widgetCounter = 0;\n\t\tthis.openedPeekWidgets = observableValue(this, 0);\n\n\t\tthis._register(this.editor.onBeginUpdate(() => this._beginUpdate()));\n\t\tthis._register(this.editor.onEndUpdate(() => this._endUpdate()));\n\n\t\tthis._register(this.editor.onDidChangeModel(() => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._model.set(this.editor.getModel(), this._currentTransaction);\n\t\t\t\tthis._forceUpdate();\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidType((e) => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._forceUpdate();\n\t\t\t\tthis.onDidType.trigger(this._currentTransaction, e);\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidPaste((e) => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._forceUpdate();\n\t\t\t\tthis.onDidPaste.trigger(this._currentTransaction, e);\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidChangeModelContent(e => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._versionId.set(this.editor.getModel()?.getVersionId() ?? null, this._currentTransaction, e);\n\t\t\t\tthis._forceUpdate();\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidChangeCursorSelection(e => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._selections.set(this.editor.getSelections(), this._currentTransaction, e);\n\t\t\t\tthis._forceUpdate();\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis.domNode = derived(reader => {\n\t\t\tthis.model.read(reader);\n\t\t\treturn this.editor.getDomNode();\n\t\t});\n\t}\n\n\tpublic forceUpdate(): void;\n\tpublic forceUpdate<T>(cb: (tx: ITransaction) => T): T;\n\tpublic forceUpdate<T>(cb?: (tx: ITransaction) => T): T {\n\t\tthis._beginUpdate();\n\t\ttry {\n\t\t\tthis._forceUpdate();\n\t\t\tif (!cb) { return undefined as T; }\n\t\t\treturn cb(this._currentTransaction!);\n\t\t} finally {\n\t\t\tthis._endUpdate();\n\t\t}\n\t}\n\n\tprivate _forceUpdate(): void {\n\t\tthis._beginUpdate();\n\t\ttry {\n\t\t\tthis._model.set(this.editor.getModel(), this._currentTransaction);\n\t\t\tthis._versionId.set(this.editor.getModel()?.getVersionId() ?? null, this._currentTransaction, undefined);\n\t\t\tthis._selections.set(this.editor.getSelections(), this._currentTransaction, undefined);\n\t\t} finally {\n\t\t\tthis._endUpdate();\n\t\t}\n\t}\n\n\tprivate readonly _model;\n\tpublic readonly model: IObservable<ITextModel | null>;\n\n\tpublic readonly isReadonly;\n\n\tprivate readonly _versionId;\n\tpublic readonly versionId: IObservableWithChange<number | null, IModelContentChangedEvent | undefined>;\n\n\tprivate readonly _selections;\n\tpublic readonly selections: IObservableWithChange<Selection[] | null, ICursorSelectionChangedEvent | undefined>;\n\n\n\tpublic readonly positions;\n\n\tpublic readonly isFocused;\n\n\tpublic readonly isTextFocused;\n\n\tpublic readonly inComposition;\n\n\tpublic readonly value;\n\tpublic readonly valueIsEmpty;\n\tpublic readonly cursorSelection;\n\tpublic readonly cursorPosition;\n\tpublic readonly cursorLineNumber;\n\n\tpublic readonly onDidType;\n\tpublic readonly onDidPaste;\n\n\tpublic readonly scrollTop;\n\tpublic readonly scrollLeft;\n\n\tpublic readonly layoutInfo;\n\tpublic readonly layoutInfoContentLeft;\n\tpublic readonly layoutInfoDecorationsLeft;\n\tpublic readonly layoutInfoWidth;\n\tpublic readonly layoutInfoHeight;\n\tpublic readonly layoutInfoMinimap;\n\tpublic readonly layoutInfoVerticalScrollbarWidth;\n\n\tpublic readonly contentWidth;\n\tpublic readonly contentHeight;\n\n\tpublic readonly domNode;\n\n\tpublic getOption<T extends EditorOption>(id: T, debugLocation = DebugLocation.ofCaller()): IObservable<FindComputedEditorOptionValueById<T>> {\n\t\treturn observableFromEvent(this, cb => this.editor.onDidChangeConfiguration(e => {\n\t\t\tif (e.hasChanged(id)) { cb(undefined); }\n\t\t}), () => this.editor.getOption(id), debugLocation);\n\t}\n\n\tpublic setDecorations(decorations: IObservable<IModelDeltaDecoration[]>): IDisposable {\n\t\tconst d = new DisposableStore();\n\t\tconst decorationsCollection = this.editor.createDecorationsCollection();\n\t\td.add(autorunOpts({ owner: this, debugName: () => `Apply decorations from ${decorations.debugName}` }, reader => {\n\t\t\tconst d = decorations.read(reader);\n\t\t\tdecorationsCollection.set(d);\n\t\t}));\n\t\td.add({\n\t\t\tdispose: () => {\n\t\t\t\tdecorationsCollection.clear();\n\t\t\t}\n\t\t});\n\t\treturn d;\n\t}\n\n\tprivate _widgetCounter;\n\n\tpublic createOverlayWidget(widget: IObservableOverlayWidget): IDisposable {\n\t\tconst overlayWidgetId = 'observableOverlayWidget' + (this._widgetCounter++);\n\t\tconst w: IOverlayWidget = {\n\t\t\tgetDomNode: () => widget.domNode,\n\t\t\tgetPosition: () => widget.position.get(),\n\t\t\tgetId: () => overlayWidgetId,\n\t\t\tallowEditorOverflow: widget.allowEditorOverflow,\n\t\t\tgetMinContentWidthInPx: () => widget.minContentWidthInPx.get(),\n\t\t};\n\t\tthis.editor.addOverlayWidget(w);\n\t\tconst d = autorun(reader => {\n\t\t\twidget.position.read(reader);\n\t\t\twidget.minContentWidthInPx.read(reader);\n\t\t\tthis.editor.layoutOverlayWidget(w);\n\t\t});\n\t\treturn toDisposable(() => {\n\t\t\td.dispose();\n\t\t\tthis.editor.removeOverlayWidget(w);\n\t\t});\n\t}\n\n\tpublic createContentWidget(widget: IObservableContentWidget): IDisposable {\n\t\tconst contentWidgetId = 'observableContentWidget' + (this._widgetCounter++);\n\t\tconst w: IContentWidget = {\n\t\t\tgetDomNode: () => widget.domNode,\n\t\t\tgetPosition: () => widget.position.get(),\n\t\t\tgetId: () => contentWidgetId,\n\t\t\tallowEditorOverflow: widget.allowEditorOverflow,\n\t\t};\n\t\tthis.editor.addContentWidget(w);\n\t\tconst d = autorun(reader => {\n\t\t\twidget.position.read(reader);\n\t\t\tthis.editor.layoutContentWidget(w);\n\t\t});\n\t\treturn toDisposable(() => {\n\t\t\td.dispose();\n\t\t\tthis.editor.removeContentWidget(w);\n\t\t});\n\t}\n\n\tpublic observeLineOffsetRange(lineRange: IObservable<LineRange>, store: DisposableStore): IObservable<OffsetRange> {\n\t\tconst start = this.observePosition(lineRange.map(r => new Position(r.startLineNumber, 1)), store);\n\t\tconst end = this.observePosition(lineRange.map(r => new Position(r.endLineNumberExclusive + 1, 1)), store);\n\n\t\treturn derived(reader => {\n\t\t\tstart.read(reader);\n\t\t\tend.read(reader);\n\t\t\tconst range = lineRange.read(reader);\n\t\t\tconst lineCount = this.model.read(reader)?.getLineCount();\n\t\t\tconst s = (\n\t\t\t\t(typeof lineCount !== 'undefined' && range.startLineNumber > lineCount\n\t\t\t\t\t? this.editor.getBottomForLineNumber(lineCount)\n\t\t\t\t\t: this.editor.getTopForLineNumber(range.startLineNumber)\n\t\t\t\t)\n\t\t\t\t- this.scrollTop.read(reader)\n\t\t\t);\n\t\t\tconst e = range.isEmpty ? s : (this.editor.getBottomForLineNumber(range.endLineNumberExclusive - 1) - this.scrollTop.read(reader));\n\t\t\treturn new OffsetRange(s, e);\n\t\t});\n\t}\n\n\t/**\n\t * Uses an approximation if the exact position cannot be determined.\n\t */\n\tgetLeftOfPosition(position: Position, reader: IReader | undefined): number {\n\t\tthis.layoutInfo.read(reader);\n\t\tthis.value.read(reader);\n\n\t\tlet offset = this.editor.getOffsetForColumn(position.lineNumber, position.column);\n\t\tif (offset === -1) {\n\t\t\t// approximation\n\t\t\tconst typicalHalfwidthCharacterWidth = this.editor.getOption(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;\n\t\t\tconst approximation = position.column * typicalHalfwidthCharacterWidth;\n\t\t\toffset = approximation;\n\t\t}\n\t\treturn offset;\n\t}\n\n\tpublic observePosition(position: IObservable<Position | null>, store: DisposableStore): IObservable<Point | null> {\n\t\tlet pos = position.get();\n\t\tconst result = observableValueOpts<Point | null>({ owner: this, debugName: () => `topLeftOfPosition${pos?.toString()}`, equalsFn: equalsIfDefined(Point.equals) }, new Point(0, 0));\n\t\tconst contentWidgetId = `observablePositionWidget` + (this._widgetCounter++);\n\t\tconst domNode = document.createElement('div');\n\t\tconst w: IContentWidget = {\n\t\t\tgetDomNode: () => domNode,\n\t\t\tgetPosition: () => {\n\t\t\t\treturn pos ? { preference: [ContentWidgetPositionPreference.EXACT], position: position.get() } : null;\n\t\t\t},\n\t\t\tgetId: () => contentWidgetId,\n\t\t\tallowEditorOverflow: false,\n\t\t\tafterRender: (position, coordinate) => {\n\t\t\t\tconst model = this._model.get();\n\t\t\t\tif (model && pos && pos.lineNumber > model.getLineCount()) {\n\t\t\t\t\t// the position is after the last line\n\t\t\t\t\tresult.set(new Point(0, this.editor.getBottomForLineNumber(model.getLineCount()) - this.scrollTop.get()), undefined);\n\t\t\t\t} else {\n\t\t\t\t\tresult.set(coordinate ? new Point(coordinate.left, coordinate.top) : null, undefined);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t\tthis.editor.addContentWidget(w);\n\t\tstore.add(autorun(reader => {\n\t\t\tpos = position.read(reader);\n\t\t\tthis.editor.layoutContentWidget(w);\n\t\t}));\n\t\tstore.add(toDisposable(() => {\n\t\t\tthis.editor.removeContentWidget(w);\n\t\t}));\n\t\treturn result;\n\t}\n\n\tpublic readonly openedPeekWidgets;\n\n\tisTargetHovered(predicate: (target: IEditorMouseEvent) => boolean, store: DisposableStore): IObservable<boolean> {\n\t\tconst isHovered = observableValue('isInjectedTextHovered', false);\n\t\tstore.add(this.editor.onMouseMove(e => {\n\t\t\tconst val = predicate(e);\n\t\t\tisHovered.set(val, undefined);\n\t\t}));\n\n\t\tstore.add(this.editor.onMouseLeave(E => {\n\t\t\tisHovered.set(false, undefined);\n\t\t}));\n\t\treturn isHovered;\n\t}\n\n\tobserveLineHeightForPosition(position: IObservable<Position> | Position): IObservable<number>;\n\tobserveLineHeightForPosition(position: IObservable<null>): IObservable<null>;\n\tobserveLineHeightForPosition(position: IObservable<Position | null> | Position): IObservable<number | null> {\n\t\treturn derived(reader => {\n\t\t\tconst pos = position instanceof Position ? position : position.read(reader);\n\t\t\tif (pos === null) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tthis.getOption(EditorOption.lineHeight).read(reader);\n\n\t\t\treturn this.editor.getLineHeightForPosition(pos);\n\t\t});\n\t}\n\n\tobserveLineHeightForLine(lineNumber: IObservable<number> | number): IObservable<number>;\n\tobserveLineHeightForLine(lineNumber: IObservable<null>): IObservable<null>;\n\tobserveLineHeightForLine(lineNumber: IObservable<number | null> | number): IObservable<number | null> {\n\t\tif (typeof lineNumber === 'number') {\n\t\t\treturn this.observeLineHeightForPosition(new Position(lineNumber, 1));\n\t\t}\n\n\t\treturn derived(reader => {\n\t\t\tconst line = lineNumber.read(reader);\n\t\t\tif (line === null) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn this.observeLineHeightForPosition(new Position(line, 1)).read(reader);\n\t\t});\n\t}\n\n\tobserveLineHeightsForLineRange(lineNumber: IObservable<LineRange> | LineRange): IObservable<number[]> {\n\t\treturn derived(reader => {\n\t\t\tconst range = lineNumber instanceof LineRange ? lineNumber : lineNumber.read(reader);\n\n\t\t\tconst heights: number[] = [];\n\t\t\tfor (let i = range.startLineNumber; i < range.endLineNumberExclusive; i++) {\n\t\t\t\theights.push(this.observeLineHeightForLine(i).read(reader));\n\t\t\t}\n\t\t\treturn heights;\n\t\t});\n\t}\n\n\tprivate readonly _onDidChangeViewZones;\n\tprivate readonly _onDidHiddenAreasChanged;\n\tprivate readonly _onDidLineHeightChanged;\n\n\t/**\n\t * Get the vertical position (top offset) for the line's bottom w.r.t. to the first line.\n\t */\n\tobserveTopForLineNumber(lineNumber: number): IObservable<number> {\n\t\treturn derived(reader => {\n\t\t\tthis.layoutInfo.read(reader);\n\t\t\tthis._onDidChangeViewZones.read(reader);\n\t\t\tthis._onDidHiddenAreasChanged.read(reader);\n\t\t\tthis._onDidLineHeightChanged.read(reader);\n\t\t\tthis._versionId.read(reader);\n\t\t\treturn this.editor.getTopForLineNumber(lineNumber);\n\t\t});\n\t}\n}\n\ninterface IObservableOverlayWidget {\n\tget domNode(): HTMLElement;\n\treadonly position: IObservable<IOverlayWidgetPosition | null>;\n\treadonly minContentWidthInPx: IObservable<number>;\n\tget allowEditorOverflow(): boolean;\n}\n\ninterface IObservableContentWidget {\n\tget domNode(): HTMLElement;\n\treadonly position: IObservable<IContentWidgetPosition | null>;\n\tget allowEditorOverflow(): boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/observableCodeEditor.ts","vs/editor/browser/observableCodeEditor.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,eAAe,EAAe,YAAY,EAAE,MAAM,gCAAgC,CAAC;AACxG,OAAO,EAAE,aAAa,EAA6D,eAAe,EAAE,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,eAAe,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAE5U,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAKxD,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAEnD;;EAEE;AACF,MAAM,UAAU,oBAAoB,CAAC,MAAmB;IACvD,OAAO,oBAAoB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,OAAO,oBAAqB,SAAQ,UAAU;aAC3B,SAAI,GAAG,IAAI,GAAG,EAAqC,CAAC;IAE5E;;MAEE;IACK,MAAM,CAAC,GAAG,CAAC,MAAmB;QACpC,IAAI,MAAM,GAAG,oBAAoB,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,C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ACpD,CAAC,CAAC,CAAC;IACJ,CAAC","file":"observableCodeEditor.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 { equalsIfDefinedC, arrayEqualsC } from '../../base/common/equals.js';\nimport { Disposable, DisposableStore, IDisposable, toDisposable } from '../../base/common/lifecycle.js';\nimport { DebugLocation, IObservable, IObservableWithChange, IReader, ITransaction, TransactionImpl, autorun, autorunOpts, derived, derivedOpts, derivedWithSetter, observableFromEvent, observableFromEventOpts, observableSignal, observableSignalFromEvent, observableValue, observableValueOpts } from '../../base/common/observable.js';\nimport { EditorOption, FindComputedEditorOptionValueById } from '../common/config/editorOptions.js';\nimport { LineRange } from '../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../common/core/ranges/offsetRange.js';\nimport { Position } from '../common/core/position.js';\nimport { Selection } from '../common/core/selection.js';\nimport { ICursorSelectionChangedEvent } from '../common/cursorEvents.js';\nimport { IModelDeltaDecoration, ITextModel } from '../common/model.js';\nimport { IModelContentChangedEvent } from '../common/textModelEvents.js';\nimport { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition, IEditorMouseEvent, IOverlayWidget, IOverlayWidgetPosition, IPasteEvent } from './editorBrowser.js';\nimport { Point } from '../common/core/2d/point.js';\n\n/**\n * Returns a facade for the code editor that provides observables for various states/events.\n*/\nexport function observableCodeEditor(editor: ICodeEditor): ObservableCodeEditor {\n\treturn ObservableCodeEditor.get(editor);\n}\n\nexport class ObservableCodeEditor extends Disposable {\n\tprivate static readonly _map = new Map<ICodeEditor, ObservableCodeEditor>();\n\n\t/**\n\t * Make sure that editor is not disposed yet!\n\t*/\n\tpublic static get(editor: ICodeEditor): ObservableCodeEditor {\n\t\tlet result = ObservableCodeEditor._map.get(editor);\n\t\tif (!result) {\n\t\t\tresult = new ObservableCodeEditor(editor);\n\t\t\tObservableCodeEditor._map.set(editor, result);\n\t\t\tconst d = editor.onDidDispose(() => {\n\t\t\t\tconst item = ObservableCodeEditor._map.get(editor);\n\t\t\t\tif (item) {\n\t\t\t\t\tObservableCodeEditor._map.delete(editor);\n\t\t\t\t\titem.dispose();\n\t\t\t\t\td.dispose();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate _updateCounter;\n\tprivate _currentTransaction: TransactionImpl | undefined;\n\n\tprivate _beginUpdate(): void {\n\t\tthis._updateCounter++;\n\t\tif (this._updateCounter === 1) {\n\t\t\tthis._currentTransaction = new TransactionImpl(() => {\n\t\t\t\t/** @description Update editor state */\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate _endUpdate(): void {\n\t\tthis._updateCounter--;\n\t\tif (this._updateCounter === 0) {\n\t\t\tconst t = this._currentTransaction!;\n\t\t\tthis._currentTransaction = undefined;\n\t\t\tt.finish();\n\t\t}\n\t}\n\n\tprivate constructor(public readonly editor: ICodeEditor) {\n\t\tsuper();\n\t\tthis._updateCounter = 0;\n\t\tthis._currentTransaction = undefined;\n\t\tthis._model = observableValue(this, this.editor.getModel());\n\t\tthis.model = this._model;\n\t\tthis.isReadonly = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, this.editor.onDidChangeConfiguration, () => this.editor.getOption(EditorOption.readOnly));\n\t\tthis._versionId = observableValueOpts<number | null, IModelContentChangedEvent | undefined>({ owner: this, lazy: true }, this.editor.getModel()?.getVersionId() ?? null);\n\t\tthis.versionId = this._versionId;\n\t\tthis._selections = observableValueOpts<Selection[] | null, ICursorSelectionChangedEvent | undefined>(\n\t\t\t{ owner: this, equalsFn: equalsIfDefinedC(arrayEqualsC(Selection.selectionsEqual)), lazy: true },\n\t\t\tthis.editor.getSelections() ?? null\n\t\t);\n\t\tthis.selections = this._selections;\n\t\tthis.positions = derivedOpts<readonly Position[] | null>(\n\t\t\t{ owner: this, equalsFn: equalsIfDefinedC(arrayEqualsC(Position.equals)) },\n\t\t\treader => this.selections.read(reader)?.map(s => s.getStartPosition()) ?? null\n\t\t);\n\t\tthis.isFocused = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, e => {\n\t\t\tconst d1 = this.editor.onDidFocusEditorWidget(e);\n\t\t\tconst d2 = this.editor.onDidBlurEditorWidget(e);\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\td1.dispose();\n\t\t\t\t\td2.dispose();\n\t\t\t\t}\n\t\t\t};\n\t\t}, () => this.editor.hasWidgetFocus());\n\t\tthis.isTextFocused = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, e => {\n\t\t\tconst d1 = this.editor.onDidFocusEditorText(e);\n\t\t\tconst d2 = this.editor.onDidBlurEditorText(e);\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\td1.dispose();\n\t\t\t\t\td2.dispose();\n\t\t\t\t}\n\t\t\t};\n\t\t}, () => this.editor.hasTextFocus());\n\t\tthis.inComposition = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, e => {\n\t\t\tconst d1 = this.editor.onDidCompositionStart(() => {\n\t\t\t\te(undefined);\n\t\t\t});\n\t\t\tconst d2 = this.editor.onDidCompositionEnd(() => {\n\t\t\t\te(undefined);\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\td1.dispose();\n\t\t\t\t\td2.dispose();\n\t\t\t\t}\n\t\t\t};\n\t\t}, () => this.editor.inComposition);\n\t\tthis.value = derivedWithSetter(this,\n\t\t\treader => { this.versionId.read(reader); return this.model.read(reader)?.getValue() ?? ''; },\n\t\t\t(value, tx) => {\n\t\t\t\tconst model = this.model.get();\n\t\t\t\tif (model !== null) {\n\t\t\t\t\tif (value !== model.getValue()) {\n\t\t\t\t\t\tmodel.setValue(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\tthis.valueIsEmpty = derived(this, reader => { this.versionId.read(reader); return this.editor.getModel()?.getValueLength() === 0; });\n\t\tthis.cursorSelection = derivedOpts({ owner: this, equalsFn: equalsIfDefinedC(Selection.selectionsEqual) }, reader => this.selections.read(reader)?.[0] ?? null);\n\t\tthis.cursorPosition = derivedOpts({ owner: this, equalsFn: Position.equals }, reader => this.selections.read(reader)?.[0]?.getPosition() ?? null);\n\t\tthis.cursorLineNumber = derived<number | null>(this, reader => this.cursorPosition.read(reader)?.lineNumber ?? null);\n\t\tthis.onDidType = observableSignal<string>(this);\n\t\tthis.onDidPaste = observableSignal<IPasteEvent>(this);\n\t\tthis.scrollTop = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, this.editor.onDidScrollChange, () => this.editor.getScrollTop());\n\t\tthis.scrollLeft = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, this.editor.onDidScrollChange, () => this.editor.getScrollLeft());\n\t\tthis.layoutInfo = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, this.editor.onDidLayoutChange, () => this.editor.getLayoutInfo());\n\t\tthis.layoutInfoContentLeft = this.layoutInfo.map(l => l.contentLeft);\n\t\tthis.layoutInfoDecorationsLeft = this.layoutInfo.map(l => l.decorationsLeft);\n\t\tthis.layoutInfoWidth = this.layoutInfo.map(l => l.width);\n\t\tthis.layoutInfoHeight = this.layoutInfo.map(l => l.height);\n\t\tthis.layoutInfoMinimap = this.layoutInfo.map(l => l.minimap);\n\t\tthis.layoutInfoVerticalScrollbarWidth = this.layoutInfo.map(l => l.verticalScrollbarWidth);\n\t\tthis.contentWidth = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, this.editor.onDidContentSizeChange, () => this.editor.getContentWidth());\n\t\tthis.contentHeight = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, this.editor.onDidContentSizeChange, () => this.editor.getContentHeight());\n\t\tthis._onDidChangeViewZones = observableSignalFromEvent(this, this.editor.onDidChangeViewZones);\n\t\tthis._onDidHiddenAreasChanged = observableSignalFromEvent(this, this.editor.onDidChangeHiddenAreas);\n\t\tthis._onDidLineHeightChanged = observableSignalFromEvent(this, this.editor.onDidChangeLineHeight);\n\n\t\tthis._widgetCounter = 0;\n\t\tthis.openedPeekWidgets = observableValue(this, 0);\n\n\t\tthis._register(this.editor.onBeginUpdate(() => this._beginUpdate()));\n\t\tthis._register(this.editor.onEndUpdate(() => this._endUpdate()));\n\n\t\tthis._register(this.editor.onDidChangeModel(() => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._model.set(this.editor.getModel(), this._currentTransaction);\n\t\t\t\tthis._forceUpdate();\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidType((e) => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._forceUpdate();\n\t\t\t\tthis.onDidType.trigger(this._currentTransaction, e);\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidPaste((e) => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._forceUpdate();\n\t\t\t\tthis.onDidPaste.trigger(this._currentTransaction, e);\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidChangeModelContent(e => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._versionId.set(this.editor.getModel()?.getVersionId() ?? null, this._currentTransaction, e);\n\t\t\t\tthis._forceUpdate();\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidChangeCursorSelection(e => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._selections.set(this.editor.getSelections(), this._currentTransaction, e);\n\t\t\t\tthis._forceUpdate();\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis.domNode = derived(reader => {\n\t\t\tthis.model.read(reader);\n\t\t\treturn this.editor.getDomNode();\n\t\t});\n\t}\n\n\t/**\n\t * Batches the transactions started by observableFromEvent.\n\t *\n\t * If the callback causes the editor to fire an event that updates\n\t * an observable value backed by observableFromEvent (such as scrollTop etc.),\n\t * then all such updates will be part of the same transaction.\n\t*/\n\tpublic transaction<T>(cb: (tx: ITransaction) => T): T {\n\t\tthis._beginUpdate();\n\t\ttry {\n\t\t\treturn cb(this._currentTransaction!);\n\t\t} finally {\n\t\t\tthis._endUpdate();\n\t\t}\n\t}\n\n\tpublic forceUpdate(): void;\n\tpublic forceUpdate<T>(cb: (tx: ITransaction) => T): T;\n\tpublic forceUpdate<T>(cb?: (tx: ITransaction) => T): T {\n\t\tthis._beginUpdate();\n\t\ttry {\n\t\t\tthis._forceUpdate();\n\t\t\tif (!cb) { return undefined as T; }\n\t\t\treturn cb(this._currentTransaction!);\n\t\t} finally {\n\t\t\tthis._endUpdate();\n\t\t}\n\t}\n\n\tprivate _forceUpdate(): void {\n\t\tthis._beginUpdate();\n\t\ttry {\n\t\t\tthis._model.set(this.editor.getModel(), this._currentTransaction);\n\t\t\tthis._versionId.set(this.editor.getModel()?.getVersionId() ?? null, this._currentTransaction, undefined);\n\t\t\tthis._selections.set(this.editor.getSelections(), this._currentTransaction, undefined);\n\t\t} finally {\n\t\t\tthis._endUpdate();\n\t\t}\n\t}\n\n\tprivate readonly _model;\n\tpublic readonly model: IObservable<ITextModel | null>;\n\n\tpublic readonly isReadonly;\n\n\tprivate readonly _versionId;\n\tpublic readonly versionId: IObservableWithChange<number | null, IModelContentChangedEvent | undefined>;\n\n\tprivate readonly _selections;\n\tpublic readonly selections: IObservableWithChange<Selection[] | null, ICursorSelectionChangedEvent | undefined>;\n\n\n\tpublic readonly positions;\n\n\tpublic readonly isFocused;\n\n\tpublic readonly isTextFocused;\n\n\tpublic readonly inComposition;\n\n\tpublic readonly value;\n\tpublic readonly valueIsEmpty;\n\tpublic readonly cursorSelection;\n\tpublic readonly cursorPosition;\n\tpublic readonly cursorLineNumber;\n\n\tpublic readonly onDidType;\n\tpublic readonly onDidPaste;\n\n\tpublic readonly scrollTop;\n\tpublic readonly scrollLeft;\n\n\tpublic readonly layoutInfo;\n\tpublic readonly layoutInfoContentLeft;\n\tpublic readonly layoutInfoDecorationsLeft;\n\tpublic readonly layoutInfoWidth;\n\tpublic readonly layoutInfoHeight;\n\tpublic readonly layoutInfoMinimap;\n\tpublic readonly layoutInfoVerticalScrollbarWidth;\n\n\tpublic readonly contentWidth;\n\tpublic readonly contentHeight;\n\n\tpublic readonly domNode;\n\n\tpublic getOption<T extends EditorOption>(id: T, debugLocation = DebugLocation.ofCaller()): IObservable<FindComputedEditorOptionValueById<T>> {\n\t\treturn observableFromEvent(this, cb => this.editor.onDidChangeConfiguration(e => {\n\t\t\tif (e.hasChanged(id)) { cb(undefined); }\n\t\t}), () => this.editor.getOption(id), debugLocation);\n\t}\n\n\tpublic setDecorations(decorations: IObservable<IModelDeltaDecoration[]>): IDisposable {\n\t\tconst d = new DisposableStore();\n\t\tconst decorationsCollection = this.editor.createDecorationsCollection();\n\t\td.add(autorunOpts({ owner: this, debugName: () => `Apply decorations from ${decorations.debugName}` }, reader => {\n\t\t\tconst d = decorations.read(reader);\n\t\t\tdecorationsCollection.set(d);\n\t\t}));\n\t\td.add({\n\t\t\tdispose: () => {\n\t\t\t\tdecorationsCollection.clear();\n\t\t\t}\n\t\t});\n\t\treturn d;\n\t}\n\n\tprivate _widgetCounter;\n\n\tpublic createOverlayWidget(widget: IObservableOverlayWidget): IDisposable {\n\t\tconst overlayWidgetId = 'observableOverlayWidget' + (this._widgetCounter++);\n\t\tconst w: IOverlayWidget = {\n\t\t\tgetDomNode: () => widget.domNode,\n\t\t\tgetPosition: () => widget.position.get(),\n\t\t\tgetId: () => overlayWidgetId,\n\t\t\tallowEditorOverflow: widget.allowEditorOverflow,\n\t\t\tgetMinContentWidthInPx: () => widget.minContentWidthInPx.get(),\n\t\t};\n\t\tthis.editor.addOverlayWidget(w);\n\t\tconst d = autorun(reader => {\n\t\t\twidget.position.read(reader);\n\t\t\twidget.minContentWidthInPx.read(reader);\n\t\t\tthis.editor.layoutOverlayWidget(w);\n\t\t});\n\t\treturn toDisposable(() => {\n\t\t\td.dispose();\n\t\t\tthis.editor.removeOverlayWidget(w);\n\t\t});\n\t}\n\n\tpublic createContentWidget(widget: IObservableContentWidget): IDisposable {\n\t\tconst contentWidgetId = 'observableContentWidget' + (this._widgetCounter++);\n\t\tconst w: IContentWidget = {\n\t\t\tgetDomNode: () => widget.domNode,\n\t\t\tgetPosition: () => widget.position.get(),\n\t\t\tgetId: () => contentWidgetId,\n\t\t\tallowEditorOverflow: widget.allowEditorOverflow,\n\t\t};\n\t\tthis.editor.addContentWidget(w);\n\t\tconst d = autorun(reader => {\n\t\t\twidget.position.read(reader);\n\t\t\tthis.editor.layoutContentWidget(w);\n\t\t});\n\t\treturn toDisposable(() => {\n\t\t\td.dispose();\n\t\t\tthis.editor.removeContentWidget(w);\n\t\t});\n\t}\n\n\tpublic observeLineOffsetRange(lineRange: IObservable<LineRange>, store: DisposableStore): IObservable<OffsetRange> {\n\t\tconst start = this.observePosition(lineRange.map(r => new Position(r.startLineNumber, 1)), store);\n\t\tconst end = this.observePosition(lineRange.map(r => new Position(r.endLineNumberExclusive + 1, 1)), store);\n\n\t\treturn derived(reader => {\n\t\t\tstart.read(reader);\n\t\t\tend.read(reader);\n\t\t\tconst range = lineRange.read(reader);\n\t\t\tconst lineCount = this.model.read(reader)?.getLineCount();\n\t\t\tconst s = (\n\t\t\t\t(typeof lineCount !== 'undefined' && range.startLineNumber > lineCount\n\t\t\t\t\t? this.editor.getBottomForLineNumber(lineCount)\n\t\t\t\t\t: this.editor.getTopForLineNumber(range.startLineNumber)\n\t\t\t\t)\n\t\t\t\t- this.scrollTop.read(reader)\n\t\t\t);\n\t\t\tconst e = range.isEmpty ? s : (this.editor.getBottomForLineNumber(range.endLineNumberExclusive - 1) - this.scrollTop.read(reader));\n\t\t\treturn new OffsetRange(s, e);\n\t\t});\n\t}\n\n\t/**\n\t * Uses an approximation if the exact position cannot be determined.\n\t */\n\tgetLeftOfPosition(position: Position, reader: IReader | undefined): number {\n\t\tthis.layoutInfo.read(reader);\n\t\tthis.value.read(reader);\n\n\t\tlet offset = this.editor.getOffsetForColumn(position.lineNumber, position.column);\n\t\tif (offset === -1) {\n\t\t\t// approximation\n\t\t\tconst typicalHalfwidthCharacterWidth = this.editor.getOption(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;\n\t\t\tconst approximation = position.column * typicalHalfwidthCharacterWidth;\n\t\t\toffset = approximation;\n\t\t}\n\t\treturn offset;\n\t}\n\n\tpublic observePosition(position: IObservable<Position | null>, store: DisposableStore): IObservable<Point | null> {\n\t\tlet pos = position.get();\n\t\tconst result = observableValueOpts<Point | null>({ owner: this, debugName: () => `topLeftOfPosition${pos?.toString()}`, equalsFn: equalsIfDefinedC(Point.equals) }, new Point(0, 0));\n\t\tconst contentWidgetId = `observablePositionWidget` + (this._widgetCounter++);\n\t\tconst domNode = document.createElement('div');\n\t\tconst w: IContentWidget = {\n\t\t\tgetDomNode: () => domNode,\n\t\t\tgetPosition: () => {\n\t\t\t\treturn pos ? { preference: [ContentWidgetPositionPreference.EXACT], position: position.get() } : null;\n\t\t\t},\n\t\t\tgetId: () => contentWidgetId,\n\t\t\tallowEditorOverflow: false,\n\t\t\tuseDisplayNone: true,\n\t\t\tafterRender: (position, coordinate) => {\n\t\t\t\tconst model = this._model.get();\n\t\t\t\tif (model && pos && pos.lineNumber > model.getLineCount()) {\n\t\t\t\t\t// the position is after the last line\n\t\t\t\t\tresult.set(new Point(0, this.editor.getBottomForLineNumber(model.getLineCount()) - this.scrollTop.get()), undefined);\n\t\t\t\t} else {\n\t\t\t\t\tresult.set(coordinate ? new Point(coordinate.left, coordinate.top) : null, undefined);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t\tthis.editor.addContentWidget(w);\n\t\tstore.add(autorun(reader => {\n\t\t\tpos = position.read(reader);\n\t\t\tthis.editor.layoutContentWidget(w);\n\t\t}));\n\t\tstore.add(toDisposable(() => {\n\t\t\tthis.editor.removeContentWidget(w);\n\t\t}));\n\t\treturn result;\n\t}\n\n\tpublic readonly openedPeekWidgets;\n\n\tisTargetHovered(predicate: (target: IEditorMouseEvent) => boolean, store: DisposableStore): IObservable<boolean> {\n\t\tconst isHovered = observableValue('isInjectedTextHovered', false);\n\t\tstore.add(this.editor.onMouseMove(e => {\n\t\t\tconst val = predicate(e);\n\t\t\tisHovered.set(val, undefined);\n\t\t}));\n\n\t\tstore.add(this.editor.onMouseLeave(E => {\n\t\t\tisHovered.set(false, undefined);\n\t\t}));\n\t\treturn isHovered;\n\t}\n\n\tobserveLineHeightForPosition(position: IObservable<Position> | Position): IObservable<number>;\n\tobserveLineHeightForPosition(position: IObservable<null>): IObservable<null>;\n\tobserveLineHeightForPosition(position: IObservable<Position | null> | Position): IObservable<number | null> {\n\t\treturn derived(reader => {\n\t\t\tconst pos = position instanceof Position ? position : position.read(reader);\n\t\t\tif (pos === null) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tthis.getOption(EditorOption.lineHeight).read(reader);\n\n\t\t\treturn this.editor.getLineHeightForPosition(pos);\n\t\t});\n\t}\n\n\tobserveLineHeightForLine(lineNumber: IObservable<number> | number): IObservable<number>;\n\tobserveLineHeightForLine(lineNumber: IObservable<null>): IObservable<null>;\n\tobserveLineHeightForLine(lineNumber: IObservable<number | null> | number): IObservable<number | null> {\n\t\tif (typeof lineNumber === 'number') {\n\t\t\treturn this.observeLineHeightForPosition(new Position(lineNumber, 1));\n\t\t}\n\n\t\treturn derived(reader => {\n\t\t\tconst line = lineNumber.read(reader);\n\t\t\tif (line === null) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn this.observeLineHeightForPosition(new Position(line, 1)).read(reader);\n\t\t});\n\t}\n\n\tobserveLineHeightsForLineRange(lineNumber: IObservable<LineRange> | LineRange): IObservable<number[]> {\n\t\treturn derived(reader => {\n\t\t\tconst range = lineNumber instanceof LineRange ? lineNumber : lineNumber.read(reader);\n\n\t\t\tconst heights: number[] = [];\n\t\t\tfor (let i = range.startLineNumber; i < range.endLineNumberExclusive; i++) {\n\t\t\t\theights.push(this.observeLineHeightForLine(i).read(reader));\n\t\t\t}\n\t\t\treturn heights;\n\t\t});\n\t}\n\n\tprivate readonly _onDidChangeViewZones;\n\tprivate readonly _onDidHiddenAreasChanged;\n\tprivate readonly _onDidLineHeightChanged;\n\n\t/**\n\t * Get the vertical position (top offset) for the line's bottom w.r.t. to the first line.\n\t */\n\tobserveTopForLineNumber(lineNumber: number): IObservable<number> {\n\t\treturn derived(reader => {\n\t\t\tthis.layoutInfo.read(reader);\n\t\t\tthis._onDidChangeViewZones.read(reader);\n\t\t\tthis._onDidHiddenAreasChanged.read(reader);\n\t\t\tthis._onDidLineHeightChanged.read(reader);\n\t\t\tthis._versionId.read(reader);\n\t\t\treturn this.editor.getTopForLineNumber(lineNumber);\n\t\t});\n\t}\n}\n\ninterface IObservableOverlayWidget {\n\tget domNode(): HTMLElement;\n\treadonly position: IObservable<IOverlayWidgetPosition | null>;\n\treadonly minContentWidthInPx: IObservable<number>;\n\tget allowEditorOverflow(): boolean;\n}\n\ninterface IObservableContentWidget {\n\tget domNode(): HTMLElement;\n\treadonly position: IObservable<IContentWidgetPosition | null>;\n\tget allowEditorOverflow(): boolean;\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 { equalsIfDefinedC, arrayEqualsC } from '../../base/common/equals.js';\nimport { Disposable, DisposableStore, IDisposable, toDisposable } from '../../base/common/lifecycle.js';\nimport { DebugLocation, IObservable, IObservableWithChange, IReader, ITransaction, TransactionImpl, autorun, autorunOpts, derived, derivedOpts, derivedWithSetter, observableFromEvent, observableFromEventOpts, observableSignal, observableSignalFromEvent, observableValue, observableValueOpts } from '../../base/common/observable.js';\nimport { EditorOption, FindComputedEditorOptionValueById } from '../common/config/editorOptions.js';\nimport { LineRange } from '../common/core/ranges/lineRange.js';\nimport { OffsetRange } from '../common/core/ranges/offsetRange.js';\nimport { Position } from '../common/core/position.js';\nimport { Selection } from '../common/core/selection.js';\nimport { ICursorSelectionChangedEvent } from '../common/cursorEvents.js';\nimport { IModelDeltaDecoration, ITextModel } from '../common/model.js';\nimport { IModelContentChangedEvent } from '../common/textModelEvents.js';\nimport { ContentWidgetPositionPreference, ICodeEditor, IContentWidget, IContentWidgetPosition, IEditorMouseEvent, IOverlayWidget, IOverlayWidgetPosition, IPasteEvent } from './editorBrowser.js';\nimport { Point } from '../common/core/2d/point.js';\n\n/**\n * Returns a facade for the code editor that provides observables for various states/events.\n*/\nexport function observableCodeEditor(editor: ICodeEditor): ObservableCodeEditor {\n\treturn ObservableCodeEditor.get(editor);\n}\n\nexport class ObservableCodeEditor extends Disposable {\n\tprivate static readonly _map = new Map<ICodeEditor, ObservableCodeEditor>();\n\n\t/**\n\t * Make sure that editor is not disposed yet!\n\t*/\n\tpublic static get(editor: ICodeEditor): ObservableCodeEditor {\n\t\tlet result = ObservableCodeEditor._map.get(editor);\n\t\tif (!result) {\n\t\t\tresult = new ObservableCodeEditor(editor);\n\t\t\tObservableCodeEditor._map.set(editor, result);\n\t\t\tconst d = editor.onDidDispose(() => {\n\t\t\t\tconst item = ObservableCodeEditor._map.get(editor);\n\t\t\t\tif (item) {\n\t\t\t\t\tObservableCodeEditor._map.delete(editor);\n\t\t\t\t\titem.dispose();\n\t\t\t\t\td.dispose();\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t\treturn result;\n\t}\n\n\tprivate _updateCounter;\n\tprivate _currentTransaction: TransactionImpl | undefined;\n\n\tprivate _beginUpdate(): void {\n\t\tthis._updateCounter++;\n\t\tif (this._updateCounter === 1) {\n\t\t\tthis._currentTransaction = new TransactionImpl(() => {\n\t\t\t\t/** @description Update editor state */\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate _endUpdate(): void {\n\t\tthis._updateCounter--;\n\t\tif (this._updateCounter === 0) {\n\t\t\tconst t = this._currentTransaction!;\n\t\t\tthis._currentTransaction = undefined;\n\t\t\tt.finish();\n\t\t}\n\t}\n\n\tprivate constructor(public readonly editor: ICodeEditor) {\n\t\tsuper();\n\t\tthis._updateCounter = 0;\n\t\tthis._currentTransaction = undefined;\n\t\tthis._model = observableValue(this, this.editor.getModel());\n\t\tthis.model = this._model;\n\t\tthis.isReadonly = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, this.editor.onDidChangeConfiguration, () => this.editor.getOption(EditorOption.readOnly));\n\t\tthis._versionId = observableValueOpts<number | null, IModelContentChangedEvent | undefined>({ owner: this, lazy: true }, this.editor.getModel()?.getVersionId() ?? null);\n\t\tthis.versionId = this._versionId;\n\t\tthis._selections = observableValueOpts<Selection[] | null, ICursorSelectionChangedEvent | undefined>(\n\t\t\t{ owner: this, equalsFn: equalsIfDefinedC(arrayEqualsC(Selection.selectionsEqual)), lazy: true },\n\t\t\tthis.editor.getSelections() ?? null\n\t\t);\n\t\tthis.selections = this._selections;\n\t\tthis.positions = derivedOpts<readonly Position[] | null>(\n\t\t\t{ owner: this, equalsFn: equalsIfDefinedC(arrayEqualsC(Position.equals)) },\n\t\t\treader => this.selections.read(reader)?.map(s => s.getStartPosition()) ?? null\n\t\t);\n\t\tthis.isFocused = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, e => {\n\t\t\tconst d1 = this.editor.onDidFocusEditorWidget(e);\n\t\t\tconst d2 = this.editor.onDidBlurEditorWidget(e);\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\td1.dispose();\n\t\t\t\t\td2.dispose();\n\t\t\t\t}\n\t\t\t};\n\t\t}, () => this.editor.hasWidgetFocus());\n\t\tthis.isTextFocused = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, e => {\n\t\t\tconst d1 = this.editor.onDidFocusEditorText(e);\n\t\t\tconst d2 = this.editor.onDidBlurEditorText(e);\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\td1.dispose();\n\t\t\t\t\td2.dispose();\n\t\t\t\t}\n\t\t\t};\n\t\t}, () => this.editor.hasTextFocus());\n\t\tthis.inComposition = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, e => {\n\t\t\tconst d1 = this.editor.onDidCompositionStart(() => {\n\t\t\t\te(undefined);\n\t\t\t});\n\t\t\tconst d2 = this.editor.onDidCompositionEnd(() => {\n\t\t\t\te(undefined);\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tdispose() {\n\t\t\t\t\td1.dispose();\n\t\t\t\t\td2.dispose();\n\t\t\t\t}\n\t\t\t};\n\t\t}, () => this.editor.inComposition);\n\t\tthis.value = derivedWithSetter(this,\n\t\t\treader => { this.versionId.read(reader); return this.model.read(reader)?.getValue() ?? ''; },\n\t\t\t(value, tx) => {\n\t\t\t\tconst model = this.model.get();\n\t\t\t\tif (model !== null) {\n\t\t\t\t\tif (value !== model.getValue()) {\n\t\t\t\t\t\tmodel.setValue(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t);\n\t\tthis.valueIsEmpty = derived(this, reader => { this.versionId.read(reader); return this.editor.getModel()?.getValueLength() === 0; });\n\t\tthis.cursorSelection = derivedOpts({ owner: this, equalsFn: equalsIfDefinedC(Selection.selectionsEqual) }, reader => this.selections.read(reader)?.[0] ?? null);\n\t\tthis.cursorPosition = derivedOpts({ owner: this, equalsFn: Position.equals }, reader => this.selections.read(reader)?.[0]?.getPosition() ?? null);\n\t\tthis.cursorLineNumber = derived<number | null>(this, reader => this.cursorPosition.read(reader)?.lineNumber ?? null);\n\t\tthis.onDidType = observableSignal<string>(this);\n\t\tthis.onDidPaste = observableSignal<IPasteEvent>(this);\n\t\tthis.scrollTop = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, this.editor.onDidScrollChange, () => this.editor.getScrollTop());\n\t\tthis.scrollLeft = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, this.editor.onDidScrollChange, () => this.editor.getScrollLeft());\n\t\tthis.layoutInfo = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, this.editor.onDidLayoutChange, () => this.editor.getLayoutInfo());\n\t\tthis.layoutInfoContentLeft = this.layoutInfo.map(l => l.contentLeft);\n\t\tthis.layoutInfoDecorationsLeft = this.layoutInfo.map(l => l.decorationsLeft);\n\t\tthis.layoutInfoWidth = this.layoutInfo.map(l => l.width);\n\t\tthis.layoutInfoHeight = this.layoutInfo.map(l => l.height);\n\t\tthis.layoutInfoMinimap = this.layoutInfo.map(l => l.minimap);\n\t\tthis.layoutInfoVerticalScrollbarWidth = this.layoutInfo.map(l => l.verticalScrollbarWidth);\n\t\tthis.contentWidth = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, this.editor.onDidContentSizeChange, () => this.editor.getContentWidth());\n\t\tthis.contentHeight = observableFromEventOpts({ owner: this, getTransaction: () => this._currentTransaction }, this.editor.onDidContentSizeChange, () => this.editor.getContentHeight());\n\t\tthis._onDidChangeViewZones = observableSignalFromEvent(this, this.editor.onDidChangeViewZones);\n\t\tthis._onDidHiddenAreasChanged = observableSignalFromEvent(this, this.editor.onDidChangeHiddenAreas);\n\t\tthis._onDidLineHeightChanged = observableSignalFromEvent(this, this.editor.onDidChangeLineHeight);\n\n\t\tthis._widgetCounter = 0;\n\t\tthis.openedPeekWidgets = observableValue(this, 0);\n\n\t\tthis._register(this.editor.onBeginUpdate(() => this._beginUpdate()));\n\t\tthis._register(this.editor.onEndUpdate(() => this._endUpdate()));\n\n\t\tthis._register(this.editor.onDidChangeModel(() => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._model.set(this.editor.getModel(), this._currentTransaction);\n\t\t\t\tthis._forceUpdate();\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidType((e) => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._forceUpdate();\n\t\t\t\tthis.onDidType.trigger(this._currentTransaction, e);\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidPaste((e) => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._forceUpdate();\n\t\t\t\tthis.onDidPaste.trigger(this._currentTransaction, e);\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidChangeModelContent(e => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._versionId.set(this.editor.getModel()?.getVersionId() ?? null, this._currentTransaction, e);\n\t\t\t\tthis._forceUpdate();\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis._register(this.editor.onDidChangeCursorSelection(e => {\n\t\t\tthis._beginUpdate();\n\t\t\ttry {\n\t\t\t\tthis._selections.set(this.editor.getSelections(), this._currentTransaction, e);\n\t\t\t\tthis._forceUpdate();\n\t\t\t} finally {\n\t\t\t\tthis._endUpdate();\n\t\t\t}\n\t\t}));\n\n\t\tthis.domNode = derived(reader => {\n\t\t\tthis.model.read(reader);\n\t\t\treturn this.editor.getDomNode();\n\t\t});\n\t}\n\n\t/**\n\t * Batches the transactions started by observableFromEvent.\n\t *\n\t * If the callback causes the editor to fire an event that updates\n\t * an observable value backed by observableFromEvent (such as scrollTop etc.),\n\t * then all such updates will be part of the same transaction.\n\t*/\n\tpublic transaction<T>(cb: (tx: ITransaction) => T): T {\n\t\tthis._beginUpdate();\n\t\ttry {\n\t\t\treturn cb(this._currentTransaction!);\n\t\t} finally {\n\t\t\tthis._endUpdate();\n\t\t}\n\t}\n\n\tpublic forceUpdate(): void;\n\tpublic forceUpdate<T>(cb: (tx: ITransaction) => T): T;\n\tpublic forceUpdate<T>(cb?: (tx: ITransaction) => T): T {\n\t\tthis._beginUpdate();\n\t\ttry {\n\t\t\tthis._forceUpdate();\n\t\t\tif (!cb) { return undefined as T; }\n\t\t\treturn cb(this._currentTransaction!);\n\t\t} finally {\n\t\t\tthis._endUpdate();\n\t\t}\n\t}\n\n\tprivate _forceUpdate(): void {\n\t\tthis._beginUpdate();\n\t\ttry {\n\t\t\tthis._model.set(this.editor.getModel(), this._currentTransaction);\n\t\t\tthis._versionId.set(this.editor.getModel()?.getVersionId() ?? null, this._currentTransaction, undefined);\n\t\t\tthis._selections.set(this.editor.getSelections(), this._currentTransaction, undefined);\n\t\t} finally {\n\t\t\tthis._endUpdate();\n\t\t}\n\t}\n\n\tprivate readonly _model;\n\tpublic readonly model: IObservable<ITextModel | null>;\n\n\tpublic readonly isReadonly;\n\n\tprivate readonly _versionId;\n\tpublic readonly versionId: IObservableWithChange<number | null, IModelContentChangedEvent | undefined>;\n\n\tprivate readonly _selections;\n\tpublic readonly selections: IObservableWithChange<Selection[] | null, ICursorSelectionChangedEvent | undefined>;\n\n\n\tpublic readonly positions;\n\n\tpublic readonly isFocused;\n\n\tpublic readonly isTextFocused;\n\n\tpublic readonly inComposition;\n\n\tpublic readonly value;\n\tpublic readonly valueIsEmpty;\n\tpublic readonly cursorSelection;\n\tpublic readonly cursorPosition;\n\tpublic readonly cursorLineNumber;\n\n\tpublic readonly onDidType;\n\tpublic readonly onDidPaste;\n\n\tpublic readonly scrollTop;\n\tpublic readonly scrollLeft;\n\n\tpublic readonly layoutInfo;\n\tpublic readonly layoutInfoContentLeft;\n\tpublic readonly layoutInfoDecorationsLeft;\n\tpublic readonly layoutInfoWidth;\n\tpublic readonly layoutInfoHeight;\n\tpublic readonly layoutInfoMinimap;\n\tpublic readonly layoutInfoVerticalScrollbarWidth;\n\n\tpublic readonly contentWidth;\n\tpublic readonly contentHeight;\n\n\tpublic readonly domNode;\n\n\tpublic getOption<T extends EditorOption>(id: T, debugLocation = DebugLocation.ofCaller()): IObservable<FindComputedEditorOptionValueById<T>> {\n\t\treturn observableFromEvent(this, cb => this.editor.onDidChangeConfiguration(e => {\n\t\t\tif (e.hasChanged(id)) { cb(undefined); }\n\t\t}), () => this.editor.getOption(id), debugLocation);\n\t}\n\n\tpublic setDecorations(decorations: IObservable<IModelDeltaDecoration[]>): IDisposable {\n\t\tconst d = new DisposableStore();\n\t\tconst decorationsCollection = this.editor.createDecorationsCollection();\n\t\td.add(autorunOpts({ owner: this, debugName: () => `Apply decorations from ${decorations.debugName}` }, reader => {\n\t\t\tconst d = decorations.read(reader);\n\t\t\tdecorationsCollection.set(d);\n\t\t}));\n\t\td.add({\n\t\t\tdispose: () => {\n\t\t\t\tdecorationsCollection.clear();\n\t\t\t}\n\t\t});\n\t\treturn d;\n\t}\n\n\tprivate _widgetCounter;\n\n\tpublic createOverlayWidget(widget: IObservableOverlayWidget): IDisposable {\n\t\tconst overlayWidgetId = 'observableOverlayWidget' + (this._widgetCounter++);\n\t\tconst w: IOverlayWidget = {\n\t\t\tgetDomNode: () => widget.domNode,\n\t\t\tgetPosition: () => widget.position.get(),\n\t\t\tgetId: () => overlayWidgetId,\n\t\t\tallowEditorOverflow: widget.allowEditorOverflow,\n\t\t\tgetMinContentWidthInPx: () => widget.minContentWidthInPx.get(),\n\t\t};\n\t\tthis.editor.addOverlayWidget(w);\n\t\tconst d = autorun(reader => {\n\t\t\twidget.position.read(reader);\n\t\t\twidget.minContentWidthInPx.read(reader);\n\t\t\tthis.editor.layoutOverlayWidget(w);\n\t\t});\n\t\treturn toDisposable(() => {\n\t\t\td.dispose();\n\t\t\tthis.editor.removeOverlayWidget(w);\n\t\t});\n\t}\n\n\tpublic createContentWidget(widget: IObservableContentWidget): IDisposable {\n\t\tconst contentWidgetId = 'observableContentWidget' + (this._widgetCounter++);\n\t\tconst w: IContentWidget = {\n\t\t\tgetDomNode: () => widget.domNode,\n\t\t\tgetPosition: () => widget.position.get(),\n\t\t\tgetId: () => contentWidgetId,\n\t\t\tallowEditorOverflow: widget.allowEditorOverflow,\n\t\t};\n\t\tthis.editor.addContentWidget(w);\n\t\tconst d = autorun(reader => {\n\t\t\twidget.position.read(reader);\n\t\t\tthis.editor.layoutContentWidget(w);\n\t\t});\n\t\treturn toDisposable(() => {\n\t\t\td.dispose();\n\t\t\tthis.editor.removeContentWidget(w);\n\t\t});\n\t}\n\n\tpublic observeLineOffsetRange(lineRange: IObservable<LineRange>, store: DisposableStore): IObservable<OffsetRange> {\n\t\tconst start = this.observePosition(lineRange.map(r => new Position(r.startLineNumber, 1)), store);\n\t\tconst end = this.observePosition(lineRange.map(r => new Position(r.endLineNumberExclusive + 1, 1)), store);\n\n\t\treturn derived(reader => {\n\t\t\tstart.read(reader);\n\t\t\tend.read(reader);\n\t\t\tconst range = lineRange.read(reader);\n\t\t\tconst lineCount = this.model.read(reader)?.getLineCount();\n\t\t\tconst s = (\n\t\t\t\t(typeof lineCount !== 'undefined' && range.startLineNumber > lineCount\n\t\t\t\t\t? this.editor.getBottomForLineNumber(lineCount)\n\t\t\t\t\t: this.editor.getTopForLineNumber(range.startLineNumber)\n\t\t\t\t)\n\t\t\t\t- this.scrollTop.read(reader)\n\t\t\t);\n\t\t\tconst e = range.isEmpty ? s : (this.editor.getBottomForLineNumber(range.endLineNumberExclusive - 1) - this.scrollTop.read(reader));\n\t\t\treturn new OffsetRange(s, e);\n\t\t});\n\t}\n\n\t/**\n\t * Uses an approximation if the exact position cannot be determined.\n\t */\n\tgetLeftOfPosition(position: Position, reader: IReader | undefined): number {\n\t\tthis.layoutInfo.read(reader);\n\t\tthis.value.read(reader);\n\n\t\tlet offset = this.editor.getOffsetForColumn(position.lineNumber, position.column);\n\t\tif (offset === -1) {\n\t\t\t// approximation\n\t\t\tconst typicalHalfwidthCharacterWidth = this.editor.getOption(EditorOption.fontInfo).typicalHalfwidthCharacterWidth;\n\t\t\tconst approximation = position.column * typicalHalfwidthCharacterWidth;\n\t\t\toffset = approximation;\n\t\t}\n\t\treturn offset;\n\t}\n\n\tpublic observePosition(position: IObservable<Position | null>, store: DisposableStore): IObservable<Point | null> {\n\t\tlet pos = position.get();\n\t\tconst result = observableValueOpts<Point | null>({ owner: this, debugName: () => `topLeftOfPosition${pos?.toString()}`, equalsFn: equalsIfDefinedC(Point.equals) }, new Point(0, 0));\n\t\tconst contentWidgetId = `observablePositionWidget` + (this._widgetCounter++);\n\t\tconst domNode = document.createElement('div');\n\t\tconst w: IContentWidget = {\n\t\t\tgetDomNode: () => domNode,\n\t\t\tgetPosition: () => {\n\t\t\t\treturn pos ? { preference: [ContentWidgetPositionPreference.EXACT], position: position.get() } : null;\n\t\t\t},\n\t\t\tgetId: () => contentWidgetId,\n\t\t\tallowEditorOverflow: false,\n\t\t\tuseDisplayNone: true,\n\t\t\tafterRender: (position, coordinate) => {\n\t\t\t\tconst model = this._model.get();\n\t\t\t\tif (model && pos && pos.lineNumber > model.getLineCount()) {\n\t\t\t\t\t// the position is after the last line\n\t\t\t\t\tresult.set(new Point(0, this.editor.getBottomForLineNumber(model.getLineCount()) - this.scrollTop.get()), undefined);\n\t\t\t\t} else {\n\t\t\t\t\tresult.set(coordinate ? new Point(coordinate.left, coordinate.top) : null, undefined);\n\t\t\t\t}\n\t\t\t},\n\t\t};\n\t\tthis.editor.addContentWidget(w);\n\t\tstore.add(autorun(reader => {\n\t\t\tpos = position.read(reader);\n\t\t\tthis.editor.layoutContentWidget(w);\n\t\t}));\n\t\tstore.add(toDisposable(() => {\n\t\t\tthis.editor.removeContentWidget(w);\n\t\t}));\n\t\treturn result;\n\t}\n\n\tpublic readonly openedPeekWidgets;\n\n\tisTargetHovered(predicate: (target: IEditorMouseEvent) => boolean, store: DisposableStore): IObservable<boolean> {\n\t\tconst isHovered = observableValue('isInjectedTextHovered', false);\n\t\tstore.add(this.editor.onMouseMove(e => {\n\t\t\tconst val = predicate(e);\n\t\t\tisHovered.set(val, undefined);\n\t\t}));\n\n\t\tstore.add(this.editor.onMouseLeave(E => {\n\t\t\tisHovered.set(false, undefined);\n\t\t}));\n\t\treturn isHovered;\n\t}\n\n\tobserveLineHeightForPosition(position: IObservable<Position> | Position): IObservable<number>;\n\tobserveLineHeightForPosition(position: IObservable<null>): IObservable<null>;\n\tobserveLineHeightForPosition(position: IObservable<Position | null> | Position): IObservable<number | null> {\n\t\treturn derived(reader => {\n\t\t\tconst pos = position instanceof Position ? position : position.read(reader);\n\t\t\tif (pos === null) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tthis.getOption(EditorOption.lineHeight).read(reader);\n\n\t\t\treturn this.editor.getLineHeightForPosition(pos);\n\t\t});\n\t}\n\n\tobserveLineHeightForLine(lineNumber: IObservable<number> | number): IObservable<number>;\n\tobserveLineHeightForLine(lineNumber: IObservable<null>): IObservable<null>;\n\tobserveLineHeightForLine(lineNumber: IObservable<number | null> | number): IObservable<number | null> {\n\t\tif (typeof lineNumber === 'number') {\n\t\t\treturn this.observeLineHeightForPosition(new Position(lineNumber, 1));\n\t\t}\n\n\t\treturn derived(reader => {\n\t\t\tconst line = lineNumber.read(reader);\n\t\t\tif (line === null) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\treturn this.observeLineHeightForPosition(new Position(line, 1)).read(reader);\n\t\t});\n\t}\n\n\tobserveLineHeightsForLineRange(lineNumber: IObservable<LineRange> | LineRange): IObservable<number[]> {\n\t\treturn derived(reader => {\n\t\t\tconst range = lineNumber instanceof LineRange ? lineNumber : lineNumber.read(reader);\n\n\t\t\tconst heights: number[] = [];\n\t\t\tfor (let i = range.startLineNumber; i < range.endLineNumberExclusive; i++) {\n\t\t\t\theights.push(this.observeLineHeightForLine(i).read(reader));\n\t\t\t}\n\t\t\treturn heights;\n\t\t});\n\t}\n\n\tprivate readonly _onDidChangeViewZones;\n\tprivate readonly _onDidHiddenAreasChanged;\n\tprivate readonly _onDidLineHeightChanged;\n\n\t/**\n\t * Get the vertical position (top offset) for the line's bottom w.r.t. to the first line.\n\t */\n\tobserveTopForLineNumber(lineNumber: number): IObservable<number> {\n\t\treturn derived(reader => {\n\t\t\tthis.layoutInfo.read(reader);\n\t\t\tthis._onDidChangeViewZones.read(reader);\n\t\t\tthis._onDidHiddenAreasChanged.read(reader);\n\t\t\tthis._onDidLineHeightChanged.read(reader);\n\t\t\tthis._versionId.read(reader);\n\t\t\treturn this.editor.getTopForLineNumber(lineNumber);\n\t\t});\n\t}\n}\n\ninterface IObservableOverlayWidget {\n\tget domNode(): HTMLElement;\n\treadonly position: IObservable<IOverlayWidgetPosition | null>;\n\treadonly minContentWidthInPx: IObservable<number>;\n\tget allowEditorOverflow(): boolean;\n}\n\ninterface IObservableContentWidget {\n\tget domNode(): HTMLElement;\n\treadonly position: IObservable<IContentWidgetPosition | null>;\n\tget allowEditorOverflow(): boolean;\n}\n"]}
|
|
@@ -72,7 +72,7 @@ let EditorWorkerService = class EditorWorkerService extends Disposable {
|
|
|
72
72
|
return links && { links };
|
|
73
73
|
}
|
|
74
74
|
}));
|
|
75
|
-
this._register(languageFeaturesService.completionProvider.register('*', new WordBasedCompletionItemProvider(this._workerManager, configurationService, this._modelService, this._languageConfigurationService, this._logService)));
|
|
75
|
+
this._register(languageFeaturesService.completionProvider.register('*', new WordBasedCompletionItemProvider(this._workerManager, configurationService, this._modelService, this._languageConfigurationService, this._logService, languageFeaturesService)));
|
|
76
76
|
}
|
|
77
77
|
dispose() {
|
|
78
78
|
super.dispose();
|
|
@@ -167,9 +167,10 @@ EditorWorkerService = __decorate([
|
|
|
167
167
|
], EditorWorkerService);
|
|
168
168
|
export { EditorWorkerService };
|
|
169
169
|
class WordBasedCompletionItemProvider {
|
|
170
|
-
constructor(workerManager, configurationService, modelService, languageConfigurationService, logService) {
|
|
170
|
+
constructor(workerManager, configurationService, modelService, languageConfigurationService, logService, languageFeaturesService) {
|
|
171
171
|
this.languageConfigurationService = languageConfigurationService;
|
|
172
172
|
this.logService = logService;
|
|
173
|
+
this.languageFeaturesService = languageFeaturesService;
|
|
173
174
|
this._debugDisplayName = 'wordbasedCompletions';
|
|
174
175
|
this._workerManager = workerManager;
|
|
175
176
|
this._configurationService = configurationService;
|
|
@@ -180,6 +181,9 @@ class WordBasedCompletionItemProvider {
|
|
|
180
181
|
if (config.wordBasedSuggestions === 'off') {
|
|
181
182
|
return undefined;
|
|
182
183
|
}
|
|
184
|
+
if (config.wordBasedSuggestions === 'offWithInlineSuggestions' && this.languageFeaturesService.inlineCompletionsProvider.has(model)) {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
183
187
|
const models = [];
|
|
184
188
|
if (config.wordBasedSuggestions === 'currentDocument') {
|
|
185
189
|
// only current file and only if not too large
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/services/editorWorkerService.ts","vs/editor/browser/services/editorWorkerService.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAe,MAAM,mCAAmC,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAA6B,MAAM,0CAA0C,CAAC;AAC9G,OAAO,EAAE,mBAAmB,EAAE,MAAM,4DAA4D,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAE5F,OAAO,EAAU,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,yDAAyD,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,iCAAiC,EAAE,MAAM,oDAAoD,CAAC;AACvG,OAAO,EAAE,eAAe,EAAE,MAAM,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ACxF,OAAO,KAAK,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,SAAgB,EAAE,WAA+B,EAAE,aAAqB;QACnG,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC;QACrC,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC;QACzC,OAAO,KAAK,CAAC,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IACpG,CAAC;IAEQ,OAAO;QACf,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACvB,CAAC;CACD,CAAA;AA1FY,kBAAkB;IAY5B,WAAA,aAAa,CAAA;IACb,WAAA,iBAAiB,CAAA;GAbP,kBAAkB,CA0F9B","file":"editorWorkerService.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 { timeout } from '../../../base/common/async.js';\nimport { Disposable, IDisposable } from '../../../base/common/lifecycle.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { logOnceWebWorkerWarning, IWebWorkerClient, Proxied } from '../../../base/common/worker/webWorker.js';\nimport { WebWorkerDescriptor } from '../../../platform/webWorker/browser/webWorkerDescriptor.js';\nimport { IWebWorkerService } from '../../../platform/webWorker/browser/webWorkerService.js';\nimport { Position } from '../../common/core/position.js';\nimport { IRange, Range } from '../../common/core/range.js';\nimport { ITextModel } from '../../common/model.js';\nimport * as languages from '../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../common/languages/languageConfigurationRegistry.js';\nimport { EditorWorker } from '../../common/services/editorWebWorker.js';\nimport { DiffAlgorithmName, IEditorWorkerService, ILineChange, IUnicodeHighlightsResult } from '../../common/services/editorWorker.js';\nimport { IModelService } from '../../common/services/model.js';\nimport { ITextResourceConfigurationService } from '../../common/services/textResourceConfiguration.js';\nimport { isNonEmptyArray } from '../../../base/common/arrays.js';\nimport { ILogService } from '../../../platform/log/common/log.js';\nimport { StopWatch } from '../../../base/common/stopwatch.js';\nimport { canceled } from '../../../base/common/errors.js';\nimport { UnicodeHighlighterOptions } from '../../common/services/unicodeTextModelHighlighter.js';\nimport { ILanguageFeaturesService } from '../../common/services/languageFeatures.js';\nimport { IDocumentDiff, IDocumentDiffProviderOptions } from '../../common/diff/documentDiffProvider.js';\nimport { MovedText } from '../../common/diff/linesDiffComputer.js';\nimport { DetailedLineRangeMapping, RangeMapping, LineRangeMapping } from '../../common/diff/rangeMapping.js';\nimport { LineRange } from '../../common/core/ranges/lineRange.js';\nimport { SectionHeader, FindSectionHeaderOptions } from '../../common/services/findSectionHeaders.js';\nimport { mainWindow } from '../../../base/browser/window.js';\nimport { WindowIntervalTimer } from '../../../base/browser/dom.js';\nimport { WorkerTextModelSyncClient } from '../../common/services/textModelSync/textModelSync.impl.js';\nimport { EditorWorkerHost } from '../../common/services/editorWorkerHost.js';\nimport { FileAccess } from '../../../base/common/network.js';\n\n/**\n * Stop the worker if it was not needed for 5 min.\n */\nconst STOP_WORKER_DELTA_TIME_MS = 5 * 60 * 1000;\n\nfunction canSyncModel(modelService: IModelService, resource: URI): boolean {\n\tconst model = modelService.getModel(resource);\n\tif (!model) {\n\t\treturn false;\n\t}\n\tif (model.isTooLargeForSyncing()) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\nexport class EditorWorkerService extends Disposable implements IEditorWorkerService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate readonly _modelService: IModelService;\n\tprivate readonly _workerManager: WorkerManager;\n\tprivate readonly _logService: ILogService;\n\n\tconstructor(\n\t\t@IModelService modelService: IModelService,\n\t\t@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,\n\t\t@ILogService logService: ILogService,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILanguageFeaturesService languageFeaturesService: ILanguageFeaturesService,\n\t\t@IWebWorkerService private readonly _webWorkerService: IWebWorkerService,\n\t) {\n\t\tsuper();\n\t\tthis._modelService = modelService;\n\n\t\tconst workerDescriptor = new WebWorkerDescriptor({\n\t\t\tesmModuleLocation: () => FileAccess.asBrowserUri('vs/editor/common/services/editorWebWorkerMain.js'),\n\t\t\tesmModuleLocationBundler: () => new URL('../../common/services/editorWebWorkerMain.js?workerModule', import.meta.url),\n\t\t\tlabel: 'editorWorkerService'\n\t\t});\n\n\t\tthis._workerManager = this._register(new WorkerManager(workerDescriptor, this._modelService, this._webWorkerService));\n\t\tthis._logService = logService;\n\n\t\t// register default link-provider and default completions-provider\n\t\tthis._register(languageFeaturesService.linkProvider.register({ language: '*', hasAccessToAllModels: true }, {\n\t\t\tprovideLinks: async (model, token) => {\n\t\t\t\tif (!canSyncModel(this._modelService, model.uri)) {\n\t\t\t\t\treturn Promise.resolve({ links: [] }); // File too large\n\t\t\t\t}\n\t\t\t\tconst worker = await this._workerWithResources([model.uri]);\n\t\t\t\tconst links = await worker.$computeLinks(model.uri.toString());\n\t\t\t\treturn links && { links };\n\t\t\t}\n\t\t}));\n\t\tthis._register(languageFeaturesService.completionProvider.register('*', new WordBasedCompletionItemProvider(this._workerManager, configurationService, this._modelService, this._languageConfigurationService, this._logService)));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t}\n\n\tpublic canComputeUnicodeHighlights(uri: URI): boolean {\n\t\treturn canSyncModel(this._modelService, uri);\n\t}\n\n\tpublic async computedUnicodeHighlights(uri: URI, options: UnicodeHighlighterOptions, range?: IRange): Promise<IUnicodeHighlightsResult> {\n\t\tconst worker = await this._workerWithResources([uri]);\n\t\treturn worker.$computeUnicodeHighlights(uri.toString(), options, range);\n\t}\n\n\tpublic async computeDiff(original: URI, modified: URI, options: IDocumentDiffProviderOptions, algorithm: DiffAlgorithmName): Promise<IDocumentDiff | null> {\n\t\tconst worker = await this._workerWithResources([original, modified], /* forceLargeModels */true);\n\t\tconst result = await worker.$computeDiff(original.toString(), modified.toString(), options, algorithm);\n\t\tif (!result) {\n\t\t\treturn null;\n\t\t}\n\t\t// Convert from space efficient JSON data to rich objects.\n\t\tconst diff: IDocumentDiff = {\n\t\t\tidentical: result.identical,\n\t\t\tquitEarly: result.quitEarly,\n\t\t\tchanges: toLineRangeMappings(result.changes),\n\t\t\tmoves: result.moves.map(m => new MovedText(\n\t\t\t\tnew LineRangeMapping(new LineRange(m[0], m[1]), new LineRange(m[2], m[3])),\n\t\t\t\ttoLineRangeMappings(m[4])\n\t\t\t))\n\t\t};\n\t\treturn diff;\n\n\t\tfunction toLineRangeMappings(changes: readonly ILineChange[]): readonly DetailedLineRangeMapping[] {\n\t\t\treturn changes.map(\n\t\t\t\t(c) => new DetailedLineRangeMapping(\n\t\t\t\t\tnew LineRange(c[0], c[1]),\n\t\t\t\t\tnew LineRange(c[2], c[3]),\n\t\t\t\t\tc[4]?.map(\n\t\t\t\t\t\t(c) => new RangeMapping(\n\t\t\t\t\t\t\tnew Range(c[0], c[1], c[2], c[3]),\n\t\t\t\t\t\t\tnew Range(c[4], c[5], c[6], c[7])\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic async computeMoreMinimalEdits(resource: URI, edits: languages.TextEdit[] | null | undefined, pretty: boolean = false): Promise<languages.TextEdit[] | undefined> {\n\t\tif (isNonEmptyArray(edits)) {\n\t\t\tif (!canSyncModel(this._modelService, resource)) {\n\t\t\t\treturn Promise.resolve(edits); // File too large\n\t\t\t}\n\t\t\tconst sw = StopWatch.create();\n\t\t\tconst result = this._workerWithResources([resource]).then(worker => worker.$computeMoreMinimalEdits(resource.toString(), edits, pretty));\n\t\t\tresult.finally(() => this._logService.trace('FORMAT#computeMoreMinimalEdits', resource.toString(true), sw.elapsed()));\n\t\t\treturn Promise.race([result, timeout(1000).then(() => edits)]);\n\n\t\t} else {\n\t\t\treturn Promise.resolve(undefined);\n\t\t}\n\t}\n\n\tpublic canNavigateValueSet(resource: URI): boolean {\n\t\treturn (canSyncModel(this._modelService, resource));\n\t}\n\n\tpublic async navigateValueSet(resource: URI, range: IRange, up: boolean): Promise<languages.IInplaceReplaceSupportResult | null> {\n\t\tconst model = this._modelService.getModel(resource);\n\t\tif (!model) {\n\t\t\treturn null;\n\t\t}\n\t\tconst wordDefRegExp = this._languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n\t\tconst wordDef = wordDefRegExp.source;\n\t\tconst wordDefFlags = wordDefRegExp.flags;\n\t\tconst worker = await this._workerWithResources([resource]);\n\t\treturn worker.$navigateValueSet(resource.toString(), range, up, wordDef, wordDefFlags);\n\t}\n\n\tpublic canComputeWordRanges(resource: URI): boolean {\n\t\treturn canSyncModel(this._modelService, resource);\n\t}\n\n\tpublic async computeWordRanges(resource: URI, range: IRange): Promise<{ [word: string]: IRange[] } | null> {\n\t\tconst model = this._modelService.getModel(resource);\n\t\tif (!model) {\n\t\t\treturn Promise.resolve(null);\n\t\t}\n\t\tconst wordDefRegExp = this._languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n\t\tconst wordDef = wordDefRegExp.source;\n\t\tconst wordDefFlags = wordDefRegExp.flags;\n\t\tconst worker = await this._workerWithResources([resource]);\n\t\treturn worker.$computeWordRanges(resource.toString(), range, wordDef, wordDefFlags);\n\t}\n\n\tpublic async findSectionHeaders(uri: URI, options: FindSectionHeaderOptions): Promise<SectionHeader[]> {\n\t\tconst worker = await this._workerWithResources([uri]);\n\t\treturn worker.$findSectionHeaders(uri.toString(), options);\n\t}\n\n\tpublic async computeDefaultDocumentColors(uri: URI): Promise<languages.IColorInformation[] | null> {\n\t\tconst worker = await this._workerWithResources([uri]);\n\t\treturn worker.$computeDefaultDocumentColors(uri.toString());\n\t}\n\n\tprivate async _workerWithResources(resources: URI[], forceLargeModels: boolean = false): Promise<Proxied<EditorWorker>> {\n\t\tconst worker = await this._workerManager.withWorker();\n\t\treturn await worker.workerWithSyncedResources(resources, forceLargeModels);\n\t}\n}\n\nclass WordBasedCompletionItemProvider implements languages.CompletionItemProvider {\n\n\tprivate readonly _workerManager: WorkerManager;\n\tprivate readonly _configurationService: ITextResourceConfigurationService;\n\tprivate readonly _modelService: IModelService;\n\n\treadonly _debugDisplayName = 'wordbasedCompletions';\n\n\tconstructor(\n\t\tworkerManager: WorkerManager,\n\t\tconfigurationService: ITextResourceConfigurationService,\n\t\tmodelService: IModelService,\n\t\tprivate readonly languageConfigurationService: ILanguageConfigurationService,\n\t\tprivate readonly logService: ILogService\n\t) {\n\t\tthis._workerManager = workerManager;\n\t\tthis._configurationService = configurationService;\n\t\tthis._modelService = modelService;\n\t}\n\n\tasync provideCompletionItems(model: ITextModel, position: Position): Promise<languages.CompletionList | undefined> {\n\t\ttype WordBasedSuggestionsConfig = {\n\t\t\twordBasedSuggestions?: 'off' | 'currentDocument' | 'matchingDocuments' | 'allDocuments';\n\t\t};\n\t\tconst config = this._configurationService.getValue<WordBasedSuggestionsConfig>(model.uri, position, 'editor');\n\t\tif (config.wordBasedSuggestions === 'off') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst models: URI[] = [];\n\t\tif (config.wordBasedSuggestions === 'currentDocument') {\n\t\t\t// only current file and only if not too large\n\t\t\tif (canSyncModel(this._modelService, model.uri)) {\n\t\t\t\tmodels.push(model.uri);\n\t\t\t}\n\t\t} else {\n\t\t\t// either all files or files of same language\n\t\t\tfor (const candidate of this._modelService.getModels()) {\n\t\t\t\tif (!canSyncModel(this._modelService, candidate.uri)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (candidate === model) {\n\t\t\t\t\tmodels.unshift(candidate.uri);\n\n\t\t\t\t} else if (config.wordBasedSuggestions === 'allDocuments' || candidate.getLanguageId() === model.getLanguageId()) {\n\t\t\t\t\tmodels.push(candidate.uri);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (models.length === 0) {\n\t\t\treturn undefined; // File too large, no other files\n\t\t}\n\n\t\tconst wordDefRegExp = this.languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n\t\tconst word = model.getWordAtPosition(position);\n\t\tconst replace = !word ? Range.fromPositions(position) : new Range(position.lineNumber, word.startColumn, position.lineNumber, word.endColumn);\n\t\tconst insert = replace.setEndPosition(position.lineNumber, position.column);\n\n\t\t// Trace logging about the word and replace/insert ranges\n\t\tthis.logService.trace('[WordBasedCompletionItemProvider]', `word: \"${word?.word || ''}\", wordDef: \"${wordDefRegExp}\", replace: [${replace.toString()}], insert: [${insert.toString()}]`);\n\n\t\tconst client = await this._workerManager.withWorker();\n\t\tconst data = await client.textualSuggest(models, word?.word, wordDefRegExp);\n\t\tif (!data) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tduration: data.duration,\n\t\t\tsuggestions: data.words.map((word): languages.CompletionItem => {\n\t\t\t\treturn {\n\t\t\t\t\tkind: languages.CompletionItemKind.Text,\n\t\t\t\t\tlabel: word,\n\t\t\t\t\tinsertText: word,\n\t\t\t\t\trange: { insert, replace }\n\t\t\t\t};\n\t\t\t}),\n\t\t};\n\t}\n}\n\nclass WorkerManager extends Disposable {\n\n\tprivate readonly _modelService: IModelService;\n\tprivate readonly _webWorkerService: IWebWorkerService;\n\tprivate _editorWorkerClient: EditorWorkerClient | null;\n\tprivate _lastWorkerUsedTime: number;\n\n\tconstructor(\n\t\tprivate readonly _workerDescriptor: WebWorkerDescriptor,\n\t\t@IModelService modelService: IModelService,\n\t\t@IWebWorkerService webWorkerService: IWebWorkerService\n\t) {\n\t\tsuper();\n\t\tthis._modelService = modelService;\n\t\tthis._webWorkerService = webWorkerService;\n\t\tthis._editorWorkerClient = null;\n\t\tthis._lastWorkerUsedTime = (new Date()).getTime();\n\n\t\tconst stopWorkerInterval = this._register(new WindowIntervalTimer());\n\t\tstopWorkerInterval.cancelAndSet(() => this._checkStopIdleWorker(), Math.round(STOP_WORKER_DELTA_TIME_MS / 2), mainWindow);\n\n\t\tthis._register(this._modelService.onModelRemoved(_ => this._checkStopEmptyWorker()));\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this._editorWorkerClient) {\n\t\t\tthis._editorWorkerClient.dispose();\n\t\t\tthis._editorWorkerClient = null;\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\t/**\n\t * Check if the model service has no more models and stop the worker if that is the case.\n\t */\n\tprivate _checkStopEmptyWorker(): void {\n\t\tif (!this._editorWorkerClient) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst models = this._modelService.getModels();\n\t\tif (models.length === 0) {\n\t\t\t// There are no more models => nothing possible for me to do\n\t\t\tthis._editorWorkerClient.dispose();\n\t\t\tthis._editorWorkerClient = null;\n\t\t}\n\t}\n\n\t/**\n\t * Check if the worker has been idle for a while and then stop it.\n\t */\n\tprivate _checkStopIdleWorker(): void {\n\t\tif (!this._editorWorkerClient) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst timeSinceLastWorkerUsedTime = (new Date()).getTime() - this._lastWorkerUsedTime;\n\t\tif (timeSinceLastWorkerUsedTime > STOP_WORKER_DELTA_TIME_MS) {\n\t\t\tthis._editorWorkerClient.dispose();\n\t\t\tthis._editorWorkerClient = null;\n\t\t}\n\t}\n\n\tpublic withWorker(): Promise<EditorWorkerClient> {\n\t\tthis._lastWorkerUsedTime = (new Date()).getTime();\n\t\tif (!this._editorWorkerClient) {\n\t\t\tthis._editorWorkerClient = new EditorWorkerClient(this._workerDescriptor, false, this._modelService, this._webWorkerService);\n\t\t}\n\t\treturn Promise.resolve(this._editorWorkerClient);\n\t}\n}\n\nclass SynchronousWorkerClient<T extends IDisposable> implements IWebWorkerClient<T> {\n\tprivate readonly _instance: T;\n\tpublic readonly proxy: Proxied<T>;\n\n\tconstructor(instance: T) {\n\t\tthis._instance = instance;\n\t\tthis.proxy = this._instance as Proxied<T>;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._instance.dispose();\n\t}\n\n\tpublic setChannel<T extends object>(channel: string, handler: T): void {\n\t\tthrow new Error(`Not supported`);\n\t}\n}\n\nexport interface IEditorWorkerClient {\n}\n\nexport class EditorWorkerClient extends Disposable implements IEditorWorkerClient {\n\n\tprivate readonly _modelService: IModelService;\n\tprivate readonly _webWorkerService: IWebWorkerService;\n\tprivate readonly _keepIdleModels: boolean;\n\tprivate _worker: IWebWorkerClient<EditorWorker> | null;\n\tprivate _modelManager: WorkerTextModelSyncClient | null;\n\tprivate _disposed = false;\n\n\tconstructor(\n\t\tprivate readonly _workerDescriptorOrWorker: WebWorkerDescriptor | Worker | Promise<Worker>,\n\t\tkeepIdleModels: boolean,\n\t\t@IModelService modelService: IModelService,\n\t\t@IWebWorkerService webWorkerService: IWebWorkerService\n\t) {\n\t\tsuper();\n\t\tthis._modelService = modelService;\n\t\tthis._webWorkerService = webWorkerService;\n\t\tthis._keepIdleModels = keepIdleModels;\n\t\tthis._worker = null;\n\t\tthis._modelManager = null;\n\t}\n\n\t// foreign host request\n\tpublic fhr(method: string, args: unknown[]): Promise<unknown> {\n\t\tthrow new Error(`Not implemented!`);\n\t}\n\n\tprivate _getOrCreateWorker(): IWebWorkerClient<EditorWorker> {\n\t\tif (!this._worker) {\n\t\t\ttry {\n\t\t\t\tthis._worker = this._register(this._webWorkerService.createWorkerClient<EditorWorker>(this._workerDescriptorOrWorker));\n\t\t\t\tEditorWorkerHost.setChannel(this._worker, this._createEditorWorkerHost());\n\t\t\t} catch (err) {\n\t\t\t\tlogOnceWebWorkerWarning(err);\n\t\t\t\tthis._worker = this._createFallbackLocalWorker();\n\t\t\t}\n\t\t}\n\t\treturn this._worker;\n\t}\n\n\tprotected async _getProxy(): Promise<Proxied<EditorWorker>> {\n\t\ttry {\n\t\t\tconst proxy = this._getOrCreateWorker().proxy;\n\t\t\tawait proxy.$ping();\n\t\t\treturn proxy;\n\t\t} catch (err) {\n\t\t\tlogOnceWebWorkerWarning(err);\n\t\t\tthis._worker = this._createFallbackLocalWorker();\n\t\t\treturn this._worker.proxy;\n\t\t}\n\t}\n\n\tprivate _createFallbackLocalWorker(): SynchronousWorkerClient<EditorWorker> {\n\t\treturn new SynchronousWorkerClient(new EditorWorker(null));\n\t}\n\n\tprivate _createEditorWorkerHost(): EditorWorkerHost {\n\t\treturn {\n\t\t\t$fhr: (method, args) => this.fhr(method, args)\n\t\t};\n\t}\n\n\tprivate _getOrCreateModelManager(proxy: Proxied<EditorWorker>): WorkerTextModelSyncClient {\n\t\tif (!this._modelManager) {\n\t\t\tthis._modelManager = this._register(new WorkerTextModelSyncClient(proxy, this._modelService, this._keepIdleModels));\n\t\t}\n\t\treturn this._modelManager;\n\t}\n\n\tpublic async workerWithSyncedResources(resources: URI[], forceLargeModels: boolean = false): Promise<Proxied<EditorWorker>> {\n\t\tif (this._disposed) {\n\t\t\treturn Promise.reject(canceled());\n\t\t}\n\t\tconst proxy = await this._getProxy();\n\t\tthis._getOrCreateModelManager(proxy).ensureSyncedResources(resources, forceLargeModels);\n\t\treturn proxy;\n\t}\n\n\tpublic async textualSuggest(resources: URI[], leadingWord: string | undefined, wordDefRegExp: RegExp): Promise<{ words: string[]; duration: number } | null> {\n\t\tconst proxy = await this.workerWithSyncedResources(resources);\n\t\tconst wordDef = wordDefRegExp.source;\n\t\tconst wordDefFlags = wordDefRegExp.flags;\n\t\treturn proxy.$textualSuggest(resources.map(r => r.toString()), leadingWord, wordDef, wordDefFlags);\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\t\tthis._disposed = 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 { timeout } from '../../../base/common/async.js';\nimport { Disposable, IDisposable } from '../../../base/common/lifecycle.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { logOnceWebWorkerWarning, IWebWorkerClient, Proxied } from '../../../base/common/worker/webWorker.js';\nimport { WebWorkerDescriptor } from '../../../platform/webWorker/browser/webWorkerDescriptor.js';\nimport { IWebWorkerService } from '../../../platform/webWorker/browser/webWorkerService.js';\nimport { Position } from '../../common/core/position.js';\nimport { IRange, Range } from '../../common/core/range.js';\nimport { ITextModel } from '../../common/model.js';\nimport * as languages from '../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../common/languages/languageConfigurationRegistry.js';\nimport { EditorWorker } from '../../common/services/editorWebWorker.js';\nimport { DiffAlgorithmName, IEditorWorkerService, ILineChange, IUnicodeHighlightsResult } from '../../common/services/editorWorker.js';\nimport { IModelService } from '../../common/services/model.js';\nimport { ITextResourceConfigurationService } from '../../common/services/textResourceConfiguration.js';\nimport { isNonEmptyArray } from '../../../base/common/arrays.js';\nimport { ILogService } from '../../../platform/log/common/log.js';\nimport { StopWatch } from '../../../base/common/stopwatch.js';\nimport { canceled } from '../../../base/common/errors.js';\nimport { UnicodeHighlighterOptions } from '../../common/services/unicodeTextModelHighlighter.js';\nimport { ILanguageFeaturesService } from '../../common/services/languageFeatures.js';\nimport { IDocumentDiff, IDocumentDiffProviderOptions } from '../../common/diff/documentDiffProvider.js';\nimport { MovedText } from '../../common/diff/linesDiffComputer.js';\nimport { DetailedLineRangeMapping, RangeMapping, LineRangeMapping } from '../../common/diff/rangeMapping.js';\nimport { LineRange } from '../../common/core/ranges/lineRange.js';\nimport { SectionHeader, FindSectionHeaderOptions } from '../../common/services/findSectionHeaders.js';\nimport { mainWindow } from '../../../base/browser/window.js';\nimport { WindowIntervalTimer } from '../../../base/browser/dom.js';\nimport { WorkerTextModelSyncClient } from '../../common/services/textModelSync/textModelSync.impl.js';\nimport { EditorWorkerHost } from '../../common/services/editorWorkerHost.js';\nimport { FileAccess } from '../../../base/common/network.js';\n\n/**\n * Stop the worker if it was not needed for 5 min.\n */\nconst STOP_WORKER_DELTA_TIME_MS = 5 * 60 * 1000;\n\nfunction canSyncModel(modelService: IModelService, resource: URI): boolean {\n\tconst model = modelService.getModel(resource);\n\tif (!model) {\n\t\treturn false;\n\t}\n\tif (model.isTooLargeForSyncing()) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\nexport class EditorWorkerService extends Disposable implements IEditorWorkerService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate readonly _modelService: IModelService;\n\tprivate readonly _workerManager: WorkerManager;\n\tprivate readonly _logService: ILogService;\n\n\tconstructor(\n\t\t@IModelService modelService: IModelService,\n\t\t@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,\n\t\t@ILogService logService: ILogService,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILanguageFeaturesService languageFeaturesService: ILanguageFeaturesService,\n\t\t@IWebWorkerService private readonly _webWorkerService: IWebWorkerService,\n\t) {\n\t\tsuper();\n\t\tthis._modelService = modelService;\n\n\t\tconst workerDescriptor = new WebWorkerDescriptor({\n\t\t\tesmModuleLocation: () => FileAccess.asBrowserUri('vs/editor/common/services/editorWebWorkerMain.js'),\n\t\t\tesmModuleLocationBundler: () => new URL('../../common/services/editorWebWorkerMain.js?workerModule', import.meta.url),\n\t\t\tlabel: 'editorWorkerService'\n\t\t});\n\n\t\tthis._workerManager = this._register(new WorkerManager(workerDescriptor, this._modelService, this._webWorkerService));\n\t\tthis._logService = logService;\n\n\t\t// register default link-provider and default completions-provider\n\t\tthis._register(languageFeaturesService.linkProvider.register({ language: '*', hasAccessToAllModels: true }, {\n\t\t\tprovideLinks: async (model, token) => {\n\t\t\t\tif (!canSyncModel(this._modelService, model.uri)) {\n\t\t\t\t\treturn Promise.resolve({ links: [] }); // File too large\n\t\t\t\t}\n\t\t\t\tconst worker = await this._workerWithResources([model.uri]);\n\t\t\t\tconst links = await worker.$computeLinks(model.uri.toString());\n\t\t\t\treturn links && { links };\n\t\t\t}\n\t\t}));\n\t\tthis._register(languageFeaturesService.completionProvider.register('*', new WordBasedCompletionItemProvider(this._workerManager, configurationService, this._modelService, this._languageConfigurationService, this._logService)));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t}\n\n\tpublic canComputeUnicodeHighlights(uri: URI): boolean {\n\t\treturn canSyncModel(this._modelService, uri);\n\t}\n\n\tpublic async computedUnicodeHighlights(uri: URI, options: UnicodeHighlighterOptions, range?: IRange): Promise<IUnicodeHighlightsResult> {\n\t\tconst worker = await this._workerWithResources([uri]);\n\t\treturn worker.$computeUnicodeHighlights(uri.toString(), options, range);\n\t}\n\n\tpublic async computeDiff(original: URI, modified: URI, options: IDocumentDiffProviderOptions, algorithm: DiffAlgorithmName): Promise<IDocumentDiff | null> {\n\t\tconst worker = await this._workerWithResources([original, modified], /* forceLargeModels */true);\n\t\tconst result = await worker.$computeDiff(original.toString(), modified.toString(), options, algorithm);\n\t\tif (!result) {\n\t\t\treturn null;\n\t\t}\n\t\t// Convert from space efficient JSON data to rich objects.\n\t\tconst diff: IDocumentDiff = {\n\t\t\tidentical: result.identical,\n\t\t\tquitEarly: result.quitEarly,\n\t\t\tchanges: toLineRangeMappings(result.changes),\n\t\t\tmoves: result.moves.map(m => new MovedText(\n\t\t\t\tnew LineRangeMapping(new LineRange(m[0], m[1]), new LineRange(m[2], m[3])),\n\t\t\t\ttoLineRangeMappings(m[4])\n\t\t\t))\n\t\t};\n\t\treturn diff;\n\n\t\tfunction toLineRangeMappings(changes: readonly ILineChange[]): readonly DetailedLineRangeMapping[] {\n\t\t\treturn changes.map(\n\t\t\t\t(c) => new DetailedLineRangeMapping(\n\t\t\t\t\tnew LineRange(c[0], c[1]),\n\t\t\t\t\tnew LineRange(c[2], c[3]),\n\t\t\t\t\tc[4]?.map(\n\t\t\t\t\t\t(c) => new RangeMapping(\n\t\t\t\t\t\t\tnew Range(c[0], c[1], c[2], c[3]),\n\t\t\t\t\t\t\tnew Range(c[4], c[5], c[6], c[7])\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic async computeMoreMinimalEdits(resource: URI, edits: languages.TextEdit[] | null | undefined, pretty: boolean = false): Promise<languages.TextEdit[] | undefined> {\n\t\tif (isNonEmptyArray(edits)) {\n\t\t\tif (!canSyncModel(this._modelService, resource)) {\n\t\t\t\treturn Promise.resolve(edits); // File too large\n\t\t\t}\n\t\t\tconst sw = StopWatch.create();\n\t\t\tconst result = this._workerWithResources([resource]).then(worker => worker.$computeMoreMinimalEdits(resource.toString(), edits, pretty));\n\t\t\tresult.finally(() => this._logService.trace('FORMAT#computeMoreMinimalEdits', resource.toString(true), sw.elapsed()));\n\t\t\treturn Promise.race([result, timeout(1000).then(() => edits)]);\n\n\t\t} else {\n\t\t\treturn Promise.resolve(undefined);\n\t\t}\n\t}\n\n\tpublic canNavigateValueSet(resource: URI): boolean {\n\t\treturn (canSyncModel(this._modelService, resource));\n\t}\n\n\tpublic async navigateValueSet(resource: URI, range: IRange, up: boolean): Promise<languages.IInplaceReplaceSupportResult | null> {\n\t\tconst model = this._modelService.getModel(resource);\n\t\tif (!model) {\n\t\t\treturn null;\n\t\t}\n\t\tconst wordDefRegExp = this._languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n\t\tconst wordDef = wordDefRegExp.source;\n\t\tconst wordDefFlags = wordDefRegExp.flags;\n\t\tconst worker = await this._workerWithResources([resource]);\n\t\treturn worker.$navigateValueSet(resource.toString(), range, up, wordDef, wordDefFlags);\n\t}\n\n\tpublic canComputeWordRanges(resource: URI): boolean {\n\t\treturn canSyncModel(this._modelService, resource);\n\t}\n\n\tpublic async computeWordRanges(resource: URI, range: IRange): Promise<{ [word: string]: IRange[] } | null> {\n\t\tconst model = this._modelService.getModel(resource);\n\t\tif (!model) {\n\t\t\treturn Promise.resolve(null);\n\t\t}\n\t\tconst wordDefRegExp = this._languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n\t\tconst wordDef = wordDefRegExp.source;\n\t\tconst wordDefFlags = wordDefRegExp.flags;\n\t\tconst worker = await this._workerWithResources([resource]);\n\t\treturn worker.$computeWordRanges(resource.toString(), range, wordDef, wordDefFlags);\n\t}\n\n\tpublic async findSectionHeaders(uri: URI, options: FindSectionHeaderOptions): Promise<SectionHeader[]> {\n\t\tconst worker = await this._workerWithResources([uri]);\n\t\treturn worker.$findSectionHeaders(uri.toString(), options);\n\t}\n\n\tpublic async computeDefaultDocumentColors(uri: URI): Promise<languages.IColorInformation[] | null> {\n\t\tconst worker = await this._workerWithResources([uri]);\n\t\treturn worker.$computeDefaultDocumentColors(uri.toString());\n\t}\n\n\tprivate async _workerWithResources(resources: URI[], forceLargeModels: boolean = false): Promise<Proxied<EditorWorker>> {\n\t\tconst worker = await this._workerManager.withWorker();\n\t\treturn await worker.workerWithSyncedResources(resources, forceLargeModels);\n\t}\n}\n\nclass WordBasedCompletionItemProvider implements languages.CompletionItemProvider {\n\n\tprivate readonly _workerManager: WorkerManager;\n\tprivate readonly _configurationService: ITextResourceConfigurationService;\n\tprivate readonly _modelService: IModelService;\n\n\treadonly _debugDisplayName = 'wordbasedCompletions';\n\n\tconstructor(\n\t\tworkerManager: WorkerManager,\n\t\tconfigurationService: ITextResourceConfigurationService,\n\t\tmodelService: IModelService,\n\t\tprivate readonly languageConfigurationService: ILanguageConfigurationService,\n\t\tprivate readonly logService: ILogService\n\t) {\n\t\tthis._workerManager = workerManager;\n\t\tthis._configurationService = configurationService;\n\t\tthis._modelService = modelService;\n\t}\n\n\tasync provideCompletionItems(model: ITextModel, position: Position): Promise<languages.CompletionList | undefined> {\n\t\ttype WordBasedSuggestionsConfig = {\n\t\t\twordBasedSuggestions?: 'off' | 'currentDocument' | 'matchingDocuments' | 'allDocuments';\n\t\t};\n\t\tconst config = this._configurationService.getValue<WordBasedSuggestionsConfig>(model.uri, position, 'editor');\n\t\tif (config.wordBasedSuggestions === 'off') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst models: URI[] = [];\n\t\tif (config.wordBasedSuggestions === 'currentDocument') {\n\t\t\t// only current file and only if not too large\n\t\t\tif (canSyncModel(this._modelService, model.uri)) {\n\t\t\t\tmodels.push(model.uri);\n\t\t\t}\n\t\t} else {\n\t\t\t// either all files or files of same language\n\t\t\tfor (const candidate of this._modelService.getModels()) {\n\t\t\t\tif (!canSyncModel(this._modelService, candidate.uri)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (candidate === model) {\n\t\t\t\t\tmodels.unshift(candidate.uri);\n\n\t\t\t\t} else if (config.wordBasedSuggestions === 'allDocuments' || candidate.getLanguageId() === model.getLanguageId()) {\n\t\t\t\t\tmodels.push(candidate.uri);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (models.length === 0) {\n\t\t\treturn undefined; // File too large, no other files\n\t\t}\n\n\t\tconst wordDefRegExp = this.languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n\t\tconst word = model.getWordAtPosition(position);\n\t\tconst replace = !word ? Range.fromPositions(position) : new Range(position.lineNumber, word.startColumn, position.lineNumber, word.endColumn);\n\t\tconst insert = replace.setEndPosition(position.lineNumber, position.column);\n\n\t\t// Trace logging about the word and replace/insert ranges\n\t\tthis.logService.trace('[WordBasedCompletionItemProvider]', `word: \"${word?.word || ''}\", wordDef: \"${wordDefRegExp}\", replace: [${replace.toString()}], insert: [${insert.toString()}]`);\n\n\t\tconst client = await this._workerManager.withWorker();\n\t\tconst data = await client.textualSuggest(models, word?.word, wordDefRegExp);\n\t\tif (!data) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tduration: data.duration,\n\t\t\tsuggestions: data.words.map((word): languages.CompletionItem => {\n\t\t\t\treturn {\n\t\t\t\t\tkind: languages.CompletionItemKind.Text,\n\t\t\t\t\tlabel: word,\n\t\t\t\t\tinsertText: word,\n\t\t\t\t\trange: { insert, replace }\n\t\t\t\t};\n\t\t\t}),\n\t\t};\n\t}\n}\n\nclass WorkerManager extends Disposable {\n\n\tprivate readonly _modelService: IModelService;\n\tprivate readonly _webWorkerService: IWebWorkerService;\n\tprivate _editorWorkerClient: EditorWorkerClient | null;\n\tprivate _lastWorkerUsedTime: number;\n\n\tconstructor(\n\t\tprivate readonly _workerDescriptor: WebWorkerDescriptor,\n\t\t@IModelService modelService: IModelService,\n\t\t@IWebWorkerService webWorkerService: IWebWorkerService\n\t) {\n\t\tsuper();\n\t\tthis._modelService = modelService;\n\t\tthis._webWorkerService = webWorkerService;\n\t\tthis._editorWorkerClient = null;\n\t\tthis._lastWorkerUsedTime = (new Date()).getTime();\n\n\t\tconst stopWorkerInterval = this._register(new WindowIntervalTimer());\n\t\tstopWorkerInterval.cancelAndSet(() => this._checkStopIdleWorker(), Math.round(STOP_WORKER_DELTA_TIME_MS / 2), mainWindow);\n\n\t\tthis._register(this._modelService.onModelRemoved(_ => this._checkStopEmptyWorker()));\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this._editorWorkerClient) {\n\t\t\tthis._editorWorkerClient.dispose();\n\t\t\tthis._editorWorkerClient = null;\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\t/**\n\t * Check if the model service has no more models and stop the worker if that is the case.\n\t */\n\tprivate _checkStopEmptyWorker(): void {\n\t\tif (!this._editorWorkerClient) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst models = this._modelService.getModels();\n\t\tif (models.length === 0) {\n\t\t\t// There are no more models => nothing possible for me to do\n\t\t\tthis._editorWorkerClient.dispose();\n\t\t\tthis._editorWorkerClient = null;\n\t\t}\n\t}\n\n\t/**\n\t * Check if the worker has been idle for a while and then stop it.\n\t */\n\tprivate _checkStopIdleWorker(): void {\n\t\tif (!this._editorWorkerClient) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst timeSinceLastWorkerUsedTime = (new Date()).getTime() - this._lastWorkerUsedTime;\n\t\tif (timeSinceLastWorkerUsedTime > STOP_WORKER_DELTA_TIME_MS) {\n\t\t\tthis._editorWorkerClient.dispose();\n\t\t\tthis._editorWorkerClient = null;\n\t\t}\n\t}\n\n\tpublic withWorker(): Promise<EditorWorkerClient> {\n\t\tthis._lastWorkerUsedTime = (new Date()).getTime();\n\t\tif (!this._editorWorkerClient) {\n\t\t\tthis._editorWorkerClient = new EditorWorkerClient(this._workerDescriptor, false, this._modelService, this._webWorkerService);\n\t\t}\n\t\treturn Promise.resolve(this._editorWorkerClient);\n\t}\n}\n\nclass SynchronousWorkerClient<T extends IDisposable> implements IWebWorkerClient<T> {\n\tprivate readonly _instance: T;\n\tpublic readonly proxy: Proxied<T>;\n\n\tconstructor(instance: T) {\n\t\tthis._instance = instance;\n\t\tthis.proxy = this._instance as Proxied<T>;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._instance.dispose();\n\t}\n\n\tpublic setChannel<T extends object>(channel: string, handler: T): void {\n\t\tthrow new Error(`Not supported`);\n\t}\n}\n\nexport interface IEditorWorkerClient {\n}\n\nexport class EditorWorkerClient extends Disposable implements IEditorWorkerClient {\n\n\tprivate readonly _modelService: IModelService;\n\tprivate readonly _webWorkerService: IWebWorkerService;\n\tprivate readonly _keepIdleModels: boolean;\n\tprivate _worker: IWebWorkerClient<EditorWorker> | null;\n\tprivate _modelManager: WorkerTextModelSyncClient | null;\n\tprivate _disposed = false;\n\n\tconstructor(\n\t\tprivate readonly _workerDescriptorOrWorker: WebWorkerDescriptor | Worker | Promise<Worker>,\n\t\tkeepIdleModels: boolean,\n\t\t@IModelService modelService: IModelService,\n\t\t@IWebWorkerService webWorkerService: IWebWorkerService\n\t) {\n\t\tsuper();\n\t\tthis._modelService = modelService;\n\t\tthis._webWorkerService = webWorkerService;\n\t\tthis._keepIdleModels = keepIdleModels;\n\t\tthis._worker = null;\n\t\tthis._modelManager = null;\n\t}\n\n\t// foreign host request\n\tpublic fhr(method: string, args: unknown[]): Promise<unknown> {\n\t\tthrow new Error(`Not implemented!`);\n\t}\n\n\tprivate _getOrCreateWorker(): IWebWorkerClient<EditorWorker> {\n\t\tif (!this._worker) {\n\t\t\ttry {\n\t\t\t\tthis._worker = this._register(this._webWorkerService.createWorkerClient<EditorWorker>(this._workerDescriptorOrWorker));\n\t\t\t\tEditorWorkerHost.setChannel(this._worker, this._createEditorWorkerHost());\n\t\t\t} catch (err) {\n\t\t\t\tlogOnceWebWorkerWarning(err);\n\t\t\t\tthis._worker = this._createFallbackLocalWorker();\n\t\t\t}\n\t\t}\n\t\treturn this._worker;\n\t}\n\n\tprotected async _getProxy(): Promise<Proxied<EditorWorker>> {\n\t\ttry {\n\t\t\tconst proxy = this._getOrCreateWorker().proxy;\n\t\t\tawait proxy.$ping();\n\t\t\treturn proxy;\n\t\t} catch (err) {\n\t\t\tlogOnceWebWorkerWarning(err);\n\t\t\tthis._worker = this._createFallbackLocalWorker();\n\t\t\treturn this._worker.proxy;\n\t\t}\n\t}\n\n\tprivate _createFallbackLocalWorker(): SynchronousWorkerClient<EditorWorker> {\n\t\treturn new SynchronousWorkerClient(new EditorWorker(null));\n\t}\n\n\tprivate _createEditorWorkerHost(): EditorWorkerHost {\n\t\treturn {\n\t\t\t$fhr: (method, args) => this.fhr(method, args)\n\t\t};\n\t}\n\n\tprivate _getOrCreateModelManager(proxy: Proxied<EditorWorker>): WorkerTextModelSyncClient {\n\t\tif (!this._modelManager) {\n\t\t\tthis._modelManager = this._register(new WorkerTextModelSyncClient(proxy, this._modelService, this._keepIdleModels));\n\t\t}\n\t\treturn this._modelManager;\n\t}\n\n\tpublic async workerWithSyncedResources(resources: URI[], forceLargeModels: boolean = false): Promise<Proxied<EditorWorker>> {\n\t\tif (this._disposed) {\n\t\t\treturn Promise.reject(canceled());\n\t\t}\n\t\tconst proxy = await this._getProxy();\n\t\tthis._getOrCreateModelManager(proxy).ensureSyncedResources(resources, forceLargeModels);\n\t\treturn proxy;\n\t}\n\n\tpublic async textualSuggest(resources: URI[], leadingWord: string | undefined, wordDefRegExp: RegExp): Promise<{ words: string[]; duration: number } | null> {\n\t\tconst proxy = await this.workerWithSyncedResources(resources);\n\t\tconst wordDef = wordDefRegExp.source;\n\t\tconst wordDefFlags = wordDefRegExp.flags;\n\t\treturn proxy.$textualSuggest(resources.map(r => r.toString()), leadingWord, wordDef, wordDefFlags);\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\t\tthis._disposed = true;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/browser/services/editorWorkerService.ts","vs/editor/browser/services/editorWorkerService.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAE,UAAU,EAAe,MAAM,mCAAmC,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAA6B,MAAM,0CAA0C,CAAC;AAC9G,OAAO,EAAE,mBAAmB,EAAE,MAAM,4DAA4D,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAE5F,OAAO,EAAU,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EAAE,6BAA6B,EAAE,MAAM,yDAAyD,CAAC;AACxG,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAExE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,iCAAiC,EAAE,MAAM,oDAAoD,CAAC;AACvG,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,gCAAgC,CAAC;AAE1D,OAAO,EAAE,w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AAqB,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAC;QACxF,OAAO,KAAK,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,SAAgB,EAAE,WAA+B,EAAE,aAAqB;QACnG,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,yBAAyB,CAAC,SAAS,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC;QACrC,MAAM,YAAY,GAAG,aAAa,CAAC,KAAK,CAAC;QACzC,OAAO,KAAK,CAAC,eAAe,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IACpG,CAAC;IAEQ,OAAO;QACf,KAAK,CAAC,OAAO,EAAE,CAAC;QAChB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;IACvB,CAAC;CACD,CAAA;AA1FY,kBAAkB;IAY5B,WAAA,aAAa,CAAA;IACb,WAAA,iBAAiB,CAAA;GAbP,kBAAkB,CA0F9B","file":"editorWorkerService.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 { timeout } from '../../../base/common/async.js';\nimport { Disposable, IDisposable } from '../../../base/common/lifecycle.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { logOnceWebWorkerWarning, IWebWorkerClient, Proxied } from '../../../base/common/worker/webWorker.js';\nimport { WebWorkerDescriptor } from '../../../platform/webWorker/browser/webWorkerDescriptor.js';\nimport { IWebWorkerService } from '../../../platform/webWorker/browser/webWorkerService.js';\nimport { Position } from '../../common/core/position.js';\nimport { IRange, Range } from '../../common/core/range.js';\nimport { ITextModel } from '../../common/model.js';\nimport * as languages from '../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../common/languages/languageConfigurationRegistry.js';\nimport { EditorWorker } from '../../common/services/editorWebWorker.js';\nimport { DiffAlgorithmName, IEditorWorkerService, ILineChange, IUnicodeHighlightsResult } from '../../common/services/editorWorker.js';\nimport { IModelService } from '../../common/services/model.js';\nimport { ITextResourceConfigurationService } from '../../common/services/textResourceConfiguration.js';\nimport { isNonEmptyArray } from '../../../base/common/arrays.js';\nimport { ILogService } from '../../../platform/log/common/log.js';\nimport { StopWatch } from '../../../base/common/stopwatch.js';\nimport { canceled } from '../../../base/common/errors.js';\nimport { UnicodeHighlighterOptions } from '../../common/services/unicodeTextModelHighlighter.js';\nimport { ILanguageFeaturesService } from '../../common/services/languageFeatures.js';\nimport { IDocumentDiff, IDocumentDiffProviderOptions } from '../../common/diff/documentDiffProvider.js';\nimport { MovedText } from '../../common/diff/linesDiffComputer.js';\nimport { DetailedLineRangeMapping, RangeMapping, LineRangeMapping } from '../../common/diff/rangeMapping.js';\nimport { LineRange } from '../../common/core/ranges/lineRange.js';\nimport { SectionHeader, FindSectionHeaderOptions } from '../../common/services/findSectionHeaders.js';\nimport { mainWindow } from '../../../base/browser/window.js';\nimport { WindowIntervalTimer } from '../../../base/browser/dom.js';\nimport { WorkerTextModelSyncClient } from '../../common/services/textModelSync/textModelSync.impl.js';\nimport { EditorWorkerHost } from '../../common/services/editorWorkerHost.js';\nimport { FileAccess } from '../../../base/common/network.js';\n\n/**\n * Stop the worker if it was not needed for 5 min.\n */\nconst STOP_WORKER_DELTA_TIME_MS = 5 * 60 * 1000;\n\nfunction canSyncModel(modelService: IModelService, resource: URI): boolean {\n\tconst model = modelService.getModel(resource);\n\tif (!model) {\n\t\treturn false;\n\t}\n\tif (model.isTooLargeForSyncing()) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\nexport class EditorWorkerService extends Disposable implements IEditorWorkerService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate readonly _modelService: IModelService;\n\tprivate readonly _workerManager: WorkerManager;\n\tprivate readonly _logService: ILogService;\n\n\tconstructor(\n\t\t@IModelService modelService: IModelService,\n\t\t@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,\n\t\t@ILogService logService: ILogService,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILanguageFeaturesService languageFeaturesService: ILanguageFeaturesService,\n\t\t@IWebWorkerService private readonly _webWorkerService: IWebWorkerService,\n\t) {\n\t\tsuper();\n\t\tthis._modelService = modelService;\n\n\t\tconst workerDescriptor = new WebWorkerDescriptor({\n\t\t\tesmModuleLocation: () => FileAccess.asBrowserUri('vs/editor/common/services/editorWebWorkerMain.js'),\n\t\t\tesmModuleLocationBundler: () => new URL('../../common/services/editorWebWorkerMain.js?workerModule', import.meta.url),\n\t\t\tlabel: 'editorWorkerService'\n\t\t});\n\n\t\tthis._workerManager = this._register(new WorkerManager(workerDescriptor, this._modelService, this._webWorkerService));\n\t\tthis._logService = logService;\n\n\t\t// register default link-provider and default completions-provider\n\t\tthis._register(languageFeaturesService.linkProvider.register({ language: '*', hasAccessToAllModels: true }, {\n\t\t\tprovideLinks: async (model, token) => {\n\t\t\t\tif (!canSyncModel(this._modelService, model.uri)) {\n\t\t\t\t\treturn Promise.resolve({ links: [] }); // File too large\n\t\t\t\t}\n\t\t\t\tconst worker = await this._workerWithResources([model.uri]);\n\t\t\t\tconst links = await worker.$computeLinks(model.uri.toString());\n\t\t\t\treturn links && { links };\n\t\t\t}\n\t\t}));\n\t\tthis._register(languageFeaturesService.completionProvider.register('*', new WordBasedCompletionItemProvider(this._workerManager, configurationService, this._modelService, this._languageConfigurationService, this._logService, languageFeaturesService)));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t}\n\n\tpublic canComputeUnicodeHighlights(uri: URI): boolean {\n\t\treturn canSyncModel(this._modelService, uri);\n\t}\n\n\tpublic async computedUnicodeHighlights(uri: URI, options: UnicodeHighlighterOptions, range?: IRange): Promise<IUnicodeHighlightsResult> {\n\t\tconst worker = await this._workerWithResources([uri]);\n\t\treturn worker.$computeUnicodeHighlights(uri.toString(), options, range);\n\t}\n\n\tpublic async computeDiff(original: URI, modified: URI, options: IDocumentDiffProviderOptions, algorithm: DiffAlgorithmName): Promise<IDocumentDiff | null> {\n\t\tconst worker = await this._workerWithResources([original, modified], /* forceLargeModels */true);\n\t\tconst result = await worker.$computeDiff(original.toString(), modified.toString(), options, algorithm);\n\t\tif (!result) {\n\t\t\treturn null;\n\t\t}\n\t\t// Convert from space efficient JSON data to rich objects.\n\t\tconst diff: IDocumentDiff = {\n\t\t\tidentical: result.identical,\n\t\t\tquitEarly: result.quitEarly,\n\t\t\tchanges: toLineRangeMappings(result.changes),\n\t\t\tmoves: result.moves.map(m => new MovedText(\n\t\t\t\tnew LineRangeMapping(new LineRange(m[0], m[1]), new LineRange(m[2], m[3])),\n\t\t\t\ttoLineRangeMappings(m[4])\n\t\t\t))\n\t\t};\n\t\treturn diff;\n\n\t\tfunction toLineRangeMappings(changes: readonly ILineChange[]): readonly DetailedLineRangeMapping[] {\n\t\t\treturn changes.map(\n\t\t\t\t(c) => new DetailedLineRangeMapping(\n\t\t\t\t\tnew LineRange(c[0], c[1]),\n\t\t\t\t\tnew LineRange(c[2], c[3]),\n\t\t\t\t\tc[4]?.map(\n\t\t\t\t\t\t(c) => new RangeMapping(\n\t\t\t\t\t\t\tnew Range(c[0], c[1], c[2], c[3]),\n\t\t\t\t\t\t\tnew Range(c[4], c[5], c[6], c[7])\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic async computeMoreMinimalEdits(resource: URI, edits: languages.TextEdit[] | null | undefined, pretty: boolean = false): Promise<languages.TextEdit[] | undefined> {\n\t\tif (isNonEmptyArray(edits)) {\n\t\t\tif (!canSyncModel(this._modelService, resource)) {\n\t\t\t\treturn Promise.resolve(edits); // File too large\n\t\t\t}\n\t\t\tconst sw = StopWatch.create();\n\t\t\tconst result = this._workerWithResources([resource]).then(worker => worker.$computeMoreMinimalEdits(resource.toString(), edits, pretty));\n\t\t\tresult.finally(() => this._logService.trace('FORMAT#computeMoreMinimalEdits', resource.toString(true), sw.elapsed()));\n\t\t\treturn Promise.race([result, timeout(1000).then(() => edits)]);\n\n\t\t} else {\n\t\t\treturn Promise.resolve(undefined);\n\t\t}\n\t}\n\n\tpublic canNavigateValueSet(resource: URI): boolean {\n\t\treturn (canSyncModel(this._modelService, resource));\n\t}\n\n\tpublic async navigateValueSet(resource: URI, range: IRange, up: boolean): Promise<languages.IInplaceReplaceSupportResult | null> {\n\t\tconst model = this._modelService.getModel(resource);\n\t\tif (!model) {\n\t\t\treturn null;\n\t\t}\n\t\tconst wordDefRegExp = this._languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n\t\tconst wordDef = wordDefRegExp.source;\n\t\tconst wordDefFlags = wordDefRegExp.flags;\n\t\tconst worker = await this._workerWithResources([resource]);\n\t\treturn worker.$navigateValueSet(resource.toString(), range, up, wordDef, wordDefFlags);\n\t}\n\n\tpublic canComputeWordRanges(resource: URI): boolean {\n\t\treturn canSyncModel(this._modelService, resource);\n\t}\n\n\tpublic async computeWordRanges(resource: URI, range: IRange): Promise<{ [word: string]: IRange[] } | null> {\n\t\tconst model = this._modelService.getModel(resource);\n\t\tif (!model) {\n\t\t\treturn Promise.resolve(null);\n\t\t}\n\t\tconst wordDefRegExp = this._languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n\t\tconst wordDef = wordDefRegExp.source;\n\t\tconst wordDefFlags = wordDefRegExp.flags;\n\t\tconst worker = await this._workerWithResources([resource]);\n\t\treturn worker.$computeWordRanges(resource.toString(), range, wordDef, wordDefFlags);\n\t}\n\n\tpublic async findSectionHeaders(uri: URI, options: FindSectionHeaderOptions): Promise<SectionHeader[]> {\n\t\tconst worker = await this._workerWithResources([uri]);\n\t\treturn worker.$findSectionHeaders(uri.toString(), options);\n\t}\n\n\tpublic async computeDefaultDocumentColors(uri: URI): Promise<languages.IColorInformation[] | null> {\n\t\tconst worker = await this._workerWithResources([uri]);\n\t\treturn worker.$computeDefaultDocumentColors(uri.toString());\n\t}\n\n\tprivate async _workerWithResources(resources: URI[], forceLargeModels: boolean = false): Promise<Proxied<EditorWorker>> {\n\t\tconst worker = await this._workerManager.withWorker();\n\t\treturn await worker.workerWithSyncedResources(resources, forceLargeModels);\n\t}\n}\n\nclass WordBasedCompletionItemProvider implements languages.CompletionItemProvider {\n\n\tprivate readonly _workerManager: WorkerManager;\n\tprivate readonly _configurationService: ITextResourceConfigurationService;\n\tprivate readonly _modelService: IModelService;\n\n\treadonly _debugDisplayName = 'wordbasedCompletions';\n\n\tconstructor(\n\t\tworkerManager: WorkerManager,\n\t\tconfigurationService: ITextResourceConfigurationService,\n\t\tmodelService: IModelService,\n\t\tprivate readonly languageConfigurationService: ILanguageConfigurationService,\n\t\tprivate readonly logService: ILogService,\n\t\tprivate readonly languageFeaturesService: ILanguageFeaturesService,\n\t) {\n\t\tthis._workerManager = workerManager;\n\t\tthis._configurationService = configurationService;\n\t\tthis._modelService = modelService;\n\t}\n\n\tasync provideCompletionItems(model: ITextModel, position: Position): Promise<languages.CompletionList | undefined> {\n\t\ttype WordBasedSuggestionsConfig = {\n\t\t\twordBasedSuggestions?: 'off' | 'currentDocument' | 'matchingDocuments' | 'allDocuments' | 'offWithInlineSuggestions';\n\t\t};\n\t\tconst config = this._configurationService.getValue<WordBasedSuggestionsConfig>(model.uri, position, 'editor');\n\t\tif (config.wordBasedSuggestions === 'off') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (config.wordBasedSuggestions === 'offWithInlineSuggestions' && this.languageFeaturesService.inlineCompletionsProvider.has(model)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst models: URI[] = [];\n\t\tif (config.wordBasedSuggestions === 'currentDocument') {\n\t\t\t// only current file and only if not too large\n\t\t\tif (canSyncModel(this._modelService, model.uri)) {\n\t\t\t\tmodels.push(model.uri);\n\t\t\t}\n\t\t} else {\n\t\t\t// either all files or files of same language\n\t\t\tfor (const candidate of this._modelService.getModels()) {\n\t\t\t\tif (!canSyncModel(this._modelService, candidate.uri)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (candidate === model) {\n\t\t\t\t\tmodels.unshift(candidate.uri);\n\n\t\t\t\t} else if (config.wordBasedSuggestions === 'allDocuments' || candidate.getLanguageId() === model.getLanguageId()) {\n\t\t\t\t\tmodels.push(candidate.uri);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (models.length === 0) {\n\t\t\treturn undefined; // File too large, no other files\n\t\t}\n\n\t\tconst wordDefRegExp = this.languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n\t\tconst word = model.getWordAtPosition(position);\n\t\tconst replace = !word ? Range.fromPositions(position) : new Range(position.lineNumber, word.startColumn, position.lineNumber, word.endColumn);\n\t\tconst insert = replace.setEndPosition(position.lineNumber, position.column);\n\n\t\t// Trace logging about the word and replace/insert ranges\n\t\tthis.logService.trace('[WordBasedCompletionItemProvider]', `word: \"${word?.word || ''}\", wordDef: \"${wordDefRegExp}\", replace: [${replace.toString()}], insert: [${insert.toString()}]`);\n\n\t\tconst client = await this._workerManager.withWorker();\n\t\tconst data = await client.textualSuggest(models, word?.word, wordDefRegExp);\n\t\tif (!data) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tduration: data.duration,\n\t\t\tsuggestions: data.words.map((word): languages.CompletionItem => {\n\t\t\t\treturn {\n\t\t\t\t\tkind: languages.CompletionItemKind.Text,\n\t\t\t\t\tlabel: word,\n\t\t\t\t\tinsertText: word,\n\t\t\t\t\trange: { insert, replace }\n\t\t\t\t};\n\t\t\t}),\n\t\t};\n\t}\n}\n\nclass WorkerManager extends Disposable {\n\n\tprivate readonly _modelService: IModelService;\n\tprivate readonly _webWorkerService: IWebWorkerService;\n\tprivate _editorWorkerClient: EditorWorkerClient | null;\n\tprivate _lastWorkerUsedTime: number;\n\n\tconstructor(\n\t\tprivate readonly _workerDescriptor: WebWorkerDescriptor,\n\t\t@IModelService modelService: IModelService,\n\t\t@IWebWorkerService webWorkerService: IWebWorkerService\n\t) {\n\t\tsuper();\n\t\tthis._modelService = modelService;\n\t\tthis._webWorkerService = webWorkerService;\n\t\tthis._editorWorkerClient = null;\n\t\tthis._lastWorkerUsedTime = (new Date()).getTime();\n\n\t\tconst stopWorkerInterval = this._register(new WindowIntervalTimer());\n\t\tstopWorkerInterval.cancelAndSet(() => this._checkStopIdleWorker(), Math.round(STOP_WORKER_DELTA_TIME_MS / 2), mainWindow);\n\n\t\tthis._register(this._modelService.onModelRemoved(_ => this._checkStopEmptyWorker()));\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this._editorWorkerClient) {\n\t\t\tthis._editorWorkerClient.dispose();\n\t\t\tthis._editorWorkerClient = null;\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\t/**\n\t * Check if the model service has no more models and stop the worker if that is the case.\n\t */\n\tprivate _checkStopEmptyWorker(): void {\n\t\tif (!this._editorWorkerClient) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst models = this._modelService.getModels();\n\t\tif (models.length === 0) {\n\t\t\t// There are no more models => nothing possible for me to do\n\t\t\tthis._editorWorkerClient.dispose();\n\t\t\tthis._editorWorkerClient = null;\n\t\t}\n\t}\n\n\t/**\n\t * Check if the worker has been idle for a while and then stop it.\n\t */\n\tprivate _checkStopIdleWorker(): void {\n\t\tif (!this._editorWorkerClient) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst timeSinceLastWorkerUsedTime = (new Date()).getTime() - this._lastWorkerUsedTime;\n\t\tif (timeSinceLastWorkerUsedTime > STOP_WORKER_DELTA_TIME_MS) {\n\t\t\tthis._editorWorkerClient.dispose();\n\t\t\tthis._editorWorkerClient = null;\n\t\t}\n\t}\n\n\tpublic withWorker(): Promise<EditorWorkerClient> {\n\t\tthis._lastWorkerUsedTime = (new Date()).getTime();\n\t\tif (!this._editorWorkerClient) {\n\t\t\tthis._editorWorkerClient = new EditorWorkerClient(this._workerDescriptor, false, this._modelService, this._webWorkerService);\n\t\t}\n\t\treturn Promise.resolve(this._editorWorkerClient);\n\t}\n}\n\nclass SynchronousWorkerClient<T extends IDisposable> implements IWebWorkerClient<T> {\n\tprivate readonly _instance: T;\n\tpublic readonly proxy: Proxied<T>;\n\n\tconstructor(instance: T) {\n\t\tthis._instance = instance;\n\t\tthis.proxy = this._instance as Proxied<T>;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._instance.dispose();\n\t}\n\n\tpublic setChannel<T extends object>(channel: string, handler: T): void {\n\t\tthrow new Error(`Not supported`);\n\t}\n}\n\nexport interface IEditorWorkerClient {\n}\n\nexport class EditorWorkerClient extends Disposable implements IEditorWorkerClient {\n\n\tprivate readonly _modelService: IModelService;\n\tprivate readonly _webWorkerService: IWebWorkerService;\n\tprivate readonly _keepIdleModels: boolean;\n\tprivate _worker: IWebWorkerClient<EditorWorker> | null;\n\tprivate _modelManager: WorkerTextModelSyncClient | null;\n\tprivate _disposed = false;\n\n\tconstructor(\n\t\tprivate readonly _workerDescriptorOrWorker: WebWorkerDescriptor | Worker | Promise<Worker>,\n\t\tkeepIdleModels: boolean,\n\t\t@IModelService modelService: IModelService,\n\t\t@IWebWorkerService webWorkerService: IWebWorkerService\n\t) {\n\t\tsuper();\n\t\tthis._modelService = modelService;\n\t\tthis._webWorkerService = webWorkerService;\n\t\tthis._keepIdleModels = keepIdleModels;\n\t\tthis._worker = null;\n\t\tthis._modelManager = null;\n\t}\n\n\t// foreign host request\n\tpublic fhr(method: string, args: unknown[]): Promise<unknown> {\n\t\tthrow new Error(`Not implemented!`);\n\t}\n\n\tprivate _getOrCreateWorker(): IWebWorkerClient<EditorWorker> {\n\t\tif (!this._worker) {\n\t\t\ttry {\n\t\t\t\tthis._worker = this._register(this._webWorkerService.createWorkerClient<EditorWorker>(this._workerDescriptorOrWorker));\n\t\t\t\tEditorWorkerHost.setChannel(this._worker, this._createEditorWorkerHost());\n\t\t\t} catch (err) {\n\t\t\t\tlogOnceWebWorkerWarning(err);\n\t\t\t\tthis._worker = this._createFallbackLocalWorker();\n\t\t\t}\n\t\t}\n\t\treturn this._worker;\n\t}\n\n\tprotected async _getProxy(): Promise<Proxied<EditorWorker>> {\n\t\ttry {\n\t\t\tconst proxy = this._getOrCreateWorker().proxy;\n\t\t\tawait proxy.$ping();\n\t\t\treturn proxy;\n\t\t} catch (err) {\n\t\t\tlogOnceWebWorkerWarning(err);\n\t\t\tthis._worker = this._createFallbackLocalWorker();\n\t\t\treturn this._worker.proxy;\n\t\t}\n\t}\n\n\tprivate _createFallbackLocalWorker(): SynchronousWorkerClient<EditorWorker> {\n\t\treturn new SynchronousWorkerClient(new EditorWorker(null));\n\t}\n\n\tprivate _createEditorWorkerHost(): EditorWorkerHost {\n\t\treturn {\n\t\t\t$fhr: (method, args) => this.fhr(method, args)\n\t\t};\n\t}\n\n\tprivate _getOrCreateModelManager(proxy: Proxied<EditorWorker>): WorkerTextModelSyncClient {\n\t\tif (!this._modelManager) {\n\t\t\tthis._modelManager = this._register(new WorkerTextModelSyncClient(proxy, this._modelService, this._keepIdleModels));\n\t\t}\n\t\treturn this._modelManager;\n\t}\n\n\tpublic async workerWithSyncedResources(resources: URI[], forceLargeModels: boolean = false): Promise<Proxied<EditorWorker>> {\n\t\tif (this._disposed) {\n\t\t\treturn Promise.reject(canceled());\n\t\t}\n\t\tconst proxy = await this._getProxy();\n\t\tthis._getOrCreateModelManager(proxy).ensureSyncedResources(resources, forceLargeModels);\n\t\treturn proxy;\n\t}\n\n\tpublic async textualSuggest(resources: URI[], leadingWord: string | undefined, wordDefRegExp: RegExp): Promise<{ words: string[]; duration: number } | null> {\n\t\tconst proxy = await this.workerWithSyncedResources(resources);\n\t\tconst wordDef = wordDefRegExp.source;\n\t\tconst wordDefFlags = wordDefRegExp.flags;\n\t\treturn proxy.$textualSuggest(resources.map(r => r.toString()), leadingWord, wordDef, wordDefFlags);\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\t\tthis._disposed = 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 { timeout } from '../../../base/common/async.js';\nimport { Disposable, IDisposable } from '../../../base/common/lifecycle.js';\nimport { URI } from '../../../base/common/uri.js';\nimport { logOnceWebWorkerWarning, IWebWorkerClient, Proxied } from '../../../base/common/worker/webWorker.js';\nimport { WebWorkerDescriptor } from '../../../platform/webWorker/browser/webWorkerDescriptor.js';\nimport { IWebWorkerService } from '../../../platform/webWorker/browser/webWorkerService.js';\nimport { Position } from '../../common/core/position.js';\nimport { IRange, Range } from '../../common/core/range.js';\nimport { ITextModel } from '../../common/model.js';\nimport * as languages from '../../common/languages.js';\nimport { ILanguageConfigurationService } from '../../common/languages/languageConfigurationRegistry.js';\nimport { EditorWorker } from '../../common/services/editorWebWorker.js';\nimport { DiffAlgorithmName, IEditorWorkerService, ILineChange, IUnicodeHighlightsResult } from '../../common/services/editorWorker.js';\nimport { IModelService } from '../../common/services/model.js';\nimport { ITextResourceConfigurationService } from '../../common/services/textResourceConfiguration.js';\nimport { isNonEmptyArray } from '../../../base/common/arrays.js';\nimport { ILogService } from '../../../platform/log/common/log.js';\nimport { StopWatch } from '../../../base/common/stopwatch.js';\nimport { canceled } from '../../../base/common/errors.js';\nimport { UnicodeHighlighterOptions } from '../../common/services/unicodeTextModelHighlighter.js';\nimport { ILanguageFeaturesService } from '../../common/services/languageFeatures.js';\nimport { IDocumentDiff, IDocumentDiffProviderOptions } from '../../common/diff/documentDiffProvider.js';\nimport { MovedText } from '../../common/diff/linesDiffComputer.js';\nimport { DetailedLineRangeMapping, RangeMapping, LineRangeMapping } from '../../common/diff/rangeMapping.js';\nimport { LineRange } from '../../common/core/ranges/lineRange.js';\nimport { SectionHeader, FindSectionHeaderOptions } from '../../common/services/findSectionHeaders.js';\nimport { mainWindow } from '../../../base/browser/window.js';\nimport { WindowIntervalTimer } from '../../../base/browser/dom.js';\nimport { WorkerTextModelSyncClient } from '../../common/services/textModelSync/textModelSync.impl.js';\nimport { EditorWorkerHost } from '../../common/services/editorWorkerHost.js';\nimport { FileAccess } from '../../../base/common/network.js';\n\n/**\n * Stop the worker if it was not needed for 5 min.\n */\nconst STOP_WORKER_DELTA_TIME_MS = 5 * 60 * 1000;\n\nfunction canSyncModel(modelService: IModelService, resource: URI): boolean {\n\tconst model = modelService.getModel(resource);\n\tif (!model) {\n\t\treturn false;\n\t}\n\tif (model.isTooLargeForSyncing()) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\nexport class EditorWorkerService extends Disposable implements IEditorWorkerService {\n\n\tdeclare readonly _serviceBrand: undefined;\n\n\tprivate readonly _modelService: IModelService;\n\tprivate readonly _workerManager: WorkerManager;\n\tprivate readonly _logService: ILogService;\n\n\tconstructor(\n\t\t@IModelService modelService: IModelService,\n\t\t@ITextResourceConfigurationService configurationService: ITextResourceConfigurationService,\n\t\t@ILogService logService: ILogService,\n\t\t@ILanguageConfigurationService private readonly _languageConfigurationService: ILanguageConfigurationService,\n\t\t@ILanguageFeaturesService languageFeaturesService: ILanguageFeaturesService,\n\t\t@IWebWorkerService private readonly _webWorkerService: IWebWorkerService,\n\t) {\n\t\tsuper();\n\t\tthis._modelService = modelService;\n\n\t\tconst workerDescriptor = new WebWorkerDescriptor({\n\t\t\tesmModuleLocation: () => FileAccess.asBrowserUri('vs/editor/common/services/editorWebWorkerMain.js'),\n\t\t\tesmModuleLocationBundler: () => new URL('../../common/services/editorWebWorkerMain.js?workerModule', import.meta.url),\n\t\t\tlabel: 'editorWorkerService'\n\t\t});\n\n\t\tthis._workerManager = this._register(new WorkerManager(workerDescriptor, this._modelService, this._webWorkerService));\n\t\tthis._logService = logService;\n\n\t\t// register default link-provider and default completions-provider\n\t\tthis._register(languageFeaturesService.linkProvider.register({ language: '*', hasAccessToAllModels: true }, {\n\t\t\tprovideLinks: async (model, token) => {\n\t\t\t\tif (!canSyncModel(this._modelService, model.uri)) {\n\t\t\t\t\treturn Promise.resolve({ links: [] }); // File too large\n\t\t\t\t}\n\t\t\t\tconst worker = await this._workerWithResources([model.uri]);\n\t\t\t\tconst links = await worker.$computeLinks(model.uri.toString());\n\t\t\t\treturn links && { links };\n\t\t\t}\n\t\t}));\n\t\tthis._register(languageFeaturesService.completionProvider.register('*', new WordBasedCompletionItemProvider(this._workerManager, configurationService, this._modelService, this._languageConfigurationService, this._logService, languageFeaturesService)));\n\t}\n\n\tpublic override dispose(): void {\n\t\tsuper.dispose();\n\t}\n\n\tpublic canComputeUnicodeHighlights(uri: URI): boolean {\n\t\treturn canSyncModel(this._modelService, uri);\n\t}\n\n\tpublic async computedUnicodeHighlights(uri: URI, options: UnicodeHighlighterOptions, range?: IRange): Promise<IUnicodeHighlightsResult> {\n\t\tconst worker = await this._workerWithResources([uri]);\n\t\treturn worker.$computeUnicodeHighlights(uri.toString(), options, range);\n\t}\n\n\tpublic async computeDiff(original: URI, modified: URI, options: IDocumentDiffProviderOptions, algorithm: DiffAlgorithmName): Promise<IDocumentDiff | null> {\n\t\tconst worker = await this._workerWithResources([original, modified], /* forceLargeModels */true);\n\t\tconst result = await worker.$computeDiff(original.toString(), modified.toString(), options, algorithm);\n\t\tif (!result) {\n\t\t\treturn null;\n\t\t}\n\t\t// Convert from space efficient JSON data to rich objects.\n\t\tconst diff: IDocumentDiff = {\n\t\t\tidentical: result.identical,\n\t\t\tquitEarly: result.quitEarly,\n\t\t\tchanges: toLineRangeMappings(result.changes),\n\t\t\tmoves: result.moves.map(m => new MovedText(\n\t\t\t\tnew LineRangeMapping(new LineRange(m[0], m[1]), new LineRange(m[2], m[3])),\n\t\t\t\ttoLineRangeMappings(m[4])\n\t\t\t))\n\t\t};\n\t\treturn diff;\n\n\t\tfunction toLineRangeMappings(changes: readonly ILineChange[]): readonly DetailedLineRangeMapping[] {\n\t\t\treturn changes.map(\n\t\t\t\t(c) => new DetailedLineRangeMapping(\n\t\t\t\t\tnew LineRange(c[0], c[1]),\n\t\t\t\t\tnew LineRange(c[2], c[3]),\n\t\t\t\t\tc[4]?.map(\n\t\t\t\t\t\t(c) => new RangeMapping(\n\t\t\t\t\t\t\tnew Range(c[0], c[1], c[2], c[3]),\n\t\t\t\t\t\t\tnew Range(c[4], c[5], c[6], c[7])\n\t\t\t\t\t\t)\n\t\t\t\t\t)\n\t\t\t\t)\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic async computeMoreMinimalEdits(resource: URI, edits: languages.TextEdit[] | null | undefined, pretty: boolean = false): Promise<languages.TextEdit[] | undefined> {\n\t\tif (isNonEmptyArray(edits)) {\n\t\t\tif (!canSyncModel(this._modelService, resource)) {\n\t\t\t\treturn Promise.resolve(edits); // File too large\n\t\t\t}\n\t\t\tconst sw = StopWatch.create();\n\t\t\tconst result = this._workerWithResources([resource]).then(worker => worker.$computeMoreMinimalEdits(resource.toString(), edits, pretty));\n\t\t\tresult.finally(() => this._logService.trace('FORMAT#computeMoreMinimalEdits', resource.toString(true), sw.elapsed()));\n\t\t\treturn Promise.race([result, timeout(1000).then(() => edits)]);\n\n\t\t} else {\n\t\t\treturn Promise.resolve(undefined);\n\t\t}\n\t}\n\n\tpublic canNavigateValueSet(resource: URI): boolean {\n\t\treturn (canSyncModel(this._modelService, resource));\n\t}\n\n\tpublic async navigateValueSet(resource: URI, range: IRange, up: boolean): Promise<languages.IInplaceReplaceSupportResult | null> {\n\t\tconst model = this._modelService.getModel(resource);\n\t\tif (!model) {\n\t\t\treturn null;\n\t\t}\n\t\tconst wordDefRegExp = this._languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n\t\tconst wordDef = wordDefRegExp.source;\n\t\tconst wordDefFlags = wordDefRegExp.flags;\n\t\tconst worker = await this._workerWithResources([resource]);\n\t\treturn worker.$navigateValueSet(resource.toString(), range, up, wordDef, wordDefFlags);\n\t}\n\n\tpublic canComputeWordRanges(resource: URI): boolean {\n\t\treturn canSyncModel(this._modelService, resource);\n\t}\n\n\tpublic async computeWordRanges(resource: URI, range: IRange): Promise<{ [word: string]: IRange[] } | null> {\n\t\tconst model = this._modelService.getModel(resource);\n\t\tif (!model) {\n\t\t\treturn Promise.resolve(null);\n\t\t}\n\t\tconst wordDefRegExp = this._languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n\t\tconst wordDef = wordDefRegExp.source;\n\t\tconst wordDefFlags = wordDefRegExp.flags;\n\t\tconst worker = await this._workerWithResources([resource]);\n\t\treturn worker.$computeWordRanges(resource.toString(), range, wordDef, wordDefFlags);\n\t}\n\n\tpublic async findSectionHeaders(uri: URI, options: FindSectionHeaderOptions): Promise<SectionHeader[]> {\n\t\tconst worker = await this._workerWithResources([uri]);\n\t\treturn worker.$findSectionHeaders(uri.toString(), options);\n\t}\n\n\tpublic async computeDefaultDocumentColors(uri: URI): Promise<languages.IColorInformation[] | null> {\n\t\tconst worker = await this._workerWithResources([uri]);\n\t\treturn worker.$computeDefaultDocumentColors(uri.toString());\n\t}\n\n\tprivate async _workerWithResources(resources: URI[], forceLargeModels: boolean = false): Promise<Proxied<EditorWorker>> {\n\t\tconst worker = await this._workerManager.withWorker();\n\t\treturn await worker.workerWithSyncedResources(resources, forceLargeModels);\n\t}\n}\n\nclass WordBasedCompletionItemProvider implements languages.CompletionItemProvider {\n\n\tprivate readonly _workerManager: WorkerManager;\n\tprivate readonly _configurationService: ITextResourceConfigurationService;\n\tprivate readonly _modelService: IModelService;\n\n\treadonly _debugDisplayName = 'wordbasedCompletions';\n\n\tconstructor(\n\t\tworkerManager: WorkerManager,\n\t\tconfigurationService: ITextResourceConfigurationService,\n\t\tmodelService: IModelService,\n\t\tprivate readonly languageConfigurationService: ILanguageConfigurationService,\n\t\tprivate readonly logService: ILogService,\n\t\tprivate readonly languageFeaturesService: ILanguageFeaturesService,\n\t) {\n\t\tthis._workerManager = workerManager;\n\t\tthis._configurationService = configurationService;\n\t\tthis._modelService = modelService;\n\t}\n\n\tasync provideCompletionItems(model: ITextModel, position: Position): Promise<languages.CompletionList | undefined> {\n\t\ttype WordBasedSuggestionsConfig = {\n\t\t\twordBasedSuggestions?: 'off' | 'currentDocument' | 'matchingDocuments' | 'allDocuments' | 'offWithInlineSuggestions';\n\t\t};\n\t\tconst config = this._configurationService.getValue<WordBasedSuggestionsConfig>(model.uri, position, 'editor');\n\t\tif (config.wordBasedSuggestions === 'off') {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (config.wordBasedSuggestions === 'offWithInlineSuggestions' && this.languageFeaturesService.inlineCompletionsProvider.has(model)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst models: URI[] = [];\n\t\tif (config.wordBasedSuggestions === 'currentDocument') {\n\t\t\t// only current file and only if not too large\n\t\t\tif (canSyncModel(this._modelService, model.uri)) {\n\t\t\t\tmodels.push(model.uri);\n\t\t\t}\n\t\t} else {\n\t\t\t// either all files or files of same language\n\t\t\tfor (const candidate of this._modelService.getModels()) {\n\t\t\t\tif (!canSyncModel(this._modelService, candidate.uri)) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (candidate === model) {\n\t\t\t\t\tmodels.unshift(candidate.uri);\n\n\t\t\t\t} else if (config.wordBasedSuggestions === 'allDocuments' || candidate.getLanguageId() === model.getLanguageId()) {\n\t\t\t\t\tmodels.push(candidate.uri);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (models.length === 0) {\n\t\t\treturn undefined; // File too large, no other files\n\t\t}\n\n\t\tconst wordDefRegExp = this.languageConfigurationService.getLanguageConfiguration(model.getLanguageId()).getWordDefinition();\n\t\tconst word = model.getWordAtPosition(position);\n\t\tconst replace = !word ? Range.fromPositions(position) : new Range(position.lineNumber, word.startColumn, position.lineNumber, word.endColumn);\n\t\tconst insert = replace.setEndPosition(position.lineNumber, position.column);\n\n\t\t// Trace logging about the word and replace/insert ranges\n\t\tthis.logService.trace('[WordBasedCompletionItemProvider]', `word: \"${word?.word || ''}\", wordDef: \"${wordDefRegExp}\", replace: [${replace.toString()}], insert: [${insert.toString()}]`);\n\n\t\tconst client = await this._workerManager.withWorker();\n\t\tconst data = await client.textualSuggest(models, word?.word, wordDefRegExp);\n\t\tif (!data) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn {\n\t\t\tduration: data.duration,\n\t\t\tsuggestions: data.words.map((word): languages.CompletionItem => {\n\t\t\t\treturn {\n\t\t\t\t\tkind: languages.CompletionItemKind.Text,\n\t\t\t\t\tlabel: word,\n\t\t\t\t\tinsertText: word,\n\t\t\t\t\trange: { insert, replace }\n\t\t\t\t};\n\t\t\t}),\n\t\t};\n\t}\n}\n\nclass WorkerManager extends Disposable {\n\n\tprivate readonly _modelService: IModelService;\n\tprivate readonly _webWorkerService: IWebWorkerService;\n\tprivate _editorWorkerClient: EditorWorkerClient | null;\n\tprivate _lastWorkerUsedTime: number;\n\n\tconstructor(\n\t\tprivate readonly _workerDescriptor: WebWorkerDescriptor,\n\t\t@IModelService modelService: IModelService,\n\t\t@IWebWorkerService webWorkerService: IWebWorkerService\n\t) {\n\t\tsuper();\n\t\tthis._modelService = modelService;\n\t\tthis._webWorkerService = webWorkerService;\n\t\tthis._editorWorkerClient = null;\n\t\tthis._lastWorkerUsedTime = (new Date()).getTime();\n\n\t\tconst stopWorkerInterval = this._register(new WindowIntervalTimer());\n\t\tstopWorkerInterval.cancelAndSet(() => this._checkStopIdleWorker(), Math.round(STOP_WORKER_DELTA_TIME_MS / 2), mainWindow);\n\n\t\tthis._register(this._modelService.onModelRemoved(_ => this._checkStopEmptyWorker()));\n\t}\n\n\tpublic override dispose(): void {\n\t\tif (this._editorWorkerClient) {\n\t\t\tthis._editorWorkerClient.dispose();\n\t\t\tthis._editorWorkerClient = null;\n\t\t}\n\t\tsuper.dispose();\n\t}\n\n\t/**\n\t * Check if the model service has no more models and stop the worker if that is the case.\n\t */\n\tprivate _checkStopEmptyWorker(): void {\n\t\tif (!this._editorWorkerClient) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst models = this._modelService.getModels();\n\t\tif (models.length === 0) {\n\t\t\t// There are no more models => nothing possible for me to do\n\t\t\tthis._editorWorkerClient.dispose();\n\t\t\tthis._editorWorkerClient = null;\n\t\t}\n\t}\n\n\t/**\n\t * Check if the worker has been idle for a while and then stop it.\n\t */\n\tprivate _checkStopIdleWorker(): void {\n\t\tif (!this._editorWorkerClient) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst timeSinceLastWorkerUsedTime = (new Date()).getTime() - this._lastWorkerUsedTime;\n\t\tif (timeSinceLastWorkerUsedTime > STOP_WORKER_DELTA_TIME_MS) {\n\t\t\tthis._editorWorkerClient.dispose();\n\t\t\tthis._editorWorkerClient = null;\n\t\t}\n\t}\n\n\tpublic withWorker(): Promise<EditorWorkerClient> {\n\t\tthis._lastWorkerUsedTime = (new Date()).getTime();\n\t\tif (!this._editorWorkerClient) {\n\t\t\tthis._editorWorkerClient = new EditorWorkerClient(this._workerDescriptor, false, this._modelService, this._webWorkerService);\n\t\t}\n\t\treturn Promise.resolve(this._editorWorkerClient);\n\t}\n}\n\nclass SynchronousWorkerClient<T extends IDisposable> implements IWebWorkerClient<T> {\n\tprivate readonly _instance: T;\n\tpublic readonly proxy: Proxied<T>;\n\n\tconstructor(instance: T) {\n\t\tthis._instance = instance;\n\t\tthis.proxy = this._instance as Proxied<T>;\n\t}\n\n\tpublic dispose(): void {\n\t\tthis._instance.dispose();\n\t}\n\n\tpublic setChannel<T extends object>(channel: string, handler: T): void {\n\t\tthrow new Error(`Not supported`);\n\t}\n}\n\nexport interface IEditorWorkerClient {\n}\n\nexport class EditorWorkerClient extends Disposable implements IEditorWorkerClient {\n\n\tprivate readonly _modelService: IModelService;\n\tprivate readonly _webWorkerService: IWebWorkerService;\n\tprivate readonly _keepIdleModels: boolean;\n\tprivate _worker: IWebWorkerClient<EditorWorker> | null;\n\tprivate _modelManager: WorkerTextModelSyncClient | null;\n\tprivate _disposed = false;\n\n\tconstructor(\n\t\tprivate readonly _workerDescriptorOrWorker: WebWorkerDescriptor | Worker | Promise<Worker>,\n\t\tkeepIdleModels: boolean,\n\t\t@IModelService modelService: IModelService,\n\t\t@IWebWorkerService webWorkerService: IWebWorkerService\n\t) {\n\t\tsuper();\n\t\tthis._modelService = modelService;\n\t\tthis._webWorkerService = webWorkerService;\n\t\tthis._keepIdleModels = keepIdleModels;\n\t\tthis._worker = null;\n\t\tthis._modelManager = null;\n\t}\n\n\t// foreign host request\n\tpublic fhr(method: string, args: unknown[]): Promise<unknown> {\n\t\tthrow new Error(`Not implemented!`);\n\t}\n\n\tprivate _getOrCreateWorker(): IWebWorkerClient<EditorWorker> {\n\t\tif (!this._worker) {\n\t\t\ttry {\n\t\t\t\tthis._worker = this._register(this._webWorkerService.createWorkerClient<EditorWorker>(this._workerDescriptorOrWorker));\n\t\t\t\tEditorWorkerHost.setChannel(this._worker, this._createEditorWorkerHost());\n\t\t\t} catch (err) {\n\t\t\t\tlogOnceWebWorkerWarning(err);\n\t\t\t\tthis._worker = this._createFallbackLocalWorker();\n\t\t\t}\n\t\t}\n\t\treturn this._worker;\n\t}\n\n\tprotected async _getProxy(): Promise<Proxied<EditorWorker>> {\n\t\ttry {\n\t\t\tconst proxy = this._getOrCreateWorker().proxy;\n\t\t\tawait proxy.$ping();\n\t\t\treturn proxy;\n\t\t} catch (err) {\n\t\t\tlogOnceWebWorkerWarning(err);\n\t\t\tthis._worker = this._createFallbackLocalWorker();\n\t\t\treturn this._worker.proxy;\n\t\t}\n\t}\n\n\tprivate _createFallbackLocalWorker(): SynchronousWorkerClient<EditorWorker> {\n\t\treturn new SynchronousWorkerClient(new EditorWorker(null));\n\t}\n\n\tprivate _createEditorWorkerHost(): EditorWorkerHost {\n\t\treturn {\n\t\t\t$fhr: (method, args) => this.fhr(method, args)\n\t\t};\n\t}\n\n\tprivate _getOrCreateModelManager(proxy: Proxied<EditorWorker>): WorkerTextModelSyncClient {\n\t\tif (!this._modelManager) {\n\t\t\tthis._modelManager = this._register(new WorkerTextModelSyncClient(proxy, this._modelService, this._keepIdleModels));\n\t\t}\n\t\treturn this._modelManager;\n\t}\n\n\tpublic async workerWithSyncedResources(resources: URI[], forceLargeModels: boolean = false): Promise<Proxied<EditorWorker>> {\n\t\tif (this._disposed) {\n\t\t\treturn Promise.reject(canceled());\n\t\t}\n\t\tconst proxy = await this._getProxy();\n\t\tthis._getOrCreateModelManager(proxy).ensureSyncedResources(resources, forceLargeModels);\n\t\treturn proxy;\n\t}\n\n\tpublic async textualSuggest(resources: URI[], leadingWord: string | undefined, wordDefRegExp: RegExp): Promise<{ words: string[]; duration: number } | null> {\n\t\tconst proxy = await this.workerWithSyncedResources(resources);\n\t\tconst wordDef = wordDefRegExp.source;\n\t\tconst wordDefFlags = wordDefRegExp.flags;\n\t\treturn proxy.$textualSuggest(resources.map(r => r.toString()), leadingWord, wordDef, wordDefFlags);\n\t}\n\n\toverride dispose(): void {\n\t\tsuper.dispose();\n\t\tthis._disposed = true;\n\t}\n}\n"]}
|