monaco-editor-core 0.56.0-dev-20251125 → 0.56.0-dev-20251218
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/nls.keys.json +1 -1
- package/esm/nls.messages.cs.js +2 -2
- package/esm/nls.messages.de.js +2 -2
- package/esm/nls.messages.es.js +2 -2
- package/esm/nls.messages.fr.js +2 -2
- package/esm/nls.messages.it.js +2 -2
- package/esm/nls.messages.ja.js +2 -2
- package/esm/nls.messages.js +1 -1
- package/esm/nls.messages.json +1 -1
- package/esm/nls.messages.ko.js +2 -2
- package/esm/nls.messages.pl.js +2 -2
- package/esm/nls.messages.pt-br.js +2 -2
- package/esm/nls.messages.ru.js +2 -2
- package/esm/nls.messages.tr.js +2 -2
- package/esm/nls.messages.zh-cn.js +2 -2
- package/esm/nls.messages.zh-tw.js +2 -2
- package/esm/nls.metadata.json +34 -6
- package/esm/vs/base/browser/dom.js +1 -4
- package/esm/vs/base/browser/dom.js.map +1 -1
- package/esm/vs/base/browser/markdownRenderer.js +25 -11
- package/esm/vs/base/browser/markdownRenderer.js.map +1 -1
- package/esm/vs/base/browser/ui/actionbar/actionViewItems.js.map +1 -1
- package/esm/vs/base/browser/ui/button/button.js +15 -8
- package/esm/vs/base/browser/ui/button/button.js.map +1 -1
- package/esm/vs/base/browser/ui/codicons/codicon/codicon-modifiers.css +3 -8
- package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/esm/vs/base/browser/ui/findinput/findInput.js +6 -1
- package/esm/vs/base/browser/ui/findinput/findInput.js.map +1 -1
- package/esm/vs/base/browser/ui/inputbox/inputBox.js +17 -1
- package/esm/vs/base/browser/ui/inputbox/inputBox.js.map +1 -1
- package/esm/vs/base/browser/ui/list/list.css +1 -0
- package/esm/vs/base/browser/ui/toggle/toggle.js +78 -6
- package/esm/vs/base/browser/ui/toggle/toggle.js.map +1 -1
- package/esm/vs/base/browser/ui/toolbar/toolbar.js +3 -0
- package/esm/vs/base/browser/ui/toolbar/toolbar.js.map +1 -1
- package/esm/vs/base/common/codiconsLibrary.js +11 -2
- package/esm/vs/base/common/codiconsLibrary.js.map +1 -1
- package/esm/vs/base/common/defaultAccount.js +6 -0
- package/esm/vs/base/common/defaultAccount.js.map +1 -0
- package/esm/vs/base/common/equals.js +73 -24
- package/esm/vs/base/common/equals.js.map +1 -1
- package/esm/vs/base/common/event.js +14 -4
- package/esm/vs/base/common/event.js.map +1 -1
- package/esm/vs/base/common/iterator.js.map +1 -1
- package/esm/vs/base/common/keybindings.js +0 -8
- package/esm/vs/base/common/keybindings.js.map +1 -1
- package/esm/vs/base/common/lifecycle.js +2 -2
- package/esm/vs/base/common/lifecycle.js.map +1 -1
- package/esm/vs/base/common/marshallingIds.js.map +1 -1
- package/esm/vs/base/common/observableInternal/index.js +1 -1
- package/esm/vs/base/common/observableInternal/index.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js +1 -1
- package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js.map +1 -1
- package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js +16 -0
- package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js.map +1 -1
- package/esm/vs/base/common/observableInternal/utils/utils.js +11 -0
- package/esm/vs/base/common/observableInternal/utils/utils.js.map +1 -1
- package/esm/vs/base/common/product.js.map +1 -1
- package/esm/vs/base/common/strings.js +3 -1
- package/esm/vs/base/common/strings.js.map +1 -1
- package/esm/vs/editor/browser/controller/dragScrolling.js +2 -1
- package/esm/vs/editor/browser/controller/dragScrolling.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js +73 -2
- package/esm/vs/editor/browser/controller/editContext/clipboardUtils.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +7 -51
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/screenReaderUtils.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +7 -20
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js +14 -44
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextInput.js.map +1 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.js +19 -0
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextRegistry.js.map +1 -0
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextState.js +14 -1
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContextState.js.map +1 -1
- package/esm/vs/editor/browser/controller/mouseHandler.js +5 -2
- package/esm/vs/editor/browser/controller/mouseHandler.js.map +1 -1
- package/esm/vs/editor/browser/editorBrowser.js.map +1 -1
- package/esm/vs/editor/browser/observableCodeEditor.js +32 -15
- package/esm/vs/editor/browser/observableCodeEditor.js.map +1 -1
- package/esm/vs/editor/browser/services/editorWorkerService.js +6 -2
- package/esm/vs/editor/browser/services/editorWorkerService.js.map +1 -1
- package/esm/vs/editor/browser/view.js +11 -2
- package/esm/vs/editor/browser/view.js.map +1 -1
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +5 -2
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js.map +1 -1
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +10 -0
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js.map +1 -1
- package/esm/vs/editor/browser/widget/multiDiffEditor/style.css +48 -0
- package/esm/vs/editor/common/config/editorConfigurationSchema.js +49 -47
- package/esm/vs/editor/common/config/editorConfigurationSchema.js.map +1 -1
- package/esm/vs/editor/common/config/editorOptions.js +410 -410
- package/esm/vs/editor/common/config/fontInfo.js +1 -1
- package/esm/vs/editor/common/config/fontInfo.js.map +1 -1
- package/esm/vs/editor/common/core/editorColorRegistry.js +69 -69
- package/esm/vs/editor/common/core/edits/edit.js +19 -0
- package/esm/vs/editor/common/core/edits/edit.js.map +1 -1
- package/esm/vs/editor/common/core/edits/stringEdit.js +13 -0
- package/esm/vs/editor/common/core/edits/stringEdit.js.map +1 -1
- package/esm/vs/editor/common/core/edits/textEdit.js +0 -3
- package/esm/vs/editor/common/core/edits/textEdit.js.map +1 -1
- package/esm/vs/editor/common/core/text/positionToOffsetImpl.js +24 -10
- package/esm/vs/editor/common/core/text/positionToOffsetImpl.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorMoveCommands.js +4 -4
- package/esm/vs/editor/common/cursor/cursorMoveCommands.js.map +1 -1
- package/esm/vs/editor/common/cursor/cursorWordOperations.js +6 -3
- package/esm/vs/editor/common/cursor/cursorWordOperations.js.map +1 -1
- package/esm/vs/editor/common/editorContextKeys.js +47 -47
- package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js +2 -2
- package/esm/vs/editor/common/languages/defaultDocumentColorsComputer.js.map +1 -1
- package/esm/vs/editor/common/languages/modesRegistry.js +1 -1
- package/esm/vs/editor/common/languages/nullTokenize.js +1 -1
- package/esm/vs/editor/common/languages/nullTokenize.js.map +1 -1
- package/esm/vs/editor/common/languages/supports/tokenization.js +3 -0
- package/esm/vs/editor/common/languages/supports/tokenization.js.map +1 -1
- package/esm/vs/editor/common/languages.js +58 -57
- package/esm/vs/editor/common/languages.js.map +1 -1
- package/esm/vs/editor/common/model/decorationProvider.js +21 -1
- package/esm/vs/editor/common/model/decorationProvider.js.map +1 -1
- package/esm/vs/editor/common/model/editStack.js +1 -1
- package/esm/vs/editor/common/model/textModel.js +49 -30
- package/esm/vs/editor/common/model/textModel.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/abstractSyntaxTokenBackend.js +6 -3
- package/esm/vs/editor/common/model/tokens/abstractSyntaxTokenBackend.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/annotations.js +177 -0
- package/esm/vs/editor/common/model/tokens/annotations.js.map +1 -0
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js +131 -0
- package/esm/vs/editor/common/model/tokens/tokenizationFontDecorationsProvider.js.map +1 -0
- package/esm/vs/editor/common/model/tokens/tokenizationTextModelPart.js +9 -0
- package/esm/vs/editor/common/model/tokens/tokenizationTextModelPart.js.map +1 -1
- package/esm/vs/editor/common/model/tokens/tokenizerSyntaxTokenBackend.js +9 -0
- package/esm/vs/editor/common/model/tokens/tokenizerSyntaxTokenBackend.js.map +1 -1
- package/esm/vs/editor/common/standaloneStrings.js +11 -11
- package/esm/vs/editor/common/textModelEditSource.js +2 -0
- package/esm/vs/editor/common/textModelEditSource.js.map +1 -1
- package/esm/vs/editor/common/textModelEvents.js.map +1 -1
- package/esm/vs/editor/common/viewLayout/lineDecorations.js.map +1 -1
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +3 -3
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js.map +1 -1
- package/esm/vs/editor/contrib/anchorSelect/browser/anchorSelect.js +6 -6
- package/esm/vs/editor/contrib/bracketMatching/browser/bracketMatching.js +6 -6
- package/esm/vs/editor/contrib/caretOperations/browser/caretOperations.js +2 -2
- package/esm/vs/editor/contrib/caretOperations/browser/transpose.js +1 -1
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js +71 -53
- package/esm/vs/editor/contrib/clipboard/browser/clipboard.js.map +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeAction.js +1 -1
- package/esm/vs/editor/contrib/codeAction/browser/codeActionCommands.js +29 -29
- package/esm/vs/editor/contrib/codeAction/browser/codeActionContributions.js +3 -3
- package/esm/vs/editor/contrib/codeAction/browser/codeActionController.js +3 -3
- package/esm/vs/editor/contrib/codeAction/browser/codeActionMenu.js +8 -8
- package/esm/vs/editor/contrib/codeAction/browser/lightBulbWidget.js +9 -9
- package/esm/vs/editor/contrib/codelens/browser/codelensController.js +2 -2
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerCloseButton.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/colorPickerParts/colorPickerHeader.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerActions.js +7 -7
- package/esm/vs/editor/contrib/comment/browser/comment.js +6 -6
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js +10 -10
- package/esm/vs/editor/contrib/cursorUndo/browser/cursorUndo.js +2 -2
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteContribution.js +4 -4
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +23 -10
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js.map +1 -1
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +8 -8
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +3 -3
- package/esm/vs/editor/contrib/dropOrPasteInto/browser/postEditWidget.js +2 -2
- package/esm/vs/editor/contrib/editorState/browser/keybindingCancellation.js +1 -1
- package/esm/vs/editor/contrib/find/browser/findController.js +16 -16
- package/esm/vs/editor/contrib/find/browser/findWidget.js +26 -26
- package/esm/vs/editor/contrib/floatingMenu/browser/floatingMenu.css +1 -1
- package/esm/vs/editor/contrib/folding/browser/folding.js +20 -20
- package/esm/vs/editor/contrib/folding/browser/folding.js.map +1 -1
- package/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +9 -9
- package/esm/vs/editor/contrib/fontZoom/browser/fontZoom.js +3 -3
- package/esm/vs/editor/contrib/format/browser/formatActions.js +2 -2
- package/esm/vs/editor/contrib/gotoError/browser/gotoError.js +8 -8
- package/esm/vs/editor/contrib/gotoError/browser/gotoErrorWidget.js +14 -14
- package/esm/vs/editor/contrib/gotoSymbol/browser/goToCommands.js +39 -39
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesTree.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.js +3 -3
- package/esm/vs/editor/contrib/gotoSymbol/browser/referencesModel.js +8 -8
- package/esm/vs/editor/contrib/gotoSymbol/browser/symbolNavigation.js +3 -3
- package/esm/vs/editor/contrib/gpu/browser/gpuActions.js +4 -4
- package/esm/vs/editor/contrib/hover/browser/hover.css +1 -1
- package/esm/vs/editor/contrib/hover/browser/hoverActionIds.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/hoverActions.js +24 -24
- package/esm/vs/editor/contrib/hover/browser/hoverCopyButton.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +10 -10
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js.map +1 -1
- package/esm/vs/editor/contrib/hover/browser/markerHoverParticipant.js +5 -5
- package/esm/vs/editor/contrib/inPlaceReplace/browser/inPlaceReplace.js +2 -2
- package/esm/vs/editor/contrib/indentation/browser/indentation.js +20 -20
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js +1 -0
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsController.js.map +1 -1
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsHover.js +8 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commandIds.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +50 -21
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +13 -12
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +7 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +5 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js +2 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/inlineCompletions.contribution.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/InlineSuggestAlternativeAction.js +8 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/InlineSuggestAlternativeAction.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/editKind.js +198 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/editKind.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionIsVisible.js +40 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionIsVisible.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +128 -70
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js +59 -11
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsSource.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js +152 -95
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineSuggestionItem.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js +113 -54
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/provideInlineCompletions.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js +317 -75
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/renameSymbolProcessor.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/telemetry.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/utils.js +20 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/utils.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +59 -42
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +29 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +78 -46
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js +9 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditWithChanges.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +11 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js +81 -41
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js +48 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewInterface.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js +18 -15
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.js +3 -4
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCollapsedView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js +6 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsCustomView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js +4 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsDeletionView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js +4 -3
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsInsertionView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js +8 -8
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsLineReplacementView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js +9 -7
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsSideBySideView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js +203 -41
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/inlineEditsWordReplacementView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/jumpToView.js +189 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/jumpToView.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js +85 -102
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/inlineEditsLongDistanceHint.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js +75 -32
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistancePreviewEditor.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistnaceWidgetPlacement.js +121 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/longDistanceHint/longDistnaceWidgetPlacement.js.map +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js +2 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViews/originalEditorInlineDiffView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +22 -20
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js +15 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/utils/utils.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/view.css +39 -6
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js +10 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineSuggestionsView.js.map +1 -1
- package/esm/vs/editor/contrib/insertFinalNewLine/browser/insertFinalNewLine.js +1 -1
- package/esm/vs/editor/contrib/lineSelection/browser/lineSelection.js +1 -1
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js +32 -32
- package/esm/vs/editor/contrib/linesOperations/browser/linesOperations.js.map +1 -1
- package/esm/vs/editor/contrib/linkedEditing/browser/linkedEditing.js +2 -2
- package/esm/vs/editor/contrib/links/browser/links.js +10 -10
- package/esm/vs/editor/contrib/message/browser/messageController.js +1 -1
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +22 -22
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +4 -4
- package/esm/vs/editor/contrib/peekView/browser/peekView.js +18 -18
- package/esm/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +25 -27
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js.map +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
- package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +2 -2
- package/esm/vs/editor/contrib/rename/browser/rename.js +19 -15
- package/esm/vs/editor/contrib/rename/browser/rename.js.map +1 -1
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
- package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js +3 -2
- package/esm/vs/editor/contrib/sectionHeaders/browser/sectionHeaders.js.map +1 -1
- package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetParser.js +33 -0
- package/esm/vs/editor/contrib/snippet/browser/snippetParser.js.map +1 -1
- package/esm/vs/editor/contrib/snippet/browser/snippetVariables.js +4 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollActions.js +11 -11
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js +12 -4
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js.map +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js +1 -0
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggest.js +9 -8
- package/esm/vs/editor/contrib/suggest/browser/suggest.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js +39 -28
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js +1 -0
- package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +22 -18
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +28 -6
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js.map +1 -1
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +1 -1
- package/esm/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +33 -33
- package/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js +4 -4
- package/esm/vs/editor/contrib/tokenization/browser/tokenization.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/bannerController.js +1 -1
- package/esm/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +24 -24
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +5 -5
- package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +3 -3
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +19 -2
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js.map +1 -1
- package/esm/vs/editor/editor.api.d.ts +34 -3
- package/esm/vs/editor/standalone/browser/standaloneLanguages.js +2 -2
- package/esm/vs/editor/standalone/browser/standaloneLanguages.js.map +1 -1
- package/esm/vs/editor/standalone/browser/standaloneServices.js +11 -1
- package/esm/vs/editor/standalone/browser/standaloneServices.js.map +1 -1
- package/esm/vs/editor/standalone/common/monarch/monarchLexer.js +1 -1
- package/esm/vs/editor/standalone/common/monarch/monarchLexer.js.map +1 -1
- package/esm/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +62 -62
- package/esm/vs/platform/action/common/actionCommonCategories.js +6 -6
- package/esm/vs/platform/actionWidget/browser/actionList.js +4 -4
- package/esm/vs/platform/actionWidget/browser/actionWidget.css +11 -8
- package/esm/vs/platform/actionWidget/browser/actionWidget.js +7 -7
- package/esm/vs/platform/actions/browser/menuEntryActionViewItem.js +5 -5
- package/esm/vs/platform/actions/browser/toolbar.js +2 -2
- package/esm/vs/platform/actions/common/actions.js +11 -5
- package/esm/vs/platform/actions/common/actions.js.map +1 -1
- package/esm/vs/platform/actions/common/menuService.js +2 -2
- package/esm/vs/platform/configuration/common/configurationRegistry.js +10 -10
- package/esm/vs/platform/contextkey/browser/contextKeyService.js +1 -1
- package/esm/vs/platform/contextkey/common/contextkey.js +9 -9
- package/esm/vs/platform/contextkey/common/contextkeys.js +9 -9
- package/esm/vs/platform/contextkey/common/scanner.js +5 -5
- package/esm/vs/platform/{product/common/productService.js → defaultAccount/common/defaultAccount.js} +2 -2
- package/esm/vs/platform/defaultAccount/common/defaultAccount.js.map +1 -0
- package/esm/vs/platform/history/browser/contextScopedHistoryWidget.js +1 -1
- package/esm/vs/platform/hover/browser/hoverWidget.js +1 -1
- package/esm/vs/platform/hover/browser/updatableHoverWidget.js +1 -1
- package/esm/vs/platform/instantiation/common/instantiation.js.map +1 -1
- package/esm/vs/platform/instantiation/common/instantiationService.js +1 -8
- package/esm/vs/platform/instantiation/common/instantiationService.js.map +1 -1
- package/esm/vs/platform/keybinding/common/abstractKeybindingService.js +4 -4
- package/esm/vs/platform/list/browser/listService.js +27 -27
- package/esm/vs/platform/log/common/log.js +1 -1
- package/esm/vs/platform/log/common/log.js.map +1 -1
- package/esm/vs/platform/markers/common/markerService.js +6 -6
- package/esm/vs/platform/markers/common/markerService.js.map +1 -1
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +8 -8
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/media/quickInput.css +45 -7
- package/esm/vs/platform/quickinput/browser/quickInput.js +51 -15
- package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputActions.js +5 -5
- package/esm/vs/platform/quickinput/browser/quickInputBox.js +13 -1
- package/esm/vs/platform/quickinput/browser/quickInputBox.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputController.js +22 -12
- package/esm/vs/platform/quickinput/browser/quickInputController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputList.js +17 -12
- package/esm/vs/platform/quickinput/browser/quickInputList.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +36 -8
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeController.js +3 -3
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeRenderer.js +8 -4
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeRenderer.js.map +1 -1
- package/esm/vs/platform/quickinput/common/quickInput.js.map +1 -1
- package/esm/vs/platform/theme/common/colorUtils.js +2 -2
- package/esm/vs/platform/theme/common/colors/baseColors.js +18 -17
- package/esm/vs/platform/theme/common/colors/baseColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/chartsColors.js +8 -8
- package/esm/vs/platform/theme/common/colors/editorColors.js +95 -95
- package/esm/vs/platform/theme/common/colors/inputColors.js +47 -47
- package/esm/vs/platform/theme/common/colors/listColors.js +36 -36
- package/esm/vs/platform/theme/common/colors/menuColors.js +7 -7
- package/esm/vs/platform/theme/common/colors/minimapColors.js +13 -13
- package/esm/vs/platform/theme/common/colors/minimapColors.js.map +1 -1
- package/esm/vs/platform/theme/common/colors/miscColors.js +16 -16
- package/esm/vs/platform/theme/common/colors/quickpickColors.js +9 -9
- package/esm/vs/platform/theme/common/colors/searchColors.js +3 -3
- package/esm/vs/platform/theme/common/iconRegistry.js +6 -6
- package/esm/vs/platform/undoRedo/common/undoRedoService.js +21 -21
- package/esm/vs/platform/undoRedo/common/undoRedoService.js.map +1 -1
- package/esm/vs/platform/window/common/window.js +1 -1
- package/esm/vs/platform/window/common/window.js.map +1 -1
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/monaco.d.ts +34 -3
- package/package.json +2 -2
- package/version.txt +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js +0 -16
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineEdit.js.map +0 -1
- package/esm/vs/platform/product/common/productService.js.map +0 -1
|
@@ -5,15 +5,12 @@
|
|
|
5
5
|
import * as browser from '../../../../base/browser/browser.js';
|
|
6
6
|
import { getActiveDocument, getActiveWindow } from '../../../../base/browser/dom.js';
|
|
7
7
|
import * as platform from '../../../../base/common/platform.js';
|
|
8
|
-
import { StopWatch } from '../../../../base/common/stopwatch.js';
|
|
9
8
|
import * as nls from '../../../../nls.js';
|
|
10
9
|
import { MenuId, MenuRegistry } from '../../../../platform/actions/common/actions.js';
|
|
11
10
|
import { IClipboardService } from '../../../../platform/clipboard/common/clipboardService.js';
|
|
12
11
|
import { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';
|
|
13
12
|
import { ILogService } from '../../../../platform/log/common/log.js';
|
|
14
|
-
import {
|
|
15
|
-
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';
|
|
16
|
-
import { CopyOptions, InMemoryClipboardMetadataManager } from '../../../browser/controller/editContext/clipboardUtils.js';
|
|
13
|
+
import { CopyOptions, generateDataToCopyAndStoreInMemory, InMemoryClipboardMetadataManager, PasteOptions } from '../../../browser/controller/editContext/clipboardUtils.js';
|
|
17
14
|
import { NativeEditContextRegistry } from '../../../browser/controller/editContext/native/nativeEditContextRegistry.js';
|
|
18
15
|
import { EditorAction, MultiCommand, registerEditorAction } from '../../../browser/editorExtensions.js';
|
|
19
16
|
import { ICodeEditorService } from '../../../browser/services/codeEditorService.js';
|
|
@@ -44,23 +41,23 @@ export const CutAction = supportsCut ? registerCommand(new MultiCommand({
|
|
|
44
41
|
menuOpts: [{
|
|
45
42
|
menuId: MenuId.MenubarEditMenu,
|
|
46
43
|
group: '2_ccp',
|
|
47
|
-
title: nls.localize(
|
|
44
|
+
title: nls.localize(820, "Cu&&t"),
|
|
48
45
|
order: 1
|
|
49
46
|
}, {
|
|
50
47
|
menuId: MenuId.EditorContext,
|
|
51
48
|
group: CLIPBOARD_CONTEXT_MENU_GROUP,
|
|
52
|
-
title: nls.localize(
|
|
49
|
+
title: nls.localize(821, "Cut"),
|
|
53
50
|
when: EditorContextKeys.writable,
|
|
54
51
|
order: 1,
|
|
55
52
|
}, {
|
|
56
53
|
menuId: MenuId.CommandPalette,
|
|
57
54
|
group: '',
|
|
58
|
-
title: nls.localize(
|
|
55
|
+
title: nls.localize(822, "Cut"),
|
|
59
56
|
order: 1
|
|
60
57
|
}, {
|
|
61
58
|
menuId: MenuId.SimpleEditorContext,
|
|
62
59
|
group: CLIPBOARD_CONTEXT_MENU_GROUP,
|
|
63
|
-
title: nls.localize(
|
|
60
|
+
title: nls.localize(823, "Cut"),
|
|
64
61
|
when: EditorContextKeys.writable,
|
|
65
62
|
order: 1,
|
|
66
63
|
}]
|
|
@@ -79,29 +76,29 @@ export const CopyAction = supportsCopy ? registerCommand(new MultiCommand({
|
|
|
79
76
|
menuOpts: [{
|
|
80
77
|
menuId: MenuId.MenubarEditMenu,
|
|
81
78
|
group: '2_ccp',
|
|
82
|
-
title: nls.localize(
|
|
79
|
+
title: nls.localize(824, "&&Copy"),
|
|
83
80
|
order: 2
|
|
84
81
|
}, {
|
|
85
82
|
menuId: MenuId.EditorContext,
|
|
86
83
|
group: CLIPBOARD_CONTEXT_MENU_GROUP,
|
|
87
|
-
title: nls.localize(
|
|
84
|
+
title: nls.localize(825, "Copy"),
|
|
88
85
|
order: 2,
|
|
89
86
|
}, {
|
|
90
87
|
menuId: MenuId.CommandPalette,
|
|
91
88
|
group: '',
|
|
92
|
-
title: nls.localize(
|
|
89
|
+
title: nls.localize(826, "Copy"),
|
|
93
90
|
order: 1
|
|
94
91
|
}, {
|
|
95
92
|
menuId: MenuId.SimpleEditorContext,
|
|
96
93
|
group: CLIPBOARD_CONTEXT_MENU_GROUP,
|
|
97
|
-
title: nls.localize(
|
|
94
|
+
title: nls.localize(827, "Copy"),
|
|
98
95
|
order: 2,
|
|
99
96
|
}]
|
|
100
97
|
})) : undefined;
|
|
101
|
-
MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { submenu: MenuId.MenubarCopy, title: nls.localize2(
|
|
102
|
-
MenuRegistry.appendMenuItem(MenuId.EditorContext, { submenu: MenuId.EditorContextCopy, title: nls.localize2(
|
|
103
|
-
MenuRegistry.appendMenuItem(MenuId.EditorContext, { submenu: MenuId.EditorContextShare, title: nls.localize2(
|
|
104
|
-
MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { submenu: MenuId.ExplorerContextShare, title: nls.localize2(
|
|
98
|
+
MenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { submenu: MenuId.MenubarCopy, title: nls.localize2(832, "Copy As"), group: '2_ccp', order: 3 });
|
|
99
|
+
MenuRegistry.appendMenuItem(MenuId.EditorContext, { submenu: MenuId.EditorContextCopy, title: nls.localize2(833, "Copy As"), group: CLIPBOARD_CONTEXT_MENU_GROUP, order: 3 });
|
|
100
|
+
MenuRegistry.appendMenuItem(MenuId.EditorContext, { submenu: MenuId.EditorContextShare, title: nls.localize2(834, "Share"), group: '11_share', order: -1, when: ContextKeyExpr.and(ContextKeyExpr.notEquals('resourceScheme', 'output'), EditorContextKeys.editorTextFocus) });
|
|
101
|
+
MenuRegistry.appendMenuItem(MenuId.ExplorerContext, { submenu: MenuId.ExplorerContextShare, title: nls.localize2(835, "Share"), group: '11_share', order: -1 });
|
|
105
102
|
export const PasteAction = supportsPaste ? registerCommand(new MultiCommand({
|
|
106
103
|
id: 'editor.action.clipboardPasteAction',
|
|
107
104
|
precondition: undefined,
|
|
@@ -117,23 +114,23 @@ export const PasteAction = supportsPaste ? registerCommand(new MultiCommand({
|
|
|
117
114
|
menuOpts: [{
|
|
118
115
|
menuId: MenuId.MenubarEditMenu,
|
|
119
116
|
group: '2_ccp',
|
|
120
|
-
title: nls.localize(
|
|
117
|
+
title: nls.localize(828, "&&Paste"),
|
|
121
118
|
order: 4
|
|
122
119
|
}, {
|
|
123
120
|
menuId: MenuId.EditorContext,
|
|
124
121
|
group: CLIPBOARD_CONTEXT_MENU_GROUP,
|
|
125
|
-
title: nls.localize(
|
|
122
|
+
title: nls.localize(829, "Paste"),
|
|
126
123
|
when: EditorContextKeys.writable,
|
|
127
124
|
order: 4,
|
|
128
125
|
}, {
|
|
129
126
|
menuId: MenuId.CommandPalette,
|
|
130
127
|
group: '',
|
|
131
|
-
title: nls.localize(
|
|
128
|
+
title: nls.localize(830, "Paste"),
|
|
132
129
|
order: 1
|
|
133
130
|
}, {
|
|
134
131
|
menuId: MenuId.SimpleEditorContext,
|
|
135
132
|
group: CLIPBOARD_CONTEXT_MENU_GROUP,
|
|
136
|
-
title: nls.localize(
|
|
133
|
+
title: nls.localize(831, "Paste"),
|
|
137
134
|
when: EditorContextKeys.writable,
|
|
138
135
|
order: 4,
|
|
139
136
|
}]
|
|
@@ -142,7 +139,7 @@ class ExecCommandCopyWithSyntaxHighlightingAction extends EditorAction {
|
|
|
142
139
|
constructor() {
|
|
143
140
|
super({
|
|
144
141
|
id: 'editor.action.clipboardCopyWithSyntaxHighlightingAction',
|
|
145
|
-
label: nls.localize2(
|
|
142
|
+
label: nls.localize2(836, "Copy with Syntax Highlighting"),
|
|
146
143
|
precondition: undefined,
|
|
147
144
|
kbOpts: {
|
|
148
145
|
kbExpr: EditorContextKeys.textInputFocus,
|
|
@@ -153,6 +150,7 @@ class ExecCommandCopyWithSyntaxHighlightingAction extends EditorAction {
|
|
|
153
150
|
}
|
|
154
151
|
run(accessor, editor) {
|
|
155
152
|
const logService = accessor.get(ILogService);
|
|
153
|
+
const clipboardService = accessor.get(IClipboardService);
|
|
156
154
|
logService.trace('ExecCommandCopyWithSyntaxHighlightingAction#run');
|
|
157
155
|
if (!editor.hasModel()) {
|
|
158
156
|
return;
|
|
@@ -164,11 +162,48 @@ class ExecCommandCopyWithSyntaxHighlightingAction extends EditorAction {
|
|
|
164
162
|
CopyOptions.forceCopyWithSyntaxHighlighting = true;
|
|
165
163
|
editor.focus();
|
|
166
164
|
logService.trace('ExecCommandCopyWithSyntaxHighlightingAction (before execCommand copy)');
|
|
167
|
-
editor
|
|
165
|
+
executeClipboardCopyWithWorkaround(editor, clipboardService);
|
|
168
166
|
logService.trace('ExecCommandCopyWithSyntaxHighlightingAction (after execCommand copy)');
|
|
169
167
|
CopyOptions.forceCopyWithSyntaxHighlighting = false;
|
|
170
168
|
}
|
|
171
169
|
}
|
|
170
|
+
function executeClipboardCopyWithWorkaround(editor, clipboardService) {
|
|
171
|
+
// !!!!!
|
|
172
|
+
// This is a workaround for what we think is an Electron bug where
|
|
173
|
+
// execCommand('copy') does not always work (it does not fire a clipboard event)
|
|
174
|
+
// We will use this as a signal that we have executed a copy command
|
|
175
|
+
// !!!!!
|
|
176
|
+
CopyOptions.electronBugWorkaroundCopyEventHasFired = false;
|
|
177
|
+
editor.getContainerDomNode().ownerDocument.execCommand('copy');
|
|
178
|
+
if (platform.isNative && CopyOptions.electronBugWorkaroundCopyEventHasFired === false) {
|
|
179
|
+
// We have encountered the Electron bug!
|
|
180
|
+
// As a workaround, we will write (only the plaintext data) to the clipboard in a different way
|
|
181
|
+
// We will use the clipboard service (which in the native case will go to electron's clipboard API)
|
|
182
|
+
const { dataToCopy } = generateDataToCopyAndStoreInMemory(editor._getViewModel(), editor.getOptions(), undefined, browser.isFirefox);
|
|
183
|
+
clipboardService.writeText(dataToCopy.text);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
async function pasteWithNavigatorAPI(editor, clipboardService, logService) {
|
|
187
|
+
const clipboardText = await clipboardService.readText();
|
|
188
|
+
if (clipboardText !== '') {
|
|
189
|
+
const metadata = InMemoryClipboardMetadataManager.INSTANCE.get(clipboardText);
|
|
190
|
+
let pasteOnNewLine = false;
|
|
191
|
+
let multicursorText = null;
|
|
192
|
+
let mode = null;
|
|
193
|
+
if (metadata) {
|
|
194
|
+
pasteOnNewLine = (editor.getOption(45 /* EditorOption.emptySelectionClipboard */) && !!metadata.isFromEmptySelection);
|
|
195
|
+
multicursorText = (typeof metadata.multicursorText !== 'undefined' ? metadata.multicursorText : null);
|
|
196
|
+
mode = metadata.mode;
|
|
197
|
+
}
|
|
198
|
+
logService.trace('pasteWithNavigatorAPI with id : ', metadata?.id, ', clipboardText.length : ', clipboardText.length);
|
|
199
|
+
editor.trigger('keyboard', "paste" /* Handler.Paste */, {
|
|
200
|
+
text: clipboardText,
|
|
201
|
+
pasteOnNewLine,
|
|
202
|
+
multicursorText,
|
|
203
|
+
mode
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
}
|
|
172
207
|
function registerExecCommandImpl(target, browserCommand) {
|
|
173
208
|
if (!target) {
|
|
174
209
|
return;
|
|
@@ -176,10 +211,11 @@ function registerExecCommandImpl(target, browserCommand) {
|
|
|
176
211
|
// 1. handle case when focus is in editor.
|
|
177
212
|
target.addImplementation(10000, 'code-editor', (accessor, args) => {
|
|
178
213
|
const logService = accessor.get(ILogService);
|
|
214
|
+
const clipboardService = accessor.get(IClipboardService);
|
|
179
215
|
logService.trace('registerExecCommandImpl (addImplementation code-editor for : ', browserCommand, ')');
|
|
180
216
|
// Only if editor text focus (i.e. not if editor has widget focus).
|
|
181
217
|
const focusedEditor = accessor.get(ICodeEditorService).getFocusedCodeEditor();
|
|
182
|
-
if (focusedEditor && focusedEditor.hasTextFocus()) {
|
|
218
|
+
if (focusedEditor && focusedEditor.hasTextFocus() && focusedEditor.hasModel()) {
|
|
183
219
|
// Do not execute if there is no selection and empty selection clipboard is off
|
|
184
220
|
const emptySelectionClipboard = focusedEditor.getOption(45 /* EditorOption.emptySelectionClipboard */);
|
|
185
221
|
const selection = focusedEditor.getSelection();
|
|
@@ -191,14 +227,19 @@ function registerExecCommandImpl(target, browserCommand) {
|
|
|
191
227
|
logCopyCommand(focusedEditor);
|
|
192
228
|
// execCommand(copy) works for edit context, but not execCommand(cut).
|
|
193
229
|
logService.trace('registerExecCommandImpl (before execCommand copy)');
|
|
194
|
-
focusedEditor
|
|
230
|
+
executeClipboardCopyWithWorkaround(focusedEditor, clipboardService);
|
|
195
231
|
focusedEditor.trigger(undefined, "cut" /* Handler.Cut */, undefined);
|
|
196
232
|
logService.trace('registerExecCommandImpl (after execCommand copy)');
|
|
197
233
|
}
|
|
198
234
|
else {
|
|
199
235
|
logCopyCommand(focusedEditor);
|
|
200
236
|
logService.trace('registerExecCommandImpl (before execCommand ' + browserCommand + ')');
|
|
201
|
-
|
|
237
|
+
if (browserCommand === 'copy') {
|
|
238
|
+
executeClipboardCopyWithWorkaround(focusedEditor, clipboardService);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
focusedEditor.getContainerDomNode().ownerDocument.execCommand(browserCommand);
|
|
242
|
+
}
|
|
202
243
|
logService.trace('registerExecCommandImpl (after execCommand ' + browserCommand + ')');
|
|
203
244
|
}
|
|
204
245
|
return true;
|
|
@@ -233,8 +274,6 @@ if (PasteAction) {
|
|
|
233
274
|
logService.trace('registerExecCommandImpl (addImplementation code-editor for : paste)');
|
|
234
275
|
const codeEditorService = accessor.get(ICodeEditorService);
|
|
235
276
|
const clipboardService = accessor.get(IClipboardService);
|
|
236
|
-
const telemetryService = accessor.get(ITelemetryService);
|
|
237
|
-
const productService = accessor.get(IProductService);
|
|
238
277
|
// Only if editor text focus (i.e. not if editor has widget focus).
|
|
239
278
|
const focusedEditor = codeEditorService.getFocusedCodeEditor();
|
|
240
279
|
if (focusedEditor && focusedEditor.hasModel() && focusedEditor.hasTextFocus()) {
|
|
@@ -246,17 +285,16 @@ if (PasteAction) {
|
|
|
246
285
|
nativeEditContext.onWillPaste();
|
|
247
286
|
}
|
|
248
287
|
}
|
|
249
|
-
const sw = StopWatch.create(true);
|
|
250
288
|
logService.trace('registerExecCommandImpl (before triggerPaste)');
|
|
289
|
+
PasteOptions.electronBugWorkaroundPasteEventHasFired = false;
|
|
251
290
|
const triggerPaste = clipboardService.triggerPaste(getActiveWindow().vscodeWindowId);
|
|
252
291
|
if (triggerPaste) {
|
|
253
292
|
logService.trace('registerExecCommandImpl (triggerPaste defined)');
|
|
254
293
|
return triggerPaste.then(async () => {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
const duration = sw.elapsed();
|
|
258
|
-
telemetryService.publicLog2('editorAsyncPaste', { duration });
|
|
294
|
+
if (PasteOptions.electronBugWorkaroundPasteEventHasFired === false) {
|
|
295
|
+
return pasteWithNavigatorAPI(focusedEditor, clipboardService, logService);
|
|
259
296
|
}
|
|
297
|
+
logService.trace('registerExecCommandImpl (after triggerPaste)');
|
|
260
298
|
return CopyPasteController.get(focusedEditor)?.finishedPaste() ?? Promise.resolve();
|
|
261
299
|
});
|
|
262
300
|
}
|
|
@@ -266,27 +304,7 @@ if (PasteAction) {
|
|
|
266
304
|
if (platform.isWeb) {
|
|
267
305
|
logService.trace('registerExecCommandImpl (Paste handling on web)');
|
|
268
306
|
// Use the clipboard service if document.execCommand('paste') was not successful
|
|
269
|
-
return (
|
|
270
|
-
const clipboardText = await clipboardService.readText();
|
|
271
|
-
if (clipboardText !== '') {
|
|
272
|
-
const metadata = InMemoryClipboardMetadataManager.INSTANCE.get(clipboardText);
|
|
273
|
-
let pasteOnNewLine = false;
|
|
274
|
-
let multicursorText = null;
|
|
275
|
-
let mode = null;
|
|
276
|
-
if (metadata) {
|
|
277
|
-
pasteOnNewLine = (focusedEditor.getOption(45 /* EditorOption.emptySelectionClipboard */) && !!metadata.isFromEmptySelection);
|
|
278
|
-
multicursorText = (typeof metadata.multicursorText !== 'undefined' ? metadata.multicursorText : null);
|
|
279
|
-
mode = metadata.mode;
|
|
280
|
-
}
|
|
281
|
-
logService.trace('registerExecCommandImpl (clipboardText.length : ', clipboardText.length, ' id : ', metadata?.id, ')');
|
|
282
|
-
focusedEditor.trigger('keyboard', "paste" /* Handler.Paste */, {
|
|
283
|
-
text: clipboardText,
|
|
284
|
-
pasteOnNewLine,
|
|
285
|
-
multicursorText,
|
|
286
|
-
mode
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
})();
|
|
307
|
+
return pasteWithNavigatorAPI(focusedEditor, clipboardService, logService);
|
|
290
308
|
}
|
|
291
309
|
return true;
|
|
292
310
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["vs/editor/contrib/clipboard/browser/clipboard.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,OAAO,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAErF,OAAO,KAAK,QAAQ,MAAM,qCAAqC,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAC;AACjE,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,2DAA2D,CAAC;AAC9F,OAAO,EAAE,cAAc,EA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,OAAO,CAAC,UAAU,+BAAiB;4BAChD,IAAI,EAAE,aAAa;4BACnB,cAAc;4BACd,eAAe;4BACf,IAAI;yBACJ,CAAC,CAAC;oBACJ,CAAC;gBACF,CAAC,CAAC,EAAE,CAAC;YACN,CAAC;YACD,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;IAEH,gEAAgE;IAChE,WAAW,CAAC,iBAAiB,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,QAA0B,EAAE,IAAa,EAAE,EAAE;QAC7F,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC7C,UAAU,CAAC,KAAK,CAAC,qEAAqE,CAAC,CAAC;QACxF,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,YAAY,CAAC,eAAe,EAAE,CAAC,cAAc,CAAC,CAAC;QACpG,OAAO,YAAY,IAAI,KAAK,CAAC;IAC9B,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,IAAI,YAAY,EAAE,CAAC;IAClB,oBAAoB,CAAC,2CAA2C,CAAC,CAAC;AACnE,CAAC","file":"clipboard.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from '../../../../base/browser/browser.js';\nimport { getActiveDocument, getActiveWindow } from '../../../../base/browser/dom.js';\nimport { KeyCode, KeyMod } from '../../../../base/common/keyCodes.js';\nimport * as platform from '../../../../base/common/platform.js';\nimport { StopWatch } from '../../../../base/common/stopwatch.js';\nimport * as nls from '../../../../nls.js';\nimport { MenuId, MenuRegistry } from '../../../../platform/actions/common/actions.js';\nimport { IClipboardService } from '../../../../platform/clipboard/common/clipboardService.js';\nimport { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';\nimport { ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js';\nimport { KeybindingWeight } from '../../../../platform/keybinding/common/keybindingsRegistry.js';\nimport { ILogService } from '../../../../platform/log/common/log.js';\nimport { IProductService } from '../../../../platform/product/common/productService.js';\nimport { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';\nimport { CopyOptions, InMemoryClipboardMetadataManager } from '../../../browser/controller/editContext/clipboardUtils.js';\nimport { NativeEditContextRegistry } from '../../../browser/controller/editContext/native/nativeEditContextRegistry.js';\nimport { ICodeEditor } from '../../../browser/editorBrowser.js';\nimport { Command, EditorAction, MultiCommand, registerEditorAction } from '../../../browser/editorExtensions.js';\nimport { ICodeEditorService } from '../../../browser/services/codeEditorService.js';\nimport { EditorOption } from '../../../common/config/editorOptions.js';\nimport { Handler } from '../../../common/editorCommon.js';\nimport { EditorContextKeys } from '../../../common/editorContextKeys.js';\nimport { CopyPasteController } from '../../dropOrPasteInto/browser/copyPasteController.js';\n\nconst CLIPBOARD_CONTEXT_MENU_GROUP = '9_cutcopypaste';\n\nconst supportsCut = (platform.isNative || document.queryCommandSupported('cut'));\nconst supportsCopy = (platform.isNative || document.queryCommandSupported('copy'));\n// Firefox only supports navigator.clipboard.readText() in browser extensions.\n// See https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/readText#Browser_compatibility\n// When loading over http, navigator.clipboard can be undefined. See https://github.com/microsoft/monaco-editor/issues/2313\nconst supportsPaste = (typeof navigator.clipboard === 'undefined' || browser.isFirefox) ? document.queryCommandSupported('paste') : true;\n\nfunction registerCommand<T extends Command>(command: T): T {\n\tcommand.register();\n\treturn command;\n}\n\nexport const CutAction = supportsCut ? registerCommand(new MultiCommand({\n\tid: 'editor.action.clipboardCutAction',\n\tprecondition: undefined,\n\tkbOpts: (\n\t\t// Do not bind cut keybindings in the browser,\n\t\t// since browsers do that for us and it avoids security prompts\n\t\tplatform.isNative ? {\n\t\t\tprimary: KeyMod.CtrlCmd | KeyCode.KeyX,\n\t\t\twin: { primary: KeyMod.CtrlCmd | KeyCode.KeyX, secondary: [KeyMod.Shift | KeyCode.Delete] },\n\t\t\tweight: KeybindingWeight.EditorContrib\n\t\t} : undefined\n\t),\n\tmenuOpts: [{\n\t\tmenuId: MenuId.MenubarEditMenu,\n\t\tgroup: '2_ccp',\n\t\ttitle: nls.localize({ key: 'miCut', comment: ['&& denotes a mnemonic'] }, \"Cu&&t\"),\n\t\torder: 1\n\t}, {\n\t\tmenuId: MenuId.EditorContext,\n\t\tgroup: CLIPBOARD_CONTEXT_MENU_GROUP,\n\t\ttitle: nls.localize('actions.clipboard.cutLabel', \"Cut\"),\n\t\twhen: EditorContextKeys.writable,\n\t\torder: 1,\n\t}, {\n\t\tmenuId: MenuId.CommandPalette,\n\t\tgroup: '',\n\t\ttitle: nls.localize('actions.clipboard.cutLabel', \"Cut\"),\n\t\torder: 1\n\t}, {\n\t\tmenuId: MenuId.SimpleEditorContext,\n\t\tgroup: CLIPBOARD_CONTEXT_MENU_GROUP,\n\t\ttitle: nls.localize('actions.clipboard.cutLabel', \"Cut\"),\n\t\twhen: EditorContextKeys.writable,\n\t\torder: 1,\n\t}]\n})) : undefined;\n\nexport const CopyAction = supportsCopy ? registerCommand(new MultiCommand({\n\tid: 'editor.action.clipboardCopyAction',\n\tprecondition: undefined,\n\tkbOpts: (\n\t\t// Do not bind copy keybindings in the browser,\n\t\t// since browsers do that for us and it avoids security prompts\n\t\tplatform.isNative ? {\n\t\t\tprimary: KeyMod.CtrlCmd | KeyCode.KeyC,\n\t\t\twin: { primary: KeyMod.CtrlCmd | KeyCode.KeyC, secondary: [KeyMod.CtrlCmd | KeyCode.Insert] },\n\t\t\tweight: KeybindingWeight.EditorContrib\n\t\t} : undefined\n\t),\n\tmenuOpts: [{\n\t\tmenuId: MenuId.MenubarEditMenu,\n\t\tgroup: '2_ccp',\n\t\ttitle: nls.localize({ key: 'miCopy', comment: ['&& denotes a mnemonic'] }, \"&&Copy\"),\n\t\torder: 2\n\t}, {\n\t\tmenuId: MenuId.EditorContext,\n\t\tgroup: CLIPBOARD_CONTEXT_MENU_GROUP,\n\t\ttitle: nls.localize('actions.clipboard.copyLabel', \"Copy\"),\n\t\torder: 2,\n\t}, {\n\t\tmenuId: MenuId.CommandPalette,\n\t\tgroup: '',\n\t\ttitle: nls.localize('actions.clipboard.copyLabel', \"Copy\"),\n\t\torder: 1\n\t}, {\n\t\tmenuId: MenuId.SimpleEditorContext,\n\t\tgroup: CLIPBOARD_CONTEXT_MENU_GROUP,\n\t\ttitle: nls.localize('actions.clipboard.copyLabel', \"Copy\"),\n\t\torder: 2,\n\t}]\n})) : undefined;\n\nMenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { submenu: MenuId.MenubarCopy, title: nls.localize2('copy as', \"Copy As\"), group: '2_ccp', order: 3 });\nMenuRegistry.appendMenuItem(MenuId.EditorContext, { submenu: MenuId.EditorContextCopy, title: nls.localize2('copy as', \"Copy As\"), group: CLIPBOARD_CONTEXT_MENU_GROUP, order: 3 });\nMenuRegistry.appendMenuItem(MenuId.EditorContext, { submenu: MenuId.EditorContextShare, title: nls.localize2('share', \"Share\"), group: '11_share', order: -1, when: ContextKeyExpr.and(ContextKeyExpr.notEquals('resourceScheme', 'output'), EditorContextKeys.editorTextFocus) });\nMenuRegistry.appendMenuItem(MenuId.ExplorerContext, { submenu: MenuId.ExplorerContextShare, title: nls.localize2('share', \"Share\"), group: '11_share', order: -1 });\n\nexport const PasteAction = supportsPaste ? registerCommand(new MultiCommand({\n\tid: 'editor.action.clipboardPasteAction',\n\tprecondition: undefined,\n\tkbOpts: (\n\t\t// Do not bind paste keybindings in the browser,\n\t\t// since browsers do that for us and it avoids security prompts\n\t\tplatform.isNative ? {\n\t\t\tprimary: KeyMod.CtrlCmd | KeyCode.KeyV,\n\t\t\twin: { primary: KeyMod.CtrlCmd | KeyCode.KeyV, secondary: [KeyMod.Shift | KeyCode.Insert] },\n\t\t\tlinux: { primary: KeyMod.CtrlCmd | KeyCode.KeyV, secondary: [KeyMod.Shift | KeyCode.Insert] },\n\t\t\tweight: KeybindingWeight.EditorContrib\n\t\t} : undefined\n\t),\n\tmenuOpts: [{\n\t\tmenuId: MenuId.MenubarEditMenu,\n\t\tgroup: '2_ccp',\n\t\ttitle: nls.localize({ key: 'miPaste', comment: ['&& denotes a mnemonic'] }, \"&&Paste\"),\n\t\torder: 4\n\t}, {\n\t\tmenuId: MenuId.EditorContext,\n\t\tgroup: CLIPBOARD_CONTEXT_MENU_GROUP,\n\t\ttitle: nls.localize('actions.clipboard.pasteLabel', \"Paste\"),\n\t\twhen: EditorContextKeys.writable,\n\t\torder: 4,\n\t}, {\n\t\tmenuId: MenuId.CommandPalette,\n\t\tgroup: '',\n\t\ttitle: nls.localize('actions.clipboard.pasteLabel', \"Paste\"),\n\t\torder: 1\n\t}, {\n\t\tmenuId: MenuId.SimpleEditorContext,\n\t\tgroup: CLIPBOARD_CONTEXT_MENU_GROUP,\n\t\ttitle: nls.localize('actions.clipboard.pasteLabel', \"Paste\"),\n\t\twhen: EditorContextKeys.writable,\n\t\torder: 4,\n\t}]\n})) : undefined;\n\nclass ExecCommandCopyWithSyntaxHighlightingAction extends EditorAction {\n\n\tconstructor() {\n\t\tsuper({\n\t\t\tid: 'editor.action.clipboardCopyWithSyntaxHighlightingAction',\n\t\t\tlabel: nls.localize2('actions.clipboard.copyWithSyntaxHighlightingLabel', \"Copy with Syntax Highlighting\"),\n\t\t\tprecondition: undefined,\n\t\t\tkbOpts: {\n\t\t\t\tkbExpr: EditorContextKeys.textInputFocus,\n\t\t\t\tprimary: 0,\n\t\t\t\tweight: KeybindingWeight.EditorContrib\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic run(accessor: ServicesAccessor, editor: ICodeEditor): void {\n\t\tconst logService = accessor.get(ILogService);\n\t\tlogService.trace('ExecCommandCopyWithSyntaxHighlightingAction#run');\n\t\tif (!editor.hasModel()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst emptySelectionClipboard = editor.getOption(EditorOption.emptySelectionClipboard);\n\n\t\tif (!emptySelectionClipboard && editor.getSelection().isEmpty()) {\n\t\t\treturn;\n\t\t}\n\n\t\tCopyOptions.forceCopyWithSyntaxHighlighting = true;\n\t\teditor.focus();\n\t\tlogService.trace('ExecCommandCopyWithSyntaxHighlightingAction (before execCommand copy)');\n\t\teditor.getContainerDomNode().ownerDocument.execCommand('copy');\n\t\tlogService.trace('ExecCommandCopyWithSyntaxHighlightingAction (after execCommand copy)');\n\t\tCopyOptions.forceCopyWithSyntaxHighlighting = false;\n\t}\n}\n\nfunction registerExecCommandImpl(target: MultiCommand | undefined, browserCommand: 'cut' | 'copy'): void {\n\tif (!target) {\n\t\treturn;\n\t}\n\n\t// 1. handle case when focus is in editor.\n\ttarget.addImplementation(10000, 'code-editor', (accessor: ServicesAccessor, args: unknown) => {\n\t\tconst logService = accessor.get(ILogService);\n\t\tlogService.trace('registerExecCommandImpl (addImplementation code-editor for : ', browserCommand, ')');\n\t\t// Only if editor text focus (i.e. not if editor has widget focus).\n\t\tconst focusedEditor = accessor.get(ICodeEditorService).getFocusedCodeEditor();\n\t\tif (focusedEditor && focusedEditor.hasTextFocus()) {\n\t\t\t// Do not execute if there is no selection and empty selection clipboard is off\n\t\t\tconst emptySelectionClipboard = focusedEditor.getOption(EditorOption.emptySelectionClipboard);\n\t\t\tconst selection = focusedEditor.getSelection();\n\t\t\tif (selection && selection.isEmpty() && !emptySelectionClipboard) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t// TODO this is very ugly. The entire copy/paste/cut system needs a complete refactoring.\n\t\t\tif (focusedEditor.getOption(EditorOption.effectiveEditContext) && browserCommand === 'cut') {\n\t\t\t\tlogCopyCommand(focusedEditor);\n\t\t\t\t// execCommand(copy) works for edit context, but not execCommand(cut).\n\t\t\t\tlogService.trace('registerExecCommandImpl (before execCommand copy)');\n\t\t\t\tfocusedEditor.getContainerDomNode().ownerDocument.execCommand('copy');\n\t\t\t\tfocusedEditor.trigger(undefined, Handler.Cut, undefined);\n\t\t\t\tlogService.trace('registerExecCommandImpl (after execCommand copy)');\n\t\t\t} else {\n\t\t\t\tlogCopyCommand(focusedEditor);\n\t\t\t\tlogService.trace('registerExecCommandImpl (before execCommand ' + browserCommand + ')');\n\t\t\t\tfocusedEditor.getContainerDomNode().ownerDocument.execCommand(browserCommand);\n\t\t\t\tlogService.trace('registerExecCommandImpl (after execCommand ' + browserCommand + ')');\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t});\n\n\t// 2. (default) handle case when focus is somewhere else.\n\ttarget.addImplementation(0, 'generic-dom', (accessor: ServicesAccessor, args: unknown) => {\n\t\tconst logService = accessor.get(ILogService);\n\t\tlogService.trace('registerExecCommandImpl (addImplementation generic-dom for : ', browserCommand, ')');\n\t\tlogService.trace('registerExecCommandImpl (before execCommand ' + browserCommand + ')');\n\t\tgetActiveDocument().execCommand(browserCommand);\n\t\tlogService.trace('registerExecCommandImpl (after execCommand ' + browserCommand + ')');\n\t\treturn true;\n\t});\n}\n\nfunction logCopyCommand(editor: ICodeEditor) {\n\tconst editContextEnabled = editor.getOption(EditorOption.effectiveEditContext);\n\tif (editContextEnabled) {\n\t\tconst nativeEditContext = NativeEditContextRegistry.get(editor.getId());\n\t\tif (nativeEditContext) {\n\t\t\tnativeEditContext.onWillCopy();\n\t\t}\n\t}\n}\n\nregisterExecCommandImpl(CutAction, 'cut');\nregisterExecCommandImpl(CopyAction, 'copy');\n\nif (PasteAction) {\n\t// 1. Paste: handle case when focus is in editor.\n\tPasteAction.addImplementation(10000, 'code-editor', (accessor: ServicesAccessor, args: unknown) => {\n\t\tconst logService = accessor.get(ILogService);\n\t\tlogService.trace('registerExecCommandImpl (addImplementation code-editor for : paste)');\n\t\tconst codeEditorService = accessor.get(ICodeEditorService);\n\t\tconst clipboardService = accessor.get(IClipboardService);\n\t\tconst telemetryService = accessor.get(ITelemetryService);\n\t\tconst productService = accessor.get(IProductService);\n\n\t\t// Only if editor text focus (i.e. not if editor has widget focus).\n\t\tconst focusedEditor = codeEditorService.getFocusedCodeEditor();\n\t\tif (focusedEditor && focusedEditor.hasModel() && focusedEditor.hasTextFocus()) {\n\t\t\t// execCommand(paste) does not work with edit context\n\t\t\tconst editContextEnabled = focusedEditor.getOption(EditorOption.effectiveEditContext);\n\t\t\tif (editContextEnabled) {\n\t\t\t\tconst nativeEditContext = NativeEditContextRegistry.get(focusedEditor.getId());\n\t\t\t\tif (nativeEditContext) {\n\t\t\t\t\tnativeEditContext.onWillPaste();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst sw = StopWatch.create(true);\n\t\t\tlogService.trace('registerExecCommandImpl (before triggerPaste)');\n\t\t\tconst triggerPaste = clipboardService.triggerPaste(getActiveWindow().vscodeWindowId);\n\t\t\tif (triggerPaste) {\n\t\t\t\tlogService.trace('registerExecCommandImpl (triggerPaste defined)');\n\t\t\t\treturn triggerPaste.then(async () => {\n\t\t\t\t\tlogService.trace('registerExecCommandImpl (after triggerPaste)');\n\t\t\t\t\tif (productService.quality !== 'stable') {\n\t\t\t\t\t\tconst duration = sw.elapsed();\n\t\t\t\t\t\ttype EditorAsyncPasteClassification = {\n\t\t\t\t\t\t\tduration: { classification: 'SystemMetaData'; purpose: 'FeatureInsight'; comment: 'The duration of the paste operation.' };\n\t\t\t\t\t\t\towner: 'aiday-mar';\n\t\t\t\t\t\t\tcomment: 'Provides insight into the delay introduced by pasting async via keybindings.';\n\t\t\t\t\t\t};\n\t\t\t\t\t\ttype EditorAsyncPasteEvent = {\n\t\t\t\t\t\t\tduration: number;\n\t\t\t\t\t\t};\n\t\t\t\t\t\ttelemetryService.publicLog2<EditorAsyncPasteEvent, EditorAsyncPasteClassification>(\n\t\t\t\t\t\t\t'editorAsyncPaste',\n\t\t\t\t\t\t\t{ duration }\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn CopyPasteController.get(focusedEditor)?.finishedPaste() ?? Promise.resolve();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tlogService.trace('registerExecCommandImpl (triggerPaste undefined)');\n\t\t\t}\n\t\t\tif (platform.isWeb) {\n\t\t\t\tlogService.trace('registerExecCommandImpl (Paste handling on web)');\n\t\t\t\t// Use the clipboard service if document.execCommand('paste') was not successful\n\t\t\t\treturn (async () => {\n\t\t\t\t\tconst clipboardText = await clipboardService.readText();\n\t\t\t\t\tif (clipboardText !== '') {\n\t\t\t\t\t\tconst metadata = InMemoryClipboardMetadataManager.INSTANCE.get(clipboardText);\n\t\t\t\t\t\tlet pasteOnNewLine = false;\n\t\t\t\t\t\tlet multicursorText: string[] | null = null;\n\t\t\t\t\t\tlet mode: string | null = null;\n\t\t\t\t\t\tif (metadata) {\n\t\t\t\t\t\t\tpasteOnNewLine = (focusedEditor.getOption(EditorOption.emptySelectionClipboard) && !!metadata.isFromEmptySelection);\n\t\t\t\t\t\t\tmulticursorText = (typeof metadata.multicursorText !== 'undefined' ? metadata.multicursorText : null);\n\t\t\t\t\t\t\tmode = metadata.mode;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlogService.trace('registerExecCommandImpl (clipboardText.length : ', clipboardText.length, ' id : ', metadata?.id, ')');\n\t\t\t\t\t\tfocusedEditor.trigger('keyboard', Handler.Paste, {\n\t\t\t\t\t\t\ttext: clipboardText,\n\t\t\t\t\t\t\tpasteOnNewLine,\n\t\t\t\t\t\t\tmulticursorText,\n\t\t\t\t\t\t\tmode\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t})();\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t});\n\n\t// 2. Paste: (default) handle case when focus is somewhere else.\n\tPasteAction.addImplementation(0, 'generic-dom', (accessor: ServicesAccessor, args: unknown) => {\n\t\tconst logService = accessor.get(ILogService);\n\t\tlogService.trace('registerExecCommandImpl (addImplementation generic-dom for : paste)');\n\t\tconst triggerPaste = accessor.get(IClipboardService).triggerPaste(getActiveWindow().vscodeWindowId);\n\t\treturn triggerPaste ?? false;\n\t});\n}\n\nif (supportsCopy) {\n\tregisterEditorAction(ExecCommandCopyWithSyntaxHighlightingAction);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["vs/editor/contrib/clipboard/browser/clipboard.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,OAAO,MAAM,qCAAqC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAErF,OAAO,KAAK,QAAQ,MAAM,qCAAqC,CAAC;AAChE,OAAO,KAAK,GAAG,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,2DAA2D,CAAC;AAC9F,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;AAGtF,OAAO,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,kCAAkC,EAAE,gCAAgC,EAAE,YAAY,EAAE,MAAM,2DAA2D,CAAC;AAC5K,OAAO,EAAE,yBAAyB,EAAE,MAAM,6EAA6E,CAAC;AAExH,OAAO,EAAW,YAAY,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AACjH,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAGpF,OAAO,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sDAAsD,CAAC;AAE3F,MAAM,4BAA4B,GAAG,gBAAgB,CAAC;AAEtD,MAAM,WAAW,GAAG,CAAC,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAC;AACjF,MAAM,YAAY,GAAG,CAAC,QAAQ,CAAC,QAAQ,IAAI,QAAQ,CA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,CAAC;gBACpE,gFAAgF;gBAChF,OAAO,qBAAqB,CAAC,aAAa,EAAE,gBAAgB,EAAE,UAAU,CAAC,CAAC;YAC3E,CAAC;YACD,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC,CAAC,CAAC;IAEH,gEAAgE;IAChE,WAAW,CAAC,iBAAiB,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC,QAA0B,EAAE,IAAa,EAAE,EAAE;QAC7F,MAAM,UAAU,GAAG,QAAQ,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QAC7C,UAAU,CAAC,KAAK,CAAC,qEAAqE,CAAC,CAAC;QACxF,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,YAAY,CAAC,eAAe,EAAE,CAAC,cAAc,CAAC,CAAC;QACpG,OAAO,YAAY,IAAI,KAAK,CAAC;IAC9B,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,IAAI,YAAY,EAAE,CAAC;IAClB,oBAAoB,CAAC,2CAA2C,CAAC,CAAC;AACnE,CAAC","file":"clipboard.js","sourceRoot":"file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport * as browser from '../../../../base/browser/browser.js';\nimport { getActiveDocument, getActiveWindow } from '../../../../base/browser/dom.js';\nimport { KeyCode, KeyMod } from '../../../../base/common/keyCodes.js';\nimport * as platform from '../../../../base/common/platform.js';\nimport * as nls from '../../../../nls.js';\nimport { MenuId, MenuRegistry } from '../../../../platform/actions/common/actions.js';\nimport { IClipboardService } from '../../../../platform/clipboard/common/clipboardService.js';\nimport { ContextKeyExpr } from '../../../../platform/contextkey/common/contextkey.js';\nimport { ServicesAccessor } from '../../../../platform/instantiation/common/instantiation.js';\nimport { KeybindingWeight } from '../../../../platform/keybinding/common/keybindingsRegistry.js';\nimport { ILogService } from '../../../../platform/log/common/log.js';\nimport { CopyOptions, generateDataToCopyAndStoreInMemory, InMemoryClipboardMetadataManager, PasteOptions } from '../../../browser/controller/editContext/clipboardUtils.js';\nimport { NativeEditContextRegistry } from '../../../browser/controller/editContext/native/nativeEditContextRegistry.js';\nimport { IActiveCodeEditor, ICodeEditor } from '../../../browser/editorBrowser.js';\nimport { Command, EditorAction, MultiCommand, registerEditorAction } from '../../../browser/editorExtensions.js';\nimport { ICodeEditorService } from '../../../browser/services/codeEditorService.js';\nimport { EditorOption } from '../../../common/config/editorOptions.js';\nimport { Handler } from '../../../common/editorCommon.js';\nimport { EditorContextKeys } from '../../../common/editorContextKeys.js';\nimport { CopyPasteController } from '../../dropOrPasteInto/browser/copyPasteController.js';\n\nconst CLIPBOARD_CONTEXT_MENU_GROUP = '9_cutcopypaste';\n\nconst supportsCut = (platform.isNative || document.queryCommandSupported('cut'));\nconst supportsCopy = (platform.isNative || document.queryCommandSupported('copy'));\n// Firefox only supports navigator.clipboard.readText() in browser extensions.\n// See https://developer.mozilla.org/en-US/docs/Web/API/Clipboard/readText#Browser_compatibility\n// When loading over http, navigator.clipboard can be undefined. See https://github.com/microsoft/monaco-editor/issues/2313\nconst supportsPaste = (typeof navigator.clipboard === 'undefined' || browser.isFirefox) ? document.queryCommandSupported('paste') : true;\n\nfunction registerCommand<T extends Command>(command: T): T {\n\tcommand.register();\n\treturn command;\n}\n\nexport const CutAction = supportsCut ? registerCommand(new MultiCommand({\n\tid: 'editor.action.clipboardCutAction',\n\tprecondition: undefined,\n\tkbOpts: (\n\t\t// Do not bind cut keybindings in the browser,\n\t\t// since browsers do that for us and it avoids security prompts\n\t\tplatform.isNative ? {\n\t\t\tprimary: KeyMod.CtrlCmd | KeyCode.KeyX,\n\t\t\twin: { primary: KeyMod.CtrlCmd | KeyCode.KeyX, secondary: [KeyMod.Shift | KeyCode.Delete] },\n\t\t\tweight: KeybindingWeight.EditorContrib\n\t\t} : undefined\n\t),\n\tmenuOpts: [{\n\t\tmenuId: MenuId.MenubarEditMenu,\n\t\tgroup: '2_ccp',\n\t\ttitle: nls.localize({ key: 'miCut', comment: ['&& denotes a mnemonic'] }, \"Cu&&t\"),\n\t\torder: 1\n\t}, {\n\t\tmenuId: MenuId.EditorContext,\n\t\tgroup: CLIPBOARD_CONTEXT_MENU_GROUP,\n\t\ttitle: nls.localize('actions.clipboard.cutLabel', \"Cut\"),\n\t\twhen: EditorContextKeys.writable,\n\t\torder: 1,\n\t}, {\n\t\tmenuId: MenuId.CommandPalette,\n\t\tgroup: '',\n\t\ttitle: nls.localize('actions.clipboard.cutLabel', \"Cut\"),\n\t\torder: 1\n\t}, {\n\t\tmenuId: MenuId.SimpleEditorContext,\n\t\tgroup: CLIPBOARD_CONTEXT_MENU_GROUP,\n\t\ttitle: nls.localize('actions.clipboard.cutLabel', \"Cut\"),\n\t\twhen: EditorContextKeys.writable,\n\t\torder: 1,\n\t}]\n})) : undefined;\n\nexport const CopyAction = supportsCopy ? registerCommand(new MultiCommand({\n\tid: 'editor.action.clipboardCopyAction',\n\tprecondition: undefined,\n\tkbOpts: (\n\t\t// Do not bind copy keybindings in the browser,\n\t\t// since browsers do that for us and it avoids security prompts\n\t\tplatform.isNative ? {\n\t\t\tprimary: KeyMod.CtrlCmd | KeyCode.KeyC,\n\t\t\twin: { primary: KeyMod.CtrlCmd | KeyCode.KeyC, secondary: [KeyMod.CtrlCmd | KeyCode.Insert] },\n\t\t\tweight: KeybindingWeight.EditorContrib\n\t\t} : undefined\n\t),\n\tmenuOpts: [{\n\t\tmenuId: MenuId.MenubarEditMenu,\n\t\tgroup: '2_ccp',\n\t\ttitle: nls.localize({ key: 'miCopy', comment: ['&& denotes a mnemonic'] }, \"&&Copy\"),\n\t\torder: 2\n\t}, {\n\t\tmenuId: MenuId.EditorContext,\n\t\tgroup: CLIPBOARD_CONTEXT_MENU_GROUP,\n\t\ttitle: nls.localize('actions.clipboard.copyLabel', \"Copy\"),\n\t\torder: 2,\n\t}, {\n\t\tmenuId: MenuId.CommandPalette,\n\t\tgroup: '',\n\t\ttitle: nls.localize('actions.clipboard.copyLabel', \"Copy\"),\n\t\torder: 1\n\t}, {\n\t\tmenuId: MenuId.SimpleEditorContext,\n\t\tgroup: CLIPBOARD_CONTEXT_MENU_GROUP,\n\t\ttitle: nls.localize('actions.clipboard.copyLabel', \"Copy\"),\n\t\torder: 2,\n\t}]\n})) : undefined;\n\nMenuRegistry.appendMenuItem(MenuId.MenubarEditMenu, { submenu: MenuId.MenubarCopy, title: nls.localize2('copy as', \"Copy As\"), group: '2_ccp', order: 3 });\nMenuRegistry.appendMenuItem(MenuId.EditorContext, { submenu: MenuId.EditorContextCopy, title: nls.localize2('copy as', \"Copy As\"), group: CLIPBOARD_CONTEXT_MENU_GROUP, order: 3 });\nMenuRegistry.appendMenuItem(MenuId.EditorContext, { submenu: MenuId.EditorContextShare, title: nls.localize2('share', \"Share\"), group: '11_share', order: -1, when: ContextKeyExpr.and(ContextKeyExpr.notEquals('resourceScheme', 'output'), EditorContextKeys.editorTextFocus) });\nMenuRegistry.appendMenuItem(MenuId.ExplorerContext, { submenu: MenuId.ExplorerContextShare, title: nls.localize2('share', \"Share\"), group: '11_share', order: -1 });\n\nexport const PasteAction = supportsPaste ? registerCommand(new MultiCommand({\n\tid: 'editor.action.clipboardPasteAction',\n\tprecondition: undefined,\n\tkbOpts: (\n\t\t// Do not bind paste keybindings in the browser,\n\t\t// since browsers do that for us and it avoids security prompts\n\t\tplatform.isNative ? {\n\t\t\tprimary: KeyMod.CtrlCmd | KeyCode.KeyV,\n\t\t\twin: { primary: KeyMod.CtrlCmd | KeyCode.KeyV, secondary: [KeyMod.Shift | KeyCode.Insert] },\n\t\t\tlinux: { primary: KeyMod.CtrlCmd | KeyCode.KeyV, secondary: [KeyMod.Shift | KeyCode.Insert] },\n\t\t\tweight: KeybindingWeight.EditorContrib\n\t\t} : undefined\n\t),\n\tmenuOpts: [{\n\t\tmenuId: MenuId.MenubarEditMenu,\n\t\tgroup: '2_ccp',\n\t\ttitle: nls.localize({ key: 'miPaste', comment: ['&& denotes a mnemonic'] }, \"&&Paste\"),\n\t\torder: 4\n\t}, {\n\t\tmenuId: MenuId.EditorContext,\n\t\tgroup: CLIPBOARD_CONTEXT_MENU_GROUP,\n\t\ttitle: nls.localize('actions.clipboard.pasteLabel', \"Paste\"),\n\t\twhen: EditorContextKeys.writable,\n\t\torder: 4,\n\t}, {\n\t\tmenuId: MenuId.CommandPalette,\n\t\tgroup: '',\n\t\ttitle: nls.localize('actions.clipboard.pasteLabel', \"Paste\"),\n\t\torder: 1\n\t}, {\n\t\tmenuId: MenuId.SimpleEditorContext,\n\t\tgroup: CLIPBOARD_CONTEXT_MENU_GROUP,\n\t\ttitle: nls.localize('actions.clipboard.pasteLabel', \"Paste\"),\n\t\twhen: EditorContextKeys.writable,\n\t\torder: 4,\n\t}]\n})) : undefined;\n\nclass ExecCommandCopyWithSyntaxHighlightingAction extends EditorAction {\n\n\tconstructor() {\n\t\tsuper({\n\t\t\tid: 'editor.action.clipboardCopyWithSyntaxHighlightingAction',\n\t\t\tlabel: nls.localize2('actions.clipboard.copyWithSyntaxHighlightingLabel', \"Copy with Syntax Highlighting\"),\n\t\t\tprecondition: undefined,\n\t\t\tkbOpts: {\n\t\t\t\tkbExpr: EditorContextKeys.textInputFocus,\n\t\t\t\tprimary: 0,\n\t\t\t\tweight: KeybindingWeight.EditorContrib\n\t\t\t}\n\t\t});\n\t}\n\n\tpublic run(accessor: ServicesAccessor, editor: ICodeEditor): void {\n\t\tconst logService = accessor.get(ILogService);\n\t\tconst clipboardService = accessor.get(IClipboardService);\n\t\tlogService.trace('ExecCommandCopyWithSyntaxHighlightingAction#run');\n\t\tif (!editor.hasModel()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst emptySelectionClipboard = editor.getOption(EditorOption.emptySelectionClipboard);\n\n\t\tif (!emptySelectionClipboard && editor.getSelection().isEmpty()) {\n\t\t\treturn;\n\t\t}\n\n\t\tCopyOptions.forceCopyWithSyntaxHighlighting = true;\n\t\teditor.focus();\n\t\tlogService.trace('ExecCommandCopyWithSyntaxHighlightingAction (before execCommand copy)');\n\t\texecuteClipboardCopyWithWorkaround(editor, clipboardService);\n\t\tlogService.trace('ExecCommandCopyWithSyntaxHighlightingAction (after execCommand copy)');\n\t\tCopyOptions.forceCopyWithSyntaxHighlighting = false;\n\t}\n}\n\nfunction executeClipboardCopyWithWorkaround(editor: IActiveCodeEditor, clipboardService: IClipboardService) {\n\t// !!!!!\n\t// This is a workaround for what we think is an Electron bug where\n\t// execCommand('copy') does not always work (it does not fire a clipboard event)\n\t// We will use this as a signal that we have executed a copy command\n\t// !!!!!\n\tCopyOptions.electronBugWorkaroundCopyEventHasFired = false;\n\teditor.getContainerDomNode().ownerDocument.execCommand('copy');\n\tif (platform.isNative && CopyOptions.electronBugWorkaroundCopyEventHasFired === false) {\n\t\t// We have encountered the Electron bug!\n\t\t// As a workaround, we will write (only the plaintext data) to the clipboard in a different way\n\t\t// We will use the clipboard service (which in the native case will go to electron's clipboard API)\n\t\tconst { dataToCopy } = generateDataToCopyAndStoreInMemory(editor._getViewModel(), editor.getOptions(), undefined, browser.isFirefox);\n\t\tclipboardService.writeText(dataToCopy.text);\n\t}\n}\n\nasync function pasteWithNavigatorAPI(editor: IActiveCodeEditor, clipboardService: IClipboardService, logService: ILogService): Promise<void> {\n\tconst clipboardText = await clipboardService.readText();\n\tif (clipboardText !== '') {\n\t\tconst metadata = InMemoryClipboardMetadataManager.INSTANCE.get(clipboardText);\n\t\tlet pasteOnNewLine = false;\n\t\tlet multicursorText: string[] | null = null;\n\t\tlet mode: string | null = null;\n\t\tif (metadata) {\n\t\t\tpasteOnNewLine = (editor.getOption(EditorOption.emptySelectionClipboard) && !!metadata.isFromEmptySelection);\n\t\t\tmulticursorText = (typeof metadata.multicursorText !== 'undefined' ? metadata.multicursorText : null);\n\t\t\tmode = metadata.mode;\n\t\t}\n\t\tlogService.trace('pasteWithNavigatorAPI with id : ', metadata?.id, ', clipboardText.length : ', clipboardText.length);\n\t\teditor.trigger('keyboard', Handler.Paste, {\n\t\t\ttext: clipboardText,\n\t\t\tpasteOnNewLine,\n\t\t\tmulticursorText,\n\t\t\tmode\n\t\t});\n\t}\n}\n\nfunction registerExecCommandImpl(target: MultiCommand | undefined, browserCommand: 'cut' | 'copy'): void {\n\tif (!target) {\n\t\treturn;\n\t}\n\n\t// 1. handle case when focus is in editor.\n\ttarget.addImplementation(10000, 'code-editor', (accessor: ServicesAccessor, args: unknown) => {\n\t\tconst logService = accessor.get(ILogService);\n\t\tconst clipboardService = accessor.get(IClipboardService);\n\t\tlogService.trace('registerExecCommandImpl (addImplementation code-editor for : ', browserCommand, ')');\n\t\t// Only if editor text focus (i.e. not if editor has widget focus).\n\t\tconst focusedEditor = accessor.get(ICodeEditorService).getFocusedCodeEditor();\n\t\tif (focusedEditor && focusedEditor.hasTextFocus() && focusedEditor.hasModel()) {\n\t\t\t// Do not execute if there is no selection and empty selection clipboard is off\n\t\t\tconst emptySelectionClipboard = focusedEditor.getOption(EditorOption.emptySelectionClipboard);\n\t\t\tconst selection = focusedEditor.getSelection();\n\t\t\tif (selection && selection.isEmpty() && !emptySelectionClipboard) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t// TODO this is very ugly. The entire copy/paste/cut system needs a complete refactoring.\n\t\t\tif (focusedEditor.getOption(EditorOption.effectiveEditContext) && browserCommand === 'cut') {\n\t\t\t\tlogCopyCommand(focusedEditor);\n\t\t\t\t// execCommand(copy) works for edit context, but not execCommand(cut).\n\t\t\t\tlogService.trace('registerExecCommandImpl (before execCommand copy)');\n\t\t\t\texecuteClipboardCopyWithWorkaround(focusedEditor, clipboardService);\n\t\t\t\tfocusedEditor.trigger(undefined, Handler.Cut, undefined);\n\t\t\t\tlogService.trace('registerExecCommandImpl (after execCommand copy)');\n\t\t\t} else {\n\t\t\t\tlogCopyCommand(focusedEditor);\n\t\t\t\tlogService.trace('registerExecCommandImpl (before execCommand ' + browserCommand + ')');\n\t\t\t\tif (browserCommand === 'copy') {\n\t\t\t\t\texecuteClipboardCopyWithWorkaround(focusedEditor, clipboardService);\n\t\t\t\t} else {\n\t\t\t\t\tfocusedEditor.getContainerDomNode().ownerDocument.execCommand(browserCommand);\n\t\t\t\t}\n\t\t\t\tlogService.trace('registerExecCommandImpl (after execCommand ' + browserCommand + ')');\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t});\n\n\t// 2. (default) handle case when focus is somewhere else.\n\ttarget.addImplementation(0, 'generic-dom', (accessor: ServicesAccessor, args: unknown) => {\n\t\tconst logService = accessor.get(ILogService);\n\t\tlogService.trace('registerExecCommandImpl (addImplementation generic-dom for : ', browserCommand, ')');\n\t\tlogService.trace('registerExecCommandImpl (before execCommand ' + browserCommand + ')');\n\t\tgetActiveDocument().execCommand(browserCommand);\n\t\tlogService.trace('registerExecCommandImpl (after execCommand ' + browserCommand + ')');\n\t\treturn true;\n\t});\n}\n\nfunction logCopyCommand(editor: ICodeEditor) {\n\tconst editContextEnabled = editor.getOption(EditorOption.effectiveEditContext);\n\tif (editContextEnabled) {\n\t\tconst nativeEditContext = NativeEditContextRegistry.get(editor.getId());\n\t\tif (nativeEditContext) {\n\t\t\tnativeEditContext.onWillCopy();\n\t\t}\n\t}\n}\n\nregisterExecCommandImpl(CutAction, 'cut');\nregisterExecCommandImpl(CopyAction, 'copy');\n\nif (PasteAction) {\n\t// 1. Paste: handle case when focus is in editor.\n\tPasteAction.addImplementation(10000, 'code-editor', (accessor: ServicesAccessor, args: unknown) => {\n\t\tconst logService = accessor.get(ILogService);\n\t\tlogService.trace('registerExecCommandImpl (addImplementation code-editor for : paste)');\n\t\tconst codeEditorService = accessor.get(ICodeEditorService);\n\t\tconst clipboardService = accessor.get(IClipboardService);\n\n\t\t// Only if editor text focus (i.e. not if editor has widget focus).\n\t\tconst focusedEditor = codeEditorService.getFocusedCodeEditor();\n\t\tif (focusedEditor && focusedEditor.hasModel() && focusedEditor.hasTextFocus()) {\n\t\t\t// execCommand(paste) does not work with edit context\n\t\t\tconst editContextEnabled = focusedEditor.getOption(EditorOption.effectiveEditContext);\n\t\t\tif (editContextEnabled) {\n\t\t\t\tconst nativeEditContext = NativeEditContextRegistry.get(focusedEditor.getId());\n\t\t\t\tif (nativeEditContext) {\n\t\t\t\t\tnativeEditContext.onWillPaste();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlogService.trace('registerExecCommandImpl (before triggerPaste)');\n\t\t\tPasteOptions.electronBugWorkaroundPasteEventHasFired = false;\n\t\t\tconst triggerPaste = clipboardService.triggerPaste(getActiveWindow().vscodeWindowId);\n\t\t\tif (triggerPaste) {\n\t\t\t\tlogService.trace('registerExecCommandImpl (triggerPaste defined)');\n\t\t\t\treturn triggerPaste.then(async () => {\n\t\t\t\t\tif (PasteOptions.electronBugWorkaroundPasteEventHasFired === false) {\n\t\t\t\t\t\treturn pasteWithNavigatorAPI(focusedEditor, clipboardService, logService);\n\t\t\t\t\t}\n\t\t\t\t\tlogService.trace('registerExecCommandImpl (after triggerPaste)');\n\t\t\t\t\treturn CopyPasteController.get(focusedEditor)?.finishedPaste() ?? Promise.resolve();\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\tlogService.trace('registerExecCommandImpl (triggerPaste undefined)');\n\t\t\t}\n\t\t\tif (platform.isWeb) {\n\t\t\t\tlogService.trace('registerExecCommandImpl (Paste handling on web)');\n\t\t\t\t// Use the clipboard service if document.execCommand('paste') was not successful\n\t\t\t\treturn pasteWithNavigatorAPI(focusedEditor, clipboardService, logService);\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t});\n\n\t// 2. Paste: (default) handle case when focus is somewhere else.\n\tPasteAction.addImplementation(0, 'generic-dom', (accessor: ServicesAccessor, args: unknown) => {\n\t\tconst logService = accessor.get(ILogService);\n\t\tlogService.trace('registerExecCommandImpl (addImplementation generic-dom for : paste)');\n\t\tconst triggerPaste = accessor.get(IClipboardService).triggerPaste(getActiveWindow().vscodeWindowId);\n\t\treturn triggerPaste ?? false;\n\t});\n}\n\nif (supportsCopy) {\n\tregisterEditorAction(ExecCommandCopyWithSyntaxHighlightingAction);\n}\n"]}
|
|
@@ -252,7 +252,7 @@ export async function applyCodeAction(accessor, item, codeActionReason, options,
|
|
|
252
252
|
const message = asMessage(err);
|
|
253
253
|
notificationService.error(typeof message === 'string'
|
|
254
254
|
? message
|
|
255
|
-
: nls.localize(
|
|
255
|
+
: nls.localize(837, "An unknown error occurred while applying the code action"));
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
// ensure the start sound and end sound do not overlap
|
|
@@ -21,23 +21,23 @@ const argsSchema = {
|
|
|
21
21
|
properties: {
|
|
22
22
|
'kind': {
|
|
23
23
|
type: 'string',
|
|
24
|
-
description: nls.localize(
|
|
24
|
+
description: nls.localize(838, "Kind of the code action to run."),
|
|
25
25
|
},
|
|
26
26
|
'apply': {
|
|
27
27
|
type: 'string',
|
|
28
|
-
description: nls.localize(
|
|
28
|
+
description: nls.localize(839, "Controls when the returned actions are applied."),
|
|
29
29
|
default: "ifSingle" /* CodeActionAutoApply.IfSingle */,
|
|
30
30
|
enum: ["first" /* CodeActionAutoApply.First */, "ifSingle" /* CodeActionAutoApply.IfSingle */, "never" /* CodeActionAutoApply.Never */],
|
|
31
31
|
enumDescriptions: [
|
|
32
|
-
nls.localize(
|
|
33
|
-
nls.localize(
|
|
34
|
-
nls.localize(
|
|
32
|
+
nls.localize(840, "Always apply the first returned code action."),
|
|
33
|
+
nls.localize(841, "Apply the first returned code action if it is the only one."),
|
|
34
|
+
nls.localize(842, "Do not apply the returned code actions."),
|
|
35
35
|
]
|
|
36
36
|
},
|
|
37
37
|
'preferred': {
|
|
38
38
|
type: 'boolean',
|
|
39
39
|
default: false,
|
|
40
|
-
description: nls.localize(
|
|
40
|
+
description: nls.localize(843, "Controls if only preferred code actions should be returned."),
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
};
|
|
@@ -51,7 +51,7 @@ export class QuickFixAction extends EditorAction {
|
|
|
51
51
|
constructor() {
|
|
52
52
|
super({
|
|
53
53
|
id: quickFixCommandId,
|
|
54
|
-
label: nls.localize2(
|
|
54
|
+
label: nls.localize2(860, "Quick Fix..."),
|
|
55
55
|
precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasCodeActionsProvider),
|
|
56
56
|
kbOpts: {
|
|
57
57
|
kbExpr: EditorContextKeys.textInputFocus,
|
|
@@ -61,7 +61,7 @@ export class QuickFixAction extends EditorAction {
|
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
run(_accessor, editor) {
|
|
64
|
-
return triggerCodeActionsForEditorSelection(editor, nls.localize(
|
|
64
|
+
return triggerCodeActionsForEditorSelection(editor, nls.localize(844, "No code actions available"), undefined, undefined, CodeActionTriggerSource.QuickFix);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
export class CodeActionCommand extends EditorCommand {
|
|
@@ -82,11 +82,11 @@ export class CodeActionCommand extends EditorCommand {
|
|
|
82
82
|
});
|
|
83
83
|
return triggerCodeActionsForEditorSelection(editor, typeof userArgs?.kind === 'string'
|
|
84
84
|
? args.preferred
|
|
85
|
-
? nls.localize(
|
|
86
|
-
: nls.localize(
|
|
85
|
+
? nls.localize(845, "No preferred code actions for '{0}' available", userArgs.kind)
|
|
86
|
+
: nls.localize(846, "No code actions for '{0}' available", userArgs.kind)
|
|
87
87
|
: args.preferred
|
|
88
|
-
? nls.localize(
|
|
89
|
-
: nls.localize(
|
|
88
|
+
? nls.localize(847, "No preferred code actions available")
|
|
89
|
+
: nls.localize(848, "No code actions available"), {
|
|
90
90
|
include: args.kind,
|
|
91
91
|
includeSourceActions: true,
|
|
92
92
|
onlyIncludePreferredActions: args.preferred,
|
|
@@ -97,7 +97,7 @@ export class RefactorAction extends EditorAction {
|
|
|
97
97
|
constructor() {
|
|
98
98
|
super({
|
|
99
99
|
id: refactorCommandId,
|
|
100
|
-
label: nls.localize2(
|
|
100
|
+
label: nls.localize2(861, "Refactor..."),
|
|
101
101
|
precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasCodeActionsProvider),
|
|
102
102
|
kbOpts: {
|
|
103
103
|
kbExpr: EditorContextKeys.textInputFocus,
|
|
@@ -125,11 +125,11 @@ export class RefactorAction extends EditorAction {
|
|
|
125
125
|
});
|
|
126
126
|
return triggerCodeActionsForEditorSelection(editor, typeof userArgs?.kind === 'string'
|
|
127
127
|
? args.preferred
|
|
128
|
-
? nls.localize(
|
|
129
|
-
: nls.localize(
|
|
128
|
+
? nls.localize(849, "No preferred refactorings for '{0}' available", userArgs.kind)
|
|
129
|
+
: nls.localize(850, "No refactorings for '{0}' available", userArgs.kind)
|
|
130
130
|
: args.preferred
|
|
131
|
-
? nls.localize(
|
|
132
|
-
: nls.localize(
|
|
131
|
+
? nls.localize(851, "No preferred refactorings available")
|
|
132
|
+
: nls.localize(852, "No refactorings available"), {
|
|
133
133
|
include: CodeActionKind.Refactor.contains(args.kind) ? args.kind : HierarchicalKind.None,
|
|
134
134
|
onlyIncludePreferredActions: args.preferred
|
|
135
135
|
}, args.apply, CodeActionTriggerSource.Refactor);
|
|
@@ -139,7 +139,7 @@ export class SourceAction extends EditorAction {
|
|
|
139
139
|
constructor() {
|
|
140
140
|
super({
|
|
141
141
|
id: sourceActionCommandId,
|
|
142
|
-
label: nls.localize2(
|
|
142
|
+
label: nls.localize2(862, "Source Action..."),
|
|
143
143
|
precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasCodeActionsProvider),
|
|
144
144
|
contextMenuOpts: {
|
|
145
145
|
group: '1_modification',
|
|
@@ -159,11 +159,11 @@ export class SourceAction extends EditorAction {
|
|
|
159
159
|
});
|
|
160
160
|
return triggerCodeActionsForEditorSelection(editor, typeof userArgs?.kind === 'string'
|
|
161
161
|
? args.preferred
|
|
162
|
-
? nls.localize(
|
|
163
|
-
: nls.localize(
|
|
162
|
+
? nls.localize(853, "No preferred source actions for '{0}' available", userArgs.kind)
|
|
163
|
+
: nls.localize(854, "No source actions for '{0}' available", userArgs.kind)
|
|
164
164
|
: args.preferred
|
|
165
|
-
? nls.localize(
|
|
166
|
-
: nls.localize(
|
|
165
|
+
? nls.localize(855, "No preferred source actions available")
|
|
166
|
+
: nls.localize(856, "No source actions available"), {
|
|
167
167
|
include: CodeActionKind.Source.contains(args.kind) ? args.kind : HierarchicalKind.None,
|
|
168
168
|
includeSourceActions: true,
|
|
169
169
|
onlyIncludePreferredActions: args.preferred,
|
|
@@ -174,7 +174,7 @@ export class OrganizeImportsAction extends EditorAction {
|
|
|
174
174
|
constructor() {
|
|
175
175
|
super({
|
|
176
176
|
id: organizeImportsCommandId,
|
|
177
|
-
label: nls.localize2(
|
|
177
|
+
label: nls.localize2(863, "Organize Imports"),
|
|
178
178
|
precondition: ContextKeyExpr.and(EditorContextKeys.writable, contextKeyForSupportedActions(CodeActionKind.SourceOrganizeImports)),
|
|
179
179
|
kbOpts: {
|
|
180
180
|
kbExpr: EditorContextKeys.textInputFocus,
|
|
@@ -182,31 +182,31 @@ export class OrganizeImportsAction extends EditorAction {
|
|
|
182
182
|
weight: 100 /* KeybindingWeight.EditorContrib */
|
|
183
183
|
},
|
|
184
184
|
metadata: {
|
|
185
|
-
description: nls.localize2(
|
|
185
|
+
description: nls.localize2(864, "Organize imports in the current file. Also called 'Optimize Imports' by some tools")
|
|
186
186
|
}
|
|
187
187
|
});
|
|
188
188
|
}
|
|
189
189
|
run(_accessor, editor) {
|
|
190
|
-
return triggerCodeActionsForEditorSelection(editor, nls.localize(
|
|
190
|
+
return triggerCodeActionsForEditorSelection(editor, nls.localize(857, "No organize imports action available"), { include: CodeActionKind.SourceOrganizeImports, includeSourceActions: true }, "ifSingle" /* CodeActionAutoApply.IfSingle */, CodeActionTriggerSource.OrganizeImports);
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
export class FixAllAction extends EditorAction {
|
|
194
194
|
constructor() {
|
|
195
195
|
super({
|
|
196
196
|
id: fixAllCommandId,
|
|
197
|
-
label: nls.localize2(
|
|
197
|
+
label: nls.localize2(865, "Fix All"),
|
|
198
198
|
precondition: ContextKeyExpr.and(EditorContextKeys.writable, contextKeyForSupportedActions(CodeActionKind.SourceFixAll))
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
201
|
run(_accessor, editor) {
|
|
202
|
-
return triggerCodeActionsForEditorSelection(editor, nls.localize(
|
|
202
|
+
return triggerCodeActionsForEditorSelection(editor, nls.localize(858, "No fix all action available"), { include: CodeActionKind.SourceFixAll, includeSourceActions: true }, "ifSingle" /* CodeActionAutoApply.IfSingle */, CodeActionTriggerSource.FixAll);
|
|
203
203
|
}
|
|
204
204
|
}
|
|
205
205
|
export class AutoFixAction extends EditorAction {
|
|
206
206
|
constructor() {
|
|
207
207
|
super({
|
|
208
208
|
id: autoFixCommandId,
|
|
209
|
-
label: nls.localize2(
|
|
209
|
+
label: nls.localize2(866, "Auto Fix..."),
|
|
210
210
|
precondition: ContextKeyExpr.and(EditorContextKeys.writable, contextKeyForSupportedActions(CodeActionKind.QuickFix)),
|
|
211
211
|
kbOpts: {
|
|
212
212
|
kbExpr: EditorContextKeys.textInputFocus,
|
|
@@ -219,7 +219,7 @@ export class AutoFixAction extends EditorAction {
|
|
|
219
219
|
});
|
|
220
220
|
}
|
|
221
221
|
run(_accessor, editor) {
|
|
222
|
-
return triggerCodeActionsForEditorSelection(editor, nls.localize(
|
|
222
|
+
return triggerCodeActionsForEditorSelection(editor, nls.localize(859, "No auto fixes available"), {
|
|
223
223
|
include: CodeActionKind.QuickFix,
|
|
224
224
|
onlyIncludePreferredActions: true
|
|
225
225
|
}, "ifSingle" /* CodeActionAutoApply.IfSingle */, CodeActionTriggerSource.AutoFix);
|
|
@@ -25,7 +25,7 @@ Registry.as(Extensions.Configuration).registerConfiguration({
|
|
|
25
25
|
'editor.codeActionWidget.showHeaders': {
|
|
26
26
|
type: 'boolean',
|
|
27
27
|
scope: 6 /* ConfigurationScope.LANGUAGE_OVERRIDABLE */,
|
|
28
|
-
description: nls.localize(
|
|
28
|
+
description: nls.localize(867, "Enable/disable showing group headers in the Code Action menu."),
|
|
29
29
|
default: true,
|
|
30
30
|
},
|
|
31
31
|
}
|
|
@@ -36,7 +36,7 @@ Registry.as(Extensions.Configuration).registerConfiguration({
|
|
|
36
36
|
'editor.codeActionWidget.includeNearbyQuickFixes': {
|
|
37
37
|
type: 'boolean',
|
|
38
38
|
scope: 6 /* ConfigurationScope.LANGUAGE_OVERRIDABLE */,
|
|
39
|
-
description: nls.localize(
|
|
39
|
+
description: nls.localize(868, "Enable/disable showing nearest Quick Fix within a line when not currently on a diagnostic."),
|
|
40
40
|
default: true,
|
|
41
41
|
},
|
|
42
42
|
}
|
|
@@ -47,7 +47,7 @@ Registry.as(Extensions.Configuration).registerConfiguration({
|
|
|
47
47
|
'editor.codeActions.triggerOnFocusChange': {
|
|
48
48
|
type: 'boolean',
|
|
49
49
|
scope: 6 /* ConfigurationScope.LANGUAGE_OVERRIDABLE */,
|
|
50
|
-
markdownDescription: nls.localize(
|
|
50
|
+
markdownDescription: nls.localize(869, 'Enable triggering {0} when {1} is set to {2}. Code Actions must be set to {3} to be triggered for window and focus changes.', '`#editor.codeActionsOnSave#`', '`#files.autoSave#`', '`afterDelay`', '`always`'),
|
|
51
51
|
default: false,
|
|
52
52
|
},
|
|
53
53
|
}
|