monaco-editor-core 0.54.0-dev-20250910 → 0.54.0-dev-20250912
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.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.ru.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 +8 -2
- package/esm/vs/base/browser/domSanitize.js +32 -21
- package/esm/vs/base/browser/domSanitize.js.map +1 -1
- package/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/esm/vs/base/browser/ui/menu/menu.js +2 -0
- package/esm/vs/base/browser/ui/menu/menu.js.map +1 -1
- package/esm/vs/base/common/codiconsLibrary.js +2 -0
- package/esm/vs/base/common/codiconsLibrary.js.map +1 -1
- package/esm/vs/base/common/observableInternal/index.js +3 -0
- package/esm/vs/base/common/observableInternal/index.js.map +1 -1
- package/esm/vs/base/common/observableInternal/logging/debugGetDependencyGraph.js +71 -0
- package/esm/vs/base/common/observableInternal/logging/debugGetDependencyGraph.js.map +1 -0
- package/esm/vs/base/common/observableInternal/observables/baseObservable.js +4 -0
- package/esm/vs/base/common/observableInternal/observables/baseObservable.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/derivedImpl.js +10 -0
- package/esm/vs/base/common/observableInternal/observables/derivedImpl.js.map +1 -1
- package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js +3 -0
- package/esm/vs/base/common/observableInternal/observables/observableFromEvent.js.map +1 -1
- package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js +9 -0
- package/esm/vs/base/common/observableInternal/reactions/autorunImpl.js.map +1 -1
- package/esm/vs/editor/browser/config/editorConfiguration.js +1 -1
- package/esm/vs/editor/browser/controller/dragScrolling.js +4 -4
- package/esm/vs/editor/browser/controller/editContext/native/nativeEditContext.js +3 -3
- package/esm/vs/editor/browser/controller/editContext/native/screenReaderContentRich.js +3 -3
- package/esm/vs/editor/browser/controller/editContext/native/screenReaderSupport.js +6 -6
- package/esm/vs/editor/browser/controller/editContext/textArea/textAreaEditContext.js +9 -9
- package/esm/vs/editor/browser/controller/mouseHandler.js +6 -6
- package/esm/vs/editor/browser/controller/mouseTarget.js +3 -3
- package/esm/vs/editor/browser/coreCommands.js +2 -2
- package/esm/vs/editor/browser/gpu/rectangleRenderer.js +1 -1
- package/esm/vs/editor/browser/gpu/viewGpuContext.js +1 -1
- package/esm/vs/editor/browser/observableCodeEditor.js +1 -1
- package/esm/vs/editor/browser/view/viewController.js +2 -2
- package/esm/vs/editor/browser/view/viewLayer.js +1 -1
- package/esm/vs/editor/browser/view/viewOverlays.js +4 -4
- package/esm/vs/editor/browser/view.js +5 -5
- package/esm/vs/editor/browser/viewParts/blockDecorations/blockDecorations.js +1 -1
- package/esm/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +3 -3
- package/esm/vs/editor/browser/viewParts/currentLineHighlight/currentLineHighlight.js +6 -6
- package/esm/vs/editor/browser/viewParts/editorScrollbar/editorScrollbar.js +8 -8
- package/esm/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js +2 -2
- package/esm/vs/editor/browser/viewParts/indentGuides/indentGuides.js +2 -2
- package/esm/vs/editor/browser/viewParts/lineNumbers/lineNumbers.js +2 -2
- package/esm/vs/editor/browser/viewParts/linesDecorations/linesDecorations.js +2 -2
- package/esm/vs/editor/browser/viewParts/margin/margin.js +2 -2
- package/esm/vs/editor/browser/viewParts/minimap/minimap.js +5 -5
- package/esm/vs/editor/browser/viewParts/overlayWidgets/overlayWidgets.js +2 -2
- package/esm/vs/editor/browser/viewParts/overviewRuler/decorationsOverviewRuler.js +4 -4
- package/esm/vs/editor/browser/viewParts/overviewRuler/overviewRuler.js +3 -3
- package/esm/vs/editor/browser/viewParts/rulers/rulers.js +2 -2
- package/esm/vs/editor/browser/viewParts/rulersGpu/rulersGpu.js +1 -1
- package/esm/vs/editor/browser/viewParts/scrollDecoration/scrollDecoration.js +3 -3
- package/esm/vs/editor/browser/viewParts/selections/selections.js +2 -2
- package/esm/vs/editor/browser/viewParts/viewCursors/viewCursor.js +2 -2
- package/esm/vs/editor/browser/viewParts/viewCursors/viewCursors.js +6 -6
- package/esm/vs/editor/browser/viewParts/viewLines/viewLineOptions.js +4 -4
- package/esm/vs/editor/browser/viewParts/viewLines/viewLines.js +11 -11
- package/esm/vs/editor/browser/viewParts/viewLinesGpu/viewLinesGpu.js +1 -1
- package/esm/vs/editor/browser/viewParts/viewZones/viewZones.js +2 -2
- package/esm/vs/editor/browser/viewParts/whitespace/whitespace.js +4 -4
- package/esm/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +12 -12
- package/esm/vs/editor/browser/widget/diffEditor/commands.js +12 -1
- package/esm/vs/editor/browser/widget/diffEditor/commands.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/components/accessibleDiffViewer.js +4 -4
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/diffEditorViewZones.js +3 -3
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/inlineDiffDeletedCodeMargin.js +2 -2
- package/esm/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/renderLines.js +2 -2
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js +25 -0
- package/esm/vs/editor/browser/widget/diffEditor/diffEditorWidget.js.map +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/gutterFeature.js +1 -1
- package/esm/vs/editor/browser/widget/diffEditor/features/overviewRulerFeature.js +1 -1
- package/esm/vs/editor/common/config/editorOptions.js +155 -154
- package/esm/vs/editor/common/config/editorOptions.js.map +1 -1
- package/esm/vs/editor/common/core/editorColorRegistry.js +68 -68
- package/esm/vs/editor/common/core/ranges/lineRange.js +3 -0
- package/esm/vs/editor/common/core/ranges/lineRange.js.map +1 -1
- package/esm/vs/editor/common/cursorCommon.js +19 -19
- package/esm/vs/editor/common/editorContextKeys.js +46 -46
- package/esm/vs/editor/common/languages/modesRegistry.js +1 -1
- package/esm/vs/editor/common/languages.js +56 -56
- package/esm/vs/editor/common/model/editStack.js +1 -1
- package/esm/vs/editor/common/standalone/standaloneEnums.js +86 -85
- package/esm/vs/editor/common/standalone/standaloneEnums.js.map +1 -1
- package/esm/vs/editor/common/standaloneStrings.js +10 -10
- package/esm/vs/editor/common/viewLayout/viewLayout.js +15 -15
- package/esm/vs/editor/common/viewLayout/viewLineRenderer.js +2 -2
- package/esm/vs/editor/common/viewModel/monospaceLineBreaksComputer.js +1 -1
- package/esm/vs/editor/common/viewModel/viewModelImpl.js +14 -14
- 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 +20 -20
- 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/codeActionModel.js +1 -1
- 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/colorDetector.js +3 -3
- 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/hoverColorPickerContribution.js +1 -1
- package/esm/vs/editor/contrib/colorPicker/browser/hoverColorPicker/hoverColorPickerParticipant.js +2 -2
- package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerActions.js +7 -7
- package/esm/vs/editor/contrib/colorPicker/browser/standaloneColorPicker/standaloneColorPickerParticipant.js +1 -1
- package/esm/vs/editor/contrib/comment/browser/comment.js +6 -6
- package/esm/vs/editor/contrib/contextmenu/browser/contextmenu.js +12 -12
- 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 +12 -12
- 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 +17 -17
- package/esm/vs/editor/contrib/find/browser/findModel.js +6 -6
- package/esm/vs/editor/contrib/find/browser/findWidget.js +32 -32
- package/esm/vs/editor/contrib/folding/browser/folding.js +23 -23
- package/esm/vs/editor/contrib/folding/browser/foldingDecorations.js +9 -9
- package/esm/vs/editor/contrib/folding/browser/foldingDecorations.js.map +1 -1
- 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/clickLinkGesture.js +21 -11
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.js.map +1 -1
- package/esm/vs/editor/contrib/gotoSymbol/browser/link/goToDefinitionAtPosition.js +2 -2
- package/esm/vs/editor/contrib/gotoSymbol/browser/peek/referencesController.js +4 -4
- 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/hoverActionIds.js +2 -2
- package/esm/vs/editor/contrib/hover/browser/hoverActions.js +24 -24
- package/esm/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +10 -10
- package/esm/vs/editor/contrib/hover/browser/markerHoverParticipant.js +6 -6
- 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 +5 -5
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsHover.js +8 -8
- package/esm/vs/editor/contrib/inlayHints/browser/inlayHintsLocations.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/commands.js +19 -19
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionContextKeys.js +12 -12
- package/esm/vs/editor/contrib/inlineCompletions/browser/controller/inlineCompletionsController.js +2 -2
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/hoverParticipant.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/hintsWidget/inlineCompletionsHintsWidget.js +5 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/model/inlineCompletionsModel.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/ghostText/ghostTextView.js +5 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorMenu.js +5 -5
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js +4 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/components/gutterIndicatorView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsModel.js +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js +2 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsView.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js +1 -0
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/inlineEditsViewProducer.js.map +1 -1
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.js +22 -21
- package/esm/vs/editor/contrib/inlineCompletions/browser/view/inlineEdits/theme.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/linkedEditing/browser/linkedEditing.js +4 -4
- package/esm/vs/editor/contrib/links/browser/links.js +11 -11
- package/esm/vs/editor/contrib/links/browser/links.js.map +1 -1
- package/esm/vs/editor/contrib/longLinesHelper/browser/longLinesHelper.js +1 -1
- package/esm/vs/editor/contrib/message/browser/messageController.js +1 -1
- package/esm/vs/editor/contrib/middleScroll/browser/middleScrollController.js +1 -1
- package/esm/vs/editor/contrib/multicursor/browser/multicursor.js +36 -36
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHints.js +1 -1
- package/esm/vs/editor/contrib/parameterHints/browser/parameterHintsModel.js +3 -3
- 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/placeholderText/browser/placeholderTextContribution.js +1 -1
- package/esm/vs/editor/contrib/placeholderText/browser/placeholderTextContribution.js.map +1 -1
- package/esm/vs/editor/contrib/quickAccess/browser/gotoLineQuickAccess.js +5 -5
- package/esm/vs/editor/contrib/quickAccess/browser/gotoSymbolQuickAccess.js +32 -32
- package/esm/vs/editor/contrib/readOnlyMessage/browser/contribution.js +3 -3
- package/esm/vs/editor/contrib/rename/browser/rename.js +11 -11
- package/esm/vs/editor/contrib/rename/browser/renameWidget.js +7 -7
- package/esm/vs/editor/contrib/smartSelect/browser/smartSelect.js +5 -5
- package/esm/vs/editor/contrib/snippet/browser/snippetController2.js +4 -4
- package/esm/vs/editor/contrib/snippet/browser/snippetSession.js +2 -2
- 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 +17 -24
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js.map +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollModelProvider.js +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollProvider.js +12 -3
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollProvider.js.map +1 -1
- package/esm/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js +5 -5
- package/esm/vs/editor/contrib/suggest/browser/suggest.js +8 -8
- package/esm/vs/editor/contrib/suggest/browser/suggestController.js +14 -14
- package/esm/vs/editor/contrib/suggest/browser/suggestInlineCompletions.js +2 -2
- package/esm/vs/editor/contrib/suggest/browser/suggestModel.js +11 -11
- package/esm/vs/editor/contrib/suggest/browser/suggestWidget.js +23 -23
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetDetails.js +5 -5
- package/esm/vs/editor/contrib/suggest/browser/suggestWidgetRenderer.js +5 -5
- package/esm/vs/editor/contrib/suggest/browser/wordContextKey.js +3 -3
- package/esm/vs/editor/contrib/suggest/browser/wordDistance.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 +27 -27
- package/esm/vs/editor/contrib/unusualLineTerminators/browser/unusualLineTerminators.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +9 -9
- package/esm/vs/editor/contrib/wordHighlighter/browser/wordHighlighter.js +7 -7
- package/esm/vs/editor/contrib/wordOperations/browser/wordOperations.js +4 -4
- package/esm/vs/editor/editor.api.d.ts +93 -85
- package/esm/vs/editor/standalone/browser/iPadShowKeyboard/iPadShowKeyboard.js +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.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/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/history/browser/contextScopedHistoryWidget.js +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/markers/common/markerService.js +2 -2
- package/esm/vs/platform/markers/common/markers.js +6 -6
- package/esm/vs/platform/quickinput/browser/commandsQuickAccess.js +7 -7
- package/esm/vs/platform/quickinput/browser/helpQuickAccess.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInput.js +21 -13
- package/esm/vs/platform/quickinput/browser/quickInput.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputActions.js +42 -8
- package/esm/vs/platform/quickinput/browser/quickInputActions.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputController.js +10 -64
- package/esm/vs/platform/quickinput/browser/quickInputController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputList.js +1 -1
- package/esm/vs/platform/quickinput/browser/quickInputUtils.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeAccessibilityProvider.js +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeController.js +12 -0
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeController.js.map +1 -1
- package/esm/vs/platform/quickinput/browser/tree/quickInputTreeRenderer.js +11 -5
- 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 +17 -17
- 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 +11 -11
- package/esm/vs/platform/theme/common/colors/miscColors.js +15 -15
- 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 +20 -20
- package/esm/vs/platform/workspace/common/workspace.js +1 -1
- package/monaco.d.ts +93 -85
- package/package.json +6 -2
- package/version.txt +1 -1
|
@@ -34,7 +34,7 @@ import { Iterable } from '../../../../base/common/iterator.js';
|
|
|
34
34
|
import { IsWebContext } from '../../../../platform/contextkey/common/contextkeys.js';
|
|
35
35
|
MenuRegistry.appendMenuItem(MenuId.EditorContext, {
|
|
36
36
|
submenu: MenuId.EditorContextPeek,
|
|
37
|
-
title: nls.localize(
|
|
37
|
+
title: nls.localize(1031, "Peek"),
|
|
38
38
|
group: 'navigation',
|
|
39
39
|
order: 100
|
|
40
40
|
});
|
|
@@ -203,12 +203,12 @@ export class SymbolNavigationAction extends EditorAction2 {
|
|
|
203
203
|
//#region --- DEFINITION
|
|
204
204
|
export class DefinitionAction extends SymbolNavigationAction {
|
|
205
205
|
async _getLocationModel(languageFeaturesService, model, position, token) {
|
|
206
|
-
return new ReferencesModel(await getDefinitionsAtPosition(languageFeaturesService.definitionProvider, model, position, false, token), nls.localize(
|
|
206
|
+
return new ReferencesModel(await getDefinitionsAtPosition(languageFeaturesService.definitionProvider, model, position, false, token), nls.localize(1032, 'Definitions'));
|
|
207
207
|
}
|
|
208
208
|
_getNoResultFoundMessage(info) {
|
|
209
209
|
return info && info.word
|
|
210
|
-
? nls.localize(
|
|
211
|
-
: nls.localize(
|
|
210
|
+
? nls.localize(1033, "No definition found for '{0}'", info.word)
|
|
211
|
+
: nls.localize(1034, "No definition found");
|
|
212
212
|
}
|
|
213
213
|
_getAlternativeCommand(editor) {
|
|
214
214
|
return editor.getOption(67 /* EditorOption.gotoLocation */).alternativeDefinitionCommand;
|
|
@@ -227,8 +227,8 @@ registerAction2(class GoToDefinitionAction extends DefinitionAction {
|
|
|
227
227
|
}, {
|
|
228
228
|
id: GoToDefinitionAction.id,
|
|
229
229
|
title: {
|
|
230
|
-
...nls.localize2(
|
|
231
|
-
mnemonicTitle: nls.localize(
|
|
230
|
+
...nls.localize2(1058, "Go to Definition"),
|
|
231
|
+
mnemonicTitle: nls.localize(1035, "Go to &&Definition"),
|
|
232
232
|
},
|
|
233
233
|
precondition: EditorContextKeys.hasDefinitionProvider,
|
|
234
234
|
keybinding: [{
|
|
@@ -263,7 +263,7 @@ registerAction2(class OpenDefinitionToSideAction extends DefinitionAction {
|
|
|
263
263
|
muteMessage: false
|
|
264
264
|
}, {
|
|
265
265
|
id: OpenDefinitionToSideAction.id,
|
|
266
|
-
title: nls.localize2(
|
|
266
|
+
title: nls.localize2(1059, "Open Definition to the Side"),
|
|
267
267
|
precondition: ContextKeyExpr.and(EditorContextKeys.hasDefinitionProvider, EditorContextKeys.isInEmbeddedEditor.toNegated()),
|
|
268
268
|
keybinding: [{
|
|
269
269
|
when: EditorContextKeys.editorTextFocus,
|
|
@@ -287,7 +287,7 @@ registerAction2(class PeekDefinitionAction extends DefinitionAction {
|
|
|
287
287
|
muteMessage: false
|
|
288
288
|
}, {
|
|
289
289
|
id: PeekDefinitionAction.id,
|
|
290
|
-
title: nls.localize2(
|
|
290
|
+
title: nls.localize2(1060, "Peek Definition"),
|
|
291
291
|
precondition: ContextKeyExpr.and(EditorContextKeys.hasDefinitionProvider, PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated()),
|
|
292
292
|
keybinding: {
|
|
293
293
|
when: EditorContextKeys.editorTextFocus,
|
|
@@ -308,12 +308,12 @@ registerAction2(class PeekDefinitionAction extends DefinitionAction {
|
|
|
308
308
|
//#region --- DECLARATION
|
|
309
309
|
class DeclarationAction extends SymbolNavigationAction {
|
|
310
310
|
async _getLocationModel(languageFeaturesService, model, position, token) {
|
|
311
|
-
return new ReferencesModel(await getDeclarationsAtPosition(languageFeaturesService.declarationProvider, model, position, false, token), nls.localize(
|
|
311
|
+
return new ReferencesModel(await getDeclarationsAtPosition(languageFeaturesService.declarationProvider, model, position, false, token), nls.localize(1036, 'Declarations'));
|
|
312
312
|
}
|
|
313
313
|
_getNoResultFoundMessage(info) {
|
|
314
314
|
return info && info.word
|
|
315
|
-
? nls.localize(
|
|
316
|
-
: nls.localize(
|
|
315
|
+
? nls.localize(1037, "No declaration found for '{0}'", info.word)
|
|
316
|
+
: nls.localize(1038, "No declaration found");
|
|
317
317
|
}
|
|
318
318
|
_getAlternativeCommand(editor) {
|
|
319
319
|
return editor.getOption(67 /* EditorOption.gotoLocation */).alternativeDeclarationCommand;
|
|
@@ -332,8 +332,8 @@ registerAction2(class GoToDeclarationAction extends DeclarationAction {
|
|
|
332
332
|
}, {
|
|
333
333
|
id: GoToDeclarationAction.id,
|
|
334
334
|
title: {
|
|
335
|
-
...nls.localize2(
|
|
336
|
-
mnemonicTitle: nls.localize(
|
|
335
|
+
...nls.localize2(1061, "Go to Declaration"),
|
|
336
|
+
mnemonicTitle: nls.localize(1039, "Go to &&Declaration"),
|
|
337
337
|
},
|
|
338
338
|
precondition: ContextKeyExpr.and(EditorContextKeys.hasDeclarationProvider, EditorContextKeys.isInEmbeddedEditor.toNegated()),
|
|
339
339
|
menu: [{
|
|
@@ -350,8 +350,8 @@ registerAction2(class GoToDeclarationAction extends DeclarationAction {
|
|
|
350
350
|
}
|
|
351
351
|
_getNoResultFoundMessage(info) {
|
|
352
352
|
return info && info.word
|
|
353
|
-
? nls.localize(
|
|
354
|
-
: nls.localize(
|
|
353
|
+
? nls.localize(1040, "No declaration found for '{0}'", info.word)
|
|
354
|
+
: nls.localize(1041, "No declaration found");
|
|
355
355
|
}
|
|
356
356
|
});
|
|
357
357
|
registerAction2(class PeekDeclarationAction extends DeclarationAction {
|
|
@@ -362,7 +362,7 @@ registerAction2(class PeekDeclarationAction extends DeclarationAction {
|
|
|
362
362
|
muteMessage: false
|
|
363
363
|
}, {
|
|
364
364
|
id: 'editor.action.peekDeclaration',
|
|
365
|
-
title: nls.localize2(
|
|
365
|
+
title: nls.localize2(1062, "Peek Declaration"),
|
|
366
366
|
precondition: ContextKeyExpr.and(EditorContextKeys.hasDeclarationProvider, PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated()),
|
|
367
367
|
menu: {
|
|
368
368
|
id: MenuId.EditorContextPeek,
|
|
@@ -376,12 +376,12 @@ registerAction2(class PeekDeclarationAction extends DeclarationAction {
|
|
|
376
376
|
//#region --- TYPE DEFINITION
|
|
377
377
|
class TypeDefinitionAction extends SymbolNavigationAction {
|
|
378
378
|
async _getLocationModel(languageFeaturesService, model, position, token) {
|
|
379
|
-
return new ReferencesModel(await getTypeDefinitionsAtPosition(languageFeaturesService.typeDefinitionProvider, model, position, false, token), nls.localize(
|
|
379
|
+
return new ReferencesModel(await getTypeDefinitionsAtPosition(languageFeaturesService.typeDefinitionProvider, model, position, false, token), nls.localize(1042, 'Type Definitions'));
|
|
380
380
|
}
|
|
381
381
|
_getNoResultFoundMessage(info) {
|
|
382
382
|
return info && info.word
|
|
383
|
-
? nls.localize(
|
|
384
|
-
: nls.localize(
|
|
383
|
+
? nls.localize(1043, "No type definition found for '{0}'", info.word)
|
|
384
|
+
: nls.localize(1044, "No type definition found");
|
|
385
385
|
}
|
|
386
386
|
_getAlternativeCommand(editor) {
|
|
387
387
|
return editor.getOption(67 /* EditorOption.gotoLocation */).alternativeTypeDefinitionCommand;
|
|
@@ -400,8 +400,8 @@ registerAction2(class GoToTypeDefinitionAction extends TypeDefinitionAction {
|
|
|
400
400
|
}, {
|
|
401
401
|
id: GoToTypeDefinitionAction.ID,
|
|
402
402
|
title: {
|
|
403
|
-
...nls.localize2(
|
|
404
|
-
mnemonicTitle: nls.localize(
|
|
403
|
+
...nls.localize2(1063, "Go to Type Definition"),
|
|
404
|
+
mnemonicTitle: nls.localize(1045, "Go to &&Type Definition"),
|
|
405
405
|
},
|
|
406
406
|
precondition: EditorContextKeys.hasTypeDefinitionProvider,
|
|
407
407
|
keybinding: {
|
|
@@ -431,7 +431,7 @@ registerAction2(class PeekTypeDefinitionAction extends TypeDefinitionAction {
|
|
|
431
431
|
muteMessage: false
|
|
432
432
|
}, {
|
|
433
433
|
id: PeekTypeDefinitionAction.ID,
|
|
434
|
-
title: nls.localize2(
|
|
434
|
+
title: nls.localize2(1064, "Peek Type Definition"),
|
|
435
435
|
precondition: ContextKeyExpr.and(EditorContextKeys.hasTypeDefinitionProvider, PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated()),
|
|
436
436
|
menu: {
|
|
437
437
|
id: MenuId.EditorContextPeek,
|
|
@@ -445,12 +445,12 @@ registerAction2(class PeekTypeDefinitionAction extends TypeDefinitionAction {
|
|
|
445
445
|
//#region --- IMPLEMENTATION
|
|
446
446
|
class ImplementationAction extends SymbolNavigationAction {
|
|
447
447
|
async _getLocationModel(languageFeaturesService, model, position, token) {
|
|
448
|
-
return new ReferencesModel(await getImplementationsAtPosition(languageFeaturesService.implementationProvider, model, position, false, token), nls.localize(
|
|
448
|
+
return new ReferencesModel(await getImplementationsAtPosition(languageFeaturesService.implementationProvider, model, position, false, token), nls.localize(1046, 'Implementations'));
|
|
449
449
|
}
|
|
450
450
|
_getNoResultFoundMessage(info) {
|
|
451
451
|
return info && info.word
|
|
452
|
-
? nls.localize(
|
|
453
|
-
: nls.localize(
|
|
452
|
+
? nls.localize(1047, "No implementation found for '{0}'", info.word)
|
|
453
|
+
: nls.localize(1048, "No implementation found");
|
|
454
454
|
}
|
|
455
455
|
_getAlternativeCommand(editor) {
|
|
456
456
|
return editor.getOption(67 /* EditorOption.gotoLocation */).alternativeImplementationCommand;
|
|
@@ -469,8 +469,8 @@ registerAction2(class GoToImplementationAction extends ImplementationAction {
|
|
|
469
469
|
}, {
|
|
470
470
|
id: GoToImplementationAction.ID,
|
|
471
471
|
title: {
|
|
472
|
-
...nls.localize2(
|
|
473
|
-
mnemonicTitle: nls.localize(
|
|
472
|
+
...nls.localize2(1065, "Go to Implementations"),
|
|
473
|
+
mnemonicTitle: nls.localize(1049, "Go to &&Implementations"),
|
|
474
474
|
},
|
|
475
475
|
precondition: EditorContextKeys.hasImplementationProvider,
|
|
476
476
|
keybinding: {
|
|
@@ -500,7 +500,7 @@ registerAction2(class PeekImplementationAction extends ImplementationAction {
|
|
|
500
500
|
muteMessage: false
|
|
501
501
|
}, {
|
|
502
502
|
id: PeekImplementationAction.ID,
|
|
503
|
-
title: nls.localize2(
|
|
503
|
+
title: nls.localize2(1066, "Peek Implementations"),
|
|
504
504
|
precondition: ContextKeyExpr.and(EditorContextKeys.hasImplementationProvider, PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated()),
|
|
505
505
|
keybinding: {
|
|
506
506
|
when: EditorContextKeys.editorTextFocus,
|
|
@@ -520,8 +520,8 @@ registerAction2(class PeekImplementationAction extends ImplementationAction {
|
|
|
520
520
|
class ReferencesAction extends SymbolNavigationAction {
|
|
521
521
|
_getNoResultFoundMessage(info) {
|
|
522
522
|
return info
|
|
523
|
-
? nls.localize(
|
|
524
|
-
: nls.localize(
|
|
523
|
+
? nls.localize(1050, "No references found for '{0}'", info.word)
|
|
524
|
+
: nls.localize(1051, "No references found");
|
|
525
525
|
}
|
|
526
526
|
_getAlternativeCommand(editor) {
|
|
527
527
|
return editor.getOption(67 /* EditorOption.gotoLocation */).alternativeReferenceCommand;
|
|
@@ -539,8 +539,8 @@ registerAction2(class GoToReferencesAction extends ReferencesAction {
|
|
|
539
539
|
}, {
|
|
540
540
|
id: 'editor.action.goToReferences',
|
|
541
541
|
title: {
|
|
542
|
-
...nls.localize2(
|
|
543
|
-
mnemonicTitle: nls.localize(
|
|
542
|
+
...nls.localize2(1067, "Go to References"),
|
|
543
|
+
mnemonicTitle: nls.localize(1052, "Go to &&References"),
|
|
544
544
|
},
|
|
545
545
|
precondition: ContextKeyExpr.and(EditorContextKeys.hasReferenceProvider, PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated()),
|
|
546
546
|
keybinding: {
|
|
@@ -561,7 +561,7 @@ registerAction2(class GoToReferencesAction extends ReferencesAction {
|
|
|
561
561
|
});
|
|
562
562
|
}
|
|
563
563
|
async _getLocationModel(languageFeaturesService, model, position, token) {
|
|
564
|
-
return new ReferencesModel(await getReferencesAtPosition(languageFeaturesService.referenceProvider, model, position, true, false, token), nls.localize(
|
|
564
|
+
return new ReferencesModel(await getReferencesAtPosition(languageFeaturesService.referenceProvider, model, position, true, false, token), nls.localize(1053, 'References'));
|
|
565
565
|
}
|
|
566
566
|
});
|
|
567
567
|
registerAction2(class PeekReferencesAction extends ReferencesAction {
|
|
@@ -572,7 +572,7 @@ registerAction2(class PeekReferencesAction extends ReferencesAction {
|
|
|
572
572
|
muteMessage: false
|
|
573
573
|
}, {
|
|
574
574
|
id: 'editor.action.referenceSearch.trigger',
|
|
575
|
-
title: nls.localize2(
|
|
575
|
+
title: nls.localize2(1068, "Peek References"),
|
|
576
576
|
precondition: ContextKeyExpr.and(EditorContextKeys.hasReferenceProvider, PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated()),
|
|
577
577
|
menu: {
|
|
578
578
|
id: MenuId.EditorContextPeek,
|
|
@@ -582,7 +582,7 @@ registerAction2(class PeekReferencesAction extends ReferencesAction {
|
|
|
582
582
|
});
|
|
583
583
|
}
|
|
584
584
|
async _getLocationModel(languageFeaturesService, model, position, token) {
|
|
585
|
-
return new ReferencesModel(await getReferencesAtPosition(languageFeaturesService.referenceProvider, model, position, false, false, token), nls.localize(
|
|
585
|
+
return new ReferencesModel(await getReferencesAtPosition(languageFeaturesService.referenceProvider, model, position, false, false, token), nls.localize(1054, 'References'));
|
|
586
586
|
}
|
|
587
587
|
});
|
|
588
588
|
//#endregion
|
|
@@ -591,17 +591,17 @@ class GenericGoToLocationAction extends SymbolNavigationAction {
|
|
|
591
591
|
constructor(config, _references, _gotoMultipleBehaviour) {
|
|
592
592
|
super(config, {
|
|
593
593
|
id: 'editor.action.goToLocation',
|
|
594
|
-
title: nls.localize2(
|
|
594
|
+
title: nls.localize2(1069, "Go to Any Symbol"),
|
|
595
595
|
precondition: ContextKeyExpr.and(PeekContext.notInPeekEditor, EditorContextKeys.isInEmbeddedEditor.toNegated()),
|
|
596
596
|
});
|
|
597
597
|
this._references = _references;
|
|
598
598
|
this._gotoMultipleBehaviour = _gotoMultipleBehaviour;
|
|
599
599
|
}
|
|
600
600
|
async _getLocationModel(languageFeaturesService, _model, _position, _token) {
|
|
601
|
-
return new ReferencesModel(this._references, nls.localize(
|
|
601
|
+
return new ReferencesModel(this._references, nls.localize(1055, 'Locations'));
|
|
602
602
|
}
|
|
603
603
|
_getNoResultFoundMessage(info) {
|
|
604
|
-
return info && nls.localize(
|
|
604
|
+
return info && nls.localize(1056, "No results for '{0}'", info.word) || '';
|
|
605
605
|
}
|
|
606
606
|
_getGoToPreference(editor) {
|
|
607
607
|
return this._gotoMultipleBehaviour ?? editor.getOption(67 /* EditorOption.gotoLocation */).multipleReferences;
|
|
@@ -680,7 +680,7 @@ CommandsRegistry.registerCommand({
|
|
|
680
680
|
if (!controller) {
|
|
681
681
|
return undefined;
|
|
682
682
|
}
|
|
683
|
-
const references = createCancelablePromise(token => getReferencesAtPosition(languageFeaturesService.referenceProvider, control.getModel(), corePosition.Position.lift(position), false, false, token).then(references => new ReferencesModel(references, nls.localize(
|
|
683
|
+
const references = createCancelablePromise(token => getReferencesAtPosition(languageFeaturesService.referenceProvider, control.getModel(), corePosition.Position.lift(position), false, false, token).then(references => new ReferencesModel(references, nls.localize(1057, 'References'))));
|
|
684
684
|
const range = new Range(position.lineNumber, position.column, position.lineNumber, position.column);
|
|
685
685
|
return Promise.resolve(controller.toggleWidget(range, references, false));
|
|
686
686
|
});
|
|
@@ -17,7 +17,14 @@ export class ClickLinkMouseEvent {
|
|
|
17
17
|
this.isLeftClick = source.event.leftButton;
|
|
18
18
|
this.isMiddleClick = source.event.middleButton;
|
|
19
19
|
this.isRightClick = source.event.rightButton;
|
|
20
|
+
this.mouseMiddleClickAction = opts.mouseMiddleClickAction;
|
|
20
21
|
this.hasTriggerModifier = hasModifier(source.event, opts.triggerModifier);
|
|
22
|
+
if (this.isMiddleClick && opts.mouseMiddleClickAction === 'ctrlLeftClick') {
|
|
23
|
+
// Redirect middle click to left click with modifier
|
|
24
|
+
this.isMiddleClick = false;
|
|
25
|
+
this.isLeftClick = true;
|
|
26
|
+
this.hasTriggerModifier = true;
|
|
27
|
+
}
|
|
21
28
|
this.hasSideBySideModifier = hasModifier(source.event, opts.triggerSideBySideModifier);
|
|
22
29
|
this.isNoneOrSingleMouseDown = (source.event.detail <= 1);
|
|
23
30
|
}
|
|
@@ -33,7 +40,8 @@ export class ClickLinkKeyboardEvent {
|
|
|
33
40
|
}
|
|
34
41
|
}
|
|
35
42
|
export class ClickLinkOptions {
|
|
36
|
-
constructor(triggerKey, triggerModifier, triggerSideBySideKey, triggerSideBySideModifier) {
|
|
43
|
+
constructor(triggerKey, triggerModifier, triggerSideBySideKey, triggerSideBySideModifier, mouseMiddleClickAction) {
|
|
44
|
+
this.mouseMiddleClickAction = mouseMiddleClickAction;
|
|
37
45
|
this.triggerKey = triggerKey;
|
|
38
46
|
this.triggerModifier = triggerModifier;
|
|
39
47
|
this.triggerSideBySideKey = triggerSideBySideKey;
|
|
@@ -43,20 +51,21 @@ export class ClickLinkOptions {
|
|
|
43
51
|
return (this.triggerKey === other.triggerKey
|
|
44
52
|
&& this.triggerModifier === other.triggerModifier
|
|
45
53
|
&& this.triggerSideBySideKey === other.triggerSideBySideKey
|
|
46
|
-
&& this.triggerSideBySideModifier === other.triggerSideBySideModifier
|
|
54
|
+
&& this.triggerSideBySideModifier === other.triggerSideBySideModifier
|
|
55
|
+
&& this.mouseMiddleClickAction === other.mouseMiddleClickAction);
|
|
47
56
|
}
|
|
48
57
|
}
|
|
49
|
-
function createOptions(multiCursorModifier) {
|
|
58
|
+
function createOptions(multiCursorModifier, mouseMiddleClickAction) {
|
|
50
59
|
if (multiCursorModifier === 'altKey') {
|
|
51
60
|
if (platform.isMacintosh) {
|
|
52
|
-
return new ClickLinkOptions(57 /* KeyCode.Meta */, 'metaKey', 6 /* KeyCode.Alt */, 'altKey');
|
|
61
|
+
return new ClickLinkOptions(57 /* KeyCode.Meta */, 'metaKey', 6 /* KeyCode.Alt */, 'altKey', mouseMiddleClickAction);
|
|
53
62
|
}
|
|
54
|
-
return new ClickLinkOptions(5 /* KeyCode.Ctrl */, 'ctrlKey', 6 /* KeyCode.Alt */, 'altKey');
|
|
63
|
+
return new ClickLinkOptions(5 /* KeyCode.Ctrl */, 'ctrlKey', 6 /* KeyCode.Alt */, 'altKey', mouseMiddleClickAction);
|
|
55
64
|
}
|
|
56
65
|
if (platform.isMacintosh) {
|
|
57
|
-
return new ClickLinkOptions(6 /* KeyCode.Alt */, 'altKey', 57 /* KeyCode.Meta */, 'metaKey');
|
|
66
|
+
return new ClickLinkOptions(6 /* KeyCode.Alt */, 'altKey', 57 /* KeyCode.Meta */, 'metaKey', mouseMiddleClickAction);
|
|
58
67
|
}
|
|
59
|
-
return new ClickLinkOptions(6 /* KeyCode.Alt */, 'altKey', 5 /* KeyCode.Ctrl */, 'ctrlKey');
|
|
68
|
+
return new ClickLinkOptions(6 /* KeyCode.Alt */, 'altKey', 5 /* KeyCode.Ctrl */, 'ctrlKey', mouseMiddleClickAction);
|
|
60
69
|
}
|
|
61
70
|
export class ClickLinkGesture extends Disposable {
|
|
62
71
|
constructor(editor, opts) {
|
|
@@ -69,13 +78,13 @@ export class ClickLinkGesture extends Disposable {
|
|
|
69
78
|
this.onCancel = this._onCancel.event;
|
|
70
79
|
this._editor = editor;
|
|
71
80
|
this._extractLineNumberFromMouseEvent = opts?.extractLineNumberFromMouseEvent ?? ((e) => e.target.position ? e.target.position.lineNumber : 0);
|
|
72
|
-
this._opts = createOptions(this._editor.getOption(86 /* EditorOption.multiCursorModifier */));
|
|
81
|
+
this._opts = createOptions(this._editor.getOption(86 /* EditorOption.multiCursorModifier */), this._editor.getOption(87 /* EditorOption.mouseMiddleClickAction */));
|
|
73
82
|
this._lastMouseMoveEvent = null;
|
|
74
83
|
this._hasTriggerKeyOnMouseDown = false;
|
|
75
84
|
this._lineNumberOnMouseDown = 0;
|
|
76
85
|
this._register(this._editor.onDidChangeConfiguration((e) => {
|
|
77
|
-
if (e.hasChanged(86 /* EditorOption.multiCursorModifier */)) {
|
|
78
|
-
const newOpts = createOptions(this._editor.getOption(86 /* EditorOption.multiCursorModifier */));
|
|
86
|
+
if (e.hasChanged(86 /* EditorOption.multiCursorModifier */) || e.hasChanged(87 /* EditorOption.mouseMiddleClickAction */)) {
|
|
87
|
+
const newOpts = createOptions(this._editor.getOption(86 /* EditorOption.multiCursorModifier */), this._editor.getOption(87 /* EditorOption.mouseMiddleClickAction */));
|
|
79
88
|
if (this._opts.equals(newOpts)) {
|
|
80
89
|
return;
|
|
81
90
|
}
|
|
@@ -120,7 +129,8 @@ export class ClickLinkGesture extends Disposable {
|
|
|
120
129
|
}
|
|
121
130
|
_onEditorMouseUp(mouseEvent) {
|
|
122
131
|
const currentLineNumber = this._extractLineNumberFromMouseEvent(mouseEvent);
|
|
123
|
-
|
|
132
|
+
const lineNumbersCorrect = !!this._lineNumberOnMouseDown && this._lineNumberOnMouseDown === currentLineNumber;
|
|
133
|
+
if (lineNumbersCorrect && (this._hasTriggerKeyOnMouseDown || (mouseEvent.isMiddleClick && mouseEvent.mouseMiddleClickAction === 'openLink'))) {
|
|
124
134
|
this._onExecute.fire(mouseEvent);
|
|
125
135
|
}
|
|
126
136
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.ts","vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.ts"],"names":[],"mappings":"AAAA;;;gGAGg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AAC;CACD","file":"clickLinkGesture.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 { IKeyboardEvent } from '../../../../../base/browser/keyboardEvent.js';\nimport { Emitter, Event } from '../../../../../base/common/event.js';\nimport { KeyCode } from '../../../../../base/common/keyCodes.js';\nimport { Disposable } from '../../../../../base/common/lifecycle.js';\nimport * as platform from '../../../../../base/common/platform.js';\nimport { ICodeEditor, IEditorMouseEvent, IMouseTarget } from '../../../../browser/editorBrowser.js';\nimport { EditorOption } from '../../../../common/config/editorOptions.js';\nimport { ICursorSelectionChangedEvent } from '../../../../common/cursorEvents.js';\n\nfunction hasModifier(e: { ctrlKey: boolean; shiftKey: boolean; altKey: boolean; metaKey: boolean }, modifier: 'ctrlKey' | 'shiftKey' | 'altKey' | 'metaKey'): boolean {\n\treturn !!e[modifier];\n}\n\n/**\n * An event that encapsulates the various trigger modifiers logic needed for go to definition.\n */\nexport class ClickLinkMouseEvent {\n\n\tpublic readonly target: IMouseTarget;\n\tpublic readonly hasTriggerModifier: boolean;\n\tpublic readonly hasSideBySideModifier: boolean;\n\tpublic readonly isNoneOrSingleMouseDown: boolean;\n\tpublic readonly isLeftClick: boolean;\n\tpublic readonly isMiddleClick: boolean;\n\tpublic readonly isRightClick: boolean;\n\n\tconstructor(source: IEditorMouseEvent, opts: ClickLinkOptions) {\n\t\tthis.target = source.target;\n\t\tthis.isLeftClick = source.event.leftButton;\n\t\tthis.isMiddleClick = source.event.middleButton;\n\t\tthis.isRightClick = source.event.rightButton;\n\t\tthis.hasTriggerModifier = hasModifier(source.event, opts.triggerModifier);\n\t\tthis.hasSideBySideModifier = hasModifier(source.event, opts.triggerSideBySideModifier);\n\t\tthis.isNoneOrSingleMouseDown = (source.event.detail <= 1);\n\t}\n}\n\n/**\n * An event that encapsulates the various trigger modifiers logic needed for go to definition.\n */\nexport class ClickLinkKeyboardEvent {\n\n\tpublic readonly keyCodeIsTriggerKey: boolean;\n\tpublic readonly keyCodeIsSideBySideKey: boolean;\n\tpublic readonly hasTriggerModifier: boolean;\n\n\tconstructor(source: IKeyboardEvent, opts: ClickLinkOptions) {\n\t\tthis.keyCodeIsTriggerKey = (source.keyCode === opts.triggerKey);\n\t\tthis.keyCodeIsSideBySideKey = (source.keyCode === opts.triggerSideBySideKey);\n\t\tthis.hasTriggerModifier = hasModifier(source, opts.triggerModifier);\n\t}\n}\nexport type TriggerModifier = 'ctrlKey' | 'shiftKey' | 'altKey' | 'metaKey';\n\nexport class ClickLinkOptions {\n\n\tpublic readonly triggerKey: KeyCode;\n\tpublic readonly triggerModifier: TriggerModifier;\n\tpublic readonly triggerSideBySideKey: KeyCode;\n\tpublic readonly triggerSideBySideModifier: TriggerModifier;\n\n\tconstructor(\n\t\ttriggerKey: KeyCode,\n\t\ttriggerModifier: TriggerModifier,\n\t\ttriggerSideBySideKey: KeyCode,\n\t\ttriggerSideBySideModifier: TriggerModifier\n\t) {\n\t\tthis.triggerKey = triggerKey;\n\t\tthis.triggerModifier = triggerModifier;\n\t\tthis.triggerSideBySideKey = triggerSideBySideKey;\n\t\tthis.triggerSideBySideModifier = triggerSideBySideModifier;\n\t}\n\n\tpublic equals(other: ClickLinkOptions): boolean {\n\t\treturn (\n\t\t\tthis.triggerKey === other.triggerKey\n\t\t\t&& this.triggerModifier === other.triggerModifier\n\t\t\t&& this.triggerSideBySideKey === other.triggerSideBySideKey\n\t\t\t&& this.triggerSideBySideModifier === other.triggerSideBySideModifier\n\t\t);\n\t}\n}\n\nfunction createOptions(multiCursorModifier: 'altKey' | 'ctrlKey' | 'metaKey'): ClickLinkOptions {\n\tif (multiCursorModifier === 'altKey') {\n\t\tif (platform.isMacintosh) {\n\t\t\treturn new ClickLinkOptions(KeyCode.Meta, 'metaKey', KeyCode.Alt, 'altKey');\n\t\t}\n\t\treturn new ClickLinkOptions(KeyCode.Ctrl, 'ctrlKey', KeyCode.Alt, 'altKey');\n\t}\n\n\tif (platform.isMacintosh) {\n\t\treturn new ClickLinkOptions(KeyCode.Alt, 'altKey', KeyCode.Meta, 'metaKey');\n\t}\n\treturn new ClickLinkOptions(KeyCode.Alt, 'altKey', KeyCode.Ctrl, 'ctrlKey');\n}\n\nexport interface IClickLinkGestureOptions {\n\t/**\n\t * Return 0 if the mouse event should not be considered.\n\t */\n\textractLineNumberFromMouseEvent?: (e: ClickLinkMouseEvent) => number;\n}\n\nexport class ClickLinkGesture extends Disposable {\n\n\tprivate readonly _onMouseMoveOrRelevantKeyDown: Emitter<[ClickLinkMouseEvent, ClickLinkKeyboardEvent | null]> = this._register(new Emitter<[ClickLinkMouseEvent, ClickLinkKeyboardEvent | null]>());\n\tpublic readonly onMouseMoveOrRelevantKeyDown: Event<[ClickLinkMouseEvent, ClickLinkKeyboardEvent | null]> = this._onMouseMoveOrRelevantKeyDown.event;\n\n\tprivate readonly _onExecute: Emitter<ClickLinkMouseEvent> = this._register(new Emitter<ClickLinkMouseEvent>());\n\tpublic readonly onExecute: Event<ClickLinkMouseEvent> = this._onExecute.event;\n\n\tprivate readonly _onCancel: Emitter<void> = this._register(new Emitter<void>());\n\tpublic readonly onCancel: Event<void> = this._onCancel.event;\n\n\tprivate readonly _editor: ICodeEditor;\n\tprivate readonly _extractLineNumberFromMouseEvent: (e: ClickLinkMouseEvent) => number;\n\tprivate _opts: ClickLinkOptions;\n\n\tprivate _lastMouseMoveEvent: ClickLinkMouseEvent | null;\n\tprivate _hasTriggerKeyOnMouseDown: boolean;\n\tprivate _lineNumberOnMouseDown: number;\n\n\tconstructor(editor: ICodeEditor, opts?: IClickLinkGestureOptions) {\n\t\tsuper();\n\n\t\tthis._editor = editor;\n\t\tthis._extractLineNumberFromMouseEvent = opts?.extractLineNumberFromMouseEvent ?? ((e) => e.target.position ? e.target.position.lineNumber : 0);\n\t\tthis._opts = createOptions(this._editor.getOption(EditorOption.multiCursorModifier));\n\n\t\tthis._lastMouseMoveEvent = null;\n\t\tthis._hasTriggerKeyOnMouseDown = false;\n\t\tthis._lineNumberOnMouseDown = 0;\n\n\t\tthis._register(this._editor.onDidChangeConfiguration((e) => {\n\t\t\tif (e.hasChanged(EditorOption.multiCursorModifier)) {\n\t\t\t\tconst newOpts = createOptions(this._editor.getOption(EditorOption.multiCursorModifier));\n\t\t\t\tif (this._opts.equals(newOpts)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis._opts = newOpts;\n\t\t\t\tthis._lastMouseMoveEvent = null;\n\t\t\t\tthis._hasTriggerKeyOnMouseDown = false;\n\t\t\t\tthis._lineNumberOnMouseDown = 0;\n\t\t\t\tthis._onCancel.fire();\n\t\t\t}\n\t\t}));\n\t\tthis._register(this._editor.onMouseMove((e: IEditorMouseEvent) => this._onEditorMouseMove(new ClickLinkMouseEvent(e, this._opts))));\n\t\tthis._register(this._editor.onMouseDown((e: IEditorMouseEvent) => this._onEditorMouseDown(new ClickLinkMouseEvent(e, this._opts))));\n\t\tthis._register(this._editor.onMouseUp((e: IEditorMouseEvent) => this._onEditorMouseUp(new ClickLinkMouseEvent(e, this._opts))));\n\t\tthis._register(this._editor.onKeyDown((e: IKeyboardEvent) => this._onEditorKeyDown(new ClickLinkKeyboardEvent(e, this._opts))));\n\t\tthis._register(this._editor.onKeyUp((e: IKeyboardEvent) => this._onEditorKeyUp(new ClickLinkKeyboardEvent(e, this._opts))));\n\t\tthis._register(this._editor.onMouseDrag(() => this._resetHandler()));\n\n\t\tthis._register(this._editor.onDidChangeCursorSelection((e) => this._onDidChangeCursorSelection(e)));\n\t\tthis._register(this._editor.onDidChangeModel((e) => this._resetHandler()));\n\t\tthis._register(this._editor.onDidChangeModelContent(() => this._resetHandler()));\n\t\tthis._register(this._editor.onDidScrollChange((e) => {\n\t\t\tif (e.scrollTopChanged || e.scrollLeftChanged) {\n\t\t\t\tthis._resetHandler();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate _onDidChangeCursorSelection(e: ICursorSelectionChangedEvent): void {\n\t\tif (e.selection && e.selection.startColumn !== e.selection.endColumn) {\n\t\t\tthis._resetHandler(); // immediately stop this feature if the user starts to select (https://github.com/microsoft/vscode/issues/7827)\n\t\t}\n\t}\n\n\tprivate _onEditorMouseMove(mouseEvent: ClickLinkMouseEvent): void {\n\t\tthis._lastMouseMoveEvent = mouseEvent;\n\n\t\tthis._onMouseMoveOrRelevantKeyDown.fire([mouseEvent, null]);\n\t}\n\n\tprivate _onEditorMouseDown(mouseEvent: ClickLinkMouseEvent): void {\n\t\t// We need to record if we had the trigger key on mouse down because someone might select something in the editor\n\t\t// holding the mouse down and then while mouse is down start to press Ctrl/Cmd to start a copy operation and then\n\t\t// release the mouse button without wanting to do the navigation.\n\t\t// With this flag we prevent goto definition if the mouse was down before the trigger key was pressed.\n\t\tthis._hasTriggerKeyOnMouseDown = mouseEvent.hasTriggerModifier;\n\t\tthis._lineNumberOnMouseDown = this._extractLineNumberFromMouseEvent(mouseEvent);\n\t}\n\n\tprivate _onEditorMouseUp(mouseEvent: ClickLinkMouseEvent): void {\n\t\tconst currentLineNumber = this._extractLineNumberFromMouseEvent(mouseEvent);\n\t\tif (this._hasTriggerKeyOnMouseDown && this._lineNumberOnMouseDown && this._lineNumberOnMouseDown === currentLineNumber) {\n\t\t\tthis._onExecute.fire(mouseEvent);\n\t\t}\n\t}\n\n\tprivate _onEditorKeyDown(e: ClickLinkKeyboardEvent): void {\n\t\tif (\n\t\t\tthis._lastMouseMoveEvent\n\t\t\t&& (\n\t\t\t\te.keyCodeIsTriggerKey // User just pressed Ctrl/Cmd (normal goto definition)\n\t\t\t\t|| (e.keyCodeIsSideBySideKey && e.hasTriggerModifier) // User pressed Ctrl/Cmd+Alt (goto definition to the side)\n\t\t\t)\n\t\t) {\n\t\t\tthis._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent, e]);\n\t\t} else if (e.hasTriggerModifier) {\n\t\t\tthis._onCancel.fire(); // remove decorations if user holds another key with ctrl/cmd to prevent accident goto declaration\n\t\t}\n\t}\n\n\tprivate _onEditorKeyUp(e: ClickLinkKeyboardEvent): void {\n\t\tif (e.keyCodeIsTriggerKey) {\n\t\t\tthis._onCancel.fire();\n\t\t}\n\t}\n\n\tprivate _resetHandler(): void {\n\t\tthis._lastMouseMoveEvent = null;\n\t\tthis._hasTriggerKeyOnMouseDown = false;\n\t\tthis._onCancel.fire();\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IKeyboardEvent } from '../../../../../base/browser/keyboardEvent.js';\nimport { Emitter, Event } from '../../../../../base/common/event.js';\nimport { KeyCode } from '../../../../../base/common/keyCodes.js';\nimport { Disposable } from '../../../../../base/common/lifecycle.js';\nimport * as platform from '../../../../../base/common/platform.js';\nimport { ICodeEditor, IEditorMouseEvent, IMouseTarget } from '../../../../browser/editorBrowser.js';\nimport { EditorOption } from '../../../../common/config/editorOptions.js';\nimport { ICursorSelectionChangedEvent } from '../../../../common/cursorEvents.js';\n\nfunction hasModifier(e: { ctrlKey: boolean; shiftKey: boolean; altKey: boolean; metaKey: boolean }, modifier: 'ctrlKey' | 'shiftKey' | 'altKey' | 'metaKey'): boolean {\n\treturn !!e[modifier];\n}\n\n/**\n * An event that encapsulates the various trigger modifiers logic needed for go to definition.\n */\nexport class ClickLinkMouseEvent {\n\n\tpublic readonly target: IMouseTarget;\n\tpublic readonly hasTriggerModifier: boolean;\n\tpublic readonly hasSideBySideModifier: boolean;\n\tpublic readonly isNoneOrSingleMouseDown: boolean;\n\tpublic readonly isLeftClick: boolean;\n\tpublic readonly isMiddleClick: boolean;\n\tpublic readonly isRightClick: boolean;\n\n\tconstructor(source: IEditorMouseEvent, opts: ClickLinkOptions) {\n\t\tthis.target = source.target;\n\t\tthis.isLeftClick = source.event.leftButton;\n\t\tthis.isMiddleClick = source.event.middleButton;\n\t\tthis.isRightClick = source.event.rightButton;\n\t\tthis.hasTriggerModifier = hasModifier(source.event, opts.triggerModifier);\n\t\tthis.hasSideBySideModifier = hasModifier(source.event, opts.triggerSideBySideModifier);\n\t\tthis.isNoneOrSingleMouseDown = (source.event.detail <= 1);\n\t}\n}\n\n/**\n * An event that encapsulates the various trigger modifiers logic needed for go to definition.\n */\nexport class ClickLinkKeyboardEvent {\n\n\tpublic readonly keyCodeIsTriggerKey: boolean;\n\tpublic readonly keyCodeIsSideBySideKey: boolean;\n\tpublic readonly hasTriggerModifier: boolean;\n\n\tconstructor(source: IKeyboardEvent, opts: ClickLinkOptions) {\n\t\tthis.keyCodeIsTriggerKey = (source.keyCode === opts.triggerKey);\n\t\tthis.keyCodeIsSideBySideKey = (source.keyCode === opts.triggerSideBySideKey);\n\t\tthis.hasTriggerModifier = hasModifier(source, opts.triggerModifier);\n\t}\n}\nexport type TriggerModifier = 'ctrlKey' | 'shiftKey' | 'altKey' | 'metaKey';\n\nexport class ClickLinkOptions {\n\n\tpublic readonly triggerKey: KeyCode;\n\tpublic readonly triggerModifier: TriggerModifier;\n\tpublic readonly triggerSideBySideKey: KeyCode;\n\tpublic readonly triggerSideBySideModifier: TriggerModifier;\n\n\tconstructor(\n\t\ttriggerKey: KeyCode,\n\t\ttriggerModifier: TriggerModifier,\n\t\ttriggerSideBySideKey: KeyCode,\n\t\ttriggerSideBySideModifier: TriggerModifier\n\t) {\n\t\tthis.triggerKey = triggerKey;\n\t\tthis.triggerModifier = triggerModifier;\n\t\tthis.triggerSideBySideKey = triggerSideBySideKey;\n\t\tthis.triggerSideBySideModifier = triggerSideBySideModifier;\n\t}\n\n\tpublic equals(other: ClickLinkOptions): boolean {\n\t\treturn (\n\t\t\tthis.triggerKey === other.triggerKey\n\t\t\t&& this.triggerModifier === other.triggerModifier\n\t\t\t&& this.triggerSideBySideKey === other.triggerSideBySideKey\n\t\t\t&& this.triggerSideBySideModifier === other.triggerSideBySideModifier\n\t\t);\n\t}\n}\n\nfunction createOptions(multiCursorModifier: 'altKey' | 'ctrlKey' | 'metaKey'): ClickLinkOptions {\n\tif (multiCursorModifier === 'altKey') {\n\t\tif (platform.isMacintosh) {\n\t\t\treturn new ClickLinkOptions(KeyCode.Meta, 'metaKey', KeyCode.Alt, 'altKey');\n\t\t}\n\t\treturn new ClickLinkOptions(KeyCode.Ctrl, 'ctrlKey', KeyCode.Alt, 'altKey');\n\t}\n\n\tif (platform.isMacintosh) {\n\t\treturn new ClickLinkOptions(KeyCode.Alt, 'altKey', KeyCode.Meta, 'metaKey');\n\t}\n\treturn new ClickLinkOptions(KeyCode.Alt, 'altKey', KeyCode.Ctrl, 'ctrlKey');\n}\n\nexport interface IClickLinkGestureOptions {\n\t/**\n\t * Return 0 if the mouse event should not be considered.\n\t */\n\textractLineNumberFromMouseEvent?: (e: ClickLinkMouseEvent) => number;\n}\n\nexport class ClickLinkGesture extends Disposable {\n\n\tprivate readonly _onMouseMoveOrRelevantKeyDown: Emitter<[ClickLinkMouseEvent, ClickLinkKeyboardEvent | null]> = this._register(new Emitter<[ClickLinkMouseEvent, ClickLinkKeyboardEvent | null]>());\n\tpublic readonly onMouseMoveOrRelevantKeyDown: Event<[ClickLinkMouseEvent, ClickLinkKeyboardEvent | null]> = this._onMouseMoveOrRelevantKeyDown.event;\n\n\tprivate readonly _onExecute: Emitter<ClickLinkMouseEvent> = this._register(new Emitter<ClickLinkMouseEvent>());\n\tpublic readonly onExecute: Event<ClickLinkMouseEvent> = this._onExecute.event;\n\n\tprivate readonly _onCancel: Emitter<void> = this._register(new Emitter<void>());\n\tpublic readonly onCancel: Event<void> = this._onCancel.event;\n\n\tprivate readonly _editor: ICodeEditor;\n\tprivate readonly _extractLineNumberFromMouseEvent: (e: ClickLinkMouseEvent) => number;\n\tprivate _opts: ClickLinkOptions;\n\n\tprivate _lastMouseMoveEvent: ClickLinkMouseEvent | null;\n\tprivate _hasTriggerKeyOnMouseDown: boolean;\n\tprivate _lineNumberOnMouseDown: number;\n\n\tconstructor(editor: ICodeEditor, opts?: IClickLinkGestureOptions) {\n\t\tsuper();\n\n\t\tthis._editor = editor;\n\t\tthis._extractLineNumberFromMouseEvent = opts?.extractLineNumberFromMouseEvent ?? ((e) => e.target.position ? e.target.position.lineNumber : 0);\n\t\tthis._opts = createOptions(this._editor.getOption(EditorOption.multiCursorModifier));\n\n\t\tthis._lastMouseMoveEvent = null;\n\t\tthis._hasTriggerKeyOnMouseDown = false;\n\t\tthis._lineNumberOnMouseDown = 0;\n\n\t\tthis._register(this._editor.onDidChangeConfiguration((e) => {\n\t\t\tif (e.hasChanged(EditorOption.multiCursorModifier)) {\n\t\t\t\tconst newOpts = createOptions(this._editor.getOption(EditorOption.multiCursorModifier));\n\t\t\t\tif (this._opts.equals(newOpts)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis._opts = newOpts;\n\t\t\t\tthis._lastMouseMoveEvent = null;\n\t\t\t\tthis._hasTriggerKeyOnMouseDown = false;\n\t\t\t\tthis._lineNumberOnMouseDown = 0;\n\t\t\t\tthis._onCancel.fire();\n\t\t\t}\n\t\t}));\n\t\tthis._register(this._editor.onMouseMove((e: IEditorMouseEvent) => this._onEditorMouseMove(new ClickLinkMouseEvent(e, this._opts))));\n\t\tthis._register(this._editor.onMouseDown((e: IEditorMouseEvent) => this._onEditorMouseDown(new ClickLinkMouseEvent(e, this._opts))));\n\t\tthis._register(this._editor.onMouseUp((e: IEditorMouseEvent) => this._onEditorMouseUp(new ClickLinkMouseEvent(e, this._opts))));\n\t\tthis._register(this._editor.onKeyDown((e: IKeyboardEvent) => this._onEditorKeyDown(new ClickLinkKeyboardEvent(e, this._opts))));\n\t\tthis._register(this._editor.onKeyUp((e: IKeyboardEvent) => this._onEditorKeyUp(new ClickLinkKeyboardEvent(e, this._opts))));\n\t\tthis._register(this._editor.onMouseDrag(() => this._resetHandler()));\n\n\t\tthis._register(this._editor.onDidChangeCursorSelection((e) => this._onDidChangeCursorSelection(e)));\n\t\tthis._register(this._editor.onDidChangeModel((e) => this._resetHandler()));\n\t\tthis._register(this._editor.onDidChangeModelContent(() => this._resetHandler()));\n\t\tthis._register(this._editor.onDidScrollChange((e) => {\n\t\t\tif (e.scrollTopChanged || e.scrollLeftChanged) {\n\t\t\t\tthis._resetHandler();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate _onDidChangeCursorSelection(e: ICursorSelectionChangedEvent): void {\n\t\tif (e.selection && e.selection.startColumn !== e.selection.endColumn) {\n\t\t\tthis._resetHandler(); // immediately stop this feature if the user starts to select (https://github.com/microsoft/vscode/issues/7827)\n\t\t}\n\t}\n\n\tprivate _onEditorMouseMove(mouseEvent: ClickLinkMouseEvent): void {\n\t\tthis._lastMouseMoveEvent = mouseEvent;\n\n\t\tthis._onMouseMoveOrRelevantKeyDown.fire([mouseEvent, null]);\n\t}\n\n\tprivate _onEditorMouseDown(mouseEvent: ClickLinkMouseEvent): void {\n\t\t// We need to record if we had the trigger key on mouse down because someone might select something in the editor\n\t\t// holding the mouse down and then while mouse is down start to press Ctrl/Cmd to start a copy operation and then\n\t\t// release the mouse button without wanting to do the navigation.\n\t\t// With this flag we prevent goto definition if the mouse was down before the trigger key was pressed.\n\t\tthis._hasTriggerKeyOnMouseDown = mouseEvent.hasTriggerModifier;\n\t\tthis._lineNumberOnMouseDown = this._extractLineNumberFromMouseEvent(mouseEvent);\n\t}\n\n\tprivate _onEditorMouseUp(mouseEvent: ClickLinkMouseEvent): void {\n\t\tconst currentLineNumber = this._extractLineNumberFromMouseEvent(mouseEvent);\n\t\tif (this._hasTriggerKeyOnMouseDown && this._lineNumberOnMouseDown && this._lineNumberOnMouseDown === currentLineNumber) {\n\t\t\tthis._onExecute.fire(mouseEvent);\n\t\t}\n\t}\n\n\tprivate _onEditorKeyDown(e: ClickLinkKeyboardEvent): void {\n\t\tif (\n\t\t\tthis._lastMouseMoveEvent\n\t\t\t&& (\n\t\t\t\te.keyCodeIsTriggerKey // User just pressed Ctrl/Cmd (normal goto definition)\n\t\t\t\t|| (e.keyCodeIsSideBySideKey && e.hasTriggerModifier) // User pressed Ctrl/Cmd+Alt (goto definition to the side)\n\t\t\t)\n\t\t) {\n\t\t\tthis._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent, e]);\n\t\t} else if (e.hasTriggerModifier) {\n\t\t\tthis._onCancel.fire(); // remove decorations if user holds another key with ctrl/cmd to prevent accident goto declaration\n\t\t}\n\t}\n\n\tprivate _onEditorKeyUp(e: ClickLinkKeyboardEvent): void {\n\t\tif (e.keyCodeIsTriggerKey) {\n\t\t\tthis._onCancel.fire();\n\t\t}\n\t}\n\n\tprivate _resetHandler(): void {\n\t\tthis._lastMouseMoveEvent = null;\n\t\tthis._hasTriggerKeyOnMouseDown = false;\n\t\tthis._onCancel.fire();\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["file:///mnt/vss/_work/1/s/dependencies/vscode/out-editor-src/vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.ts","vs/editor/contrib/gotoSymbol/browser/link/clickLinkGesture.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,OAAO,EAAS,MAAM,qCAAqC,CAAC;AAErE,OAAO,EAAE,UAAU,EAAE,MAAM,yCAAyC,CAAC;AACrE,OAAO,KAAK,QAAQ,MAAM,wCAAwC,CAAC;AAKnE,SAAS,WAAW,CAAC,CAA6E,EAAE,QAAuD;IAC1J,OAAO,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AACtB,CAAC;AAED;;GAEG;AACH,MAAM,OAAO,mBAAmB;IAY/B,YAAY,MAAyB,EAAE,IAAsB;QAC5D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC;QAC3C,IAAI,CAAC,aAAa,GAAG,MAA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AmB,EAAE,CAAC;YAC3B,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;QACvB,CAAC;IACF,CAAC;IAEO,aAAa;QACpB,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC;QAChC,IAAI,CAAC,yBAAyB,GAAG,KAAK,CAAC;QACvC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;CACD","file":"clickLinkGesture.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 { IKeyboardEvent } from '../../../../../base/browser/keyboardEvent.js';\nimport { Emitter, Event } from '../../../../../base/common/event.js';\nimport { KeyCode } from '../../../../../base/common/keyCodes.js';\nimport { Disposable } from '../../../../../base/common/lifecycle.js';\nimport * as platform from '../../../../../base/common/platform.js';\nimport { ICodeEditor, IEditorMouseEvent, IMouseTarget } from '../../../../browser/editorBrowser.js';\nimport { EditorOption, MouseMiddleClickAction } from '../../../../common/config/editorOptions.js';\nimport { ICursorSelectionChangedEvent } from '../../../../common/cursorEvents.js';\n\nfunction hasModifier(e: { ctrlKey: boolean; shiftKey: boolean; altKey: boolean; metaKey: boolean }, modifier: 'ctrlKey' | 'shiftKey' | 'altKey' | 'metaKey'): boolean {\n\treturn !!e[modifier];\n}\n\n/**\n * An event that encapsulates the various trigger modifiers logic needed for go to definition.\n */\nexport class ClickLinkMouseEvent {\n\n\tpublic readonly target: IMouseTarget;\n\tpublic readonly hasTriggerModifier: boolean;\n\tpublic readonly hasSideBySideModifier: boolean;\n\tpublic readonly isNoneOrSingleMouseDown: boolean;\n\tpublic readonly isLeftClick: boolean;\n\tpublic readonly isMiddleClick: boolean;\n\tpublic readonly isRightClick: boolean;\n\n\tpublic readonly mouseMiddleClickAction: MouseMiddleClickAction;\n\n\tconstructor(source: IEditorMouseEvent, opts: ClickLinkOptions) {\n\t\tthis.target = source.target;\n\t\tthis.isLeftClick = source.event.leftButton;\n\t\tthis.isMiddleClick = source.event.middleButton;\n\t\tthis.isRightClick = source.event.rightButton;\n\t\tthis.mouseMiddleClickAction = opts.mouseMiddleClickAction;\n\t\tthis.hasTriggerModifier = hasModifier(source.event, opts.triggerModifier);\n\n\t\tif (this.isMiddleClick && opts.mouseMiddleClickAction === 'ctrlLeftClick') {\n\t\t\t// Redirect middle click to left click with modifier\n\t\t\tthis.isMiddleClick = false;\n\t\t\tthis.isLeftClick = true;\n\t\t\tthis.hasTriggerModifier = true;\n\t\t}\n\t\tthis.hasSideBySideModifier = hasModifier(source.event, opts.triggerSideBySideModifier);\n\t\tthis.isNoneOrSingleMouseDown = (source.event.detail <= 1);\n\t}\n}\n\n/**\n * An event that encapsulates the various trigger modifiers logic needed for go to definition.\n */\nexport class ClickLinkKeyboardEvent {\n\n\tpublic readonly keyCodeIsTriggerKey: boolean;\n\tpublic readonly keyCodeIsSideBySideKey: boolean;\n\tpublic readonly hasTriggerModifier: boolean;\n\n\tconstructor(source: IKeyboardEvent, opts: ClickLinkOptions) {\n\t\tthis.keyCodeIsTriggerKey = (source.keyCode === opts.triggerKey);\n\t\tthis.keyCodeIsSideBySideKey = (source.keyCode === opts.triggerSideBySideKey);\n\t\tthis.hasTriggerModifier = hasModifier(source, opts.triggerModifier);\n\t}\n}\nexport type TriggerModifier = 'ctrlKey' | 'shiftKey' | 'altKey' | 'metaKey';\n\nexport class ClickLinkOptions {\n\n\tpublic readonly triggerKey: KeyCode;\n\tpublic readonly triggerModifier: TriggerModifier;\n\tpublic readonly triggerSideBySideKey: KeyCode;\n\tpublic readonly triggerSideBySideModifier: TriggerModifier;\n\n\tconstructor(\n\t\ttriggerKey: KeyCode,\n\t\ttriggerModifier: TriggerModifier,\n\t\ttriggerSideBySideKey: KeyCode,\n\t\ttriggerSideBySideModifier: TriggerModifier,\n\t\tpublic readonly mouseMiddleClickAction: MouseMiddleClickAction,\n\t) {\n\t\tthis.triggerKey = triggerKey;\n\t\tthis.triggerModifier = triggerModifier;\n\t\tthis.triggerSideBySideKey = triggerSideBySideKey;\n\t\tthis.triggerSideBySideModifier = triggerSideBySideModifier;\n\t}\n\n\tpublic equals(other: ClickLinkOptions): boolean {\n\t\treturn (\n\t\t\tthis.triggerKey === other.triggerKey\n\t\t\t&& this.triggerModifier === other.triggerModifier\n\t\t\t&& this.triggerSideBySideKey === other.triggerSideBySideKey\n\t\t\t&& this.triggerSideBySideModifier === other.triggerSideBySideModifier\n\t\t\t&& this.mouseMiddleClickAction === other.mouseMiddleClickAction\n\t\t);\n\t}\n}\n\nfunction createOptions(multiCursorModifier: 'altKey' | 'ctrlKey' | 'metaKey', mouseMiddleClickAction: MouseMiddleClickAction): ClickLinkOptions {\n\tif (multiCursorModifier === 'altKey') {\n\t\tif (platform.isMacintosh) {\n\t\t\treturn new ClickLinkOptions(KeyCode.Meta, 'metaKey', KeyCode.Alt, 'altKey', mouseMiddleClickAction);\n\t\t}\n\t\treturn new ClickLinkOptions(KeyCode.Ctrl, 'ctrlKey', KeyCode.Alt, 'altKey', mouseMiddleClickAction);\n\t}\n\n\tif (platform.isMacintosh) {\n\t\treturn new ClickLinkOptions(KeyCode.Alt, 'altKey', KeyCode.Meta, 'metaKey', mouseMiddleClickAction);\n\t}\n\treturn new ClickLinkOptions(KeyCode.Alt, 'altKey', KeyCode.Ctrl, 'ctrlKey', mouseMiddleClickAction);\n}\n\nexport interface IClickLinkGestureOptions {\n\t/**\n\t * Return 0 if the mouse event should not be considered.\n\t */\n\textractLineNumberFromMouseEvent?: (e: ClickLinkMouseEvent) => number;\n}\n\nexport class ClickLinkGesture extends Disposable {\n\n\tprivate readonly _onMouseMoveOrRelevantKeyDown: Emitter<[ClickLinkMouseEvent, ClickLinkKeyboardEvent | null]> = this._register(new Emitter<[ClickLinkMouseEvent, ClickLinkKeyboardEvent | null]>());\n\tpublic readonly onMouseMoveOrRelevantKeyDown: Event<[ClickLinkMouseEvent, ClickLinkKeyboardEvent | null]> = this._onMouseMoveOrRelevantKeyDown.event;\n\n\tprivate readonly _onExecute: Emitter<ClickLinkMouseEvent> = this._register(new Emitter<ClickLinkMouseEvent>());\n\tpublic readonly onExecute: Event<ClickLinkMouseEvent> = this._onExecute.event;\n\n\tprivate readonly _onCancel: Emitter<void> = this._register(new Emitter<void>());\n\tpublic readonly onCancel: Event<void> = this._onCancel.event;\n\n\tprivate readonly _editor: ICodeEditor;\n\tprivate readonly _extractLineNumberFromMouseEvent: (e: ClickLinkMouseEvent) => number;\n\tprivate _opts: ClickLinkOptions;\n\n\tprivate _lastMouseMoveEvent: ClickLinkMouseEvent | null;\n\tprivate _hasTriggerKeyOnMouseDown: boolean;\n\tprivate _lineNumberOnMouseDown: number;\n\n\tconstructor(editor: ICodeEditor, opts?: IClickLinkGestureOptions) {\n\t\tsuper();\n\n\t\tthis._editor = editor;\n\t\tthis._extractLineNumberFromMouseEvent = opts?.extractLineNumberFromMouseEvent ?? ((e) => e.target.position ? e.target.position.lineNumber : 0);\n\t\tthis._opts = createOptions(this._editor.getOption(EditorOption.multiCursorModifier), this._editor.getOption(EditorOption.mouseMiddleClickAction));\n\n\t\tthis._lastMouseMoveEvent = null;\n\t\tthis._hasTriggerKeyOnMouseDown = false;\n\t\tthis._lineNumberOnMouseDown = 0;\n\n\t\tthis._register(this._editor.onDidChangeConfiguration((e) => {\n\t\t\tif (e.hasChanged(EditorOption.multiCursorModifier) || e.hasChanged(EditorOption.mouseMiddleClickAction)) {\n\t\t\t\tconst newOpts = createOptions(this._editor.getOption(EditorOption.multiCursorModifier), this._editor.getOption(EditorOption.mouseMiddleClickAction));\n\t\t\t\tif (this._opts.equals(newOpts)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis._opts = newOpts;\n\t\t\t\tthis._lastMouseMoveEvent = null;\n\t\t\t\tthis._hasTriggerKeyOnMouseDown = false;\n\t\t\t\tthis._lineNumberOnMouseDown = 0;\n\t\t\t\tthis._onCancel.fire();\n\t\t\t}\n\t\t}));\n\t\tthis._register(this._editor.onMouseMove((e: IEditorMouseEvent) => this._onEditorMouseMove(new ClickLinkMouseEvent(e, this._opts))));\n\t\tthis._register(this._editor.onMouseDown((e: IEditorMouseEvent) => this._onEditorMouseDown(new ClickLinkMouseEvent(e, this._opts))));\n\t\tthis._register(this._editor.onMouseUp((e: IEditorMouseEvent) => this._onEditorMouseUp(new ClickLinkMouseEvent(e, this._opts))));\n\t\tthis._register(this._editor.onKeyDown((e: IKeyboardEvent) => this._onEditorKeyDown(new ClickLinkKeyboardEvent(e, this._opts))));\n\t\tthis._register(this._editor.onKeyUp((e: IKeyboardEvent) => this._onEditorKeyUp(new ClickLinkKeyboardEvent(e, this._opts))));\n\t\tthis._register(this._editor.onMouseDrag(() => this._resetHandler()));\n\n\t\tthis._register(this._editor.onDidChangeCursorSelection((e) => this._onDidChangeCursorSelection(e)));\n\t\tthis._register(this._editor.onDidChangeModel((e) => this._resetHandler()));\n\t\tthis._register(this._editor.onDidChangeModelContent(() => this._resetHandler()));\n\t\tthis._register(this._editor.onDidScrollChange((e) => {\n\t\t\tif (e.scrollTopChanged || e.scrollLeftChanged) {\n\t\t\t\tthis._resetHandler();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate _onDidChangeCursorSelection(e: ICursorSelectionChangedEvent): void {\n\t\tif (e.selection && e.selection.startColumn !== e.selection.endColumn) {\n\t\t\tthis._resetHandler(); // immediately stop this feature if the user starts to select (https://github.com/microsoft/vscode/issues/7827)\n\t\t}\n\t}\n\n\tprivate _onEditorMouseMove(mouseEvent: ClickLinkMouseEvent): void {\n\t\tthis._lastMouseMoveEvent = mouseEvent;\n\n\t\tthis._onMouseMoveOrRelevantKeyDown.fire([mouseEvent, null]);\n\t}\n\n\tprivate _onEditorMouseDown(mouseEvent: ClickLinkMouseEvent): void {\n\t\t// We need to record if we had the trigger key on mouse down because someone might select something in the editor\n\t\t// holding the mouse down and then while mouse is down start to press Ctrl/Cmd to start a copy operation and then\n\t\t// release the mouse button without wanting to do the navigation.\n\t\t// With this flag we prevent goto definition if the mouse was down before the trigger key was pressed.\n\t\tthis._hasTriggerKeyOnMouseDown = mouseEvent.hasTriggerModifier;\n\t\tthis._lineNumberOnMouseDown = this._extractLineNumberFromMouseEvent(mouseEvent);\n\t}\n\n\tprivate _onEditorMouseUp(mouseEvent: ClickLinkMouseEvent): void {\n\t\tconst currentLineNumber = this._extractLineNumberFromMouseEvent(mouseEvent);\n\t\tconst lineNumbersCorrect = !!this._lineNumberOnMouseDown && this._lineNumberOnMouseDown === currentLineNumber;\n\t\tif (lineNumbersCorrect && (this._hasTriggerKeyOnMouseDown || (mouseEvent.isMiddleClick && mouseEvent.mouseMiddleClickAction === 'openLink'))) {\n\t\t\tthis._onExecute.fire(mouseEvent);\n\t\t}\n\t}\n\n\tprivate _onEditorKeyDown(e: ClickLinkKeyboardEvent): void {\n\t\tif (\n\t\t\tthis._lastMouseMoveEvent\n\t\t\t&& (\n\t\t\t\te.keyCodeIsTriggerKey // User just pressed Ctrl/Cmd (normal goto definition)\n\t\t\t\t|| (e.keyCodeIsSideBySideKey && e.hasTriggerModifier) // User pressed Ctrl/Cmd+Alt (goto definition to the side)\n\t\t\t)\n\t\t) {\n\t\t\tthis._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent, e]);\n\t\t} else if (e.hasTriggerModifier) {\n\t\t\tthis._onCancel.fire(); // remove decorations if user holds another key with ctrl/cmd to prevent accident goto declaration\n\t\t}\n\t}\n\n\tprivate _onEditorKeyUp(e: ClickLinkKeyboardEvent): void {\n\t\tif (e.keyCodeIsTriggerKey) {\n\t\t\tthis._onCancel.fire();\n\t\t}\n\t}\n\n\tprivate _resetHandler(): void {\n\t\tthis._lastMouseMoveEvent = null;\n\t\tthis._hasTriggerKeyOnMouseDown = false;\n\t\tthis._onCancel.fire();\n\t}\n}\n","/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n\nimport { IKeyboardEvent } from '../../../../../base/browser/keyboardEvent.js';\nimport { Emitter, Event } from '../../../../../base/common/event.js';\nimport { KeyCode } from '../../../../../base/common/keyCodes.js';\nimport { Disposable } from '../../../../../base/common/lifecycle.js';\nimport * as platform from '../../../../../base/common/platform.js';\nimport { ICodeEditor, IEditorMouseEvent, IMouseTarget } from '../../../../browser/editorBrowser.js';\nimport { EditorOption, MouseMiddleClickAction } from '../../../../common/config/editorOptions.js';\nimport { ICursorSelectionChangedEvent } from '../../../../common/cursorEvents.js';\n\nfunction hasModifier(e: { ctrlKey: boolean; shiftKey: boolean; altKey: boolean; metaKey: boolean }, modifier: 'ctrlKey' | 'shiftKey' | 'altKey' | 'metaKey'): boolean {\n\treturn !!e[modifier];\n}\n\n/**\n * An event that encapsulates the various trigger modifiers logic needed for go to definition.\n */\nexport class ClickLinkMouseEvent {\n\n\tpublic readonly target: IMouseTarget;\n\tpublic readonly hasTriggerModifier: boolean;\n\tpublic readonly hasSideBySideModifier: boolean;\n\tpublic readonly isNoneOrSingleMouseDown: boolean;\n\tpublic readonly isLeftClick: boolean;\n\tpublic readonly isMiddleClick: boolean;\n\tpublic readonly isRightClick: boolean;\n\n\tpublic readonly mouseMiddleClickAction: MouseMiddleClickAction;\n\n\tconstructor(source: IEditorMouseEvent, opts: ClickLinkOptions) {\n\t\tthis.target = source.target;\n\t\tthis.isLeftClick = source.event.leftButton;\n\t\tthis.isMiddleClick = source.event.middleButton;\n\t\tthis.isRightClick = source.event.rightButton;\n\t\tthis.mouseMiddleClickAction = opts.mouseMiddleClickAction;\n\t\tthis.hasTriggerModifier = hasModifier(source.event, opts.triggerModifier);\n\n\t\tif (this.isMiddleClick && opts.mouseMiddleClickAction === 'ctrlLeftClick') {\n\t\t\t// Redirect middle click to left click with modifier\n\t\t\tthis.isMiddleClick = false;\n\t\t\tthis.isLeftClick = true;\n\t\t\tthis.hasTriggerModifier = true;\n\t\t}\n\t\tthis.hasSideBySideModifier = hasModifier(source.event, opts.triggerSideBySideModifier);\n\t\tthis.isNoneOrSingleMouseDown = (source.event.detail <= 1);\n\t}\n}\n\n/**\n * An event that encapsulates the various trigger modifiers logic needed for go to definition.\n */\nexport class ClickLinkKeyboardEvent {\n\n\tpublic readonly keyCodeIsTriggerKey: boolean;\n\tpublic readonly keyCodeIsSideBySideKey: boolean;\n\tpublic readonly hasTriggerModifier: boolean;\n\n\tconstructor(source: IKeyboardEvent, opts: ClickLinkOptions) {\n\t\tthis.keyCodeIsTriggerKey = (source.keyCode === opts.triggerKey);\n\t\tthis.keyCodeIsSideBySideKey = (source.keyCode === opts.triggerSideBySideKey);\n\t\tthis.hasTriggerModifier = hasModifier(source, opts.triggerModifier);\n\t}\n}\nexport type TriggerModifier = 'ctrlKey' | 'shiftKey' | 'altKey' | 'metaKey';\n\nexport class ClickLinkOptions {\n\n\tpublic readonly triggerKey: KeyCode;\n\tpublic readonly triggerModifier: TriggerModifier;\n\tpublic readonly triggerSideBySideKey: KeyCode;\n\tpublic readonly triggerSideBySideModifier: TriggerModifier;\n\n\tconstructor(\n\t\ttriggerKey: KeyCode,\n\t\ttriggerModifier: TriggerModifier,\n\t\ttriggerSideBySideKey: KeyCode,\n\t\ttriggerSideBySideModifier: TriggerModifier,\n\t\tpublic readonly mouseMiddleClickAction: MouseMiddleClickAction,\n\t) {\n\t\tthis.triggerKey = triggerKey;\n\t\tthis.triggerModifier = triggerModifier;\n\t\tthis.triggerSideBySideKey = triggerSideBySideKey;\n\t\tthis.triggerSideBySideModifier = triggerSideBySideModifier;\n\t}\n\n\tpublic equals(other: ClickLinkOptions): boolean {\n\t\treturn (\n\t\t\tthis.triggerKey === other.triggerKey\n\t\t\t&& this.triggerModifier === other.triggerModifier\n\t\t\t&& this.triggerSideBySideKey === other.triggerSideBySideKey\n\t\t\t&& this.triggerSideBySideModifier === other.triggerSideBySideModifier\n\t\t\t&& this.mouseMiddleClickAction === other.mouseMiddleClickAction\n\t\t);\n\t}\n}\n\nfunction createOptions(multiCursorModifier: 'altKey' | 'ctrlKey' | 'metaKey', mouseMiddleClickAction: MouseMiddleClickAction): ClickLinkOptions {\n\tif (multiCursorModifier === 'altKey') {\n\t\tif (platform.isMacintosh) {\n\t\t\treturn new ClickLinkOptions(KeyCode.Meta, 'metaKey', KeyCode.Alt, 'altKey', mouseMiddleClickAction);\n\t\t}\n\t\treturn new ClickLinkOptions(KeyCode.Ctrl, 'ctrlKey', KeyCode.Alt, 'altKey', mouseMiddleClickAction);\n\t}\n\n\tif (platform.isMacintosh) {\n\t\treturn new ClickLinkOptions(KeyCode.Alt, 'altKey', KeyCode.Meta, 'metaKey', mouseMiddleClickAction);\n\t}\n\treturn new ClickLinkOptions(KeyCode.Alt, 'altKey', KeyCode.Ctrl, 'ctrlKey', mouseMiddleClickAction);\n}\n\nexport interface IClickLinkGestureOptions {\n\t/**\n\t * Return 0 if the mouse event should not be considered.\n\t */\n\textractLineNumberFromMouseEvent?: (e: ClickLinkMouseEvent) => number;\n}\n\nexport class ClickLinkGesture extends Disposable {\n\n\tprivate readonly _onMouseMoveOrRelevantKeyDown: Emitter<[ClickLinkMouseEvent, ClickLinkKeyboardEvent | null]> = this._register(new Emitter<[ClickLinkMouseEvent, ClickLinkKeyboardEvent | null]>());\n\tpublic readonly onMouseMoveOrRelevantKeyDown: Event<[ClickLinkMouseEvent, ClickLinkKeyboardEvent | null]> = this._onMouseMoveOrRelevantKeyDown.event;\n\n\tprivate readonly _onExecute: Emitter<ClickLinkMouseEvent> = this._register(new Emitter<ClickLinkMouseEvent>());\n\tpublic readonly onExecute: Event<ClickLinkMouseEvent> = this._onExecute.event;\n\n\tprivate readonly _onCancel: Emitter<void> = this._register(new Emitter<void>());\n\tpublic readonly onCancel: Event<void> = this._onCancel.event;\n\n\tprivate readonly _editor: ICodeEditor;\n\tprivate readonly _extractLineNumberFromMouseEvent: (e: ClickLinkMouseEvent) => number;\n\tprivate _opts: ClickLinkOptions;\n\n\tprivate _lastMouseMoveEvent: ClickLinkMouseEvent | null;\n\tprivate _hasTriggerKeyOnMouseDown: boolean;\n\tprivate _lineNumberOnMouseDown: number;\n\n\tconstructor(editor: ICodeEditor, opts?: IClickLinkGestureOptions) {\n\t\tsuper();\n\n\t\tthis._editor = editor;\n\t\tthis._extractLineNumberFromMouseEvent = opts?.extractLineNumberFromMouseEvent ?? ((e) => e.target.position ? e.target.position.lineNumber : 0);\n\t\tthis._opts = createOptions(this._editor.getOption(EditorOption.multiCursorModifier), this._editor.getOption(EditorOption.mouseMiddleClickAction));\n\n\t\tthis._lastMouseMoveEvent = null;\n\t\tthis._hasTriggerKeyOnMouseDown = false;\n\t\tthis._lineNumberOnMouseDown = 0;\n\n\t\tthis._register(this._editor.onDidChangeConfiguration((e) => {\n\t\t\tif (e.hasChanged(EditorOption.multiCursorModifier) || e.hasChanged(EditorOption.mouseMiddleClickAction)) {\n\t\t\t\tconst newOpts = createOptions(this._editor.getOption(EditorOption.multiCursorModifier), this._editor.getOption(EditorOption.mouseMiddleClickAction));\n\t\t\t\tif (this._opts.equals(newOpts)) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis._opts = newOpts;\n\t\t\t\tthis._lastMouseMoveEvent = null;\n\t\t\t\tthis._hasTriggerKeyOnMouseDown = false;\n\t\t\t\tthis._lineNumberOnMouseDown = 0;\n\t\t\t\tthis._onCancel.fire();\n\t\t\t}\n\t\t}));\n\t\tthis._register(this._editor.onMouseMove((e: IEditorMouseEvent) => this._onEditorMouseMove(new ClickLinkMouseEvent(e, this._opts))));\n\t\tthis._register(this._editor.onMouseDown((e: IEditorMouseEvent) => this._onEditorMouseDown(new ClickLinkMouseEvent(e, this._opts))));\n\t\tthis._register(this._editor.onMouseUp((e: IEditorMouseEvent) => this._onEditorMouseUp(new ClickLinkMouseEvent(e, this._opts))));\n\t\tthis._register(this._editor.onKeyDown((e: IKeyboardEvent) => this._onEditorKeyDown(new ClickLinkKeyboardEvent(e, this._opts))));\n\t\tthis._register(this._editor.onKeyUp((e: IKeyboardEvent) => this._onEditorKeyUp(new ClickLinkKeyboardEvent(e, this._opts))));\n\t\tthis._register(this._editor.onMouseDrag(() => this._resetHandler()));\n\n\t\tthis._register(this._editor.onDidChangeCursorSelection((e) => this._onDidChangeCursorSelection(e)));\n\t\tthis._register(this._editor.onDidChangeModel((e) => this._resetHandler()));\n\t\tthis._register(this._editor.onDidChangeModelContent(() => this._resetHandler()));\n\t\tthis._register(this._editor.onDidScrollChange((e) => {\n\t\t\tif (e.scrollTopChanged || e.scrollLeftChanged) {\n\t\t\t\tthis._resetHandler();\n\t\t\t}\n\t\t}));\n\t}\n\n\tprivate _onDidChangeCursorSelection(e: ICursorSelectionChangedEvent): void {\n\t\tif (e.selection && e.selection.startColumn !== e.selection.endColumn) {\n\t\t\tthis._resetHandler(); // immediately stop this feature if the user starts to select (https://github.com/microsoft/vscode/issues/7827)\n\t\t}\n\t}\n\n\tprivate _onEditorMouseMove(mouseEvent: ClickLinkMouseEvent): void {\n\t\tthis._lastMouseMoveEvent = mouseEvent;\n\n\t\tthis._onMouseMoveOrRelevantKeyDown.fire([mouseEvent, null]);\n\t}\n\n\tprivate _onEditorMouseDown(mouseEvent: ClickLinkMouseEvent): void {\n\t\t// We need to record if we had the trigger key on mouse down because someone might select something in the editor\n\t\t// holding the mouse down and then while mouse is down start to press Ctrl/Cmd to start a copy operation and then\n\t\t// release the mouse button without wanting to do the navigation.\n\t\t// With this flag we prevent goto definition if the mouse was down before the trigger key was pressed.\n\t\tthis._hasTriggerKeyOnMouseDown = mouseEvent.hasTriggerModifier;\n\t\tthis._lineNumberOnMouseDown = this._extractLineNumberFromMouseEvent(mouseEvent);\n\t}\n\n\tprivate _onEditorMouseUp(mouseEvent: ClickLinkMouseEvent): void {\n\t\tconst currentLineNumber = this._extractLineNumberFromMouseEvent(mouseEvent);\n\t\tconst lineNumbersCorrect = !!this._lineNumberOnMouseDown && this._lineNumberOnMouseDown === currentLineNumber;\n\t\tif (lineNumbersCorrect && (this._hasTriggerKeyOnMouseDown || (mouseEvent.isMiddleClick && mouseEvent.mouseMiddleClickAction === 'openLink'))) {\n\t\t\tthis._onExecute.fire(mouseEvent);\n\t\t}\n\t}\n\n\tprivate _onEditorKeyDown(e: ClickLinkKeyboardEvent): void {\n\t\tif (\n\t\t\tthis._lastMouseMoveEvent\n\t\t\t&& (\n\t\t\t\te.keyCodeIsTriggerKey // User just pressed Ctrl/Cmd (normal goto definition)\n\t\t\t\t|| (e.keyCodeIsSideBySideKey && e.hasTriggerModifier) // User pressed Ctrl/Cmd+Alt (goto definition to the side)\n\t\t\t)\n\t\t) {\n\t\t\tthis._onMouseMoveOrRelevantKeyDown.fire([this._lastMouseMoveEvent, e]);\n\t\t} else if (e.hasTriggerModifier) {\n\t\t\tthis._onCancel.fire(); // remove decorations if user holds another key with ctrl/cmd to prevent accident goto declaration\n\t\t}\n\t}\n\n\tprivate _onEditorKeyUp(e: ClickLinkKeyboardEvent): void {\n\t\tif (e.keyCodeIsTriggerKey) {\n\t\t\tthis._onCancel.fire();\n\t\t}\n\t}\n\n\tprivate _resetHandler(): void {\n\t\tthis._lastMouseMoveEvent = null;\n\t\tthis._hasTriggerKeyOnMouseDown = false;\n\t\tthis._onCancel.fire();\n\t}\n}\n"]}
|
|
@@ -150,7 +150,7 @@ let GotoDefinitionAtPositionEditorContribution = class GotoDefinitionAtPositionE
|
|
|
150
150
|
combinedRange = Range.plusRange(combinedRange, originSelectionRange);
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
this.addDecoration(combinedRange, new MarkdownString().appendText(nls.localize(
|
|
153
|
+
this.addDecoration(combinedRange, new MarkdownString().appendText(nls.localize(1070, "Click to show {0} definitions.", results.length)));
|
|
154
154
|
}
|
|
155
155
|
else {
|
|
156
156
|
// Single result
|
|
@@ -242,7 +242,7 @@ let GotoDefinitionAtPositionEditorContribution = class GotoDefinitionAtPositionE
|
|
|
242
242
|
gotoDefinition(position, openToSide) {
|
|
243
243
|
this.editor.setPosition(position);
|
|
244
244
|
return this.editor.invokeWithinContext((accessor) => {
|
|
245
|
-
const canPeek = !openToSide && this.editor.getOption(
|
|
245
|
+
const canPeek = !openToSide && this.editor.getOption(101 /* EditorOption.definitionLinkOpensInPeek */) && !this.isInPeekEditor(accessor);
|
|
246
246
|
const action = new DefinitionAction({ openToSide, openInPeek: canPeek, muteMessage: true }, { title: { value: '', original: '' }, id: '', precondition: undefined });
|
|
247
247
|
return action.run(accessor);
|
|
248
248
|
});
|
|
@@ -34,7 +34,7 @@ import { OneReference } from '../referencesModel.js';
|
|
|
34
34
|
import { LayoutData, ReferenceWidget } from './referencesWidget.js';
|
|
35
35
|
import { EditorContextKeys } from '../../../../common/editorContextKeys.js';
|
|
36
36
|
import { InputFocusedContext } from '../../../../../platform/contextkey/common/contextkeys.js';
|
|
37
|
-
export const ctxReferenceSearchVisible = new RawContextKey('referenceSearchVisible', false, nls.localize(
|
|
37
|
+
export const ctxReferenceSearchVisible = new RawContextKey('referenceSearchVisible', false, nls.localize(1071, "Whether reference peek is visible, like 'Peek References' or 'Peek Definition'"));
|
|
38
38
|
let ReferencesController = class ReferencesController {
|
|
39
39
|
static { ReferencesController_1 = this; }
|
|
40
40
|
static { this.ID = 'editor.contrib.referencesController'; }
|
|
@@ -84,7 +84,7 @@ let ReferencesController = class ReferencesController {
|
|
|
84
84
|
const storageKey = 'peekViewLayout';
|
|
85
85
|
const data = LayoutData.fromJSON(this._storageService.get(storageKey, 0 /* StorageScope.PROFILE */, '{}'));
|
|
86
86
|
this._widget = this._instantiationService.createInstance(ReferenceWidget, this._editor, this._defaultTreeKeyboardSupport, data);
|
|
87
|
-
this._widget.setTitle(nls.localize(
|
|
87
|
+
this._widget.setTitle(nls.localize(1072, "Loading..."));
|
|
88
88
|
this._widget.show(range);
|
|
89
89
|
this._disposables.add(this._widget.onDidClose(() => {
|
|
90
90
|
modelPromise.cancel();
|
|
@@ -140,7 +140,7 @@ let ReferencesController = class ReferencesController {
|
|
|
140
140
|
if (this._widget && this._model && this._editor.hasModel()) { // might have been closed
|
|
141
141
|
// set title
|
|
142
142
|
if (!this._model.isEmpty) {
|
|
143
|
-
this._widget.setMetaTitle(nls.localize(
|
|
143
|
+
this._widget.setMetaTitle(nls.localize(1073, "{0} ({1})", this._model.title, this._model.references.length));
|
|
144
144
|
}
|
|
145
145
|
else {
|
|
146
146
|
this._widget.setMetaTitle('');
|
|
@@ -151,7 +151,7 @@ let ReferencesController = class ReferencesController {
|
|
|
151
151
|
const selection = this._model.nearestReference(uri, pos);
|
|
152
152
|
if (selection) {
|
|
153
153
|
return this._widget.setSelection(selection).then(() => {
|
|
154
|
-
if (this._widget && this._editor.getOption(
|
|
154
|
+
if (this._widget && this._editor.getOption(99 /* EditorOption.peekWidgetDefaultFocus */) === 'editor') {
|
|
155
155
|
this._widget.focusOnPreviewEditor();
|
|
156
156
|
}
|
|
157
157
|
});
|
|
@@ -115,10 +115,10 @@ let FileReferencesTemplate = class FileReferencesTemplate extends Disposable {
|
|
|
115
115
|
const len = element.children.length;
|
|
116
116
|
this.badge.setCount(len);
|
|
117
117
|
if (len > 1) {
|
|
118
|
-
this.badge.setTitleFormat(localize(
|
|
118
|
+
this.badge.setTitleFormat(localize(1074, "{0} references", len));
|
|
119
119
|
}
|
|
120
120
|
else {
|
|
121
|
-
this.badge.setTitleFormat(localize(
|
|
121
|
+
this.badge.setTitleFormat(localize(1075, "{0} reference", len));
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
};
|
|
@@ -192,7 +192,7 @@ export class OneReferenceRenderer {
|
|
|
192
192
|
//#endregion
|
|
193
193
|
export class AccessibilityProvider {
|
|
194
194
|
getWidgetAriaLabel() {
|
|
195
|
-
return localize(
|
|
195
|
+
return localize(1076, "References");
|
|
196
196
|
}
|
|
197
197
|
getAriaLabel(element) {
|
|
198
198
|
return element.ariaMessage;
|
|
@@ -301,7 +301,7 @@ let ReferenceWidget = class ReferenceWidget extends peekView.PeekViewWidget {
|
|
|
301
301
|
};
|
|
302
302
|
this._preview = this._instantiationService.createInstance(EmbeddedCodeEditorWidget, this._previewContainer, options, {}, this.editor);
|
|
303
303
|
dom.hide(this._previewContainer);
|
|
304
|
-
this._previewNotAvailableMessage = this._instantiationService.createInstance(TextModel, nls.localize(
|
|
304
|
+
this._previewNotAvailableMessage = this._instantiationService.createInstance(TextModel, nls.localize(1077, "no preview available"), PLAINTEXT_LANGUAGE_ID, TextModel.DEFAULT_CREATION_OPTIONS, null);
|
|
305
305
|
// tree
|
|
306
306
|
this._treeContainer = dom.append(containerElement, dom.$('div.ref-tree.inline'));
|
|
307
307
|
const treeOptions = {
|
|
@@ -415,7 +415,7 @@ let ReferenceWidget = class ReferenceWidget extends peekView.PeekViewWidget {
|
|
|
415
415
|
}
|
|
416
416
|
if (this._model.isEmpty) {
|
|
417
417
|
this.setTitle('');
|
|
418
|
-
this._messageContainer.innerText = nls.localize(
|
|
418
|
+
this._messageContainer.innerText = nls.localize(1078, "No results");
|
|
419
419
|
dom.show(this._messageContainer);
|
|
420
420
|
return Promise.resolve(undefined);
|
|
421
421
|
}
|
|
@@ -476,7 +476,7 @@ let ReferenceWidget = class ReferenceWidget extends peekView.PeekViewWidget {
|
|
|
476
476
|
this.setTitle(basenameOrAuthority(reference.uri), this._uriLabel.getUriLabel(dirname(reference.uri)));
|
|
477
477
|
}
|
|
478
478
|
else {
|
|
479
|
-
this.setTitle(nls.localize(
|
|
479
|
+
this.setTitle(nls.localize(1079, "References"));
|
|
480
480
|
}
|
|
481
481
|
const promise = this._textModelResolverService.createModelReference(reference.uri);
|
|
482
482
|
if (this._tree.getInput() === reference.parent) {
|
|
@@ -32,10 +32,10 @@ export class OneReference {
|
|
|
32
32
|
get ariaMessage() {
|
|
33
33
|
const preview = this.parent.getPreview(this)?.preview(this.range);
|
|
34
34
|
if (!preview) {
|
|
35
|
-
return localize(
|
|
35
|
+
return localize(1080, "in {0} on line {1} at column {2}", basename(this.uri), this.range.startLineNumber, this.range.startColumn);
|
|
36
36
|
}
|
|
37
37
|
else {
|
|
38
|
-
return localize(
|
|
38
|
+
return localize(1081, "{0} in {1} on line {2} at column {3}", preview.value, basename(this.uri), this.range.startLineNumber, this.range.startColumn);
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
}
|
|
@@ -81,10 +81,10 @@ export class FileReferences {
|
|
|
81
81
|
get ariaMessage() {
|
|
82
82
|
const len = this.children.length;
|
|
83
83
|
if (len === 1) {
|
|
84
|
-
return localize(
|
|
84
|
+
return localize(1082, "1 symbol in {0}, full path {1}", basename(this.uri), this.uri.fsPath);
|
|
85
85
|
}
|
|
86
86
|
else {
|
|
87
|
-
return localize(
|
|
87
|
+
return localize(1083, "{0} symbols in {1}, full path {2}", len, basename(this.uri), this.uri.fsPath);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
async resolve(textModelResolverService) {
|
|
@@ -148,16 +148,16 @@ export class ReferencesModel {
|
|
|
148
148
|
}
|
|
149
149
|
get ariaMessage() {
|
|
150
150
|
if (this.isEmpty) {
|
|
151
|
-
return localize(
|
|
151
|
+
return localize(1084, "No results found");
|
|
152
152
|
}
|
|
153
153
|
else if (this.references.length === 1) {
|
|
154
|
-
return localize(
|
|
154
|
+
return localize(1085, "Found 1 symbol in {0}", this.references[0].uri.fsPath);
|
|
155
155
|
}
|
|
156
156
|
else if (this.groups.length === 1) {
|
|
157
|
-
return localize(
|
|
157
|
+
return localize(1086, "Found {0} symbols in {1}", this.references.length, this.groups[0].uri.fsPath);
|
|
158
158
|
}
|
|
159
159
|
else {
|
|
160
|
-
return localize(
|
|
160
|
+
return localize(1087, "Found {0} symbols in {1} files", this.references.length, this.groups.length);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
nextOrPreviousReference(reference, next) {
|