monaco-editor-core 0.56.0-dev-20251124 → 0.56.0-dev-20251217
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 -2
- 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/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/list/list.css +1 -0
- 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/async.js +11 -0
- package/esm/vs/base/common/async.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/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/fontInfo.js +1 -1
- package/esm/vs/editor/common/config/fontInfo.js.map +1 -1
- 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.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/languages/defaultDocumentColorsComputer.js +2 -2
- package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js.map +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 +2 -1
- 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/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/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 +1 -1
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js.map +1 -1
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +54 -36
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js.map +1 -1
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +14 -1
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js.map +1 -1
- package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +1 -1
- package/esm/vs/editor/contrib/hover/browser/hover.css +1 -1
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +1 -1
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js.map +1 -1
- package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
- 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/inlineCompletions/browser/controller/commandIds.js +2 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +33 -4
- 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 -65
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +69 -13
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js +159 -94
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js +124 -50
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +393 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js.map +1 -0
- 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 +11 -11
- 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 -11
- 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 +37 -2
- 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 -4
- 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 +7 -3
- package/esm/vs/platform/quickinput/browser/quickInput.js +19 -11
- 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/quickInputController.js +6 -6
- package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +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 +37 -2
- 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
|
@@ -8,7 +8,7 @@ import { Emitter } from '../../../../base/common/event.js';
|
|
|
8
8
|
import { Disposable } from '../../../../base/common/lifecycle.js';
|
|
9
9
|
import { LineRange } from '../../core/ranges/lineRange.js';
|
|
10
10
|
import { derivedOpts, observableSignal, observableValueOpts } from '../../../../base/common/observable.js';
|
|
11
|
-
import {
|
|
11
|
+
import { equalsIfDefinedC, thisEqualsC, arrayEqualsC } from '../../../../base/common/equals.js';
|
|
12
12
|
/**
|
|
13
13
|
* @internal
|
|
14
14
|
*/
|
|
@@ -20,7 +20,7 @@ export class AttachedViews {
|
|
|
20
20
|
this._viewsChanged = observableSignal(this);
|
|
21
21
|
this.visibleLineRanges = derivedOpts({
|
|
22
22
|
owner: this,
|
|
23
|
-
equalsFn:
|
|
23
|
+
equalsFn: arrayEqualsC(thisEqualsC())
|
|
24
24
|
}, reader => {
|
|
25
25
|
this._viewsChanged.read(reader);
|
|
26
26
|
const ranges = LineRange.joinMany([...this._views].map(view => view.state.read(reader)?.visibleLineRanges ?? []));
|
|
@@ -66,7 +66,7 @@ class AttachedViewImpl {
|
|
|
66
66
|
get state() { return this._state; }
|
|
67
67
|
constructor(handleStateChange) {
|
|
68
68
|
this.handleStateChange = handleStateChange;
|
|
69
|
-
this._state = observableValueOpts({ owner: this, equalsFn:
|
|
69
|
+
this._state = observableValueOpts({ owner: this, equalsFn: equalsIfDefinedC((a, b) => a.equals(b)) }, undefined);
|
|
70
70
|
}
|
|
71
71
|
setVisibleLines(visibleLines, stabilized) {
|
|
72
72
|
const visibleLineRanges = visibleLines.map((line) => new LineRange(line.startLineNumber, line.endLineNumber + 1));
|
|
@@ -113,6 +113,9 @@ export class AbstractSyntaxTokenBackend extends Disposable {
|
|
|
113
113
|
this._onDidChangeTokens = this._register(new Emitter());
|
|
114
114
|
/** @internal, should not be exposed by the text model! */
|
|
115
115
|
this.onDidChangeTokens = this._onDidChangeTokens.event;
|
|
116
|
+
this._onDidChangeFontTokens = this._register(new Emitter());
|
|
117
|
+
/** @internal, should not be exposed by the text model! */
|
|
118
|
+
this.onDidChangeFontTokens = this._onDidChangeFontTokens.event;
|
|
116
119
|
}
|
|
117
120
|
tokenizeIfCheap(lineNumber) {
|
|
118
121
|
if (this.isCheapToTokenize(lineNumber)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/model/tokens/abstractSyntaxTokenBackend.ts","vs/editor/common/model/tokens/abstractSyntaxTokenBackend.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAS,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAQ3D,OAAO,EAAE,WAAW,EAAoC,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC7I,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mCAAmC,CAAC;AAE7F;;GAEG;AACH,MAAM,OAAO,aAAa;IASzB;QARiB,8BAAyB,GAAG,IAAI,OAAO,EAAiE,CAAC;QAC1G,6BAAwB,GAAG,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC;QAE/D,WAAM,GAAG,IAAI,GAAG,EAAoB,CAAC;QACrC,kBAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QAKvD,IAAI,CAAC,iBAAiB,GAAG,WAAW,CAAC;YACpC,KAAK,EAAE,IAAI;YACX,QAAQ,EAAE,WAAW,CAAC,UAAU,EAAE,CAAC;SACnC,EAAE,MAAM,CAAC,EAAE;YACX,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAChC,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAChC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,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UAAU,CAAC,CAAC;QACpC,CAAC;IACF,CAAC;CASD","file":"abstractSyntaxTokenBackend.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 { equals } from '../../../../base/common/arrays.js';\nimport { RunOnceScheduler } from '../../../../base/common/async.js';\nimport { Emitter, Event } from '../../../../base/common/event.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { LineRange } from '../../core/ranges/lineRange.js';\nimport { StandardTokenType } from '../../encodedTokenAttributes.js';\nimport { ILanguageIdCodec } from '../../languages.js';\nimport { IAttachedView } from '../../model.js';\nimport { TextModel } from '../textModel.js';\nimport { IModelContentChangedEvent, IModelTokensChangedEvent } from '../../textModelEvents.js';\nimport { BackgroundTokenizationState } from '../../tokenizationTextModelPart.js';\nimport { LineTokens } from '../../tokens/lineTokens.js';\nimport { derivedOpts, IObservable, ISettableObservable, observableSignal, observableValueOpts } from '../../../../base/common/observable.js';\nimport { equalsIfDefined, itemEquals, itemsEquals } from '../../../../base/common/equals.js';\n\n/**\n * @internal\n */\nexport class AttachedViews {\n\tprivate readonly _onDidChangeVisibleRanges = new Emitter<{ view: IAttachedView; state: AttachedViewState | undefined }>();\n\tpublic readonly onDidChangeVisibleRanges = this._onDidChangeVisibleRanges.event;\n\n\tprivate readonly _views = new Set<AttachedViewImpl>();\n\tprivate readonly _viewsChanged = observableSignal(this);\n\n\tpublic readonly visibleLineRanges: IObservable<readonly LineRange[]>;\n\n\tconstructor() {\n\t\tthis.visibleLineRanges = derivedOpts({\n\t\t\towner: this,\n\t\t\tequalsFn: itemsEquals(itemEquals())\n\t\t}, reader => {\n\t\t\tthis._viewsChanged.read(reader);\n\t\t\tconst ranges = LineRange.joinMany(\n\t\t\t\t[...this._views].map(view => view.state.read(reader)?.visibleLineRanges ?? [])\n\t\t\t);\n\t\t\treturn ranges;\n\t\t});\n\t}\n\n\tpublic attachView(): IAttachedView {\n\t\tconst view = new AttachedViewImpl((state) => {\n\t\t\tthis._onDidChangeVisibleRanges.fire({ view, state });\n\t\t});\n\t\tthis._views.add(view);\n\t\tthis._viewsChanged.trigger(undefined);\n\t\treturn view;\n\t}\n\n\tpublic detachView(view: IAttachedView): void {\n\t\tthis._views.delete(view as AttachedViewImpl);\n\t\tthis._onDidChangeVisibleRanges.fire({ view, state: undefined });\n\t\tthis._viewsChanged.trigger(undefined);\n\t}\n}\n\n/**\n * @internal\n */\nexport class AttachedViewState {\n\tconstructor(\n\t\treadonly visibleLineRanges: readonly LineRange[],\n\t\treadonly stabilized: boolean,\n\t) { }\n\n\tpublic equals(other: AttachedViewState): boolean {\n\t\tif (this === other) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!equals(this.visibleLineRanges, other.visibleLineRanges, (a, b) => a.equals(b))) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.stabilized !== other.stabilized) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n}\n\nclass AttachedViewImpl implements IAttachedView {\n\tprivate readonly _state: ISettableObservable<AttachedViewState | undefined>;\n\tpublic get state(): IObservable<AttachedViewState | undefined> { return this._state; }\n\n\tconstructor(\n\t\tprivate readonly handleStateChange: (state: AttachedViewState) => void\n\t) {\n\t\tthis._state = observableValueOpts<AttachedViewState | undefined>({ owner: this, equalsFn: equalsIfDefined((a, b) => a.equals(b)) }, undefined);\n\t}\n\n\tsetVisibleLines(visibleLines: { startLineNumber: number; endLineNumber: number }[], stabilized: boolean): void {\n\t\tconst visibleLineRanges = visibleLines.map((line) => new LineRange(line.startLineNumber, line.endLineNumber + 1));\n\t\tconst state = new AttachedViewState(visibleLineRanges, stabilized);\n\t\tthis._state.set(state, undefined, undefined);\n\t\tthis.handleStateChange(state);\n\t}\n}\n\n\nexport class AttachedViewHandler extends Disposable {\n\tprivate readonly runner = this._register(new RunOnceScheduler(() => this.update(), 50));\n\n\tprivate _computedLineRanges: readonly LineRange[] = [];\n\tprivate _lineRanges: readonly LineRange[] = [];\n\tpublic get lineRanges(): readonly LineRange[] { return this._lineRanges; }\n\n\tconstructor(private readonly _refreshTokens: () => void) {\n\t\tsuper();\n\t}\n\n\tprivate update(): void {\n\t\tif (equals(this._computedLineRanges, this._lineRanges, (a, b) => a.equals(b))) {\n\t\t\treturn;\n\t\t}\n\t\tthis._computedLineRanges = this._lineRanges;\n\t\tthis._refreshTokens();\n\t}\n\n\tpublic handleStateChange(state: AttachedViewState): void {\n\t\tthis._lineRanges = state.visibleLineRanges;\n\t\tif (state.stabilized) {\n\t\t\tthis.runner.cancel();\n\t\t\tthis.update();\n\t\t} else {\n\t\t\tthis.runner.schedule();\n\t\t}\n\t}\n}\n\nexport abstract class AbstractSyntaxTokenBackend extends Disposable {\n\tprotected abstract _backgroundTokenizationState: BackgroundTokenizationState;\n\tpublic get backgroundTokenizationState(): BackgroundTokenizationState {\n\t\treturn this._backgroundTokenizationState;\n\t}\n\n\tprotected abstract readonly _onDidChangeBackgroundTokenizationState: Emitter<void>;\n\t/** @internal, should not be exposed by the text model! */\n\tpublic abstract readonly onDidChangeBackgroundTokenizationState: Event<void>;\n\n\tprotected readonly _onDidChangeTokens = this._register(new Emitter<IModelTokensChangedEvent>());\n\t/** @internal, should not be exposed by the text model! */\n\tpublic readonly onDidChangeTokens: Event<IModelTokensChangedEvent> = this._onDidChangeTokens.event;\n\n\tconstructor(\n\t\tprotected readonly _languageIdCodec: ILanguageIdCodec,\n\t\tprotected readonly _textModel: TextModel,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic abstract todo_resetTokenization(fireTokenChangeEvent?: boolean): void;\n\n\tpublic abstract handleDidChangeAttached(): void;\n\n\tpublic abstract handleDidChangeContent(e: IModelContentChangedEvent): void;\n\n\tpublic abstract forceTokenization(lineNumber: number): void;\n\n\tpublic abstract hasAccurateTokensForLine(lineNumber: number): boolean;\n\n\tpublic abstract isCheapToTokenize(lineNumber: number): boolean;\n\n\tpublic tokenizeIfCheap(lineNumber: number): void {\n\t\tif (this.isCheapToTokenize(lineNumber)) {\n\t\t\tthis.forceTokenization(lineNumber);\n\t\t}\n\t}\n\n\tpublic abstract getLineTokens(lineNumber: number): LineTokens;\n\n\tpublic abstract getTokenTypeIfInsertingCharacter(lineNumber: number, column: number, character: string): StandardTokenType;\n\n\tpublic abstract tokenizeLinesAt(lineNumber: number, lines: string[]): LineTokens[] | null;\n\n\tpublic abstract get hasTokens(): 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 { equals } from '../../../../base/common/arrays.js';\nimport { RunOnceScheduler } from '../../../../base/common/async.js';\nimport { Emitter, Event } from '../../../../base/common/event.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { LineRange } from '../../core/ranges/lineRange.js';\nimport { StandardTokenType } from '../../encodedTokenAttributes.js';\nimport { ILanguageIdCodec } from '../../languages.js';\nimport { IAttachedView } from '../../model.js';\nimport { TextModel } from '../textModel.js';\nimport { IModelContentChangedEvent, IModelTokensChangedEvent } from '../../textModelEvents.js';\nimport { BackgroundTokenizationState } from '../../tokenizationTextModelPart.js';\nimport { LineTokens } from '../../tokens/lineTokens.js';\nimport { derivedOpts, IObservable, ISettableObservable, observableSignal, observableValueOpts } from '../../../../base/common/observable.js';\nimport { equalsIfDefined, itemEquals, itemsEquals } from '../../../../base/common/equals.js';\n\n/**\n * @internal\n */\nexport class AttachedViews {\n\tprivate readonly _onDidChangeVisibleRanges = new Emitter<{ view: IAttachedView; state: AttachedViewState | undefined }>();\n\tpublic readonly onDidChangeVisibleRanges = this._onDidChangeVisibleRanges.event;\n\n\tprivate readonly _views = new Set<AttachedViewImpl>();\n\tprivate readonly _viewsChanged = observableSignal(this);\n\n\tpublic readonly visibleLineRanges: IObservable<readonly LineRange[]>;\n\n\tconstructor() {\n\t\tthis.visibleLineRanges = derivedOpts({\n\t\t\towner: this,\n\t\t\tequalsFn: itemsEquals(itemEquals())\n\t\t}, reader => {\n\t\t\tthis._viewsChanged.read(reader);\n\t\t\tconst ranges = LineRange.joinMany(\n\t\t\t\t[...this._views].map(view => view.state.read(reader)?.visibleLineRanges ?? [])\n\t\t\t);\n\t\t\treturn ranges;\n\t\t});\n\t}\n\n\tpublic attachView(): IAttachedView {\n\t\tconst view = new AttachedViewImpl((state) => {\n\t\t\tthis._onDidChangeVisibleRanges.fire({ view, state });\n\t\t});\n\t\tthis._views.add(view);\n\t\tthis._viewsChanged.trigger(undefined);\n\t\treturn view;\n\t}\n\n\tpublic detachView(view: IAttachedView): void {\n\t\tthis._views.delete(view as AttachedViewImpl);\n\t\tthis._onDidChangeVisibleRanges.fire({ view, state: undefined });\n\t\tthis._viewsChanged.trigger(undefined);\n\t}\n}\n\n/**\n * @internal\n */\nexport class AttachedViewState {\n\tconstructor(\n\t\treadonly visibleLineRanges: readonly LineRange[],\n\t\treadonly stabilized: boolean,\n\t) { }\n\n\tpublic equals(other: AttachedViewState): boolean {\n\t\tif (this === other) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!equals(this.visibleLineRanges, other.visibleLineRanges, (a, b) => a.equals(b))) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.stabilized !== other.stabilized) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n}\n\nclass AttachedViewImpl implements IAttachedView {\n\tprivate readonly _state: ISettableObservable<AttachedViewState | undefined>;\n\tpublic get state(): IObservable<AttachedViewState | undefined> { return this._state; }\n\n\tconstructor(\n\t\tprivate readonly handleStateChange: (state: AttachedViewState) => void\n\t) {\n\t\tthis._state = observableValueOpts<AttachedViewState | undefined>({ owner: this, equalsFn: equalsIfDefined((a, b) => a.equals(b)) }, undefined);\n\t}\n\n\tsetVisibleLines(visibleLines: { startLineNumber: number; endLineNumber: number }[], stabilized: boolean): void {\n\t\tconst visibleLineRanges = visibleLines.map((line) => new LineRange(line.startLineNumber, line.endLineNumber + 1));\n\t\tconst state = new AttachedViewState(visibleLineRanges, stabilized);\n\t\tthis._state.set(state, undefined, undefined);\n\t\tthis.handleStateChange(state);\n\t}\n}\n\n\nexport class AttachedViewHandler extends Disposable {\n\tprivate readonly runner = this._register(new RunOnceScheduler(() => this.update(), 50));\n\n\tprivate _computedLineRanges: readonly LineRange[] = [];\n\tprivate _lineRanges: readonly LineRange[] = [];\n\tpublic get lineRanges(): readonly LineRange[] { return this._lineRanges; }\n\n\tconstructor(private readonly _refreshTokens: () => void) {\n\t\tsuper();\n\t}\n\n\tprivate update(): void {\n\t\tif (equals(this._computedLineRanges, this._lineRanges, (a, b) => a.equals(b))) {\n\t\t\treturn;\n\t\t}\n\t\tthis._computedLineRanges = this._lineRanges;\n\t\tthis._refreshTokens();\n\t}\n\n\tpublic handleStateChange(state: AttachedViewState): void {\n\t\tthis._lineRanges = state.visibleLineRanges;\n\t\tif (state.stabilized) {\n\t\t\tthis.runner.cancel();\n\t\t\tthis.update();\n\t\t} else {\n\t\t\tthis.runner.schedule();\n\t\t}\n\t}\n}\n\nexport abstract class AbstractSyntaxTokenBackend extends Disposable {\n\tprotected abstract _backgroundTokenizationState: BackgroundTokenizationState;\n\tpublic get backgroundTokenizationState(): BackgroundTokenizationState {\n\t\treturn this._backgroundTokenizationState;\n\t}\n\n\tprotected abstract readonly _onDidChangeBackgroundTokenizationState: Emitter<void>;\n\t/** @internal, should not be exposed by the text model! */\n\tpublic abstract readonly onDidChangeBackgroundTokenizationState: Event<void>;\n\n\tprotected readonly _onDidChangeTokens = this._register(new Emitter<IModelTokensChangedEvent>());\n\t/** @internal, should not be exposed by the text model! */\n\tpublic readonly onDidChangeTokens: Event<IModelTokensChangedEvent> = this._onDidChangeTokens.event;\n\n\tconstructor(\n\t\tprotected readonly _languageIdCodec: ILanguageIdCodec,\n\t\tprotected readonly _textModel: TextModel,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic abstract todo_resetTokenization(fireTokenChangeEvent?: boolean): void;\n\n\tpublic abstract handleDidChangeAttached(): void;\n\n\tpublic abstract handleDidChangeContent(e: IModelContentChangedEvent): void;\n\n\tpublic abstract forceTokenization(lineNumber: number): void;\n\n\tpublic abstract hasAccurateTokensForLine(lineNumber: number): boolean;\n\n\tpublic abstract isCheapToTokenize(lineNumber: number): boolean;\n\n\tpublic tokenizeIfCheap(lineNumber: number): void {\n\t\tif (this.isCheapToTokenize(lineNumber)) {\n\t\t\tthis.forceTokenization(lineNumber);\n\t\t}\n\t}\n\n\tpublic abstract getLineTokens(lineNumber: number): LineTokens;\n\n\tpublic abstract getTokenTypeIfInsertingCharacter(lineNumber: number, column: number, character: string): StandardTokenType;\n\n\tpublic abstract tokenizeLinesAt(lineNumber: number, lines: string[]): LineTokens[] | null;\n\n\tpublic abstract get hasTokens(): boolean;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/model/tokens/abstractSyntaxTokenBackend.ts","vs/editor/common/model/tokens/abstractSyntaxTokenBackend.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,MAAM,mCAAmC,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,OAAO,EAAS,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,gCAAgC,CAAC;AAQ3D,OAAO,EAAE,WAAW,EAAoC,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC7I,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEhG;;GAEG;AACH,MAAM,OAAO,aAAa;IASzB;QARiB,8BAAyB,GA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C;QACxB,CAAC;IACF,CAAC;CACD;AAED,MAAM,OAAgB,0BAA2B,SAAQ,UAAU;IAElE,IAAW,2BAA2B;QACrC,OAAO,IAAI,CAAC,4BAA4B,CAAC;IAC1C,CAAC;IAcD,YACoB,gBAAkC,EAClC,UAAqB;QAExC,KAAK,EAAE,CAAC;QAHW,qBAAgB,GAAhB,gBAAgB,CAAkB;QAClC,eAAU,GAAV,UAAU,CAAW;QAVtB,uBAAkB,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,OAAO,EAA4B,CAAC,CAAC;QAChG,0DAA0D;QAC1C,sBAAiB,GAAoC,IAAI,CAAC,kBAAkB,CAAC,KAAK,CAAC;QAEhF,2BAAsB,GAA0C,IAAI,CAAC,SAAS,CAAC,IAAI,OAAO,EAAgC,CAAC,CAAC;QAC/I,0DAA0D;QAC1C,0BAAqB,GAAwC,IAAI,CAAC,sBAAsB,CAAC,KAAK,CAAC;IAO/G,CAAC;IAcM,eAAe,CAAC,UAAkB;QACxC,IAAI,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,EAAE,CAAC;YACxC,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QACpC,CAAC;IACF,CAAC;CASD","file":"abstractSyntaxTokenBackend.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 { equals } from '../../../../base/common/arrays.js';\nimport { RunOnceScheduler } from '../../../../base/common/async.js';\nimport { Emitter, Event } from '../../../../base/common/event.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { LineRange } from '../../core/ranges/lineRange.js';\nimport { StandardTokenType } from '../../encodedTokenAttributes.js';\nimport { ILanguageIdCodec } from '../../languages.js';\nimport { IAttachedView } from '../../model.js';\nimport { TextModel } from '../textModel.js';\nimport { IModelContentChangedEvent, IModelTokensChangedEvent, IModelFontTokensChangedEvent } from '../../textModelEvents.js';\nimport { BackgroundTokenizationState } from '../../tokenizationTextModelPart.js';\nimport { LineTokens } from '../../tokens/lineTokens.js';\nimport { derivedOpts, IObservable, ISettableObservable, observableSignal, observableValueOpts } from '../../../../base/common/observable.js';\nimport { equalsIfDefinedC, thisEqualsC, arrayEqualsC } from '../../../../base/common/equals.js';\n\n/**\n * @internal\n */\nexport class AttachedViews {\n\tprivate readonly _onDidChangeVisibleRanges = new Emitter<{ view: IAttachedView; state: AttachedViewState | undefined }>();\n\tpublic readonly onDidChangeVisibleRanges = this._onDidChangeVisibleRanges.event;\n\n\tprivate readonly _views = new Set<AttachedViewImpl>();\n\tprivate readonly _viewsChanged = observableSignal(this);\n\n\tpublic readonly visibleLineRanges: IObservable<readonly LineRange[]>;\n\n\tconstructor() {\n\t\tthis.visibleLineRanges = derivedOpts({\n\t\t\towner: this,\n\t\t\tequalsFn: arrayEqualsC(thisEqualsC())\n\t\t}, reader => {\n\t\t\tthis._viewsChanged.read(reader);\n\t\t\tconst ranges = LineRange.joinMany(\n\t\t\t\t[...this._views].map(view => view.state.read(reader)?.visibleLineRanges ?? [])\n\t\t\t);\n\t\t\treturn ranges;\n\t\t});\n\t}\n\n\tpublic attachView(): IAttachedView {\n\t\tconst view = new AttachedViewImpl((state) => {\n\t\t\tthis._onDidChangeVisibleRanges.fire({ view, state });\n\t\t});\n\t\tthis._views.add(view);\n\t\tthis._viewsChanged.trigger(undefined);\n\t\treturn view;\n\t}\n\n\tpublic detachView(view: IAttachedView): void {\n\t\tthis._views.delete(view as AttachedViewImpl);\n\t\tthis._onDidChangeVisibleRanges.fire({ view, state: undefined });\n\t\tthis._viewsChanged.trigger(undefined);\n\t}\n}\n\n/**\n * @internal\n */\nexport class AttachedViewState {\n\tconstructor(\n\t\treadonly visibleLineRanges: readonly LineRange[],\n\t\treadonly stabilized: boolean,\n\t) { }\n\n\tpublic equals(other: AttachedViewState): boolean {\n\t\tif (this === other) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!equals(this.visibleLineRanges, other.visibleLineRanges, (a, b) => a.equals(b))) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.stabilized !== other.stabilized) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n}\n\nclass AttachedViewImpl implements IAttachedView {\n\tprivate readonly _state: ISettableObservable<AttachedViewState | undefined>;\n\tpublic get state(): IObservable<AttachedViewState | undefined> { return this._state; }\n\n\tconstructor(\n\t\tprivate readonly handleStateChange: (state: AttachedViewState) => void\n\t) {\n\t\tthis._state = observableValueOpts<AttachedViewState | undefined>({ owner: this, equalsFn: equalsIfDefinedC((a, b) => a.equals(b)) }, undefined);\n\t}\n\n\tsetVisibleLines(visibleLines: { startLineNumber: number; endLineNumber: number }[], stabilized: boolean): void {\n\t\tconst visibleLineRanges = visibleLines.map((line) => new LineRange(line.startLineNumber, line.endLineNumber + 1));\n\t\tconst state = new AttachedViewState(visibleLineRanges, stabilized);\n\t\tthis._state.set(state, undefined, undefined);\n\t\tthis.handleStateChange(state);\n\t}\n}\n\n\nexport class AttachedViewHandler extends Disposable {\n\tprivate readonly runner = this._register(new RunOnceScheduler(() => this.update(), 50));\n\n\tprivate _computedLineRanges: readonly LineRange[] = [];\n\tprivate _lineRanges: readonly LineRange[] = [];\n\tpublic get lineRanges(): readonly LineRange[] { return this._lineRanges; }\n\n\tconstructor(private readonly _refreshTokens: () => void) {\n\t\tsuper();\n\t}\n\n\tprivate update(): void {\n\t\tif (equals(this._computedLineRanges, this._lineRanges, (a, b) => a.equals(b))) {\n\t\t\treturn;\n\t\t}\n\t\tthis._computedLineRanges = this._lineRanges;\n\t\tthis._refreshTokens();\n\t}\n\n\tpublic handleStateChange(state: AttachedViewState): void {\n\t\tthis._lineRanges = state.visibleLineRanges;\n\t\tif (state.stabilized) {\n\t\t\tthis.runner.cancel();\n\t\t\tthis.update();\n\t\t} else {\n\t\t\tthis.runner.schedule();\n\t\t}\n\t}\n}\n\nexport abstract class AbstractSyntaxTokenBackend extends Disposable {\n\tprotected abstract _backgroundTokenizationState: BackgroundTokenizationState;\n\tpublic get backgroundTokenizationState(): BackgroundTokenizationState {\n\t\treturn this._backgroundTokenizationState;\n\t}\n\n\tprotected abstract readonly _onDidChangeBackgroundTokenizationState: Emitter<void>;\n\t/** @internal, should not be exposed by the text model! */\n\tpublic abstract readonly onDidChangeBackgroundTokenizationState: Event<void>;\n\n\tprotected readonly _onDidChangeTokens = this._register(new Emitter<IModelTokensChangedEvent>());\n\t/** @internal, should not be exposed by the text model! */\n\tpublic readonly onDidChangeTokens: Event<IModelTokensChangedEvent> = this._onDidChangeTokens.event;\n\n\tprotected readonly _onDidChangeFontTokens: Emitter<IModelFontTokensChangedEvent> = this._register(new Emitter<IModelFontTokensChangedEvent>());\n\t/** @internal, should not be exposed by the text model! */\n\tpublic readonly onDidChangeFontTokens: Event<IModelFontTokensChangedEvent> = this._onDidChangeFontTokens.event;\n\n\tconstructor(\n\t\tprotected readonly _languageIdCodec: ILanguageIdCodec,\n\t\tprotected readonly _textModel: TextModel,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic abstract todo_resetTokenization(fireTokenChangeEvent?: boolean): void;\n\n\tpublic abstract handleDidChangeAttached(): void;\n\n\tpublic abstract handleDidChangeContent(e: IModelContentChangedEvent): void;\n\n\tpublic abstract forceTokenization(lineNumber: number): void;\n\n\tpublic abstract hasAccurateTokensForLine(lineNumber: number): boolean;\n\n\tpublic abstract isCheapToTokenize(lineNumber: number): boolean;\n\n\tpublic tokenizeIfCheap(lineNumber: number): void {\n\t\tif (this.isCheapToTokenize(lineNumber)) {\n\t\t\tthis.forceTokenization(lineNumber);\n\t\t}\n\t}\n\n\tpublic abstract getLineTokens(lineNumber: number): LineTokens;\n\n\tpublic abstract getTokenTypeIfInsertingCharacter(lineNumber: number, column: number, character: string): StandardTokenType;\n\n\tpublic abstract tokenizeLinesAt(lineNumber: number, lines: string[]): LineTokens[] | null;\n\n\tpublic abstract get hasTokens(): 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 { equals } from '../../../../base/common/arrays.js';\nimport { RunOnceScheduler } from '../../../../base/common/async.js';\nimport { Emitter, Event } from '../../../../base/common/event.js';\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { LineRange } from '../../core/ranges/lineRange.js';\nimport { StandardTokenType } from '../../encodedTokenAttributes.js';\nimport { ILanguageIdCodec } from '../../languages.js';\nimport { IAttachedView } from '../../model.js';\nimport { TextModel } from '../textModel.js';\nimport { IModelContentChangedEvent, IModelTokensChangedEvent, IModelFontTokensChangedEvent } from '../../textModelEvents.js';\nimport { BackgroundTokenizationState } from '../../tokenizationTextModelPart.js';\nimport { LineTokens } from '../../tokens/lineTokens.js';\nimport { derivedOpts, IObservable, ISettableObservable, observableSignal, observableValueOpts } from '../../../../base/common/observable.js';\nimport { equalsIfDefinedC, thisEqualsC, arrayEqualsC } from '../../../../base/common/equals.js';\n\n/**\n * @internal\n */\nexport class AttachedViews {\n\tprivate readonly _onDidChangeVisibleRanges = new Emitter<{ view: IAttachedView; state: AttachedViewState | undefined }>();\n\tpublic readonly onDidChangeVisibleRanges = this._onDidChangeVisibleRanges.event;\n\n\tprivate readonly _views = new Set<AttachedViewImpl>();\n\tprivate readonly _viewsChanged = observableSignal(this);\n\n\tpublic readonly visibleLineRanges: IObservable<readonly LineRange[]>;\n\n\tconstructor() {\n\t\tthis.visibleLineRanges = derivedOpts({\n\t\t\towner: this,\n\t\t\tequalsFn: arrayEqualsC(thisEqualsC())\n\t\t}, reader => {\n\t\t\tthis._viewsChanged.read(reader);\n\t\t\tconst ranges = LineRange.joinMany(\n\t\t\t\t[...this._views].map(view => view.state.read(reader)?.visibleLineRanges ?? [])\n\t\t\t);\n\t\t\treturn ranges;\n\t\t});\n\t}\n\n\tpublic attachView(): IAttachedView {\n\t\tconst view = new AttachedViewImpl((state) => {\n\t\t\tthis._onDidChangeVisibleRanges.fire({ view, state });\n\t\t});\n\t\tthis._views.add(view);\n\t\tthis._viewsChanged.trigger(undefined);\n\t\treturn view;\n\t}\n\n\tpublic detachView(view: IAttachedView): void {\n\t\tthis._views.delete(view as AttachedViewImpl);\n\t\tthis._onDidChangeVisibleRanges.fire({ view, state: undefined });\n\t\tthis._viewsChanged.trigger(undefined);\n\t}\n}\n\n/**\n * @internal\n */\nexport class AttachedViewState {\n\tconstructor(\n\t\treadonly visibleLineRanges: readonly LineRange[],\n\t\treadonly stabilized: boolean,\n\t) { }\n\n\tpublic equals(other: AttachedViewState): boolean {\n\t\tif (this === other) {\n\t\t\treturn true;\n\t\t}\n\t\tif (!equals(this.visibleLineRanges, other.visibleLineRanges, (a, b) => a.equals(b))) {\n\t\t\treturn false;\n\t\t}\n\t\tif (this.stabilized !== other.stabilized) {\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n}\n\nclass AttachedViewImpl implements IAttachedView {\n\tprivate readonly _state: ISettableObservable<AttachedViewState | undefined>;\n\tpublic get state(): IObservable<AttachedViewState | undefined> { return this._state; }\n\n\tconstructor(\n\t\tprivate readonly handleStateChange: (state: AttachedViewState) => void\n\t) {\n\t\tthis._state = observableValueOpts<AttachedViewState | undefined>({ owner: this, equalsFn: equalsIfDefinedC((a, b) => a.equals(b)) }, undefined);\n\t}\n\n\tsetVisibleLines(visibleLines: { startLineNumber: number; endLineNumber: number }[], stabilized: boolean): void {\n\t\tconst visibleLineRanges = visibleLines.map((line) => new LineRange(line.startLineNumber, line.endLineNumber + 1));\n\t\tconst state = new AttachedViewState(visibleLineRanges, stabilized);\n\t\tthis._state.set(state, undefined, undefined);\n\t\tthis.handleStateChange(state);\n\t}\n}\n\n\nexport class AttachedViewHandler extends Disposable {\n\tprivate readonly runner = this._register(new RunOnceScheduler(() => this.update(), 50));\n\n\tprivate _computedLineRanges: readonly LineRange[] = [];\n\tprivate _lineRanges: readonly LineRange[] = [];\n\tpublic get lineRanges(): readonly LineRange[] { return this._lineRanges; }\n\n\tconstructor(private readonly _refreshTokens: () => void) {\n\t\tsuper();\n\t}\n\n\tprivate update(): void {\n\t\tif (equals(this._computedLineRanges, this._lineRanges, (a, b) => a.equals(b))) {\n\t\t\treturn;\n\t\t}\n\t\tthis._computedLineRanges = this._lineRanges;\n\t\tthis._refreshTokens();\n\t}\n\n\tpublic handleStateChange(state: AttachedViewState): void {\n\t\tthis._lineRanges = state.visibleLineRanges;\n\t\tif (state.stabilized) {\n\t\t\tthis.runner.cancel();\n\t\t\tthis.update();\n\t\t} else {\n\t\t\tthis.runner.schedule();\n\t\t}\n\t}\n}\n\nexport abstract class AbstractSyntaxTokenBackend extends Disposable {\n\tprotected abstract _backgroundTokenizationState: BackgroundTokenizationState;\n\tpublic get backgroundTokenizationState(): BackgroundTokenizationState {\n\t\treturn this._backgroundTokenizationState;\n\t}\n\n\tprotected abstract readonly _onDidChangeBackgroundTokenizationState: Emitter<void>;\n\t/** @internal, should not be exposed by the text model! */\n\tpublic abstract readonly onDidChangeBackgroundTokenizationState: Event<void>;\n\n\tprotected readonly _onDidChangeTokens = this._register(new Emitter<IModelTokensChangedEvent>());\n\t/** @internal, should not be exposed by the text model! */\n\tpublic readonly onDidChangeTokens: Event<IModelTokensChangedEvent> = this._onDidChangeTokens.event;\n\n\tprotected readonly _onDidChangeFontTokens: Emitter<IModelFontTokensChangedEvent> = this._register(new Emitter<IModelFontTokensChangedEvent>());\n\t/** @internal, should not be exposed by the text model! */\n\tpublic readonly onDidChangeFontTokens: Event<IModelFontTokensChangedEvent> = this._onDidChangeFontTokens.event;\n\n\tconstructor(\n\t\tprotected readonly _languageIdCodec: ILanguageIdCodec,\n\t\tprotected readonly _textModel: TextModel,\n\t) {\n\t\tsuper();\n\t}\n\n\tpublic abstract todo_resetTokenization(fireTokenChangeEvent?: boolean): void;\n\n\tpublic abstract handleDidChangeAttached(): void;\n\n\tpublic abstract handleDidChangeContent(e: IModelContentChangedEvent): void;\n\n\tpublic abstract forceTokenization(lineNumber: number): void;\n\n\tpublic abstract hasAccurateTokensForLine(lineNumber: number): boolean;\n\n\tpublic abstract isCheapToTokenize(lineNumber: number): boolean;\n\n\tpublic tokenizeIfCheap(lineNumber: number): void {\n\t\tif (this.isCheapToTokenize(lineNumber)) {\n\t\t\tthis.forceTokenization(lineNumber);\n\t\t}\n\t}\n\n\tpublic abstract getLineTokens(lineNumber: number): LineTokens;\n\n\tpublic abstract getTokenTypeIfInsertingCharacter(lineNumber: number, column: number, character: string): StandardTokenType;\n\n\tpublic abstract tokenizeLinesAt(lineNumber: number, lines: string[]): LineTokens[] | null;\n\n\tpublic abstract get hasTokens(): boolean;\n}\n"]}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { binarySearch2 } from '../../../../base/common/arrays.js';
|
|
6
|
+
export class AnnotatedString {
|
|
7
|
+
constructor(annotations = []) {
|
|
8
|
+
/**
|
|
9
|
+
* Annotations are non intersecting and contiguous in the array.
|
|
10
|
+
*/
|
|
11
|
+
this._annotations = [];
|
|
12
|
+
this._annotations = annotations;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Set annotations for a specific range.
|
|
16
|
+
* Annotations should be sorted and non-overlapping.
|
|
17
|
+
* If the annotation value is undefined, the annotation is removed.
|
|
18
|
+
*/
|
|
19
|
+
setAnnotations(annotations) {
|
|
20
|
+
for (const annotation of annotations.annotations) {
|
|
21
|
+
const startIndex = this._getStartIndexOfIntersectingAnnotation(annotation.range.start);
|
|
22
|
+
const endIndexExclusive = this._getEndIndexOfIntersectingAnnotation(annotation.range.endExclusive);
|
|
23
|
+
if (annotation.annotation !== undefined) {
|
|
24
|
+
this._annotations.splice(startIndex, endIndexExclusive - startIndex, { range: annotation.range, annotation: annotation.annotation });
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
this._annotations.splice(startIndex, endIndexExclusive - startIndex);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Returns all annotations that intersect with the given offset range.
|
|
33
|
+
*/
|
|
34
|
+
getAnnotationsIntersecting(range) {
|
|
35
|
+
const startIndex = this._getStartIndexOfIntersectingAnnotation(range.start);
|
|
36
|
+
const endIndexExclusive = this._getEndIndexOfIntersectingAnnotation(range.endExclusive);
|
|
37
|
+
return this._annotations.slice(startIndex, endIndexExclusive);
|
|
38
|
+
}
|
|
39
|
+
_getStartIndexOfIntersectingAnnotation(offset) {
|
|
40
|
+
// Find index to the left of the offset
|
|
41
|
+
const startIndexWhereToReplace = binarySearch2(this._annotations.length, (index) => {
|
|
42
|
+
return this._annotations[index].range.start - offset;
|
|
43
|
+
});
|
|
44
|
+
let startIndex;
|
|
45
|
+
if (startIndexWhereToReplace >= 0) {
|
|
46
|
+
startIndex = startIndexWhereToReplace;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const candidate = this._annotations[-(startIndexWhereToReplace + 2)]?.range;
|
|
50
|
+
if (candidate && offset >= candidate.start && offset <= candidate.endExclusive) {
|
|
51
|
+
startIndex = -(startIndexWhereToReplace + 2);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
startIndex = -(startIndexWhereToReplace + 1);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return startIndex;
|
|
58
|
+
}
|
|
59
|
+
_getEndIndexOfIntersectingAnnotation(offset) {
|
|
60
|
+
// Find index to the right of the offset
|
|
61
|
+
const endIndexWhereToReplace = binarySearch2(this._annotations.length, (index) => {
|
|
62
|
+
return this._annotations[index].range.endExclusive - offset;
|
|
63
|
+
});
|
|
64
|
+
let endIndexExclusive;
|
|
65
|
+
if (endIndexWhereToReplace >= 0) {
|
|
66
|
+
endIndexExclusive = endIndexWhereToReplace + 1;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const candidate = this._annotations[-(endIndexWhereToReplace + 1)]?.range;
|
|
70
|
+
if (candidate && offset >= candidate.start && offset <= candidate.endExclusive) {
|
|
71
|
+
endIndexExclusive = -endIndexWhereToReplace;
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
endIndexExclusive = -(endIndexWhereToReplace + 1);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return endIndexExclusive;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Applies a string edit to the annotated string, updating annotation ranges accordingly.
|
|
81
|
+
* @param edit The string edit to apply.
|
|
82
|
+
* @returns The annotations that were deleted (became empty) as a result of the edit.
|
|
83
|
+
*/
|
|
84
|
+
applyEdit(edit) {
|
|
85
|
+
const annotations = this._annotations.slice();
|
|
86
|
+
// treat edits as deletion of the replace range and then as insertion that extends the first range
|
|
87
|
+
const finalAnnotations = [];
|
|
88
|
+
const deletedAnnotations = [];
|
|
89
|
+
let offset = 0;
|
|
90
|
+
for (const e of edit.replacements) {
|
|
91
|
+
while (true) {
|
|
92
|
+
// ranges before the current edit
|
|
93
|
+
const annotation = annotations[0];
|
|
94
|
+
if (!annotation) {
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
const range = annotation.range;
|
|
98
|
+
if (range.endExclusive >= e.replaceRange.start) {
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
annotations.shift();
|
|
102
|
+
const newAnnotation = { range: range.delta(offset), annotation: annotation.annotation };
|
|
103
|
+
if (!newAnnotation.range.isEmpty) {
|
|
104
|
+
finalAnnotations.push(newAnnotation);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
deletedAnnotations.push(newAnnotation);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const intersecting = [];
|
|
111
|
+
while (true) {
|
|
112
|
+
const annotation = annotations[0];
|
|
113
|
+
if (!annotation) {
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
const range = annotation.range;
|
|
117
|
+
if (!range.intersectsOrTouches(e.replaceRange)) {
|
|
118
|
+
break;
|
|
119
|
+
}
|
|
120
|
+
annotations.shift();
|
|
121
|
+
intersecting.push(annotation);
|
|
122
|
+
}
|
|
123
|
+
for (let i = intersecting.length - 1; i >= 0; i--) {
|
|
124
|
+
const annotation = intersecting[i];
|
|
125
|
+
let r = annotation.range;
|
|
126
|
+
// Inserted text will extend the first intersecting annotation, if the edit truly overlaps it
|
|
127
|
+
const shouldExtend = i === 0 && (e.replaceRange.endExclusive > r.start) && (e.replaceRange.start < r.endExclusive);
|
|
128
|
+
// Annotation shrinks by the overlap then grows with the new text length
|
|
129
|
+
const overlap = r.intersect(e.replaceRange).length;
|
|
130
|
+
r = r.deltaEnd(-overlap + (shouldExtend ? e.newText.length : 0));
|
|
131
|
+
// If the annotation starts after the edit start, shift left to the edit start position
|
|
132
|
+
const rangeAheadOfReplaceRange = r.start - e.replaceRange.start;
|
|
133
|
+
if (rangeAheadOfReplaceRange > 0) {
|
|
134
|
+
r = r.delta(-rangeAheadOfReplaceRange);
|
|
135
|
+
}
|
|
136
|
+
// If annotation shouldn't be extended AND it is after or on edit start, move it after the newly inserted text
|
|
137
|
+
if (!shouldExtend && rangeAheadOfReplaceRange >= 0) {
|
|
138
|
+
r = r.delta(e.newText.length);
|
|
139
|
+
}
|
|
140
|
+
// We already took our offset into account.
|
|
141
|
+
// Because we add r back to the queue (which then adds offset again),
|
|
142
|
+
// we have to remove it here so as to not double count it.
|
|
143
|
+
r = r.delta(-(e.newText.length - e.replaceRange.length));
|
|
144
|
+
annotations.unshift({ annotation: annotation.annotation, range: r });
|
|
145
|
+
}
|
|
146
|
+
offset += e.newText.length - e.replaceRange.length;
|
|
147
|
+
}
|
|
148
|
+
while (true) {
|
|
149
|
+
const annotation = annotations[0];
|
|
150
|
+
if (!annotation) {
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
annotations.shift();
|
|
154
|
+
const newAnnotation = { annotation: annotation.annotation, range: annotation.range.delta(offset) };
|
|
155
|
+
if (!newAnnotation.range.isEmpty) {
|
|
156
|
+
finalAnnotations.push(newAnnotation);
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
deletedAnnotations.push(newAnnotation);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
this._annotations = finalAnnotations;
|
|
163
|
+
return deletedAnnotations;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
export class AnnotationsUpdate {
|
|
167
|
+
static create(annotations) {
|
|
168
|
+
return new AnnotationsUpdate(annotations);
|
|
169
|
+
}
|
|
170
|
+
constructor(annotations) {
|
|
171
|
+
this._annotations = annotations;
|
|
172
|
+
}
|
|
173
|
+
get annotations() {
|
|
174
|
+
return this._annotations;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
//# sourceMappingURL=annotations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/model/tokens/annotations.ts","vs/editor/common/model/tokens/annotations.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AA0BlE,MAAM,OAAO,eAAe;IAO3B,YAAY,cAAgC,EAAE;QAL9C;;WAEG;QACK,iBAAY,GAAqB,EAAE,CAAC;QAG3C,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACI,cAAc,CAAC,WAAiC;QACtD,KAAK,MAAM,UAAU,IAAI,WAAW,CAAC,WAAW,EAAE,CAAC;YAClD,MAAM,UAAU,GAAG,IAAI,CAAC,sCAAsC,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACvF,MAAM,i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AO,IAAI,CAAC,YAAY,CAAC;IAC1B,CAAC;CACD","file":"annotations.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 { binarySearch2 } from '../../../../base/common/arrays.js';\nimport { StringEdit } from '../../core/edits/stringEdit.js';\nimport { OffsetRange } from '../../core/ranges/offsetRange.js';\n\nexport interface IAnnotation<T> {\n\trange: OffsetRange;\n\tannotation: T;\n}\n\nexport interface IAnnotatedString<T> {\n\t/**\n\t * Set annotations for a specific line.\n\t * Annotations should be sorted and non-overlapping.\n\t */\n\tsetAnnotations(annotations: AnnotationsUpdate<T>): void;\n\t/**\n\t * Return annotations intersecting with the given offset range.\n\t */\n\tgetAnnotationsIntersecting(range: OffsetRange): IAnnotation<T>[];\n\t/**\n\t * Apply a string edit to the annotated string.\n\t * @returns The annotations that were deleted (became empty) as a result of the edit.\n\t */\n\tapplyEdit(edit: StringEdit): IAnnotation<T>[];\n}\n\nexport class AnnotatedString<T> implements IAnnotatedString<T> {\n\n\t/**\n\t * Annotations are non intersecting and contiguous in the array.\n\t */\n\tprivate _annotations: IAnnotation<T>[] = [];\n\n\tconstructor(annotations: IAnnotation<T>[] = []) {\n\t\tthis._annotations = annotations;\n\t}\n\n\t/**\n\t * Set annotations for a specific range.\n\t * Annotations should be sorted and non-overlapping.\n\t * If the annotation value is undefined, the annotation is removed.\n\t */\n\tpublic setAnnotations(annotations: AnnotationsUpdate<T>): void {\n\t\tfor (const annotation of annotations.annotations) {\n\t\t\tconst startIndex = this._getStartIndexOfIntersectingAnnotation(annotation.range.start);\n\t\t\tconst endIndexExclusive = this._getEndIndexOfIntersectingAnnotation(annotation.range.endExclusive);\n\t\t\tif (annotation.annotation !== undefined) {\n\t\t\t\tthis._annotations.splice(startIndex, endIndexExclusive - startIndex, { range: annotation.range, annotation: annotation.annotation });\n\t\t\t} else {\n\t\t\t\tthis._annotations.splice(startIndex, endIndexExclusive - startIndex);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns all annotations that intersect with the given offset range.\n\t */\n\tpublic getAnnotationsIntersecting(range: OffsetRange): IAnnotation<T>[] {\n\t\tconst startIndex = this._getStartIndexOfIntersectingAnnotation(range.start);\n\t\tconst endIndexExclusive = this._getEndIndexOfIntersectingAnnotation(range.endExclusive);\n\t\treturn this._annotations.slice(startIndex, endIndexExclusive);\n\t}\n\n\tprivate _getStartIndexOfIntersectingAnnotation(offset: number): number {\n\t\t// Find index to the left of the offset\n\t\tconst startIndexWhereToReplace = binarySearch2(this._annotations.length, (index) => {\n\t\t\treturn this._annotations[index].range.start - offset;\n\t\t});\n\t\tlet startIndex: number;\n\t\tif (startIndexWhereToReplace >= 0) {\n\t\t\tstartIndex = startIndexWhereToReplace;\n\t\t} else {\n\t\t\tconst candidate = this._annotations[- (startIndexWhereToReplace + 2)]?.range;\n\t\t\tif (candidate && offset >= candidate.start && offset <= candidate.endExclusive) {\n\t\t\t\tstartIndex = - (startIndexWhereToReplace + 2);\n\t\t\t} else {\n\t\t\t\tstartIndex = - (startIndexWhereToReplace + 1);\n\t\t\t}\n\t\t}\n\t\treturn startIndex;\n\t}\n\n\tprivate _getEndIndexOfIntersectingAnnotation(offset: number): number {\n\t\t// Find index to the right of the offset\n\t\tconst endIndexWhereToReplace = binarySearch2(this._annotations.length, (index) => {\n\t\t\treturn this._annotations[index].range.endExclusive - offset;\n\t\t});\n\t\tlet endIndexExclusive: number;\n\t\tif (endIndexWhereToReplace >= 0) {\n\t\t\tendIndexExclusive = endIndexWhereToReplace + 1;\n\t\t} else {\n\t\t\tconst candidate = this._annotations[-(endIndexWhereToReplace + 1)]?.range;\n\t\t\tif (candidate && offset >= candidate.start && offset <= candidate.endExclusive) {\n\t\t\t\tendIndexExclusive = - endIndexWhereToReplace;\n\t\t\t} else {\n\t\t\t\tendIndexExclusive = - (endIndexWhereToReplace + 1);\n\t\t\t}\n\t\t}\n\t\treturn endIndexExclusive;\n\t}\n\n\t/**\n\t * Applies a string edit to the annotated string, updating annotation ranges accordingly.\n\t * @param edit The string edit to apply.\n\t * @returns The annotations that were deleted (became empty) as a result of the edit.\n\t */\n\tpublic applyEdit(edit: StringEdit): IAnnotation<T>[] {\n\t\tconst annotations = this._annotations.slice();\n\n\t\t// treat edits as deletion of the replace range and then as insertion that extends the first range\n\t\tconst finalAnnotations: IAnnotation<T>[] = [];\n\t\tconst deletedAnnotations: IAnnotation<T>[] = [];\n\n\t\tlet offset = 0;\n\n\t\tfor (const e of edit.replacements) {\n\t\t\twhile (true) {\n\t\t\t\t// ranges before the current edit\n\t\t\t\tconst annotation = annotations[0];\n\t\t\t\tif (!annotation) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst range = annotation.range;\n\t\t\t\tif (range.endExclusive >= e.replaceRange.start) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tannotations.shift();\n\t\t\t\tconst newAnnotation = { range: range.delta(offset), annotation: annotation.annotation };\n\t\t\t\tif (!newAnnotation.range.isEmpty) {\n\t\t\t\t\tfinalAnnotations.push(newAnnotation);\n\t\t\t\t} else {\n\t\t\t\t\tdeletedAnnotations.push(newAnnotation);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst intersecting: IAnnotation<T>[] = [];\n\t\t\twhile (true) {\n\t\t\t\tconst annotation = annotations[0];\n\t\t\t\tif (!annotation) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst range = annotation.range;\n\t\t\t\tif (!range.intersectsOrTouches(e.replaceRange)) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tannotations.shift();\n\t\t\t\tintersecting.push(annotation);\n\t\t\t}\n\n\t\t\tfor (let i = intersecting.length - 1; i >= 0; i--) {\n\t\t\t\tconst annotation = intersecting[i];\n\t\t\t\tlet r = annotation.range;\n\n\t\t\t\t// Inserted text will extend the first intersecting annotation, if the edit truly overlaps it\n\t\t\t\tconst shouldExtend = i === 0 && (e.replaceRange.endExclusive > r.start) && (e.replaceRange.start < r.endExclusive);\n\t\t\t\t// Annotation shrinks by the overlap then grows with the new text length\n\t\t\t\tconst overlap = r.intersect(e.replaceRange)!.length;\n\t\t\t\tr = r.deltaEnd(-overlap + (shouldExtend ? e.newText.length : 0));\n\n\t\t\t\t// If the annotation starts after the edit start, shift left to the edit start position\n\t\t\t\tconst rangeAheadOfReplaceRange = r.start - e.replaceRange.start;\n\t\t\t\tif (rangeAheadOfReplaceRange > 0) {\n\t\t\t\t\tr = r.delta(-rangeAheadOfReplaceRange);\n\t\t\t\t}\n\n\t\t\t\t// If annotation shouldn't be extended AND it is after or on edit start, move it after the newly inserted text\n\t\t\t\tif (!shouldExtend && rangeAheadOfReplaceRange >= 0) {\n\t\t\t\t\tr = r.delta(e.newText.length);\n\t\t\t\t}\n\n\t\t\t\t// We already took our offset into account.\n\t\t\t\t// Because we add r back to the queue (which then adds offset again),\n\t\t\t\t// we have to remove it here so as to not double count it.\n\t\t\t\tr = r.delta(-(e.newText.length - e.replaceRange.length));\n\n\t\t\t\tannotations.unshift({ annotation: annotation.annotation, range: r });\n\t\t\t}\n\n\t\t\toffset += e.newText.length - e.replaceRange.length;\n\t\t}\n\n\t\twhile (true) {\n\t\t\tconst annotation = annotations[0];\n\t\t\tif (!annotation) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tannotations.shift();\n\t\t\tconst newAnnotation = { annotation: annotation.annotation, range: annotation.range.delta(offset) };\n\t\t\tif (!newAnnotation.range.isEmpty) {\n\t\t\t\tfinalAnnotations.push(newAnnotation);\n\t\t\t} else {\n\t\t\t\tdeletedAnnotations.push(newAnnotation);\n\t\t\t}\n\t\t}\n\t\tthis._annotations = finalAnnotations;\n\t\treturn deletedAnnotations;\n\t}\n}\n\nexport interface IAnnotationUpdate<T> {\n\trange: OffsetRange;\n\tannotation: T | undefined;\n}\n\nexport class AnnotationsUpdate<T> {\n\n\tpublic static create<T>(annotations: IAnnotationUpdate<T>[]): AnnotationsUpdate<T> {\n\t\treturn new AnnotationsUpdate(annotations);\n\t}\n\n\tprivate _annotations: IAnnotationUpdate<T>[];\n\n\tprivate constructor(annotations: IAnnotationUpdate<T>[]) {\n\t\tthis._annotations = annotations;\n\t}\n\n\tget annotations(): IAnnotationUpdate<T>[] {\n\t\treturn this._annotations;\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 { binarySearch2 } from '../../../../base/common/arrays.js';\nimport { StringEdit } from '../../core/edits/stringEdit.js';\nimport { OffsetRange } from '../../core/ranges/offsetRange.js';\n\nexport interface IAnnotation<T> {\n\trange: OffsetRange;\n\tannotation: T;\n}\n\nexport interface IAnnotatedString<T> {\n\t/**\n\t * Set annotations for a specific line.\n\t * Annotations should be sorted and non-overlapping.\n\t */\n\tsetAnnotations(annotations: AnnotationsUpdate<T>): void;\n\t/**\n\t * Return annotations intersecting with the given offset range.\n\t */\n\tgetAnnotationsIntersecting(range: OffsetRange): IAnnotation<T>[];\n\t/**\n\t * Apply a string edit to the annotated string.\n\t * @returns The annotations that were deleted (became empty) as a result of the edit.\n\t */\n\tapplyEdit(edit: StringEdit): IAnnotation<T>[];\n}\n\nexport class AnnotatedString<T> implements IAnnotatedString<T> {\n\n\t/**\n\t * Annotations are non intersecting and contiguous in the array.\n\t */\n\tprivate _annotations: IAnnotation<T>[] = [];\n\n\tconstructor(annotations: IAnnotation<T>[] = []) {\n\t\tthis._annotations = annotations;\n\t}\n\n\t/**\n\t * Set annotations for a specific range.\n\t * Annotations should be sorted and non-overlapping.\n\t * If the annotation value is undefined, the annotation is removed.\n\t */\n\tpublic setAnnotations(annotations: AnnotationsUpdate<T>): void {\n\t\tfor (const annotation of annotations.annotations) {\n\t\t\tconst startIndex = this._getStartIndexOfIntersectingAnnotation(annotation.range.start);\n\t\t\tconst endIndexExclusive = this._getEndIndexOfIntersectingAnnotation(annotation.range.endExclusive);\n\t\t\tif (annotation.annotation !== undefined) {\n\t\t\t\tthis._annotations.splice(startIndex, endIndexExclusive - startIndex, { range: annotation.range, annotation: annotation.annotation });\n\t\t\t} else {\n\t\t\t\tthis._annotations.splice(startIndex, endIndexExclusive - startIndex);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns all annotations that intersect with the given offset range.\n\t */\n\tpublic getAnnotationsIntersecting(range: OffsetRange): IAnnotation<T>[] {\n\t\tconst startIndex = this._getStartIndexOfIntersectingAnnotation(range.start);\n\t\tconst endIndexExclusive = this._getEndIndexOfIntersectingAnnotation(range.endExclusive);\n\t\treturn this._annotations.slice(startIndex, endIndexExclusive);\n\t}\n\n\tprivate _getStartIndexOfIntersectingAnnotation(offset: number): number {\n\t\t// Find index to the left of the offset\n\t\tconst startIndexWhereToReplace = binarySearch2(this._annotations.length, (index) => {\n\t\t\treturn this._annotations[index].range.start - offset;\n\t\t});\n\t\tlet startIndex: number;\n\t\tif (startIndexWhereToReplace >= 0) {\n\t\t\tstartIndex = startIndexWhereToReplace;\n\t\t} else {\n\t\t\tconst candidate = this._annotations[- (startIndexWhereToReplace + 2)]?.range;\n\t\t\tif (candidate && offset >= candidate.start && offset <= candidate.endExclusive) {\n\t\t\t\tstartIndex = - (startIndexWhereToReplace + 2);\n\t\t\t} else {\n\t\t\t\tstartIndex = - (startIndexWhereToReplace + 1);\n\t\t\t}\n\t\t}\n\t\treturn startIndex;\n\t}\n\n\tprivate _getEndIndexOfIntersectingAnnotation(offset: number): number {\n\t\t// Find index to the right of the offset\n\t\tconst endIndexWhereToReplace = binarySearch2(this._annotations.length, (index) => {\n\t\t\treturn this._annotations[index].range.endExclusive - offset;\n\t\t});\n\t\tlet endIndexExclusive: number;\n\t\tif (endIndexWhereToReplace >= 0) {\n\t\t\tendIndexExclusive = endIndexWhereToReplace + 1;\n\t\t} else {\n\t\t\tconst candidate = this._annotations[-(endIndexWhereToReplace + 1)]?.range;\n\t\t\tif (candidate && offset >= candidate.start && offset <= candidate.endExclusive) {\n\t\t\t\tendIndexExclusive = - endIndexWhereToReplace;\n\t\t\t} else {\n\t\t\t\tendIndexExclusive = - (endIndexWhereToReplace + 1);\n\t\t\t}\n\t\t}\n\t\treturn endIndexExclusive;\n\t}\n\n\t/**\n\t * Applies a string edit to the annotated string, updating annotation ranges accordingly.\n\t * @param edit The string edit to apply.\n\t * @returns The annotations that were deleted (became empty) as a result of the edit.\n\t */\n\tpublic applyEdit(edit: StringEdit): IAnnotation<T>[] {\n\t\tconst annotations = this._annotations.slice();\n\n\t\t// treat edits as deletion of the replace range and then as insertion that extends the first range\n\t\tconst finalAnnotations: IAnnotation<T>[] = [];\n\t\tconst deletedAnnotations: IAnnotation<T>[] = [];\n\n\t\tlet offset = 0;\n\n\t\tfor (const e of edit.replacements) {\n\t\t\twhile (true) {\n\t\t\t\t// ranges before the current edit\n\t\t\t\tconst annotation = annotations[0];\n\t\t\t\tif (!annotation) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst range = annotation.range;\n\t\t\t\tif (range.endExclusive >= e.replaceRange.start) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tannotations.shift();\n\t\t\t\tconst newAnnotation = { range: range.delta(offset), annotation: annotation.annotation };\n\t\t\t\tif (!newAnnotation.range.isEmpty) {\n\t\t\t\t\tfinalAnnotations.push(newAnnotation);\n\t\t\t\t} else {\n\t\t\t\t\tdeletedAnnotations.push(newAnnotation);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst intersecting: IAnnotation<T>[] = [];\n\t\t\twhile (true) {\n\t\t\t\tconst annotation = annotations[0];\n\t\t\t\tif (!annotation) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tconst range = annotation.range;\n\t\t\t\tif (!range.intersectsOrTouches(e.replaceRange)) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tannotations.shift();\n\t\t\t\tintersecting.push(annotation);\n\t\t\t}\n\n\t\t\tfor (let i = intersecting.length - 1; i >= 0; i--) {\n\t\t\t\tconst annotation = intersecting[i];\n\t\t\t\tlet r = annotation.range;\n\n\t\t\t\t// Inserted text will extend the first intersecting annotation, if the edit truly overlaps it\n\t\t\t\tconst shouldExtend = i === 0 && (e.replaceRange.endExclusive > r.start) && (e.replaceRange.start < r.endExclusive);\n\t\t\t\t// Annotation shrinks by the overlap then grows with the new text length\n\t\t\t\tconst overlap = r.intersect(e.replaceRange)!.length;\n\t\t\t\tr = r.deltaEnd(-overlap + (shouldExtend ? e.newText.length : 0));\n\n\t\t\t\t// If the annotation starts after the edit start, shift left to the edit start position\n\t\t\t\tconst rangeAheadOfReplaceRange = r.start - e.replaceRange.start;\n\t\t\t\tif (rangeAheadOfReplaceRange > 0) {\n\t\t\t\t\tr = r.delta(-rangeAheadOfReplaceRange);\n\t\t\t\t}\n\n\t\t\t\t// If annotation shouldn't be extended AND it is after or on edit start, move it after the newly inserted text\n\t\t\t\tif (!shouldExtend && rangeAheadOfReplaceRange >= 0) {\n\t\t\t\t\tr = r.delta(e.newText.length);\n\t\t\t\t}\n\n\t\t\t\t// We already took our offset into account.\n\t\t\t\t// Because we add r back to the queue (which then adds offset again),\n\t\t\t\t// we have to remove it here so as to not double count it.\n\t\t\t\tr = r.delta(-(e.newText.length - e.replaceRange.length));\n\n\t\t\t\tannotations.unshift({ annotation: annotation.annotation, range: r });\n\t\t\t}\n\n\t\t\toffset += e.newText.length - e.replaceRange.length;\n\t\t}\n\n\t\twhile (true) {\n\t\t\tconst annotation = annotations[0];\n\t\t\tif (!annotation) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tannotations.shift();\n\t\t\tconst newAnnotation = { annotation: annotation.annotation, range: annotation.range.delta(offset) };\n\t\t\tif (!newAnnotation.range.isEmpty) {\n\t\t\t\tfinalAnnotations.push(newAnnotation);\n\t\t\t} else {\n\t\t\t\tdeletedAnnotations.push(newAnnotation);\n\t\t\t}\n\t\t}\n\t\tthis._annotations = finalAnnotations;\n\t\treturn deletedAnnotations;\n\t}\n}\n\nexport interface IAnnotationUpdate<T> {\n\trange: OffsetRange;\n\tannotation: T | undefined;\n}\n\nexport class AnnotationsUpdate<T> {\n\n\tpublic static create<T>(annotations: IAnnotationUpdate<T>[]): AnnotationsUpdate<T> {\n\t\treturn new AnnotationsUpdate(annotations);\n\t}\n\n\tprivate _annotations: IAnnotationUpdate<T>[];\n\n\tprivate constructor(annotations: IAnnotationUpdate<T>[]) {\n\t\tthis._annotations = annotations;\n\t}\n\n\tget annotations(): IAnnotationUpdate<T>[] {\n\t\treturn this._annotations;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { Disposable } from '../../../../base/common/lifecycle.js';
|
|
6
|
+
import { Range } from '../../core/range.js';
|
|
7
|
+
import { LineFontChangingDecoration, LineHeightChangingDecoration } from '../decorationProvider.js';
|
|
8
|
+
import { Emitter } from '../../../../base/common/event.js';
|
|
9
|
+
import { classNameForFontTokenDecorations } from '../../languages/supports/tokenization.js';
|
|
10
|
+
import { Position } from '../../core/position.js';
|
|
11
|
+
import { AnnotatedString, AnnotationsUpdate } from './annotations.js';
|
|
12
|
+
import { OffsetRange } from '../../core/ranges/offsetRange.js';
|
|
13
|
+
import { offsetEditFromContentChanges } from '../textModelStringEdit.js';
|
|
14
|
+
export class TokenizationFontDecorationProvider extends Disposable {
|
|
15
|
+
static { this.DECORATION_COUNT = 0; }
|
|
16
|
+
constructor(textModel, tokenizationTextModelPart) {
|
|
17
|
+
super();
|
|
18
|
+
this.textModel = textModel;
|
|
19
|
+
this.tokenizationTextModelPart = tokenizationTextModelPart;
|
|
20
|
+
this._onDidChangeLineHeight = new Emitter();
|
|
21
|
+
this.onDidChangeLineHeight = this._onDidChangeLineHeight.event;
|
|
22
|
+
this._onDidChangeFont = new Emitter();
|
|
23
|
+
this.onDidChangeFont = this._onDidChangeFont.event;
|
|
24
|
+
this._fontAnnotatedString = new AnnotatedString();
|
|
25
|
+
this._register(this.tokenizationTextModelPart.onDidChangeFontTokens(fontChanges => {
|
|
26
|
+
const linesChanged = new Set();
|
|
27
|
+
const fontTokenAnnotations = [];
|
|
28
|
+
const affectedLineHeights = new Set();
|
|
29
|
+
const affectedLineFonts = new Set();
|
|
30
|
+
for (const annotation of fontChanges.changes.annotations) {
|
|
31
|
+
const startPosition = this.textModel.getPositionAt(annotation.range.start);
|
|
32
|
+
const endPosition = this.textModel.getPositionAt(annotation.range.endExclusive);
|
|
33
|
+
if (startPosition.lineNumber !== endPosition.lineNumber) {
|
|
34
|
+
// The token should be always on a single line
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
const lineNumber = startPosition.lineNumber;
|
|
38
|
+
let fontTokenAnnotation;
|
|
39
|
+
if (annotation.annotation === undefined) {
|
|
40
|
+
fontTokenAnnotation = {
|
|
41
|
+
range: annotation.range,
|
|
42
|
+
annotation: undefined
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
const decorationId = `tokenization-font-decoration-${TokenizationFontDecorationProvider.DECORATION_COUNT}`;
|
|
47
|
+
const fontTokenDecoration = {
|
|
48
|
+
fontToken: annotation.annotation,
|
|
49
|
+
decorationId
|
|
50
|
+
};
|
|
51
|
+
fontTokenAnnotation = {
|
|
52
|
+
range: annotation.range,
|
|
53
|
+
annotation: fontTokenDecoration
|
|
54
|
+
};
|
|
55
|
+
TokenizationFontDecorationProvider.DECORATION_COUNT++;
|
|
56
|
+
if (annotation.annotation.lineHeight) {
|
|
57
|
+
affectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, annotation.annotation.lineHeight));
|
|
58
|
+
}
|
|
59
|
+
affectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));
|
|
60
|
+
}
|
|
61
|
+
fontTokenAnnotations.push(fontTokenAnnotation);
|
|
62
|
+
if (!linesChanged.has(lineNumber)) {
|
|
63
|
+
// Signal the removal of the font tokenization decorations on the line number
|
|
64
|
+
const lineNumberStartOffset = this.textModel.getOffsetAt(new Position(lineNumber, 1));
|
|
65
|
+
const lineNumberEndOffset = this.textModel.getOffsetAt(new Position(lineNumber, this.textModel.getLineMaxColumn(lineNumber)));
|
|
66
|
+
const lineOffsetRange = new OffsetRange(lineNumberStartOffset, lineNumberEndOffset);
|
|
67
|
+
const lineAnnotations = this._fontAnnotatedString.getAnnotationsIntersecting(lineOffsetRange);
|
|
68
|
+
for (const annotation of lineAnnotations) {
|
|
69
|
+
const decorationId = annotation.annotation.decorationId;
|
|
70
|
+
affectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, null));
|
|
71
|
+
affectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));
|
|
72
|
+
}
|
|
73
|
+
linesChanged.add(lineNumber);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
this._fontAnnotatedString.setAnnotations(AnnotationsUpdate.create(fontTokenAnnotations));
|
|
77
|
+
this._onDidChangeLineHeight.fire(affectedLineHeights);
|
|
78
|
+
this._onDidChangeFont.fire(affectedLineFonts);
|
|
79
|
+
}));
|
|
80
|
+
}
|
|
81
|
+
handleDidChangeContent(change) {
|
|
82
|
+
const edits = offsetEditFromContentChanges(change.changes);
|
|
83
|
+
const deletedAnnotations = this._fontAnnotatedString.applyEdit(edits);
|
|
84
|
+
if (deletedAnnotations.length === 0) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
/* We should fire line and font change events if decorations have been added or removed
|
|
88
|
+
* No decorations are added on edit, but they can be removed */
|
|
89
|
+
const affectedLineHeights = new Set();
|
|
90
|
+
const affectedLineFonts = new Set();
|
|
91
|
+
for (const deletedAnnotation of deletedAnnotations) {
|
|
92
|
+
const startPosition = this.textModel.getPositionAt(deletedAnnotation.range.start);
|
|
93
|
+
const lineNumber = startPosition.lineNumber;
|
|
94
|
+
const decorationId = deletedAnnotation.annotation.decorationId;
|
|
95
|
+
affectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, null));
|
|
96
|
+
affectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));
|
|
97
|
+
}
|
|
98
|
+
this._onDidChangeLineHeight.fire(affectedLineHeights);
|
|
99
|
+
this._onDidChangeFont.fire(affectedLineFonts);
|
|
100
|
+
}
|
|
101
|
+
getDecorationsInRange(range, ownerId, filterOutValidation, onlyMinimapDecorations) {
|
|
102
|
+
const startOffsetOfRange = this.textModel.getOffsetAt(range.getStartPosition());
|
|
103
|
+
const endOffsetOfRange = this.textModel.getOffsetAt(range.getEndPosition());
|
|
104
|
+
const annotations = this._fontAnnotatedString.getAnnotationsIntersecting(new OffsetRange(startOffsetOfRange, endOffsetOfRange));
|
|
105
|
+
const decorations = [];
|
|
106
|
+
for (const annotation of annotations) {
|
|
107
|
+
const annotationStartPosition = this.textModel.getPositionAt(annotation.range.start);
|
|
108
|
+
const annotationEndPosition = this.textModel.getPositionAt(annotation.range.endExclusive);
|
|
109
|
+
const range = Range.fromPositions(annotationStartPosition, annotationEndPosition);
|
|
110
|
+
const anno = annotation.annotation;
|
|
111
|
+
const className = classNameForFontTokenDecorations(anno.fontToken.fontFamily ?? '', anno.fontToken.fontSize ?? '');
|
|
112
|
+
const affectsFont = !!(anno.fontToken.fontFamily || anno.fontToken.fontSize);
|
|
113
|
+
const id = anno.decorationId;
|
|
114
|
+
decorations.push({
|
|
115
|
+
id: id,
|
|
116
|
+
options: {
|
|
117
|
+
description: 'FontOptionDecoration',
|
|
118
|
+
inlineClassName: className,
|
|
119
|
+
affectsFont
|
|
120
|
+
},
|
|
121
|
+
ownerId: 0,
|
|
122
|
+
range
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
return decorations;
|
|
126
|
+
}
|
|
127
|
+
getAllDecorations(ownerId, filterOutValidation) {
|
|
128
|
+
return this.getDecorationsInRange(new Range(1, 1, this.textModel.getLineCount(), 1), ownerId, filterOutValidation);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
//# sourceMappingURL=tokenizationFontDecorationsProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.ts","vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AAGlE,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAsB,0BAA0B,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AACxH,OAAO,EAAE,OAAO,EAAE,MAAM,kCAAkC,CAAC;AAE3D,OAAO,EAAE,gCAAgC,EAAE,MAAM,0CAA0C,CAAC;AAC5F,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAuC,MAAM,kBAAkB,CAAC;AAC3G,OAAO,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AAC/D,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAOzE,MAAM,OAAO,kCAAmC,SAAQ,UAAU;aAElD,qBAAgB,GAAG,CAAH,AAAI,CAAC;IAUpC,YACkB,SAAqB,EACrB,yBAAoD;QAErE,KAAK,EAAE,CAAC;QAHS,cAAS,GAAT,SAAS,CAAY;QACrB,8BAAyB,GAAzB,yBAAyB,CAA2B;QAVrD,2BAAsB,GAAG,IAAI,OAAO,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gC,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,IAAI,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,IAAI,EAAE,CAAC,CAAC;YACnH,MAAM,WAAW,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,IAAI,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;YAC7E,MAAM,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;YAC7B,WAAW,CAAC,IAAI,CAAC;gBAChB,EAAE,EAAE,EAAE;gBACN,OAAO,EAAE;oBACR,WAAW,EAAE,sBAAsB;oBACnC,eAAe,EAAE,SAAS;oBAC1B,WAAW;iBACX;gBACD,OAAO,EAAE,CAAC;gBACV,KAAK;aACL,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,WAAW,CAAC;IACpB,CAAC;IAEM,iBAAiB,CAAC,OAAgB,EAAE,mBAA6B;QACvE,OAAO,IAAI,CAAC,qBAAqB,CAChC,IAAI,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,EACjD,OAAO,EACP,mBAAmB,CACnB,CAAC;IACH,CAAC","file":"tokenizationFontDecorationsProvider.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 { Disposable } from '../../../../base/common/lifecycle.js';\nimport { IModelDecoration, ITextModel } from '../../model.js';\nimport { TokenizationTextModelPart } from './tokenizationTextModelPart.js';\nimport { Range } from '../../core/range.js';\nimport { DecorationProvider, LineFontChangingDecoration, LineHeightChangingDecoration } from '../decorationProvider.js';\nimport { Emitter } from '../../../../base/common/event.js';\nimport { IFontTokenOption, IModelContentChangedEvent } from '../../textModelEvents.js';\nimport { classNameForFontTokenDecorations } from '../../languages/supports/tokenization.js';\nimport { Position } from '../../core/position.js';\nimport { AnnotatedString, AnnotationsUpdate, IAnnotatedString, IAnnotationUpdate } from './annotations.js';\nimport { OffsetRange } from '../../core/ranges/offsetRange.js';\nimport { offsetEditFromContentChanges } from '../textModelStringEdit.js';\n\nexport interface IFontTokenAnnotation {\n\tdecorationId: string;\n\tfontToken: IFontTokenOption;\n}\n\nexport class TokenizationFontDecorationProvider extends Disposable implements DecorationProvider {\n\n\tprivate static DECORATION_COUNT = 0;\n\n\tprivate readonly _onDidChangeLineHeight = new Emitter<Set<LineHeightChangingDecoration>>();\n\tpublic readonly onDidChangeLineHeight = this._onDidChangeLineHeight.event;\n\n\tprivate readonly _onDidChangeFont = new Emitter<Set<LineFontChangingDecoration>>();\n\tpublic readonly onDidChangeFont = this._onDidChangeFont.event;\n\n\tprivate _fontAnnotatedString: IAnnotatedString<IFontTokenAnnotation> = new AnnotatedString<IFontTokenAnnotation>();\n\n\tconstructor(\n\t\tprivate readonly textModel: ITextModel,\n\t\tprivate readonly tokenizationTextModelPart: TokenizationTextModelPart\n\t) {\n\t\tsuper();\n\t\tthis._register(this.tokenizationTextModelPart.onDidChangeFontTokens(fontChanges => {\n\n\t\t\tconst linesChanged = new Set<number>();\n\t\t\tconst fontTokenAnnotations: IAnnotationUpdate<IFontTokenAnnotation>[] = [];\n\n\t\t\tconst affectedLineHeights = new Set<LineHeightChangingDecoration>();\n\t\t\tconst affectedLineFonts = new Set<LineFontChangingDecoration>();\n\n\t\t\tfor (const annotation of fontChanges.changes.annotations) {\n\n\t\t\t\tconst startPosition = this.textModel.getPositionAt(annotation.range.start);\n\t\t\t\tconst endPosition = this.textModel.getPositionAt(annotation.range.endExclusive);\n\n\t\t\t\tif (startPosition.lineNumber !== endPosition.lineNumber) {\n\t\t\t\t\t// The token should be always on a single line\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst lineNumber = startPosition.lineNumber;\n\n\t\t\t\tlet fontTokenAnnotation: IAnnotationUpdate<IFontTokenAnnotation>;\n\t\t\t\tif (annotation.annotation === undefined) {\n\t\t\t\t\tfontTokenAnnotation = {\n\t\t\t\t\t\trange: annotation.range,\n\t\t\t\t\t\tannotation: undefined\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tconst decorationId = `tokenization-font-decoration-${TokenizationFontDecorationProvider.DECORATION_COUNT}`;\n\t\t\t\t\tconst fontTokenDecoration: IFontTokenAnnotation = {\n\t\t\t\t\t\tfontToken: annotation.annotation,\n\t\t\t\t\t\tdecorationId\n\t\t\t\t\t};\n\t\t\t\t\tfontTokenAnnotation = {\n\t\t\t\t\t\trange: annotation.range,\n\t\t\t\t\t\tannotation: fontTokenDecoration\n\t\t\t\t\t};\n\t\t\t\t\tTokenizationFontDecorationProvider.DECORATION_COUNT++;\n\n\t\t\t\t\tif (annotation.annotation.lineHeight) {\n\t\t\t\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, annotation.annotation.lineHeight));\n\t\t\t\t\t}\n\t\t\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\n\t\t\t\t}\n\t\t\t\tfontTokenAnnotations.push(fontTokenAnnotation);\n\n\t\t\t\tif (!linesChanged.has(lineNumber)) {\n\t\t\t\t\t// Signal the removal of the font tokenization decorations on the line number\n\t\t\t\t\tconst lineNumberStartOffset = this.textModel.getOffsetAt(new Position(lineNumber, 1));\n\t\t\t\t\tconst lineNumberEndOffset = this.textModel.getOffsetAt(new Position(lineNumber, this.textModel.getLineMaxColumn(lineNumber)));\n\t\t\t\t\tconst lineOffsetRange = new OffsetRange(lineNumberStartOffset, lineNumberEndOffset);\n\t\t\t\t\tconst lineAnnotations = this._fontAnnotatedString.getAnnotationsIntersecting(lineOffsetRange);\n\t\t\t\t\tfor (const annotation of lineAnnotations) {\n\t\t\t\t\t\tconst decorationId = annotation.annotation.decorationId;\n\t\t\t\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, null));\n\t\t\t\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\t\t\t\t\t}\n\t\t\t\t\tlinesChanged.add(lineNumber);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._fontAnnotatedString.setAnnotations(AnnotationsUpdate.create(fontTokenAnnotations));\n\t\t\tthis._onDidChangeLineHeight.fire(affectedLineHeights);\n\t\t\tthis._onDidChangeFont.fire(affectedLineFonts);\n\t\t}));\n\t}\n\n\tpublic handleDidChangeContent(change: IModelContentChangedEvent) {\n\t\tconst edits = offsetEditFromContentChanges(change.changes);\n\t\tconst deletedAnnotations = this._fontAnnotatedString.applyEdit(edits);\n\t\tif (deletedAnnotations.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\t/* We should fire line and font change events if decorations have been added or removed\n\t\t * No decorations are added on edit, but they can be removed */\n\t\tconst affectedLineHeights = new Set<LineHeightChangingDecoration>();\n\t\tconst affectedLineFonts = new Set<LineFontChangingDecoration>();\n\t\tfor (const deletedAnnotation of deletedAnnotations) {\n\t\t\tconst startPosition = this.textModel.getPositionAt(deletedAnnotation.range.start);\n\t\t\tconst lineNumber = startPosition.lineNumber;\n\t\t\tconst decorationId = deletedAnnotation.annotation.decorationId;\n\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, null));\n\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\t\t}\n\t\tthis._onDidChangeLineHeight.fire(affectedLineHeights);\n\t\tthis._onDidChangeFont.fire(affectedLineFonts);\n\t}\n\n\tpublic getDecorationsInRange(range: Range, ownerId?: number, filterOutValidation?: boolean, onlyMinimapDecorations?: boolean): IModelDecoration[] {\n\t\tconst startOffsetOfRange = this.textModel.getOffsetAt(range.getStartPosition());\n\t\tconst endOffsetOfRange = this.textModel.getOffsetAt(range.getEndPosition());\n\t\tconst annotations = this._fontAnnotatedString.getAnnotationsIntersecting(new OffsetRange(startOffsetOfRange, endOffsetOfRange));\n\n\t\tconst decorations: IModelDecoration[] = [];\n\t\tfor (const annotation of annotations) {\n\t\t\tconst annotationStartPosition = this.textModel.getPositionAt(annotation.range.start);\n\t\t\tconst annotationEndPosition = this.textModel.getPositionAt(annotation.range.endExclusive);\n\t\t\tconst range = Range.fromPositions(annotationStartPosition, annotationEndPosition);\n\t\t\tconst anno = annotation.annotation;\n\t\t\tconst className = classNameForFontTokenDecorations(anno.fontToken.fontFamily ?? '', anno.fontToken.fontSize ?? '');\n\t\t\tconst affectsFont = !!(anno.fontToken.fontFamily || anno.fontToken.fontSize);\n\t\t\tconst id = anno.decorationId;\n\t\t\tdecorations.push({\n\t\t\t\tid: id,\n\t\t\t\toptions: {\n\t\t\t\t\tdescription: 'FontOptionDecoration',\n\t\t\t\t\tinlineClassName: className,\n\t\t\t\t\taffectsFont\n\t\t\t\t},\n\t\t\t\townerId: 0,\n\t\t\t\trange\n\t\t\t});\n\t\t}\n\t\treturn decorations;\n\t}\n\n\tpublic getAllDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[] {\n\t\treturn this.getDecorationsInRange(\n\t\t\tnew Range(1, 1, this.textModel.getLineCount(), 1),\n\t\t\townerId,\n\t\t\tfilterOutValidation\n\t\t);\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { Disposable } from '../../../../base/common/lifecycle.js';\nimport { IModelDecoration, ITextModel } from '../../model.js';\nimport { TokenizationTextModelPart } from './tokenizationTextModelPart.js';\nimport { Range } from '../../core/range.js';\nimport { DecorationProvider, LineFontChangingDecoration, LineHeightChangingDecoration } from '../decorationProvider.js';\nimport { Emitter } from '../../../../base/common/event.js';\nimport { IFontTokenOption, IModelContentChangedEvent } from '../../textModelEvents.js';\nimport { classNameForFontTokenDecorations } from '../../languages/supports/tokenization.js';\nimport { Position } from '../../core/position.js';\nimport { AnnotatedString, AnnotationsUpdate, IAnnotatedString, IAnnotationUpdate } from './annotations.js';\nimport { OffsetRange } from '../../core/ranges/offsetRange.js';\nimport { offsetEditFromContentChanges } from '../textModelStringEdit.js';\n\nexport interface IFontTokenAnnotation {\n\tdecorationId: string;\n\tfontToken: IFontTokenOption;\n}\n\nexport class TokenizationFontDecorationProvider extends Disposable implements DecorationProvider {\n\n\tprivate static DECORATION_COUNT = 0;\n\n\tprivate readonly _onDidChangeLineHeight = new Emitter<Set<LineHeightChangingDecoration>>();\n\tpublic readonly onDidChangeLineHeight = this._onDidChangeLineHeight.event;\n\n\tprivate readonly _onDidChangeFont = new Emitter<Set<LineFontChangingDecoration>>();\n\tpublic readonly onDidChangeFont = this._onDidChangeFont.event;\n\n\tprivate _fontAnnotatedString: IAnnotatedString<IFontTokenAnnotation> = new AnnotatedString<IFontTokenAnnotation>();\n\n\tconstructor(\n\t\tprivate readonly textModel: ITextModel,\n\t\tprivate readonly tokenizationTextModelPart: TokenizationTextModelPart\n\t) {\n\t\tsuper();\n\t\tthis._register(this.tokenizationTextModelPart.onDidChangeFontTokens(fontChanges => {\n\n\t\t\tconst linesChanged = new Set<number>();\n\t\t\tconst fontTokenAnnotations: IAnnotationUpdate<IFontTokenAnnotation>[] = [];\n\n\t\t\tconst affectedLineHeights = new Set<LineHeightChangingDecoration>();\n\t\t\tconst affectedLineFonts = new Set<LineFontChangingDecoration>();\n\n\t\t\tfor (const annotation of fontChanges.changes.annotations) {\n\n\t\t\t\tconst startPosition = this.textModel.getPositionAt(annotation.range.start);\n\t\t\t\tconst endPosition = this.textModel.getPositionAt(annotation.range.endExclusive);\n\n\t\t\t\tif (startPosition.lineNumber !== endPosition.lineNumber) {\n\t\t\t\t\t// The token should be always on a single line\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst lineNumber = startPosition.lineNumber;\n\n\t\t\t\tlet fontTokenAnnotation: IAnnotationUpdate<IFontTokenAnnotation>;\n\t\t\t\tif (annotation.annotation === undefined) {\n\t\t\t\t\tfontTokenAnnotation = {\n\t\t\t\t\t\trange: annotation.range,\n\t\t\t\t\t\tannotation: undefined\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tconst decorationId = `tokenization-font-decoration-${TokenizationFontDecorationProvider.DECORATION_COUNT}`;\n\t\t\t\t\tconst fontTokenDecoration: IFontTokenAnnotation = {\n\t\t\t\t\t\tfontToken: annotation.annotation,\n\t\t\t\t\t\tdecorationId\n\t\t\t\t\t};\n\t\t\t\t\tfontTokenAnnotation = {\n\t\t\t\t\t\trange: annotation.range,\n\t\t\t\t\t\tannotation: fontTokenDecoration\n\t\t\t\t\t};\n\t\t\t\t\tTokenizationFontDecorationProvider.DECORATION_COUNT++;\n\n\t\t\t\t\tif (annotation.annotation.lineHeight) {\n\t\t\t\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, annotation.annotation.lineHeight));\n\t\t\t\t\t}\n\t\t\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\n\t\t\t\t}\n\t\t\t\tfontTokenAnnotations.push(fontTokenAnnotation);\n\n\t\t\t\tif (!linesChanged.has(lineNumber)) {\n\t\t\t\t\t// Signal the removal of the font tokenization decorations on the line number\n\t\t\t\t\tconst lineNumberStartOffset = this.textModel.getOffsetAt(new Position(lineNumber, 1));\n\t\t\t\t\tconst lineNumberEndOffset = this.textModel.getOffsetAt(new Position(lineNumber, this.textModel.getLineMaxColumn(lineNumber)));\n\t\t\t\t\tconst lineOffsetRange = new OffsetRange(lineNumberStartOffset, lineNumberEndOffset);\n\t\t\t\t\tconst lineAnnotations = this._fontAnnotatedString.getAnnotationsIntersecting(lineOffsetRange);\n\t\t\t\t\tfor (const annotation of lineAnnotations) {\n\t\t\t\t\t\tconst decorationId = annotation.annotation.decorationId;\n\t\t\t\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, null));\n\t\t\t\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\t\t\t\t\t}\n\t\t\t\t\tlinesChanged.add(lineNumber);\n\t\t\t\t}\n\t\t\t}\n\t\t\tthis._fontAnnotatedString.setAnnotations(AnnotationsUpdate.create(fontTokenAnnotations));\n\t\t\tthis._onDidChangeLineHeight.fire(affectedLineHeights);\n\t\t\tthis._onDidChangeFont.fire(affectedLineFonts);\n\t\t}));\n\t}\n\n\tpublic handleDidChangeContent(change: IModelContentChangedEvent) {\n\t\tconst edits = offsetEditFromContentChanges(change.changes);\n\t\tconst deletedAnnotations = this._fontAnnotatedString.applyEdit(edits);\n\t\tif (deletedAnnotations.length === 0) {\n\t\t\treturn;\n\t\t}\n\t\t/* We should fire line and font change events if decorations have been added or removed\n\t\t * No decorations are added on edit, but they can be removed */\n\t\tconst affectedLineHeights = new Set<LineHeightChangingDecoration>();\n\t\tconst affectedLineFonts = new Set<LineFontChangingDecoration>();\n\t\tfor (const deletedAnnotation of deletedAnnotations) {\n\t\t\tconst startPosition = this.textModel.getPositionAt(deletedAnnotation.range.start);\n\t\t\tconst lineNumber = startPosition.lineNumber;\n\t\t\tconst decorationId = deletedAnnotation.annotation.decorationId;\n\t\t\taffectedLineHeights.add(new LineHeightChangingDecoration(0, decorationId, lineNumber, null));\n\t\t\taffectedLineFonts.add(new LineFontChangingDecoration(0, decorationId, lineNumber));\n\t\t}\n\t\tthis._onDidChangeLineHeight.fire(affectedLineHeights);\n\t\tthis._onDidChangeFont.fire(affectedLineFonts);\n\t}\n\n\tpublic getDecorationsInRange(range: Range, ownerId?: number, filterOutValidation?: boolean, onlyMinimapDecorations?: boolean): IModelDecoration[] {\n\t\tconst startOffsetOfRange = this.textModel.getOffsetAt(range.getStartPosition());\n\t\tconst endOffsetOfRange = this.textModel.getOffsetAt(range.getEndPosition());\n\t\tconst annotations = this._fontAnnotatedString.getAnnotationsIntersecting(new OffsetRange(startOffsetOfRange, endOffsetOfRange));\n\n\t\tconst decorations: IModelDecoration[] = [];\n\t\tfor (const annotation of annotations) {\n\t\t\tconst annotationStartPosition = this.textModel.getPositionAt(annotation.range.start);\n\t\t\tconst annotationEndPosition = this.textModel.getPositionAt(annotation.range.endExclusive);\n\t\t\tconst range = Range.fromPositions(annotationStartPosition, annotationEndPosition);\n\t\t\tconst anno = annotation.annotation;\n\t\t\tconst className = classNameForFontTokenDecorations(anno.fontToken.fontFamily ?? '', anno.fontToken.fontSize ?? '');\n\t\t\tconst affectsFont = !!(anno.fontToken.fontFamily || anno.fontToken.fontSize);\n\t\t\tconst id = anno.decorationId;\n\t\t\tdecorations.push({\n\t\t\t\tid: id,\n\t\t\t\toptions: {\n\t\t\t\t\tdescription: 'FontOptionDecoration',\n\t\t\t\t\tinlineClassName: className,\n\t\t\t\t\taffectsFont\n\t\t\t\t},\n\t\t\t\townerId: 0,\n\t\t\t\trange\n\t\t\t});\n\t\t}\n\t\treturn decorations;\n\t}\n\n\tpublic getAllDecorations(ownerId?: number, filterOutValidation?: boolean): IModelDecoration[] {\n\t\treturn this.getDecorationsInRange(\n\t\t\tnew Range(1, 1, this.textModel.getLineCount(), 1),\n\t\t\townerId,\n\t\t\tfilterOutValidation\n\t\t);\n\t}\n}\n"]}
|
|
@@ -37,6 +37,8 @@ let TokenizationTextModelPart = TokenizationTextModelPart_1 = class Tokenization
|
|
|
37
37
|
this._languageConfigurationService = _languageConfigurationService;
|
|
38
38
|
this._instantiationService = _instantiationService;
|
|
39
39
|
this._treeSitterLibraryService = _treeSitterLibraryService;
|
|
40
|
+
this._onDidChangeFontTokens = this._register(new Emitter());
|
|
41
|
+
this.onDidChangeFontTokens = this._onDidChangeFontTokens.event;
|
|
40
42
|
this._languageIdObs = observableValue(this, this._languageId);
|
|
41
43
|
this._useTreeSitter = derived(this, reader => {
|
|
42
44
|
const languageId = this._languageIdObs.read(reader);
|
|
@@ -53,6 +55,11 @@ let TokenizationTextModelPart = TokenizationTextModelPart_1 = class Tokenization
|
|
|
53
55
|
reader.store.add(tokens.onDidChangeTokens(e => {
|
|
54
56
|
this._emitModelTokensChangedEvent(e);
|
|
55
57
|
}));
|
|
58
|
+
reader.store.add(tokens.onDidChangeFontTokens(e => {
|
|
59
|
+
if (!this._textModel._isDisposing()) {
|
|
60
|
+
this._onDidChangeFontTokens.fire(e);
|
|
61
|
+
}
|
|
62
|
+
}));
|
|
56
63
|
reader.store.add(tokens.onDidChangeBackgroundTokenizationState(e => {
|
|
57
64
|
this._bracketPairsTextModelPart.handleDidChangeBackgroundTokenizationState();
|
|
58
65
|
}));
|
|
@@ -74,6 +81,8 @@ let TokenizationTextModelPart = TokenizationTextModelPart_1 = class Tokenization
|
|
|
74
81
|
this.onDidChangeLanguageConfiguration = this._onDidChangeLanguageConfiguration.event;
|
|
75
82
|
this._onDidChangeTokens = this._register(new Emitter());
|
|
76
83
|
this.onDidChangeTokens = this._onDidChangeTokens.event;
|
|
84
|
+
this._onDidChangeFontTokens = this._register(new Emitter());
|
|
85
|
+
this.onDidChangeFontTokens = this._onDidChangeFontTokens.event;
|
|
77
86
|
}
|
|
78
87
|
handleLanguageConfigurationServiceChange(e) {
|
|
79
88
|
if (e.affects(this._languageId)) {
|