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
package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js
CHANGED
|
@@ -24,10 +24,9 @@ import { InlineEditsView } from './inlineEditsView.js';
|
|
|
24
24
|
import { InlineEditTabAction } from './inlineEditsViewInterface.js';
|
|
25
25
|
import { InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from './components/gutterIndicatorView.js';
|
|
26
26
|
let InlineEditsViewAndDiffProducer = class InlineEditsViewAndDiffProducer extends Disposable {
|
|
27
|
-
constructor(_editor,
|
|
27
|
+
constructor(_editor, _model, _showCollapsed, instantiationService) {
|
|
28
28
|
super();
|
|
29
29
|
this._editor = _editor;
|
|
30
|
-
this._edit = _edit;
|
|
31
30
|
this._model = _model;
|
|
32
31
|
this._showCollapsed = _showCollapsed;
|
|
33
32
|
this._inlineEdit = derived(this, (reader) => {
|
|
@@ -35,25 +34,29 @@ let InlineEditsViewAndDiffProducer = class InlineEditsViewAndDiffProducer extend
|
|
|
35
34
|
if (!model) {
|
|
36
35
|
return undefined;
|
|
37
36
|
}
|
|
38
|
-
const inlineEdit = this._edit.read(reader);
|
|
39
|
-
if (!inlineEdit) {
|
|
40
|
-
return undefined;
|
|
41
|
-
}
|
|
42
37
|
const textModel = this._editor.getModel();
|
|
43
38
|
if (!textModel) {
|
|
44
39
|
return undefined;
|
|
45
40
|
}
|
|
46
|
-
const
|
|
47
|
-
if (!
|
|
41
|
+
const state = model.inlineEditState.read(reader);
|
|
42
|
+
if (!state) {
|
|
48
43
|
return undefined;
|
|
49
44
|
}
|
|
50
|
-
const
|
|
51
|
-
const innerEditRange = Range.fromPositions(textModel.getPositionAt(e.replaceRange.start), textModel.getPositionAt(e.replaceRange.endExclusive));
|
|
52
|
-
return new TextReplacement(innerEditRange, e.newText);
|
|
53
|
-
});
|
|
54
|
-
const diffEdits = new TextEdit(edits);
|
|
45
|
+
const action = state.inlineSuggestion.action;
|
|
55
46
|
const text = new TextModelText(textModel);
|
|
56
|
-
|
|
47
|
+
let diffEdits;
|
|
48
|
+
if (action?.kind === 'edit') {
|
|
49
|
+
const editOffset = action.stringEdit;
|
|
50
|
+
const edits = editOffset.replacements.map(e => {
|
|
51
|
+
const innerEditRange = Range.fromPositions(textModel.getPositionAt(e.replaceRange.start), textModel.getPositionAt(e.replaceRange.endExclusive));
|
|
52
|
+
return new TextReplacement(innerEditRange, e.newText);
|
|
53
|
+
});
|
|
54
|
+
diffEdits = new TextEdit(edits);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
diffEdits = undefined;
|
|
58
|
+
}
|
|
59
|
+
return new InlineEditWithChanges(text, action, diffEdits, model.primaryPosition.read(undefined), model.allPositions.read(undefined), state.inlineSuggestion.source.inlineSuggestions.commands ?? [], state.inlineSuggestion);
|
|
57
60
|
});
|
|
58
61
|
this._inlineEditModel = derived(this, reader => {
|
|
59
62
|
const model = this._model.read(reader);
|
|
@@ -83,7 +86,7 @@ let InlineEditsViewAndDiffProducer = class InlineEditsViewAndDiffProducer extend
|
|
|
83
86
|
}
|
|
84
87
|
};
|
|
85
88
|
InlineEditsViewAndDiffProducer = __decorate([
|
|
86
|
-
__param(
|
|
89
|
+
__param(3, IInstantiationService)
|
|
87
90
|
], InlineEditsViewAndDiffProducer);
|
|
88
91
|
export { InlineEditsViewAndDiffProducer };
|
|
89
92
|
//# sourceMappingURL=inlineEditsViewProducer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,OAAO,EAAe,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kEAAkE,CAAC;AAEzG,OAAO,EAAwB,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAC5G,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,QAAQ,E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AAA;GArDX,8BAA8B,CAiE1C","file":"inlineEditsViewProducer.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 { derived, IObservable } from '../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../browser/observableCodeEditor.js';\nimport { Range } from '../../../../../common/core/range.js';\nimport { TextReplacement, TextEdit } from '../../../../../common/core/edits/textEdit.js';\nimport { TextModelText } from '../../../../../common/model/textModelText.js';\nimport { InlineCompletionsModel } from '../../model/inlineCompletionsModel.js';\nimport { InlineEdit } from '../../model/inlineEdit.js';\nimport { InlineEditWithChanges } from './inlineEditWithChanges.js';\nimport { ModelPerInlineEdit } from './inlineEditsModel.js';\nimport { InlineEditsView } from './inlineEditsView.js';\nimport { InlineEditTabAction } from './inlineEditsViewInterface.js';\nimport { InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from './components/gutterIndicatorView.js';\n\nexport class InlineEditsViewAndDiffProducer extends Disposable { // TODO: This class is no longer a diff producer. Rename it or get rid of it\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\tprivate readonly _inlineEdit = derived<InlineEditWithChanges | undefined>(this, (reader) => {\n\t\tconst model = this._model.read(reader);\n\t\tif (!model) { return undefined; }\n\t\tconst inlineEdit = this._edit.read(reader);\n\t\tif (!inlineEdit) { return undefined; }\n\t\tconst textModel = this._editor.getModel();\n\t\tif (!textModel) { return undefined; }\n\n\t\tconst editOffset = model.inlineEditState.read(undefined)?.inlineSuggestion.updatedEdit;\n\t\tif (!editOffset) { return undefined; }\n\n\t\tconst edits = editOffset.replacements.map(e => {\n\t\t\tconst innerEditRange = Range.fromPositions(\n\t\t\t\ttextModel.getPositionAt(e.replaceRange.start),\n\t\t\t\ttextModel.getPositionAt(e.replaceRange.endExclusive)\n\t\t\t);\n\t\t\treturn new TextReplacement(innerEditRange, e.newText);\n\t\t});\n\n\t\tconst diffEdits = new TextEdit(edits);\n\t\tconst text = new TextModelText(textModel);\n\n\t\treturn new InlineEditWithChanges(text, diffEdits, model.primaryPosition.read(undefined), model.allPositions.read(undefined), inlineEdit.commands, inlineEdit.inlineSuggestion);\n\t});\n\n\tpublic readonly _inlineEditModel = derived<ModelPerInlineEdit | undefined>(this, reader => {\n\t\tconst model = this._model.read(reader);\n\t\tif (!model) { return undefined; }\n\t\tconst edit = this._inlineEdit.read(reader);\n\t\tif (!edit) { return undefined; }\n\n\t\tconst tabAction = derived<InlineEditTabAction>(this, reader => {\n\t\t\t/** @description tabAction */\n\t\t\tif (this._editorObs.isFocused.read(reader)) {\n\t\t\t\tif (model.tabShouldJumpToInlineEdit.read(reader)) { return InlineEditTabAction.Jump; }\n\t\t\t\tif (model.tabShouldAcceptInlineEdit.read(reader)) { return InlineEditTabAction.Accept; }\n\t\t\t}\n\t\t\treturn InlineEditTabAction.Inactive;\n\t\t});\n\n\t\treturn new ModelPerInlineEdit(model, edit, tabAction);\n\t});\n\n\tpublic readonly view: InlineEditsView;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _edit: IObservable<InlineEdit | undefined>,\n\t\tprivate readonly _model: IObservable<InlineCompletionsModel | undefined>,\n\t\tprivate readonly _showCollapsed: IObservable<boolean>,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis.view = this._register(instantiationService.createInstance(InlineEditsView, this._editor, this._inlineEditModel,\n\t\t\tthis._model.map(model => model ? SimpleInlineSuggestModel.fromInlineCompletionModel(model) : undefined),\n\t\t\tthis._inlineEdit.map(e => e ? InlineSuggestionGutterMenuData.fromInlineSuggestion(e.inlineCompletion) : undefined),\n\t\t\tthis._showCollapsed,\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 { derived, IObservable } from '../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../browser/observableCodeEditor.js';\nimport { Range } from '../../../../../common/core/range.js';\nimport { TextReplacement, TextEdit } from '../../../../../common/core/edits/textEdit.js';\nimport { TextModelText } from '../../../../../common/model/textModelText.js';\nimport { InlineCompletionsModel } from '../../model/inlineCompletionsModel.js';\nimport { InlineEdit } from '../../model/inlineEdit.js';\nimport { InlineEditWithChanges } from './inlineEditWithChanges.js';\nimport { ModelPerInlineEdit } from './inlineEditsModel.js';\nimport { InlineEditsView } from './inlineEditsView.js';\nimport { InlineEditTabAction } from './inlineEditsViewInterface.js';\nimport { InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from './components/gutterIndicatorView.js';\n\nexport class InlineEditsViewAndDiffProducer extends Disposable { // TODO: This class is no longer a diff producer. Rename it or get rid of it\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\tprivate readonly _inlineEdit = derived<InlineEditWithChanges | undefined>(this, (reader) => {\n\t\tconst model = this._model.read(reader);\n\t\tif (!model) { return undefined; }\n\t\tconst inlineEdit = this._edit.read(reader);\n\t\tif (!inlineEdit) { return undefined; }\n\t\tconst textModel = this._editor.getModel();\n\t\tif (!textModel) { return undefined; }\n\n\t\tconst editOffset = model.inlineEditState.read(undefined)?.inlineSuggestion.updatedEdit;\n\t\tif (!editOffset) { return undefined; }\n\n\t\tconst edits = editOffset.replacements.map(e => {\n\t\t\tconst innerEditRange = Range.fromPositions(\n\t\t\t\ttextModel.getPositionAt(e.replaceRange.start),\n\t\t\t\ttextModel.getPositionAt(e.replaceRange.endExclusive)\n\t\t\t);\n\t\t\treturn new TextReplacement(innerEditRange, e.newText);\n\t\t});\n\n\t\tconst diffEdits = new TextEdit(edits);\n\t\tconst text = new TextModelText(textModel);\n\n\t\treturn new InlineEditWithChanges(text, diffEdits, model.primaryPosition.read(undefined), model.allPositions.read(undefined), inlineEdit.commands, inlineEdit.inlineSuggestion);\n\t});\n\n\tpublic readonly _inlineEditModel = derived<ModelPerInlineEdit | undefined>(this, reader => {\n\t\tconst model = this._model.read(reader);\n\t\tif (!model) { return undefined; }\n\t\tconst edit = this._inlineEdit.read(reader);\n\t\tif (!edit) { return undefined; }\n\n\t\tconst tabAction = derived<InlineEditTabAction>(this, reader => {\n\t\t\t/** @description tabAction */\n\t\t\tif (this._editorObs.isFocused.read(reader)) {\n\t\t\t\tif (model.tabShouldJumpToInlineEdit.read(reader)) { return InlineEditTabAction.Jump; }\n\t\t\t\tif (model.tabShouldAcceptInlineEdit.read(reader)) { return InlineEditTabAction.Accept; }\n\t\t\t}\n\t\t\treturn InlineEditTabAction.Inactive;\n\t\t});\n\n\t\treturn new ModelPerInlineEdit(model, edit, tabAction);\n\t});\n\n\tpublic readonly view: InlineEditsView;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _edit: IObservable<InlineEdit | undefined>,\n\t\tprivate readonly _model: IObservable<InlineCompletionsModel | undefined>,\n\t\tprivate readonly _showCollapsed: IObservable<boolean>,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis.view = this._register(instantiationService.createInstance(InlineEditsView, this._editor, this._inlineEditModel,\n\t\t\tthis._model.map(model => model ? SimpleInlineSuggestModel.fromInlineCompletionModel(model) : undefined),\n\t\t\tthis._inlineEdit.map(e => e ? InlineSuggestionGutterMenuData.fromInlineSuggestion(e.inlineCompletion) : undefined),\n\t\t\tthis._showCollapsed,\n\t\t));\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;;;;;;;;;;AAEhG,OAAO,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AACxE,OAAO,EAAE,OAAO,EAAe,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,qBAAqB,EAAE,MAAM,kEAAkE,CAAC;AAEzG,OAAO,EAAwB,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAC5G,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,8CAA8C,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAE7E,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,8BAA8B,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAExG,IAAM,8BAA8B,GAApC,MAAM,8BAA+B,SAAQ,UAAU;IA+D7D,YACkB,OAAoB,EACpB,MAAuD,EACvD,cAAoC,EAC9B,oBAA2C;QAElE,KAAK,EAAE,CAAC;QALS,YAAO,GAAP,OAAO,CAAa;QACpB,WAAM,GAAN,MAAM,CAAiD;QACvD,mBAAc,GAAd,cAAc,CAAsB;QA/D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AAkB,CAAC,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;QACvD,CAAC,CAAC,CAAC;QAYF,IAAI,CAAC,UAAU,GAAG,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAErD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,oBAAoB,CAAC,cAAc,CAAC,eAAe,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAClH,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,wBAAwB,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EACvG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,8BAA8B,CAAC,oBAAoB,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAClH,IAAI,CAAC,cAAc,CACnB,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AA/EY,8BAA8B;IAmExC,WAAA,qBAAqB,CAAA;GAnEX,8BAA8B,CA+E1C","file":"inlineEditsViewProducer.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 { derived, IObservable } from '../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../browser/observableCodeEditor.js';\nimport { Range } from '../../../../../common/core/range.js';\nimport { TextReplacement, TextEdit } from '../../../../../common/core/edits/textEdit.js';\nimport { TextModelText } from '../../../../../common/model/textModelText.js';\nimport { InlineCompletionsModel } from '../../model/inlineCompletionsModel.js';\nimport { InlineEditWithChanges } from './inlineEditWithChanges.js';\nimport { ModelPerInlineEdit } from './inlineEditsModel.js';\nimport { InlineEditsView } from './inlineEditsView.js';\nimport { InlineEditTabAction } from './inlineEditsViewInterface.js';\nimport { InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from './components/gutterIndicatorView.js';\n\nexport class InlineEditsViewAndDiffProducer extends Disposable { // TODO: This class is no longer a diff producer. Rename it or get rid of it\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\tprivate readonly _inlineEdit = derived<InlineEditWithChanges | undefined>(this, (reader) => {\n\t\tconst model = this._model.read(reader);\n\t\tif (!model) { return undefined; }\n\t\tconst textModel = this._editor.getModel();\n\t\tif (!textModel) { return undefined; }\n\n\t\tconst state = model.inlineEditState.read(reader);\n\t\tif (!state) { return undefined; }\n\t\tconst action = state.inlineSuggestion.action;\n\n\t\tconst text = new TextModelText(textModel);\n\n\t\tlet diffEdits: TextEdit | undefined;\n\n\t\tif (action?.kind === 'edit') {\n\t\t\tconst editOffset = action.stringEdit;\n\n\t\t\tconst edits = editOffset.replacements.map(e => {\n\t\t\t\tconst innerEditRange = Range.fromPositions(\n\t\t\t\t\ttextModel.getPositionAt(e.replaceRange.start),\n\t\t\t\t\ttextModel.getPositionAt(e.replaceRange.endExclusive)\n\t\t\t\t);\n\t\t\t\treturn new TextReplacement(innerEditRange, e.newText);\n\t\t\t});\n\t\t\tdiffEdits = new TextEdit(edits);\n\t\t} else {\n\t\t\tdiffEdits = undefined;\n\t\t}\n\n\t\treturn new InlineEditWithChanges(\n\t\t\ttext,\n\t\t\taction,\n\t\t\tdiffEdits,\n\t\t\tmodel.primaryPosition.read(undefined),\n\t\t\tmodel.allPositions.read(undefined),\n\t\t\tstate.inlineSuggestion.source.inlineSuggestions.commands ?? [],\n\t\t\tstate.inlineSuggestion\n\t\t);\n\t});\n\n\tpublic readonly _inlineEditModel = derived<ModelPerInlineEdit | undefined>(this, reader => {\n\t\tconst model = this._model.read(reader);\n\t\tif (!model) { return undefined; }\n\t\tconst edit = this._inlineEdit.read(reader);\n\t\tif (!edit) { return undefined; }\n\n\t\tconst tabAction = derived<InlineEditTabAction>(this, reader => {\n\t\t\t/** @description tabAction */\n\t\t\tif (this._editorObs.isFocused.read(reader)) {\n\t\t\t\tif (model.tabShouldJumpToInlineEdit.read(reader)) { return InlineEditTabAction.Jump; }\n\t\t\t\tif (model.tabShouldAcceptInlineEdit.read(reader)) { return InlineEditTabAction.Accept; }\n\t\t\t}\n\t\t\treturn InlineEditTabAction.Inactive;\n\t\t});\n\n\t\treturn new ModelPerInlineEdit(model, edit, tabAction);\n\t});\n\n\tpublic readonly view: InlineEditsView;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _model: IObservable<InlineCompletionsModel | undefined>,\n\t\tprivate readonly _showCollapsed: IObservable<boolean>,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis.view = this._register(instantiationService.createInstance(InlineEditsView, this._editor, this._inlineEditModel,\n\t\t\tthis._model.map(model => model ? SimpleInlineSuggestModel.fromInlineCompletionModel(model) : undefined),\n\t\t\tthis._inlineEdit.map(e => e ? InlineSuggestionGutterMenuData.fromInlineSuggestion(e.inlineCompletion) : undefined),\n\t\t\tthis._showCollapsed,\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 { derived, IObservable } from '../../../../../../base/common/observable.js';\nimport { IInstantiationService } from '../../../../../../platform/instantiation/common/instantiation.js';\nimport { ICodeEditor } from '../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../browser/observableCodeEditor.js';\nimport { Range } from '../../../../../common/core/range.js';\nimport { TextReplacement, TextEdit } from '../../../../../common/core/edits/textEdit.js';\nimport { TextModelText } from '../../../../../common/model/textModelText.js';\nimport { InlineCompletionsModel } from '../../model/inlineCompletionsModel.js';\nimport { InlineEditWithChanges } from './inlineEditWithChanges.js';\nimport { ModelPerInlineEdit } from './inlineEditsModel.js';\nimport { InlineEditsView } from './inlineEditsView.js';\nimport { InlineEditTabAction } from './inlineEditsViewInterface.js';\nimport { InlineSuggestionGutterMenuData, SimpleInlineSuggestModel } from './components/gutterIndicatorView.js';\n\nexport class InlineEditsViewAndDiffProducer extends Disposable { // TODO: This class is no longer a diff producer. Rename it or get rid of it\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\tprivate readonly _inlineEdit = derived<InlineEditWithChanges | undefined>(this, (reader) => {\n\t\tconst model = this._model.read(reader);\n\t\tif (!model) { return undefined; }\n\t\tconst textModel = this._editor.getModel();\n\t\tif (!textModel) { return undefined; }\n\n\t\tconst state = model.inlineEditState.read(reader);\n\t\tif (!state) { return undefined; }\n\t\tconst action = state.inlineSuggestion.action;\n\n\t\tconst text = new TextModelText(textModel);\n\n\t\tlet diffEdits: TextEdit | undefined;\n\n\t\tif (action?.kind === 'edit') {\n\t\t\tconst editOffset = action.stringEdit;\n\n\t\t\tconst edits = editOffset.replacements.map(e => {\n\t\t\t\tconst innerEditRange = Range.fromPositions(\n\t\t\t\t\ttextModel.getPositionAt(e.replaceRange.start),\n\t\t\t\t\ttextModel.getPositionAt(e.replaceRange.endExclusive)\n\t\t\t\t);\n\t\t\t\treturn new TextReplacement(innerEditRange, e.newText);\n\t\t\t});\n\t\t\tdiffEdits = new TextEdit(edits);\n\t\t} else {\n\t\t\tdiffEdits = undefined;\n\t\t}\n\n\t\treturn new InlineEditWithChanges(\n\t\t\ttext,\n\t\t\taction,\n\t\t\tdiffEdits,\n\t\t\tmodel.primaryPosition.read(undefined),\n\t\t\tmodel.allPositions.read(undefined),\n\t\t\tstate.inlineSuggestion.source.inlineSuggestions.commands ?? [],\n\t\t\tstate.inlineSuggestion\n\t\t);\n\t});\n\n\tpublic readonly _inlineEditModel = derived<ModelPerInlineEdit | undefined>(this, reader => {\n\t\tconst model = this._model.read(reader);\n\t\tif (!model) { return undefined; }\n\t\tconst edit = this._inlineEdit.read(reader);\n\t\tif (!edit) { return undefined; }\n\n\t\tconst tabAction = derived<InlineEditTabAction>(this, reader => {\n\t\t\t/** @description tabAction */\n\t\t\tif (this._editorObs.isFocused.read(reader)) {\n\t\t\t\tif (model.tabShouldJumpToInlineEdit.read(reader)) { return InlineEditTabAction.Jump; }\n\t\t\t\tif (model.tabShouldAcceptInlineEdit.read(reader)) { return InlineEditTabAction.Accept; }\n\t\t\t}\n\t\t\treturn InlineEditTabAction.Inactive;\n\t\t});\n\n\t\treturn new ModelPerInlineEdit(model, edit, tabAction);\n\t});\n\n\tpublic readonly view: InlineEditsView;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _model: IObservable<InlineCompletionsModel | undefined>,\n\t\tprivate readonly _showCollapsed: IObservable<boolean>,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tthis.view = this._register(instantiationService.createInstance(InlineEditsView, this._editor, this._inlineEditModel,\n\t\t\tthis._model.map(model => model ? SimpleInlineSuggestModel.fromInlineCompletionModel(model) : undefined),\n\t\t\tthis._inlineEdit.map(e => e ? InlineSuggestionGutterMenuData.fromInlineSuggestion(e.inlineCompletion) : undefined),\n\t\t\tthis._showCollapsed,\n\t\t));\n\t}\n}\n"]}
|
|
@@ -12,7 +12,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
13
13
|
*--------------------------------------------------------------------------------------------*/
|
|
14
14
|
import { n } from '../../../../../../../base/browser/dom.js';
|
|
15
|
-
import {
|
|
15
|
+
import { Event } from '../../../../../../../base/common/event.js';
|
|
16
16
|
import { Disposable } from '../../../../../../../base/common/lifecycle.js';
|
|
17
17
|
import { constObservable, derived } from '../../../../../../../base/common/observable.js';
|
|
18
18
|
import { IAccessibilityService } from '../../../../../../../platform/accessibility/common/accessibility.js';
|
|
@@ -28,12 +28,11 @@ let InlineEditsCollapsedView = class InlineEditsCollapsedView extends Disposable
|
|
|
28
28
|
this._editor = _editor;
|
|
29
29
|
this._edit = _edit;
|
|
30
30
|
this._accessibilityService = _accessibilityService;
|
|
31
|
-
this.
|
|
32
|
-
this.onDidClick = this._onDidClick.event;
|
|
31
|
+
this.onDidClick = Event.None;
|
|
33
32
|
this._iconRef = n.ref();
|
|
34
33
|
this.isHovered = constObservable(false);
|
|
35
34
|
this._editorObs = observableCodeEditor(this._editor);
|
|
36
|
-
const firstEdit = this._edit.map(inlineEdit => inlineEdit?.edit
|
|
35
|
+
const firstEdit = this._edit.map(inlineEdit => inlineEdit?.edit?.replacements[0] ?? null);
|
|
37
36
|
const startPosition = firstEdit.map(edit => edit ? singleTextRemoveCommonPrefix(edit, this._editor.getModel()).range.getStartPosition() : null);
|
|
38
37
|
const observedStartPoint = this._editorObs.observePosition(startPosition, this._store);
|
|
39
38
|
const startPoint = derived(reader => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;gGAGgG;AAChG,OAAO,EAAE,CAAC,EAAE,MAAM,0CAA0C,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,UAAU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C,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC;YACjE,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC/C,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACtD,MAAM,eAAe,GAAG,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACxD,MAAM,oBAAoB,GAAG,cAAc,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;YACrF,OAAO,IAAI,WAAW,EAAE;iBACtB,MAAM,CAAC,WAAW,CAAC;iBACnB,MAAM,CAAC,YAAY,CAAC;iBACpB,MAAM,CAAC,eAAe,CAAC;iBACvB,MAAM,CAAC,oBAAoB,CAAC;iBAC5B,MAAM,CAAC,cAAc,CAAC;iBACtB,MAAM,CAAC,WAAW,CAAC;iBACnB,KAAK,EAAE,CAAC;QACX,CAAC,CAAC,CAAC;IACJ,CAAC;CAGD,CAAA;AAzHY,wBAAwB;IAalC,WAAA,qBAAqB,CAAA;GAbX,wBAAwB,CAyHpC","file":"inlineEditsCollapsedView.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 *--------------------------------------------------------------------------------------------*/\nimport { n } from '../../../../../../../base/browser/dom.js';\nimport { IMouseEvent } from '../../../../../../../base/browser/mouseEvent.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { constObservable, derived, IObservable } from '../../../../../../../base/common/observable.js';\nimport { IAccessibilityService } from '../../../../../../../platform/accessibility/common/accessibility.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { singleTextRemoveCommonPrefix } from '../../../model/singleTextEditHelpers.js';\nimport { IInlineEditsView } from '../inlineEditsViewInterface.js';\nimport { InlineEditWithChanges } from '../inlineEditWithChanges.js';\nimport { inlineEditIndicatorPrimaryBorder } from '../theme.js';\nimport { getEditorValidOverlayRect, PathBuilder, rectToProps } from '../utils/utils.js';\n\nexport class InlineEditsCollapsedView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick = this._register(new Emitter<IMouseEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\tprivate readonly _iconRef = n.ref<SVGElement>();\n\n\treadonly isVisible: IObservable<boolean>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _edit: IObservable<InlineEditWithChanges | undefined>,\n\t\t@IAccessibilityService private readonly _accessibilityService: IAccessibilityService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst firstEdit = this._edit.map(inlineEdit => inlineEdit?.edit.replacements[0] ?? null);\n\n\t\tconst startPosition = firstEdit.map(edit => edit ? singleTextRemoveCommonPrefix(edit, this._editor.getModel()!).range.getStartPosition() : null);\n\t\tconst observedStartPoint = this._editorObs.observePosition(startPosition, this._store);\n\t\tconst startPoint = derived<Point | null>(reader => {\n\t\t\tconst point = observedStartPoint.read(reader);\n\t\t\tif (!point) { return null; }\n\n\t\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\tconst scrollLeft = this._editorObs.scrollLeft.read(reader);\n\t\t\treturn new Point(contentLeft + point.x - scrollLeft, point.y);\n\t\t});\n\n\t\tconst overlayElement = n.div({\n\t\t\tclass: 'inline-edits-collapsed-view',\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'visible',\n\t\t\t\ttop: '0px',\n\t\t\t\tleft: '0px',\n\t\t\t\tdisplay: 'block',\n\t\t\t},\n\t\t}, [\n\t\t\t[this.getCollapsedIndicator(startPoint)],\n\t\t]).keepUpdated(this._store).element;\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: overlayElement,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: constObservable(0),\n\t\t}));\n\n\t\tthis.isVisible = this._edit.map((inlineEdit, reader) => !!inlineEdit && startPoint.read(reader) !== null);\n\t}\n\n\tpublic triggerAnimation(): Promise<Animation> {\n\t\tif (this._accessibilityService.isMotionReduced()) {\n\t\t\treturn new Animation(null, null).finished;\n\t\t}\n\n\t\t// PULSE ANIMATION:\n\t\tconst animation = this._iconRef.element.animate([\n\t\t\t{ offset: 0.00, transform: 'translateY(-3px)', },\n\t\t\t{ offset: 0.20, transform: 'translateY(1px)', },\n\t\t\t{ offset: 0.36, transform: 'translateY(-1px)', },\n\t\t\t{ offset: 0.52, transform: 'translateY(1px)', },\n\t\t\t{ offset: 0.68, transform: 'translateY(-1px)', },\n\t\t\t{ offset: 0.84, transform: 'translateY(1px)', },\n\t\t\t{ offset: 1.00, transform: 'translateY(0px)', },\n\t\t], { duration: 2000 });\n\n\t\treturn animation.finished;\n\t}\n\n\tprivate getCollapsedIndicator(startPoint: IObservable<Point | null>) {\n\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft;\n\t\tconst startPointTranslated = startPoint.map((p, reader) => p ? p.deltaX(-contentLeft.read(reader)) : null);\n\t\tconst iconPath = this.createIconPath(startPointTranslated);\n\n\t\treturn n.svg({\n\t\t\tclass: 'collapsedView',\n\t\t\tref: this._iconRef,\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\t...rectToProps((r) => getEditorValidOverlayRect(this._editorObs).read(r)),\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tpointerEvents: 'none',\n\t\t\t}\n\t\t}, [\n\t\t\tn.svgElem('path', {\n\t\t\t\tclass: 'collapsedViewPath',\n\t\t\t\td: iconPath,\n\t\t\t\tfill: asCssVariable(inlineEditIndicatorPrimaryBorder),\n\t\t\t}),\n\t\t]);\n\t}\n\n\tprivate createIconPath(indicatorPoint: IObservable<Point | null>): IObservable<string> {\n\t\tconst width = 6;\n\t\tconst triangleHeight = 3;\n\t\tconst baseHeight = 1;\n\n\t\treturn indicatorPoint.map(point => {\n\t\t\tif (!point) { return new PathBuilder().build(); }\n\t\t\tconst baseTopLeft = point.deltaX(-width / 2).deltaY(-baseHeight);\n\t\t\tconst baseTopRight = baseTopLeft.deltaX(width);\n\t\t\tconst baseBottomLeft = baseTopLeft.deltaY(baseHeight);\n\t\t\tconst baseBottomRight = baseTopRight.deltaY(baseHeight);\n\t\t\tconst triangleBottomCenter = baseBottomLeft.deltaX(width / 2).deltaY(triangleHeight);\n\t\t\treturn new PathBuilder()\n\t\t\t\t.moveTo(baseTopLeft)\n\t\t\t\t.lineTo(baseTopRight)\n\t\t\t\t.lineTo(baseBottomRight)\n\t\t\t\t.lineTo(triangleBottomCenter)\n\t\t\t\t.lineTo(baseBottomLeft)\n\t\t\t\t.lineTo(baseTopLeft)\n\t\t\t\t.build();\n\t\t});\n\t}\n\n\treadonly isHovered = constObservable(false);\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 *--------------------------------------------------------------------------------------------*/\nimport { n } from '../../../../../../../base/browser/dom.js';\nimport { IMouseEvent } from '../../../../../../../base/browser/mouseEvent.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { constObservable, derived, IObservable } from '../../../../../../../base/common/observable.js';\nimport { IAccessibilityService } from '../../../../../../../platform/accessibility/common/accessibility.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { singleTextRemoveCommonPrefix } from '../../../model/singleTextEditHelpers.js';\nimport { IInlineEditsView } from '../inlineEditsViewInterface.js';\nimport { InlineEditWithChanges } from '../inlineEditWithChanges.js';\nimport { inlineEditIndicatorPrimaryBorder } from '../theme.js';\nimport { getEditorValidOverlayRect, PathBuilder, rectToProps } from '../utils/utils.js';\n\nexport class InlineEditsCollapsedView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick = this._register(new Emitter<IMouseEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\tprivate readonly _iconRef = n.ref<SVGElement>();\n\n\treadonly isVisible: IObservable<boolean>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _edit: IObservable<InlineEditWithChanges | undefined>,\n\t\t@IAccessibilityService private readonly _accessibilityService: IAccessibilityService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst firstEdit = this._edit.map(inlineEdit => inlineEdit?.edit.replacements[0] ?? null);\n\n\t\tconst startPosition = firstEdit.map(edit => edit ? singleTextRemoveCommonPrefix(edit, this._editor.getModel()!).range.getStartPosition() : null);\n\t\tconst observedStartPoint = this._editorObs.observePosition(startPosition, this._store);\n\t\tconst startPoint = derived<Point | null>(reader => {\n\t\t\tconst point = observedStartPoint.read(reader);\n\t\t\tif (!point) { return null; }\n\n\t\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\tconst scrollLeft = this._editorObs.scrollLeft.read(reader);\n\t\t\treturn new Point(contentLeft + point.x - scrollLeft, point.y);\n\t\t});\n\n\t\tconst overlayElement = n.div({\n\t\t\tclass: 'inline-edits-collapsed-view',\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'visible',\n\t\t\t\ttop: '0px',\n\t\t\t\tleft: '0px',\n\t\t\t\tdisplay: 'block',\n\t\t\t},\n\t\t}, [\n\t\t\t[this.getCollapsedIndicator(startPoint)],\n\t\t]).keepUpdated(this._store).element;\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: overlayElement,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: constObservable(0),\n\t\t}));\n\n\t\tthis.isVisible = this._edit.map((inlineEdit, reader) => !!inlineEdit && startPoint.read(reader) !== null);\n\t}\n\n\tpublic triggerAnimation(): Promise<Animation> {\n\t\tif (this._accessibilityService.isMotionReduced()) {\n\t\t\treturn new Animation(null, null).finished;\n\t\t}\n\n\t\t// PULSE ANIMATION:\n\t\tconst animation = this._iconRef.element.animate([\n\t\t\t{ offset: 0.00, transform: 'translateY(-3px)', },\n\t\t\t{ offset: 0.20, transform: 'translateY(1px)', },\n\t\t\t{ offset: 0.36, transform: 'translateY(-1px)', },\n\t\t\t{ offset: 0.52, transform: 'translateY(1px)', },\n\t\t\t{ offset: 0.68, transform: 'translateY(-1px)', },\n\t\t\t{ offset: 0.84, transform: 'translateY(1px)', },\n\t\t\t{ offset: 1.00, transform: 'translateY(0px)', },\n\t\t], { duration: 2000 });\n\n\t\treturn animation.finished;\n\t}\n\n\tprivate getCollapsedIndicator(startPoint: IObservable<Point | null>) {\n\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft;\n\t\tconst startPointTranslated = startPoint.map((p, reader) => p ? p.deltaX(-contentLeft.read(reader)) : null);\n\t\tconst iconPath = this.createIconPath(startPointTranslated);\n\n\t\treturn n.svg({\n\t\t\tclass: 'collapsedView',\n\t\t\tref: this._iconRef,\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\t...rectToProps((r) => getEditorValidOverlayRect(this._editorObs).read(r)),\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tpointerEvents: 'none',\n\t\t\t}\n\t\t}, [\n\t\t\tn.svgElem('path', {\n\t\t\t\tclass: 'collapsedViewPath',\n\t\t\t\td: iconPath,\n\t\t\t\tfill: asCssVariable(inlineEditIndicatorPrimaryBorder),\n\t\t\t}),\n\t\t]);\n\t}\n\n\tprivate createIconPath(indicatorPoint: IObservable<Point | null>): IObservable<string> {\n\t\tconst width = 6;\n\t\tconst triangleHeight = 3;\n\t\tconst baseHeight = 1;\n\n\t\treturn indicatorPoint.map(point => {\n\t\t\tif (!point) { return new PathBuilder().build(); }\n\t\t\tconst baseTopLeft = point.deltaX(-width / 2).deltaY(-baseHeight);\n\t\t\tconst baseTopRight = baseTopLeft.deltaX(width);\n\t\t\tconst baseBottomLeft = baseTopLeft.deltaY(baseHeight);\n\t\t\tconst baseBottomRight = baseTopRight.deltaY(baseHeight);\n\t\t\tconst triangleBottomCenter = baseBottomLeft.deltaX(width / 2).deltaY(triangleHeight);\n\t\t\treturn new PathBuilder()\n\t\t\t\t.moveTo(baseTopLeft)\n\t\t\t\t.lineTo(baseTopRight)\n\t\t\t\t.lineTo(baseBottomRight)\n\t\t\t\t.lineTo(triangleBottomCenter)\n\t\t\t\t.lineTo(baseBottomLeft)\n\t\t\t\t.lineTo(baseTopLeft)\n\t\t\t\t.build();\n\t\t});\n\t}\n\n\treadonly isHovered = constObservable(false);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;gGAGgG;AAChG,OAAO,EAAE,CAAC,EAAE,MAAM,0CAA0C,CAAC;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,2CAA2C,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,+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AC;YAC/C,MAAM,cAAc,GAAG,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACtD,MAAM,eAAe,GAAG,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;YACxD,MAAM,oBAAoB,GAAG,cAAc,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;YACrF,OAAO,IAAI,WAAW,EAAE;iBACtB,MAAM,CAAC,WAAW,CAAC;iBACnB,MAAM,CAAC,YAAY,CAAC;iBACpB,MAAM,CAAC,eAAe,CAAC;iBACvB,MAAM,CAAC,oBAAoB,CAAC;iBAC5B,MAAM,CAAC,cAAc,CAAC;iBACtB,MAAM,CAAC,WAAW,CAAC;iBACnB,KAAK,EAAE,CAAC;QACX,CAAC,CAAC,CAAC;IACJ,CAAC;CAGD,CAAA;AAxHY,wBAAwB;IAYlC,WAAA,qBAAqB,CAAA;GAZX,wBAAwB,CAwHpC","file":"inlineEditsCollapsedView.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 *--------------------------------------------------------------------------------------------*/\nimport { n } from '../../../../../../../base/browser/dom.js';\nimport { Event } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { constObservable, derived, IObservable } from '../../../../../../../base/common/observable.js';\nimport { IAccessibilityService } from '../../../../../../../platform/accessibility/common/accessibility.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { singleTextRemoveCommonPrefix } from '../../../model/singleTextEditHelpers.js';\nimport { IInlineEditsView } from '../inlineEditsViewInterface.js';\nimport { InlineEditWithChanges } from '../inlineEditWithChanges.js';\nimport { inlineEditIndicatorPrimaryBorder } from '../theme.js';\nimport { getEditorValidOverlayRect, PathBuilder, rectToProps } from '../utils/utils.js';\n\nexport class InlineEditsCollapsedView extends Disposable implements IInlineEditsView {\n\n\treadonly onDidClick = Event.None;\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\tprivate readonly _iconRef = n.ref<SVGElement>();\n\n\treadonly isVisible: IObservable<boolean>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _edit: IObservable<InlineEditWithChanges | undefined>,\n\t\t@IAccessibilityService private readonly _accessibilityService: IAccessibilityService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst firstEdit = this._edit.map(inlineEdit => inlineEdit?.edit?.replacements[0] ?? null);\n\n\t\tconst startPosition = firstEdit.map(edit => edit ? singleTextRemoveCommonPrefix(edit, this._editor.getModel()!).range.getStartPosition() : null);\n\t\tconst observedStartPoint = this._editorObs.observePosition(startPosition, this._store);\n\t\tconst startPoint = derived<Point | null>(reader => {\n\t\t\tconst point = observedStartPoint.read(reader);\n\t\t\tif (!point) { return null; }\n\n\t\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\tconst scrollLeft = this._editorObs.scrollLeft.read(reader);\n\t\t\treturn new Point(contentLeft + point.x - scrollLeft, point.y);\n\t\t});\n\n\t\tconst overlayElement = n.div({\n\t\t\tclass: 'inline-edits-collapsed-view',\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'visible',\n\t\t\t\ttop: '0px',\n\t\t\t\tleft: '0px',\n\t\t\t\tdisplay: 'block',\n\t\t\t},\n\t\t}, [\n\t\t\t[this.getCollapsedIndicator(startPoint)],\n\t\t]).keepUpdated(this._store).element;\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: overlayElement,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: constObservable(0),\n\t\t}));\n\n\t\tthis.isVisible = this._edit.map((inlineEdit, reader) => !!inlineEdit && startPoint.read(reader) !== null);\n\t}\n\n\tpublic triggerAnimation(): Promise<Animation> {\n\t\tif (this._accessibilityService.isMotionReduced()) {\n\t\t\treturn new Animation(null, null).finished;\n\t\t}\n\n\t\t// PULSE ANIMATION:\n\t\tconst animation = this._iconRef.element.animate([\n\t\t\t{ offset: 0.00, transform: 'translateY(-3px)', },\n\t\t\t{ offset: 0.20, transform: 'translateY(1px)', },\n\t\t\t{ offset: 0.36, transform: 'translateY(-1px)', },\n\t\t\t{ offset: 0.52, transform: 'translateY(1px)', },\n\t\t\t{ offset: 0.68, transform: 'translateY(-1px)', },\n\t\t\t{ offset: 0.84, transform: 'translateY(1px)', },\n\t\t\t{ offset: 1.00, transform: 'translateY(0px)', },\n\t\t], { duration: 2000 });\n\n\t\treturn animation.finished;\n\t}\n\n\tprivate getCollapsedIndicator(startPoint: IObservable<Point | null>) {\n\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft;\n\t\tconst startPointTranslated = startPoint.map((p, reader) => p ? p.deltaX(-contentLeft.read(reader)) : null);\n\t\tconst iconPath = this.createIconPath(startPointTranslated);\n\n\t\treturn n.svg({\n\t\t\tclass: 'collapsedView',\n\t\t\tref: this._iconRef,\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\t...rectToProps((r) => getEditorValidOverlayRect(this._editorObs).read(r)),\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tpointerEvents: 'none',\n\t\t\t}\n\t\t}, [\n\t\t\tn.svgElem('path', {\n\t\t\t\tclass: 'collapsedViewPath',\n\t\t\t\td: iconPath,\n\t\t\t\tfill: asCssVariable(inlineEditIndicatorPrimaryBorder),\n\t\t\t}),\n\t\t]);\n\t}\n\n\tprivate createIconPath(indicatorPoint: IObservable<Point | null>): IObservable<string> {\n\t\tconst width = 6;\n\t\tconst triangleHeight = 3;\n\t\tconst baseHeight = 1;\n\n\t\treturn indicatorPoint.map(point => {\n\t\t\tif (!point) { return new PathBuilder().build(); }\n\t\t\tconst baseTopLeft = point.deltaX(-width / 2).deltaY(-baseHeight);\n\t\t\tconst baseTopRight = baseTopLeft.deltaX(width);\n\t\t\tconst baseBottomLeft = baseTopLeft.deltaY(baseHeight);\n\t\t\tconst baseBottomRight = baseTopRight.deltaY(baseHeight);\n\t\t\tconst triangleBottomCenter = baseBottomLeft.deltaX(width / 2).deltaY(triangleHeight);\n\t\t\treturn new PathBuilder()\n\t\t\t\t.moveTo(baseTopLeft)\n\t\t\t\t.lineTo(baseTopRight)\n\t\t\t\t.lineTo(baseBottomRight)\n\t\t\t\t.lineTo(triangleBottomCenter)\n\t\t\t\t.lineTo(baseBottomLeft)\n\t\t\t\t.lineTo(baseTopLeft)\n\t\t\t\t.build();\n\t\t});\n\t}\n\n\treadonly isHovered = constObservable(false);\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 *--------------------------------------------------------------------------------------------*/\nimport { n } from '../../../../../../../base/browser/dom.js';\nimport { Event } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { constObservable, derived, IObservable } from '../../../../../../../base/common/observable.js';\nimport { IAccessibilityService } from '../../../../../../../platform/accessibility/common/accessibility.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { Point } from '../../../../../../common/core/2d/point.js';\nimport { singleTextRemoveCommonPrefix } from '../../../model/singleTextEditHelpers.js';\nimport { IInlineEditsView } from '../inlineEditsViewInterface.js';\nimport { InlineEditWithChanges } from '../inlineEditWithChanges.js';\nimport { inlineEditIndicatorPrimaryBorder } from '../theme.js';\nimport { getEditorValidOverlayRect, PathBuilder, rectToProps } from '../utils/utils.js';\n\nexport class InlineEditsCollapsedView extends Disposable implements IInlineEditsView {\n\n\treadonly onDidClick = Event.None;\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\tprivate readonly _iconRef = n.ref<SVGElement>();\n\n\treadonly isVisible: IObservable<boolean>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tprivate readonly _edit: IObservable<InlineEditWithChanges | undefined>,\n\t\t@IAccessibilityService private readonly _accessibilityService: IAccessibilityService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst firstEdit = this._edit.map(inlineEdit => inlineEdit?.edit?.replacements[0] ?? null);\n\n\t\tconst startPosition = firstEdit.map(edit => edit ? singleTextRemoveCommonPrefix(edit, this._editor.getModel()!).range.getStartPosition() : null);\n\t\tconst observedStartPoint = this._editorObs.observePosition(startPosition, this._store);\n\t\tconst startPoint = derived<Point | null>(reader => {\n\t\t\tconst point = observedStartPoint.read(reader);\n\t\t\tif (!point) { return null; }\n\n\t\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\tconst scrollLeft = this._editorObs.scrollLeft.read(reader);\n\t\t\treturn new Point(contentLeft + point.x - scrollLeft, point.y);\n\t\t});\n\n\t\tconst overlayElement = n.div({\n\t\t\tclass: 'inline-edits-collapsed-view',\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'visible',\n\t\t\t\ttop: '0px',\n\t\t\t\tleft: '0px',\n\t\t\t\tdisplay: 'block',\n\t\t\t},\n\t\t}, [\n\t\t\t[this.getCollapsedIndicator(startPoint)],\n\t\t]).keepUpdated(this._store).element;\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: overlayElement,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: constObservable(0),\n\t\t}));\n\n\t\tthis.isVisible = this._edit.map((inlineEdit, reader) => !!inlineEdit && startPoint.read(reader) !== null);\n\t}\n\n\tpublic triggerAnimation(): Promise<Animation> {\n\t\tif (this._accessibilityService.isMotionReduced()) {\n\t\t\treturn new Animation(null, null).finished;\n\t\t}\n\n\t\t// PULSE ANIMATION:\n\t\tconst animation = this._iconRef.element.animate([\n\t\t\t{ offset: 0.00, transform: 'translateY(-3px)', },\n\t\t\t{ offset: 0.20, transform: 'translateY(1px)', },\n\t\t\t{ offset: 0.36, transform: 'translateY(-1px)', },\n\t\t\t{ offset: 0.52, transform: 'translateY(1px)', },\n\t\t\t{ offset: 0.68, transform: 'translateY(-1px)', },\n\t\t\t{ offset: 0.84, transform: 'translateY(1px)', },\n\t\t\t{ offset: 1.00, transform: 'translateY(0px)', },\n\t\t], { duration: 2000 });\n\n\t\treturn animation.finished;\n\t}\n\n\tprivate getCollapsedIndicator(startPoint: IObservable<Point | null>) {\n\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft;\n\t\tconst startPointTranslated = startPoint.map((p, reader) => p ? p.deltaX(-contentLeft.read(reader)) : null);\n\t\tconst iconPath = this.createIconPath(startPointTranslated);\n\n\t\treturn n.svg({\n\t\t\tclass: 'collapsedView',\n\t\t\tref: this._iconRef,\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\t...rectToProps((r) => getEditorValidOverlayRect(this._editorObs).read(r)),\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tpointerEvents: 'none',\n\t\t\t}\n\t\t}, [\n\t\t\tn.svgElem('path', {\n\t\t\t\tclass: 'collapsedViewPath',\n\t\t\t\td: iconPath,\n\t\t\t\tfill: asCssVariable(inlineEditIndicatorPrimaryBorder),\n\t\t\t}),\n\t\t]);\n\t}\n\n\tprivate createIconPath(indicatorPoint: IObservable<Point | null>): IObservable<string> {\n\t\tconst width = 6;\n\t\tconst triangleHeight = 3;\n\t\tconst baseHeight = 1;\n\n\t\treturn indicatorPoint.map(point => {\n\t\t\tif (!point) { return new PathBuilder().build(); }\n\t\t\tconst baseTopLeft = point.deltaX(-width / 2).deltaY(-baseHeight);\n\t\t\tconst baseTopRight = baseTopLeft.deltaX(width);\n\t\t\tconst baseBottomLeft = baseTopLeft.deltaY(baseHeight);\n\t\t\tconst baseBottomRight = baseTopRight.deltaY(baseHeight);\n\t\t\tconst triangleBottomCenter = baseBottomLeft.deltaX(width / 2).deltaY(triangleHeight);\n\t\t\treturn new PathBuilder()\n\t\t\t\t.moveTo(baseTopLeft)\n\t\t\t\t.lineTo(baseTopRight)\n\t\t\t\t.lineTo(baseBottomRight)\n\t\t\t\t.lineTo(triangleBottomCenter)\n\t\t\t\t.lineTo(baseBottomLeft)\n\t\t\t\t.lineTo(baseTopLeft)\n\t\t\t\t.build();\n\t\t});\n\t}\n\n\treadonly isHovered = constObservable(false);\n}\n"]}
|
|
@@ -11,8 +11,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
12
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
13
13
|
*--------------------------------------------------------------------------------------------*/
|
|
14
|
-
import {
|
|
15
|
-
import { StandardMouseEvent } from '../../../../../../../base/browser/mouseEvent.js';
|
|
14
|
+
import { n } from '../../../../../../../base/browser/dom.js';
|
|
16
15
|
import { Emitter } from '../../../../../../../base/common/event.js';
|
|
17
16
|
import { Disposable } from '../../../../../../../base/common/lifecycle.js';
|
|
18
17
|
import { autorun, constObservable, derived, derivedObservableWithCache, observableValue } from '../../../../../../../base/common/observable.js';
|
|
@@ -26,8 +25,8 @@ import { LineRange } from '../../../../../../common/core/ranges/lineRange.js';
|
|
|
26
25
|
import { InlineCompletionHintStyle } from '../../../../../../common/languages.js';
|
|
27
26
|
import { ILanguageService } from '../../../../../../common/languages/language.js';
|
|
28
27
|
import { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';
|
|
29
|
-
import { InlineEditTabAction } from '../inlineEditsViewInterface.js';
|
|
30
|
-
import { getEditorBlendedColor, inlineEditIndicatorPrimaryBackground, inlineEditIndicatorSecondaryBackground,
|
|
28
|
+
import { InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';
|
|
29
|
+
import { getEditorBlendedColor, INLINE_EDITS_BORDER_RADIUS, inlineEditIndicatorPrimaryBackground, inlineEditIndicatorSecondaryBackground, inlineEditIndicatorSuccessfulBackground } from '../theme.js';
|
|
31
30
|
import { getContentRenderWidth, maxContentWidthInRange, rectToProps } from '../utils/utils.js';
|
|
32
31
|
const MIN_END_OF_LINE_PADDING = 14;
|
|
33
32
|
const PADDING_VERTICALLY = 0;
|
|
@@ -56,7 +55,7 @@ let InlineEditsCustomView = class InlineEditsCustomView extends Disposable {
|
|
|
56
55
|
border = inlineEditIndicatorPrimaryBackground;
|
|
57
56
|
break;
|
|
58
57
|
case InlineEditTabAction.Accept:
|
|
59
|
-
border =
|
|
58
|
+
border = inlineEditIndicatorSuccessfulBackground;
|
|
60
59
|
break;
|
|
61
60
|
}
|
|
62
61
|
return {
|
|
@@ -221,7 +220,7 @@ let InlineEditsCustomView = class InlineEditsCustomView extends Disposable {
|
|
|
221
220
|
boxSizing: 'border-box',
|
|
222
221
|
cursor: 'pointer',
|
|
223
222
|
border: styles.map(s => `1px solid ${s.border}`),
|
|
224
|
-
borderRadius:
|
|
223
|
+
borderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,
|
|
225
224
|
backgroundColor: styles.map(s => s.background),
|
|
226
225
|
display: 'flex',
|
|
227
226
|
alignItems: 'center',
|
|
@@ -231,7 +230,7 @@ let InlineEditsCustomView = class InlineEditsCustomView extends Disposable {
|
|
|
231
230
|
onmousedown: e => {
|
|
232
231
|
e.preventDefault(); // This prevents that the editor loses focus
|
|
233
232
|
},
|
|
234
|
-
onclick: (e) => { this._onDidClick.fire(
|
|
233
|
+
onclick: (e) => { this._onDidClick.fire(InlineEditClickEvent.create(e)); }
|
|
235
234
|
}, [
|
|
236
235
|
line
|
|
237
236
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.ts","vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;gGAGgG;AAChG,OAAO,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,0CAA0C,CAAC;AACxE,OAAO,EAAe,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAClG,OAAO,EAAE,OAAO,EAAE,MAAM,2CAA2C,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,OAAO,EAAE,0BAA0B,EAAwB,eAAe,EAAE,MAAM,gDAAgD,CAAC;AACtK,OAAO,EAAE,gBAAgB,EAAE,MAAM,6DAA6D,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,0DAA0D,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,MAAM,4DAA4D,CAAC;AAE3F,OAAO,EAAwB,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAC/G,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,2FAA2F,CAAC;AAEnJ,OAAO,EAAE,IAAI,EAAE,MAAM,0CAA0C,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,mDAAmD,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,gDAAgD,CAAC;AAClF,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAoB,mBAAmB,EA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U,EAAE,QAAQ;aACpB;YACD,WAAW,EAAE,CAAC,CAAC,EAAE;gBAChB,CAAC,CAAC,cAAc,EAAE,CAAC,CAAC,4CAA4C;YACjE,CAAC;YACD,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACnF,EAAE;YACF,IAAI;SACJ,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AA1OY,qBAAqB;IAiB/B,WAAA,aAAa,CAAA;IACb,WAAA,gBAAgB,CAAA;GAlBN,qBAAqB,CA0OjC","file":"inlineEditsCustomView.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 *--------------------------------------------------------------------------------------------*/\nimport { getWindow, n } from '../../../../../../../base/browser/dom.js';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../../../../base/browser/mouseEvent.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorun, constObservable, derived, derivedObservableWithCache, IObservable, IReader, observableValue } from '../../../../../../../base/common/observable.js';\nimport { editorBackground } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { InlineCompletionHintStyle } from '../../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineSuggestHint } from '../../../model/inlineSuggestionItem.js';\nimport { IInlineEditsView, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBlendedColor, inlineEditIndicatorPrimaryBackground, inlineEditIndicatorSecondaryBackground, inlineEditIndicatorsuccessfulBackground } from '../theme.js';\nimport { getContentRenderWidth, maxContentWidthInRange, rectToProps } from '../utils/utils.js';\n\nconst MIN_END_OF_LINE_PADDING = 14;\nconst PADDING_VERTICALLY = 0;\nconst PADDING_HORIZONTALLY = 4;\nconst HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW = 4;\nconst VERTICAL_OFFSET_WHEN_ABOVE_BELOW = 2;\n// !! minEndOfLinePadding should always be larger than paddingHorizontally + horizontalOffsetWhenAboveBelow\n\nexport class InlineEditsCustomView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick = this._register(new Emitter<IMouseEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _isHovered = observableValue(this, false);\n\treadonly isHovered: IObservable<boolean> = this._isHovered;\n\tprivate readonly _viewRef = n.ref<HTMLDivElement>();\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\treadonly minEditorScrollHeight: IObservable<number>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tdisplayLocation: IObservable<InlineSuggestHint | undefined>,\n\t\ttabAction: IObservable<InlineEditTabAction>,\n\t\t@IThemeService themeService: IThemeService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst styles = tabAction.map((v, reader) => {\n\t\t\tlet border;\n\t\t\tswitch (v) {\n\t\t\t\tcase InlineEditTabAction.Inactive: border = inlineEditIndicatorSecondaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Jump: border = inlineEditIndicatorPrimaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Accept: border = inlineEditIndicatorsuccessfulBackground; break;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tborder: getEditorBlendedColor(border, themeService).read(reader).toString(),\n\t\t\t\tbackground: asCssVariable(editorBackground)\n\t\t\t};\n\t\t});\n\n\t\tconst state = displayLocation.map(dl => dl ? this.getState(dl) : undefined);\n\n\t\tconst view = state.map(s => s ? this.getRendering(s, styles) : undefined);\n\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst s = state.read(reader);\n\t\t\tif (!s) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn s.rect.read(reader).bottom + this._editor.getScrollTop();\n\t\t});\n\n\t\tconst overlay = n.div({\n\t\t\tclass: 'inline-edits-custom-view',\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'visible',\n\t\t\t\ttop: '0px',\n\t\t\t\tleft: '0px',\n\t\t\t\tdisplay: 'block',\n\t\t\t},\n\t\t}, [view]).keepUpdated(this._store);\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: overlay.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derivedObservableWithCache<number>(this, (reader, prev) => {\n\t\t\t\tconst s = state.read(reader);\n\t\t\t\tif (!s) { return prev ?? 0; }\n\n\t\t\t\tconst current = s.rect.map(rect => rect.right).read(reader)\n\t\t\t\t\t+ this._editorObs.layoutInfoVerticalScrollbarWidth.read(reader)\n\t\t\t\t\t+ PADDING_HORIZONTALLY\n\t\t\t\t\t- this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\t\treturn Math.max(prev ?? 0, current); // will run into infinite loop otherwise TODO: fix this\n\t\t\t}).recomputeInitiallyAndOnChange(this._store),\n\t\t}));\n\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst v = view.read(reader);\n\t\t\tif (!v) { this._isHovered.set(false, undefined); return; }\n\t\t\tthis._isHovered.set(overlay.isHovered.read(reader), undefined);\n\t\t}));\n\t}\n\n\t// TODO: this is very similar to side by side `fitsInsideViewport`, try to use the same function\n\tprivate fitsInsideViewport(range: LineRange, displayLabel: string, reader: IReader | undefined): boolean {\n\t\tconst editorWidth = this._editorObs.layoutInfoWidth.read(reader);\n\t\tconst editorContentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\tconst editorVerticalScrollbar = this._editor.getLayoutInfo().verticalScrollbarWidth;\n\t\tconst minimapWidth = this._editorObs.layoutInfoMinimap.read(reader).minimapLeft !== 0 ? this._editorObs.layoutInfoMinimap.read(reader).minimapWidth : 0;\n\n\t\tconst maxOriginalContent = maxContentWidthInRange(this._editorObs, range, undefined);\n\t\tconst maxModifiedContent = getContentRenderWidth(displayLabel, this._editor, this._editor.getModel()!);\n\t\tconst padding = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\n\t\treturn maxOriginalContent + maxModifiedContent + padding < editorWidth - editorContentLeft - editorVerticalScrollbar - minimapWidth;\n\t}\n\n\tprivate getState(displayLocation: InlineSuggestHint): { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle } {\n\n\t\tconst contentState = derived(this, (reader) => {\n\t\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t\tconst startColumn = displayLocation.range.startColumn;\n\t\t\tconst endColumn = displayLocation.range.endColumn;\n\t\t\tconst lineCount = this._editor.getModel()?.getLineCount() ?? 0;\n\n\t\t\tconst lineWidth = maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber, startLineNumber + 1), reader);\n\t\t\tconst lineWidthBelow = startLineNumber + 1 <= lineCount ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber + 1, startLineNumber + 2), reader) : undefined;\n\t\t\tconst lineWidthAbove = startLineNumber - 1 >= 1 ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber - 1, startLineNumber), reader) : undefined;\n\t\t\tconst startContentLeftOffset = this._editor.getOffsetForColumn(startLineNumber, startColumn);\n\t\t\tconst endContentLeftOffset = this._editor.getOffsetForColumn(endLineNumber, endColumn);\n\n\t\t\treturn {\n\t\t\t\tlineWidth,\n\t\t\t\tlineWidthBelow,\n\t\t\t\tlineWidthAbove,\n\t\t\t\tstartContentLeftOffset,\n\t\t\t\tendContentLeftOffset\n\t\t\t};\n\t\t});\n\n\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t// only check viewport once in the beginning when rendering the view\n\t\tconst fitsInsideViewport = this.fitsInsideViewport(new LineRange(startLineNumber, endLineNumber + 1), displayLocation.content, undefined);\n\n\t\tconst rect = derived(this, reader => {\n\t\t\tconst w = this._editorObs.getOption(EditorOption.fontInfo).read(reader).typicalHalfwidthCharacterWidth;\n\n\t\t\tconst { lineWidth, lineWidthBelow, lineWidthAbove, startContentLeftOffset, endContentLeftOffset } = contentState.read(reader);\n\n\t\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\tconst lineHeight = this._editorObs.observeLineHeightForLine(startLineNumber).recomputeInitiallyAndOnChange(reader.store).read(reader);\n\t\t\tconst scrollTop = this._editorObs.scrollTop.read(reader);\n\t\t\tconst scrollLeft = this._editorObs.scrollLeft.read(reader);\n\n\t\t\tlet position: 'end' | 'below' | 'above';\n\t\t\tif (startLineNumber === endLineNumber && endContentLeftOffset + 5 * w >= lineWidth && fitsInsideViewport) {\n\t\t\t\tposition = 'end'; // Render at the end of the line if the range ends almost at the end of the line\n\t\t\t} else if (lineWidthBelow !== undefined && lineWidthBelow + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'below'; // Render Below if possible\n\t\t\t} else if (lineWidthAbove !== undefined && lineWidthAbove + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'above'; // Render Above if possible\n\t\t\t} else {\n\t\t\t\tposition = 'end'; // Render at the end of the line otherwise\n\t\t\t}\n\n\t\t\tlet topOfLine;\n\t\t\tlet contentStartOffset;\n\t\t\tlet deltaX = 0;\n\t\t\tlet deltaY = 0;\n\n\t\t\tswitch (position) {\n\t\t\t\tcase 'end': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber);\n\t\t\t\t\tcontentStartOffset = lineWidth;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'below': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber + 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'above': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber - 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = -PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst textRect = Rect.fromLeftTopWidthHeight(\n\t\t\t\tcontentLeft + contentStartOffset - scrollLeft,\n\t\t\t\ttopOfLine - scrollTop,\n\t\t\t\tw * displayLocation.content.length,\n\t\t\t\tlineHeight\n\t\t\t);\n\n\t\t\treturn textRect.withMargin(PADDING_VERTICALLY, PADDING_HORIZONTALLY).translateX(deltaX).translateY(deltaY);\n\t\t});\n\n\t\treturn {\n\t\t\trect,\n\t\t\tlabel: displayLocation.content,\n\t\t\tkind: displayLocation.style\n\t\t};\n\t}\n\n\tprivate getRendering(state: { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle }, styles: IObservable<{ background: string; border: string }>) {\n\n\t\tconst line = document.createElement('div');\n\t\tconst t = this._editor.getModel()!.tokenization.tokenizeLinesAt(1, [state.label])?.[0];\n\t\tlet tokens: LineTokens;\n\t\tif (t && state.kind === InlineCompletionHintStyle.Code) {\n\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(state.label, this._languageService.languageIdCodec);\n\t\t} else {\n\t\t\ttokens = LineTokens.createEmpty(state.label, this._languageService.languageIdCodec);\n\t\t}\n\n\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor).withSetWidth(false).withScrollBeyondLastColumn(0), [], line, true);\n\t\tline.style.width = `${result.minWidthInPx}px`;\n\n\t\tconst rect = state.rect.map(r => r.withMargin(0, PADDING_HORIZONTALLY));\n\n\t\treturn n.div({\n\t\t\tclass: 'collapsedView',\n\t\t\tref: this._viewRef,\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\t...rectToProps(reader => rect.read(reader)),\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tboxSizing: 'border-box',\n\t\t\t\tcursor: 'pointer',\n\t\t\t\tborder: styles.map(s => `1px solid ${s.border}`),\n\t\t\t\tborderRadius: '4px',\n\t\t\t\tbackgroundColor: styles.map(s => s.background),\n\n\t\t\t\tdisplay: 'flex',\n\t\t\t\talignItems: 'center',\n\t\t\t\tjustifyContent: 'center',\n\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t},\n\t\t\tonmousedown: e => {\n\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t},\n\t\t\tonclick: (e) => { this._onDidClick.fire(new StandardMouseEvent(getWindow(e), e)); }\n\t\t}, [\n\t\t\tline\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 *--------------------------------------------------------------------------------------------*/\nimport { getWindow, n } from '../../../../../../../base/browser/dom.js';\nimport { IMouseEvent, StandardMouseEvent } from '../../../../../../../base/browser/mouseEvent.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorun, constObservable, derived, derivedObservableWithCache, IObservable, IReader, observableValue } from '../../../../../../../base/common/observable.js';\nimport { editorBackground } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { InlineCompletionHintStyle } from '../../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineSuggestHint } from '../../../model/inlineSuggestionItem.js';\nimport { IInlineEditsView, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBlendedColor, inlineEditIndicatorPrimaryBackground, inlineEditIndicatorSecondaryBackground, inlineEditIndicatorsuccessfulBackground } from '../theme.js';\nimport { getContentRenderWidth, maxContentWidthInRange, rectToProps } from '../utils/utils.js';\n\nconst MIN_END_OF_LINE_PADDING = 14;\nconst PADDING_VERTICALLY = 0;\nconst PADDING_HORIZONTALLY = 4;\nconst HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW = 4;\nconst VERTICAL_OFFSET_WHEN_ABOVE_BELOW = 2;\n// !! minEndOfLinePadding should always be larger than paddingHorizontally + horizontalOffsetWhenAboveBelow\n\nexport class InlineEditsCustomView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick = this._register(new Emitter<IMouseEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _isHovered = observableValue(this, false);\n\treadonly isHovered: IObservable<boolean> = this._isHovered;\n\tprivate readonly _viewRef = n.ref<HTMLDivElement>();\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\treadonly minEditorScrollHeight: IObservable<number>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tdisplayLocation: IObservable<InlineSuggestHint | undefined>,\n\t\ttabAction: IObservable<InlineEditTabAction>,\n\t\t@IThemeService themeService: IThemeService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst styles = tabAction.map((v, reader) => {\n\t\t\tlet border;\n\t\t\tswitch (v) {\n\t\t\t\tcase InlineEditTabAction.Inactive: border = inlineEditIndicatorSecondaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Jump: border = inlineEditIndicatorPrimaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Accept: border = inlineEditIndicatorsuccessfulBackground; break;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tborder: getEditorBlendedColor(border, themeService).read(reader).toString(),\n\t\t\t\tbackground: asCssVariable(editorBackground)\n\t\t\t};\n\t\t});\n\n\t\tconst state = displayLocation.map(dl => dl ? this.getState(dl) : undefined);\n\n\t\tconst view = state.map(s => s ? this.getRendering(s, styles) : undefined);\n\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst s = state.read(reader);\n\t\t\tif (!s) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn s.rect.read(reader).bottom + this._editor.getScrollTop();\n\t\t});\n\n\t\tconst overlay = n.div({\n\t\t\tclass: 'inline-edits-custom-view',\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'visible',\n\t\t\t\ttop: '0px',\n\t\t\t\tleft: '0px',\n\t\t\t\tdisplay: 'block',\n\t\t\t},\n\t\t}, [view]).keepUpdated(this._store);\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: overlay.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derivedObservableWithCache<number>(this, (reader, prev) => {\n\t\t\t\tconst s = state.read(reader);\n\t\t\t\tif (!s) { return prev ?? 0; }\n\n\t\t\t\tconst current = s.rect.map(rect => rect.right).read(reader)\n\t\t\t\t\t+ this._editorObs.layoutInfoVerticalScrollbarWidth.read(reader)\n\t\t\t\t\t+ PADDING_HORIZONTALLY\n\t\t\t\t\t- this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\t\treturn Math.max(prev ?? 0, current); // will run into infinite loop otherwise TODO: fix this\n\t\t\t}).recomputeInitiallyAndOnChange(this._store),\n\t\t}));\n\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst v = view.read(reader);\n\t\t\tif (!v) { this._isHovered.set(false, undefined); return; }\n\t\t\tthis._isHovered.set(overlay.isHovered.read(reader), undefined);\n\t\t}));\n\t}\n\n\t// TODO: this is very similar to side by side `fitsInsideViewport`, try to use the same function\n\tprivate fitsInsideViewport(range: LineRange, displayLabel: string, reader: IReader | undefined): boolean {\n\t\tconst editorWidth = this._editorObs.layoutInfoWidth.read(reader);\n\t\tconst editorContentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\tconst editorVerticalScrollbar = this._editor.getLayoutInfo().verticalScrollbarWidth;\n\t\tconst minimapWidth = this._editorObs.layoutInfoMinimap.read(reader).minimapLeft !== 0 ? this._editorObs.layoutInfoMinimap.read(reader).minimapWidth : 0;\n\n\t\tconst maxOriginalContent = maxContentWidthInRange(this._editorObs, range, undefined);\n\t\tconst maxModifiedContent = getContentRenderWidth(displayLabel, this._editor, this._editor.getModel()!);\n\t\tconst padding = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\n\t\treturn maxOriginalContent + maxModifiedContent + padding < editorWidth - editorContentLeft - editorVerticalScrollbar - minimapWidth;\n\t}\n\n\tprivate getState(displayLocation: InlineSuggestHint): { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle } {\n\n\t\tconst contentState = derived(this, (reader) => {\n\t\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t\tconst startColumn = displayLocation.range.startColumn;\n\t\t\tconst endColumn = displayLocation.range.endColumn;\n\t\t\tconst lineCount = this._editor.getModel()?.getLineCount() ?? 0;\n\n\t\t\tconst lineWidth = maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber, startLineNumber + 1), reader);\n\t\t\tconst lineWidthBelow = startLineNumber + 1 <= lineCount ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber + 1, startLineNumber + 2), reader) : undefined;\n\t\t\tconst lineWidthAbove = startLineNumber - 1 >= 1 ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber - 1, startLineNumber), reader) : undefined;\n\t\t\tconst startContentLeftOffset = this._editor.getOffsetForColumn(startLineNumber, startColumn);\n\t\t\tconst endContentLeftOffset = this._editor.getOffsetForColumn(endLineNumber, endColumn);\n\n\t\t\treturn {\n\t\t\t\tlineWidth,\n\t\t\t\tlineWidthBelow,\n\t\t\t\tlineWidthAbove,\n\t\t\t\tstartContentLeftOffset,\n\t\t\t\tendContentLeftOffset\n\t\t\t};\n\t\t});\n\n\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t// only check viewport once in the beginning when rendering the view\n\t\tconst fitsInsideViewport = this.fitsInsideViewport(new LineRange(startLineNumber, endLineNumber + 1), displayLocation.content, undefined);\n\n\t\tconst rect = derived(this, reader => {\n\t\t\tconst w = this._editorObs.getOption(EditorOption.fontInfo).read(reader).typicalHalfwidthCharacterWidth;\n\n\t\t\tconst { lineWidth, lineWidthBelow, lineWidthAbove, startContentLeftOffset, endContentLeftOffset } = contentState.read(reader);\n\n\t\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\tconst lineHeight = this._editorObs.observeLineHeightForLine(startLineNumber).recomputeInitiallyAndOnChange(reader.store).read(reader);\n\t\t\tconst scrollTop = this._editorObs.scrollTop.read(reader);\n\t\t\tconst scrollLeft = this._editorObs.scrollLeft.read(reader);\n\n\t\t\tlet position: 'end' | 'below' | 'above';\n\t\t\tif (startLineNumber === endLineNumber && endContentLeftOffset + 5 * w >= lineWidth && fitsInsideViewport) {\n\t\t\t\tposition = 'end'; // Render at the end of the line if the range ends almost at the end of the line\n\t\t\t} else if (lineWidthBelow !== undefined && lineWidthBelow + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'below'; // Render Below if possible\n\t\t\t} else if (lineWidthAbove !== undefined && lineWidthAbove + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'above'; // Render Above if possible\n\t\t\t} else {\n\t\t\t\tposition = 'end'; // Render at the end of the line otherwise\n\t\t\t}\n\n\t\t\tlet topOfLine;\n\t\t\tlet contentStartOffset;\n\t\t\tlet deltaX = 0;\n\t\t\tlet deltaY = 0;\n\n\t\t\tswitch (position) {\n\t\t\t\tcase 'end': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber);\n\t\t\t\t\tcontentStartOffset = lineWidth;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'below': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber + 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'above': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber - 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = -PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst textRect = Rect.fromLeftTopWidthHeight(\n\t\t\t\tcontentLeft + contentStartOffset - scrollLeft,\n\t\t\t\ttopOfLine - scrollTop,\n\t\t\t\tw * displayLocation.content.length,\n\t\t\t\tlineHeight\n\t\t\t);\n\n\t\t\treturn textRect.withMargin(PADDING_VERTICALLY, PADDING_HORIZONTALLY).translateX(deltaX).translateY(deltaY);\n\t\t});\n\n\t\treturn {\n\t\t\trect,\n\t\t\tlabel: displayLocation.content,\n\t\t\tkind: displayLocation.style\n\t\t};\n\t}\n\n\tprivate getRendering(state: { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle }, styles: IObservable<{ background: string; border: string }>) {\n\n\t\tconst line = document.createElement('div');\n\t\tconst t = this._editor.getModel()!.tokenization.tokenizeLinesAt(1, [state.label])?.[0];\n\t\tlet tokens: LineTokens;\n\t\tif (t && state.kind === InlineCompletionHintStyle.Code) {\n\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(state.label, this._languageService.languageIdCodec);\n\t\t} else {\n\t\t\ttokens = LineTokens.createEmpty(state.label, this._languageService.languageIdCodec);\n\t\t}\n\n\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor).withSetWidth(false).withScrollBeyondLastColumn(0), [], line, true);\n\t\tline.style.width = `${result.minWidthInPx}px`;\n\n\t\tconst rect = state.rect.map(r => r.withMargin(0, PADDING_HORIZONTALLY));\n\n\t\treturn n.div({\n\t\t\tclass: 'collapsedView',\n\t\t\tref: this._viewRef,\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\t...rectToProps(reader => rect.read(reader)),\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tboxSizing: 'border-box',\n\t\t\t\tcursor: 'pointer',\n\t\t\t\tborder: styles.map(s => `1px solid ${s.border}`),\n\t\t\t\tborderRadius: '4px',\n\t\t\t\tbackgroundColor: styles.map(s => s.background),\n\n\t\t\t\tdisplay: 'flex',\n\t\t\t\talignItems: 'center',\n\t\t\t\tjustifyContent: 'center',\n\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t},\n\t\t\tonmousedown: e => {\n\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t},\n\t\t\tonclick: (e) => { this._onDidClick.fire(new StandardMouseEvent(getWindow(e), e)); }\n\t\t}, [\n\t\t\tline\n\t\t]);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.ts","vs/editor/contrib/inlineCompletions/browser/view/inl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C;SAC1E,EAAE;YACF,IAAI;SACJ,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AA1OY,qBAAqB;IAiB/B,WAAA,aAAa,CAAA;IACb,WAAA,gBAAgB,CAAA;GAlBN,qBAAqB,CA0OjC","file":"inlineEditsCustomView.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 *--------------------------------------------------------------------------------------------*/\nimport { n } from '../../../../../../../base/browser/dom.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorun, constObservable, derived, derivedObservableWithCache, IObservable, IReader, observableValue } from '../../../../../../../base/common/observable.js';\nimport { editorBackground } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { InlineCompletionHintStyle } from '../../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineSuggestHint } from '../../../model/inlineSuggestionItem.js';\nimport { IInlineEditsView, InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBlendedColor, INLINE_EDITS_BORDER_RADIUS, inlineEditIndicatorPrimaryBackground, inlineEditIndicatorSecondaryBackground, inlineEditIndicatorSuccessfulBackground } from '../theme.js';\nimport { getContentRenderWidth, maxContentWidthInRange, rectToProps } from '../utils/utils.js';\n\nconst MIN_END_OF_LINE_PADDING = 14;\nconst PADDING_VERTICALLY = 0;\nconst PADDING_HORIZONTALLY = 4;\nconst HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW = 4;\nconst VERTICAL_OFFSET_WHEN_ABOVE_BELOW = 2;\n// !! minEndOfLinePadding should always be larger than paddingHorizontally + horizontalOffsetWhenAboveBelow\n\nexport class InlineEditsCustomView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick = this._register(new Emitter<InlineEditClickEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _isHovered = observableValue(this, false);\n\treadonly isHovered: IObservable<boolean> = this._isHovered;\n\tprivate readonly _viewRef = n.ref<HTMLDivElement>();\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\treadonly minEditorScrollHeight: IObservable<number>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tdisplayLocation: IObservable<InlineSuggestHint | undefined>,\n\t\ttabAction: IObservable<InlineEditTabAction>,\n\t\t@IThemeService themeService: IThemeService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst styles = tabAction.map((v, reader) => {\n\t\t\tlet border;\n\t\t\tswitch (v) {\n\t\t\t\tcase InlineEditTabAction.Inactive: border = inlineEditIndicatorSecondaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Jump: border = inlineEditIndicatorPrimaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Accept: border = inlineEditIndicatorSuccessfulBackground; break;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tborder: getEditorBlendedColor(border, themeService).read(reader).toString(),\n\t\t\t\tbackground: asCssVariable(editorBackground)\n\t\t\t};\n\t\t});\n\n\t\tconst state = displayLocation.map(dl => dl ? this.getState(dl) : undefined);\n\n\t\tconst view = state.map(s => s ? this.getRendering(s, styles) : undefined);\n\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst s = state.read(reader);\n\t\t\tif (!s) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn s.rect.read(reader).bottom + this._editor.getScrollTop();\n\t\t});\n\n\t\tconst overlay = n.div({\n\t\t\tclass: 'inline-edits-custom-view',\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'visible',\n\t\t\t\ttop: '0px',\n\t\t\t\tleft: '0px',\n\t\t\t\tdisplay: 'block',\n\t\t\t},\n\t\t}, [view]).keepUpdated(this._store);\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: overlay.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derivedObservableWithCache<number>(this, (reader, prev) => {\n\t\t\t\tconst s = state.read(reader);\n\t\t\t\tif (!s) { return prev ?? 0; }\n\n\t\t\t\tconst current = s.rect.map(rect => rect.right).read(reader)\n\t\t\t\t\t+ this._editorObs.layoutInfoVerticalScrollbarWidth.read(reader)\n\t\t\t\t\t+ PADDING_HORIZONTALLY\n\t\t\t\t\t- this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\t\treturn Math.max(prev ?? 0, current); // will run into infinite loop otherwise TODO: fix this\n\t\t\t}).recomputeInitiallyAndOnChange(this._store),\n\t\t}));\n\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst v = view.read(reader);\n\t\t\tif (!v) { this._isHovered.set(false, undefined); return; }\n\t\t\tthis._isHovered.set(overlay.isHovered.read(reader), undefined);\n\t\t}));\n\t}\n\n\t// TODO: this is very similar to side by side `fitsInsideViewport`, try to use the same function\n\tprivate fitsInsideViewport(range: LineRange, displayLabel: string, reader: IReader | undefined): boolean {\n\t\tconst editorWidth = this._editorObs.layoutInfoWidth.read(reader);\n\t\tconst editorContentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\tconst editorVerticalScrollbar = this._editor.getLayoutInfo().verticalScrollbarWidth;\n\t\tconst minimapWidth = this._editorObs.layoutInfoMinimap.read(reader).minimapLeft !== 0 ? this._editorObs.layoutInfoMinimap.read(reader).minimapWidth : 0;\n\n\t\tconst maxOriginalContent = maxContentWidthInRange(this._editorObs, range, undefined);\n\t\tconst maxModifiedContent = getContentRenderWidth(displayLabel, this._editor, this._editor.getModel()!);\n\t\tconst padding = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\n\t\treturn maxOriginalContent + maxModifiedContent + padding < editorWidth - editorContentLeft - editorVerticalScrollbar - minimapWidth;\n\t}\n\n\tprivate getState(displayLocation: InlineSuggestHint): { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle } {\n\n\t\tconst contentState = derived(this, (reader) => {\n\t\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t\tconst startColumn = displayLocation.range.startColumn;\n\t\t\tconst endColumn = displayLocation.range.endColumn;\n\t\t\tconst lineCount = this._editor.getModel()?.getLineCount() ?? 0;\n\n\t\t\tconst lineWidth = maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber, startLineNumber + 1), reader);\n\t\t\tconst lineWidthBelow = startLineNumber + 1 <= lineCount ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber + 1, startLineNumber + 2), reader) : undefined;\n\t\t\tconst lineWidthAbove = startLineNumber - 1 >= 1 ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber - 1, startLineNumber), reader) : undefined;\n\t\t\tconst startContentLeftOffset = this._editor.getOffsetForColumn(startLineNumber, startColumn);\n\t\t\tconst endContentLeftOffset = this._editor.getOffsetForColumn(endLineNumber, endColumn);\n\n\t\t\treturn {\n\t\t\t\tlineWidth,\n\t\t\t\tlineWidthBelow,\n\t\t\t\tlineWidthAbove,\n\t\t\t\tstartContentLeftOffset,\n\t\t\t\tendContentLeftOffset\n\t\t\t};\n\t\t});\n\n\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t// only check viewport once in the beginning when rendering the view\n\t\tconst fitsInsideViewport = this.fitsInsideViewport(new LineRange(startLineNumber, endLineNumber + 1), displayLocation.content, undefined);\n\n\t\tconst rect = derived(this, reader => {\n\t\t\tconst w = this._editorObs.getOption(EditorOption.fontInfo).read(reader).typicalHalfwidthCharacterWidth;\n\n\t\t\tconst { lineWidth, lineWidthBelow, lineWidthAbove, startContentLeftOffset, endContentLeftOffset } = contentState.read(reader);\n\n\t\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\tconst lineHeight = this._editorObs.observeLineHeightForLine(startLineNumber).recomputeInitiallyAndOnChange(reader.store).read(reader);\n\t\t\tconst scrollTop = this._editorObs.scrollTop.read(reader);\n\t\t\tconst scrollLeft = this._editorObs.scrollLeft.read(reader);\n\n\t\t\tlet position: 'end' | 'below' | 'above';\n\t\t\tif (startLineNumber === endLineNumber && endContentLeftOffset + 5 * w >= lineWidth && fitsInsideViewport) {\n\t\t\t\tposition = 'end'; // Render at the end of the line if the range ends almost at the end of the line\n\t\t\t} else if (lineWidthBelow !== undefined && lineWidthBelow + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'below'; // Render Below if possible\n\t\t\t} else if (lineWidthAbove !== undefined && lineWidthAbove + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'above'; // Render Above if possible\n\t\t\t} else {\n\t\t\t\tposition = 'end'; // Render at the end of the line otherwise\n\t\t\t}\n\n\t\t\tlet topOfLine;\n\t\t\tlet contentStartOffset;\n\t\t\tlet deltaX = 0;\n\t\t\tlet deltaY = 0;\n\n\t\t\tswitch (position) {\n\t\t\t\tcase 'end': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber);\n\t\t\t\t\tcontentStartOffset = lineWidth;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'below': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber + 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'above': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber - 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = -PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst textRect = Rect.fromLeftTopWidthHeight(\n\t\t\t\tcontentLeft + contentStartOffset - scrollLeft,\n\t\t\t\ttopOfLine - scrollTop,\n\t\t\t\tw * displayLocation.content.length,\n\t\t\t\tlineHeight\n\t\t\t);\n\n\t\t\treturn textRect.withMargin(PADDING_VERTICALLY, PADDING_HORIZONTALLY).translateX(deltaX).translateY(deltaY);\n\t\t});\n\n\t\treturn {\n\t\t\trect,\n\t\t\tlabel: displayLocation.content,\n\t\t\tkind: displayLocation.style\n\t\t};\n\t}\n\n\tprivate getRendering(state: { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle }, styles: IObservable<{ background: string; border: string }>) {\n\n\t\tconst line = document.createElement('div');\n\t\tconst t = this._editor.getModel()!.tokenization.tokenizeLinesAt(1, [state.label])?.[0];\n\t\tlet tokens: LineTokens;\n\t\tif (t && state.kind === InlineCompletionHintStyle.Code) {\n\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(state.label, this._languageService.languageIdCodec);\n\t\t} else {\n\t\t\ttokens = LineTokens.createEmpty(state.label, this._languageService.languageIdCodec);\n\t\t}\n\n\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor).withSetWidth(false).withScrollBeyondLastColumn(0), [], line, true);\n\t\tline.style.width = `${result.minWidthInPx}px`;\n\n\t\tconst rect = state.rect.map(r => r.withMargin(0, PADDING_HORIZONTALLY));\n\n\t\treturn n.div({\n\t\t\tclass: 'collapsedView',\n\t\t\tref: this._viewRef,\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\t...rectToProps(reader => rect.read(reader)),\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tboxSizing: 'border-box',\n\t\t\t\tcursor: 'pointer',\n\t\t\t\tborder: styles.map(s => `1px solid ${s.border}`),\n\t\t\t\tborderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,\n\t\t\t\tbackgroundColor: styles.map(s => s.background),\n\n\t\t\t\tdisplay: 'flex',\n\t\t\t\talignItems: 'center',\n\t\t\t\tjustifyContent: 'center',\n\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t},\n\t\t\tonmousedown: e => {\n\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t},\n\t\t\tonclick: (e) => { this._onDidClick.fire(InlineEditClickEvent.create(e)); }\n\t\t}, [\n\t\t\tline\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 *--------------------------------------------------------------------------------------------*/\nimport { n } from '../../../../../../../base/browser/dom.js';\nimport { Emitter } from '../../../../../../../base/common/event.js';\nimport { Disposable } from '../../../../../../../base/common/lifecycle.js';\nimport { autorun, constObservable, derived, derivedObservableWithCache, IObservable, IReader, observableValue } from '../../../../../../../base/common/observable.js';\nimport { editorBackground } from '../../../../../../../platform/theme/common/colorRegistry.js';\nimport { asCssVariable } from '../../../../../../../platform/theme/common/colorUtils.js';\nimport { IThemeService } from '../../../../../../../platform/theme/common/themeService.js';\nimport { ICodeEditor } from '../../../../../../browser/editorBrowser.js';\nimport { ObservableCodeEditor, observableCodeEditor } from '../../../../../../browser/observableCodeEditor.js';\nimport { LineSource, renderLines, RenderOptions } from '../../../../../../browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js';\nimport { EditorOption } from '../../../../../../common/config/editorOptions.js';\nimport { Rect } from '../../../../../../common/core/2d/rect.js';\nimport { LineRange } from '../../../../../../common/core/ranges/lineRange.js';\nimport { InlineCompletionHintStyle } from '../../../../../../common/languages.js';\nimport { ILanguageService } from '../../../../../../common/languages/language.js';\nimport { LineTokens, TokenArray } from '../../../../../../common/tokens/lineTokens.js';\nimport { InlineSuggestHint } from '../../../model/inlineSuggestionItem.js';\nimport { IInlineEditsView, InlineEditClickEvent, InlineEditTabAction } from '../inlineEditsViewInterface.js';\nimport { getEditorBlendedColor, INLINE_EDITS_BORDER_RADIUS, inlineEditIndicatorPrimaryBackground, inlineEditIndicatorSecondaryBackground, inlineEditIndicatorSuccessfulBackground } from '../theme.js';\nimport { getContentRenderWidth, maxContentWidthInRange, rectToProps } from '../utils/utils.js';\n\nconst MIN_END_OF_LINE_PADDING = 14;\nconst PADDING_VERTICALLY = 0;\nconst PADDING_HORIZONTALLY = 4;\nconst HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW = 4;\nconst VERTICAL_OFFSET_WHEN_ABOVE_BELOW = 2;\n// !! minEndOfLinePadding should always be larger than paddingHorizontally + horizontalOffsetWhenAboveBelow\n\nexport class InlineEditsCustomView extends Disposable implements IInlineEditsView {\n\n\tprivate readonly _onDidClick = this._register(new Emitter<InlineEditClickEvent>());\n\treadonly onDidClick = this._onDidClick.event;\n\n\tprivate readonly _isHovered = observableValue(this, false);\n\treadonly isHovered: IObservable<boolean> = this._isHovered;\n\tprivate readonly _viewRef = n.ref<HTMLDivElement>();\n\n\tprivate readonly _editorObs: ObservableCodeEditor;\n\n\treadonly minEditorScrollHeight: IObservable<number>;\n\n\tconstructor(\n\t\tprivate readonly _editor: ICodeEditor,\n\t\tdisplayLocation: IObservable<InlineSuggestHint | undefined>,\n\t\ttabAction: IObservable<InlineEditTabAction>,\n\t\t@IThemeService themeService: IThemeService,\n\t\t@ILanguageService private readonly _languageService: ILanguageService,\n\t) {\n\t\tsuper();\n\n\t\tthis._editorObs = observableCodeEditor(this._editor);\n\n\t\tconst styles = tabAction.map((v, reader) => {\n\t\t\tlet border;\n\t\t\tswitch (v) {\n\t\t\t\tcase InlineEditTabAction.Inactive: border = inlineEditIndicatorSecondaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Jump: border = inlineEditIndicatorPrimaryBackground; break;\n\t\t\t\tcase InlineEditTabAction.Accept: border = inlineEditIndicatorSuccessfulBackground; break;\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tborder: getEditorBlendedColor(border, themeService).read(reader).toString(),\n\t\t\t\tbackground: asCssVariable(editorBackground)\n\t\t\t};\n\t\t});\n\n\t\tconst state = displayLocation.map(dl => dl ? this.getState(dl) : undefined);\n\n\t\tconst view = state.map(s => s ? this.getRendering(s, styles) : undefined);\n\n\t\tthis.minEditorScrollHeight = derived(this, reader => {\n\t\t\tconst s = state.read(reader);\n\t\t\tif (!s) {\n\t\t\t\treturn 0;\n\t\t\t}\n\t\t\treturn s.rect.read(reader).bottom + this._editor.getScrollTop();\n\t\t});\n\n\t\tconst overlay = n.div({\n\t\t\tclass: 'inline-edits-custom-view',\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\toverflow: 'visible',\n\t\t\t\ttop: '0px',\n\t\t\t\tleft: '0px',\n\t\t\t\tdisplay: 'block',\n\t\t\t},\n\t\t}, [view]).keepUpdated(this._store);\n\n\t\tthis._register(this._editorObs.createOverlayWidget({\n\t\t\tdomNode: overlay.element,\n\t\t\tposition: constObservable(null),\n\t\t\tallowEditorOverflow: false,\n\t\t\tminContentWidthInPx: derivedObservableWithCache<number>(this, (reader, prev) => {\n\t\t\t\tconst s = state.read(reader);\n\t\t\t\tif (!s) { return prev ?? 0; }\n\n\t\t\t\tconst current = s.rect.map(rect => rect.right).read(reader)\n\t\t\t\t\t+ this._editorObs.layoutInfoVerticalScrollbarWidth.read(reader)\n\t\t\t\t\t+ PADDING_HORIZONTALLY\n\t\t\t\t\t- this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\t\treturn Math.max(prev ?? 0, current); // will run into infinite loop otherwise TODO: fix this\n\t\t\t}).recomputeInitiallyAndOnChange(this._store),\n\t\t}));\n\n\t\tthis._register(autorun((reader) => {\n\t\t\tconst v = view.read(reader);\n\t\t\tif (!v) { this._isHovered.set(false, undefined); return; }\n\t\t\tthis._isHovered.set(overlay.isHovered.read(reader), undefined);\n\t\t}));\n\t}\n\n\t// TODO: this is very similar to side by side `fitsInsideViewport`, try to use the same function\n\tprivate fitsInsideViewport(range: LineRange, displayLabel: string, reader: IReader | undefined): boolean {\n\t\tconst editorWidth = this._editorObs.layoutInfoWidth.read(reader);\n\t\tconst editorContentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\tconst editorVerticalScrollbar = this._editor.getLayoutInfo().verticalScrollbarWidth;\n\t\tconst minimapWidth = this._editorObs.layoutInfoMinimap.read(reader).minimapLeft !== 0 ? this._editorObs.layoutInfoMinimap.read(reader).minimapWidth : 0;\n\n\t\tconst maxOriginalContent = maxContentWidthInRange(this._editorObs, range, undefined);\n\t\tconst maxModifiedContent = getContentRenderWidth(displayLabel, this._editor, this._editor.getModel()!);\n\t\tconst padding = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\n\t\treturn maxOriginalContent + maxModifiedContent + padding < editorWidth - editorContentLeft - editorVerticalScrollbar - minimapWidth;\n\t}\n\n\tprivate getState(displayLocation: InlineSuggestHint): { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle } {\n\n\t\tconst contentState = derived(this, (reader) => {\n\t\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t\tconst startColumn = displayLocation.range.startColumn;\n\t\t\tconst endColumn = displayLocation.range.endColumn;\n\t\t\tconst lineCount = this._editor.getModel()?.getLineCount() ?? 0;\n\n\t\t\tconst lineWidth = maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber, startLineNumber + 1), reader);\n\t\t\tconst lineWidthBelow = startLineNumber + 1 <= lineCount ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber + 1, startLineNumber + 2), reader) : undefined;\n\t\t\tconst lineWidthAbove = startLineNumber - 1 >= 1 ? maxContentWidthInRange(this._editorObs, new LineRange(startLineNumber - 1, startLineNumber), reader) : undefined;\n\t\t\tconst startContentLeftOffset = this._editor.getOffsetForColumn(startLineNumber, startColumn);\n\t\t\tconst endContentLeftOffset = this._editor.getOffsetForColumn(endLineNumber, endColumn);\n\n\t\t\treturn {\n\t\t\t\tlineWidth,\n\t\t\t\tlineWidthBelow,\n\t\t\t\tlineWidthAbove,\n\t\t\t\tstartContentLeftOffset,\n\t\t\t\tendContentLeftOffset\n\t\t\t};\n\t\t});\n\n\t\tconst startLineNumber = displayLocation.range.startLineNumber;\n\t\tconst endLineNumber = displayLocation.range.endLineNumber;\n\t\t// only check viewport once in the beginning when rendering the view\n\t\tconst fitsInsideViewport = this.fitsInsideViewport(new LineRange(startLineNumber, endLineNumber + 1), displayLocation.content, undefined);\n\n\t\tconst rect = derived(this, reader => {\n\t\t\tconst w = this._editorObs.getOption(EditorOption.fontInfo).read(reader).typicalHalfwidthCharacterWidth;\n\n\t\t\tconst { lineWidth, lineWidthBelow, lineWidthAbove, startContentLeftOffset, endContentLeftOffset } = contentState.read(reader);\n\n\t\t\tconst contentLeft = this._editorObs.layoutInfoContentLeft.read(reader);\n\t\t\tconst lineHeight = this._editorObs.observeLineHeightForLine(startLineNumber).recomputeInitiallyAndOnChange(reader.store).read(reader);\n\t\t\tconst scrollTop = this._editorObs.scrollTop.read(reader);\n\t\t\tconst scrollLeft = this._editorObs.scrollLeft.read(reader);\n\n\t\t\tlet position: 'end' | 'below' | 'above';\n\t\t\tif (startLineNumber === endLineNumber && endContentLeftOffset + 5 * w >= lineWidth && fitsInsideViewport) {\n\t\t\t\tposition = 'end'; // Render at the end of the line if the range ends almost at the end of the line\n\t\t\t} else if (lineWidthBelow !== undefined && lineWidthBelow + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'below'; // Render Below if possible\n\t\t\t} else if (lineWidthAbove !== undefined && lineWidthAbove + MIN_END_OF_LINE_PADDING - HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW - PADDING_HORIZONTALLY < startContentLeftOffset) {\n\t\t\t\tposition = 'above'; // Render Above if possible\n\t\t\t} else {\n\t\t\t\tposition = 'end'; // Render at the end of the line otherwise\n\t\t\t}\n\n\t\t\tlet topOfLine;\n\t\t\tlet contentStartOffset;\n\t\t\tlet deltaX = 0;\n\t\t\tlet deltaY = 0;\n\n\t\t\tswitch (position) {\n\t\t\t\tcase 'end': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber);\n\t\t\t\t\tcontentStartOffset = lineWidth;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + MIN_END_OF_LINE_PADDING;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'below': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber + 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcase 'above': {\n\t\t\t\t\ttopOfLine = this._editorObs.editor.getTopForLineNumber(startLineNumber - 1);\n\t\t\t\t\tcontentStartOffset = startContentLeftOffset;\n\t\t\t\t\tdeltaX = PADDING_HORIZONTALLY + HORIZONTAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tdeltaY = -PADDING_VERTICALLY + VERTICAL_OFFSET_WHEN_ABOVE_BELOW;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst textRect = Rect.fromLeftTopWidthHeight(\n\t\t\t\tcontentLeft + contentStartOffset - scrollLeft,\n\t\t\t\ttopOfLine - scrollTop,\n\t\t\t\tw * displayLocation.content.length,\n\t\t\t\tlineHeight\n\t\t\t);\n\n\t\t\treturn textRect.withMargin(PADDING_VERTICALLY, PADDING_HORIZONTALLY).translateX(deltaX).translateY(deltaY);\n\t\t});\n\n\t\treturn {\n\t\t\trect,\n\t\t\tlabel: displayLocation.content,\n\t\t\tkind: displayLocation.style\n\t\t};\n\t}\n\n\tprivate getRendering(state: { rect: IObservable<Rect>; label: string; kind: InlineCompletionHintStyle }, styles: IObservable<{ background: string; border: string }>) {\n\n\t\tconst line = document.createElement('div');\n\t\tconst t = this._editor.getModel()!.tokenization.tokenizeLinesAt(1, [state.label])?.[0];\n\t\tlet tokens: LineTokens;\n\t\tif (t && state.kind === InlineCompletionHintStyle.Code) {\n\t\t\ttokens = TokenArray.fromLineTokens(t).toLineTokens(state.label, this._languageService.languageIdCodec);\n\t\t} else {\n\t\t\ttokens = LineTokens.createEmpty(state.label, this._languageService.languageIdCodec);\n\t\t}\n\n\t\tconst result = renderLines(new LineSource([tokens]), RenderOptions.fromEditor(this._editor).withSetWidth(false).withScrollBeyondLastColumn(0), [], line, true);\n\t\tline.style.width = `${result.minWidthInPx}px`;\n\n\t\tconst rect = state.rect.map(r => r.withMargin(0, PADDING_HORIZONTALLY));\n\n\t\treturn n.div({\n\t\t\tclass: 'collapsedView',\n\t\t\tref: this._viewRef,\n\t\t\tstyle: {\n\t\t\t\tposition: 'absolute',\n\t\t\t\t...rectToProps(reader => rect.read(reader)),\n\t\t\t\toverflow: 'hidden',\n\t\t\t\tboxSizing: 'border-box',\n\t\t\t\tcursor: 'pointer',\n\t\t\t\tborder: styles.map(s => `1px solid ${s.border}`),\n\t\t\t\tborderRadius: `${INLINE_EDITS_BORDER_RADIUS}px`,\n\t\t\t\tbackgroundColor: styles.map(s => s.background),\n\n\t\t\t\tdisplay: 'flex',\n\t\t\t\talignItems: 'center',\n\t\t\t\tjustifyContent: 'center',\n\t\t\t\twhiteSpace: 'nowrap',\n\t\t\t},\n\t\t\tonmousedown: e => {\n\t\t\t\te.preventDefault(); // This prevents that the editor loses focus\n\t\t\t},\n\t\t\tonclick: (e) => { this._onDidClick.fire(InlineEditClickEvent.create(e)); }\n\t\t}, [\n\t\t\tline\n\t\t]);\n\t}\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { n } from '../../../../../../../base/browser/dom.js';
|
|
6
|
-
import {
|
|
6
|
+
import { Event } from '../../../../../../../base/common/event.js';
|
|
7
7
|
import { Disposable } from '../../../../../../../base/common/lifecycle.js';
|
|
8
8
|
import { constObservable, derived, derivedObservableWithCache } from '../../../../../../../base/common/observable.js';
|
|
9
9
|
import { editorBackground } from '../../../../../../../platform/theme/common/colorRegistry.js';
|
|
@@ -12,14 +12,14 @@ import { observableCodeEditor } from '../../../../../../browser/observableCodeEd
|
|
|
12
12
|
import { Rect } from '../../../../../../common/core/2d/rect.js';
|
|
13
13
|
import { OffsetRange } from '../../../../../../common/core/ranges/offsetRange.js';
|
|
14
14
|
import { Position } from '../../../../../../common/core/position.js';
|
|
15
|
-
import { getOriginalBorderColor, originalBackgroundColor } from '../theme.js';
|
|
15
|
+
import { getOriginalBorderColor, INLINE_EDITS_BORDER_RADIUS, originalBackgroundColor } from '../theme.js';
|
|
16
16
|
import { getPrefixTrim, mapOutFalsy, maxContentWidthInRange } from '../utils/utils.js';
|
|
17
17
|
const HORIZONTAL_PADDING = 0;
|
|
18
18
|
const VERTICAL_PADDING = 0;
|
|
19
19
|
const BORDER_WIDTH = 1;
|
|
20
20
|
const WIDGET_SEPARATOR_WIDTH = 1;
|
|
21
21
|
const WIDGET_SEPARATOR_DIFF_EDITOR_WIDTH = 3;
|
|
22
|
-
const BORDER_RADIUS =
|
|
22
|
+
const BORDER_RADIUS = INLINE_EDITS_BORDER_RADIUS;
|
|
23
23
|
export class InlineEditsDeletionView extends Disposable {
|
|
24
24
|
constructor(_editor, _edit, _uiState, _tabAction) {
|
|
25
25
|
super();
|
|
@@ -27,8 +27,7 @@ export class InlineEditsDeletionView extends Disposable {
|
|
|
27
27
|
this._edit = _edit;
|
|
28
28
|
this._uiState = _uiState;
|
|
29
29
|
this._tabAction = _tabAction;
|
|
30
|
-
this.
|
|
31
|
-
this.onDidClick = this._onDidClick.event;
|
|
30
|
+
this.onDidClick = Event.None;
|
|
32
31
|
this._display = derived(this, reader => !!this._uiState.read(reader) ? 'block' : 'none');
|
|
33
32
|
this._editorMaxContentWidthInRange = derived(this, reader => {
|
|
34
33
|
const originalDisplayRange = this._originalDisplayRange.read(reader);
|