@codingame/monaco-vscode-api 6.0.2 → 7.0.0
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/README.md +93 -73
- package/api.js +1 -1
- package/debugProtocol.d.ts +10 -1
- package/extensions.d.ts +2 -0
- package/missing-services.js +21 -2
- package/monaco.d.ts +1 -1
- package/monaco.js +1 -1
- package/package.json +9 -9
- package/service-override/extensions.d.ts +1 -2
- package/services.js +4 -2
- package/vscode/src/vs/base/browser/dnd.js +1 -1
- package/vscode/src/vs/base/browser/dom.js +116 -5
- package/vscode/src/vs/base/browser/domObservable.js +16 -0
- package/vscode/src/vs/base/browser/markdownRenderer.js +5 -3
- package/vscode/src/vs/base/browser/trustedTypes.js +1 -2
- package/vscode/src/vs/base/browser/ui/actionbar/actionViewItems.js +1 -1
- package/vscode/src/vs/base/browser/ui/actionbar/actionbar.js +1 -1
- package/vscode/src/vs/base/browser/ui/button/button.js +2 -2
- package/vscode/src/vs/base/browser/ui/contextview/contextview.js +1 -4
- package/vscode/src/vs/base/browser/ui/dropdown/dropdown.js +1 -1
- package/vscode/src/vs/base/browser/ui/dropdown/dropdownActionViewItem.js +1 -1
- package/vscode/src/vs/base/browser/ui/highlightedlabel/highlightedLabel.js +1 -1
- package/vscode/src/vs/base/browser/ui/hover/hover.d.ts +32 -16
- package/vscode/src/vs/base/browser/ui/hover/hoverDelegate.d.ts +2 -2
- package/vscode/src/vs/base/browser/ui/hover/hoverDelegate2.js +2 -2
- package/vscode/src/vs/base/browser/ui/hover/hoverWidget.css.js +1 -1
- package/vscode/src/vs/base/browser/ui/hover/hoverWidget.js +2 -0
- package/vscode/src/vs/base/browser/ui/iconLabel/iconLabel.js +1 -1
- package/vscode/src/vs/base/browser/ui/iconLabel/simpleIconLabel.js +1 -1
- package/vscode/src/vs/base/browser/ui/inputbox/inputBox.js +1 -1
- package/vscode/src/vs/base/browser/ui/keybindingLabel/keybindingLabel.js +1 -1
- package/vscode/src/vs/base/browser/ui/list/listView.js +3 -5
- package/vscode/src/vs/base/browser/ui/list/rowCache.js +1 -8
- package/vscode/src/vs/base/browser/ui/sash/sash.js +1 -1
- package/vscode/src/vs/base/browser/ui/selectBox/selectBoxCustom.js +7 -11
- package/vscode/src/vs/base/browser/ui/splitview/paneview.js +1 -1
- package/vscode/src/vs/base/browser/ui/splitview/splitview.js +1 -1
- package/vscode/src/vs/base/browser/ui/table/tableWidget.js +1 -1
- package/vscode/src/vs/base/browser/ui/toggle/toggle.js +1 -1
- package/vscode/src/vs/base/browser/ui/toolbar/toolbar.d.ts +8 -1
- package/vscode/src/vs/base/browser/ui/toolbar/toolbar.js +2 -3
- package/vscode/src/vs/base/browser/ui/tree/abstractTree.js +1 -1
- package/vscode/src/vs/base/browser/ui/tree/asyncDataTree.js +0 -3
- package/vscode/src/vs/base/common/assert.js +1 -1
- package/vscode/src/vs/base/common/collections.js +49 -1
- package/vscode/src/vs/base/common/equals.js +55 -5
- package/vscode/src/vs/base/common/errors.js +14 -1
- package/vscode/src/vs/base/common/event.js +2 -1
- package/vscode/src/vs/base/common/history.js +7 -4
- package/vscode/src/vs/base/common/iterator.js +9 -1
- package/vscode/src/vs/base/common/map.d.ts +41 -0
- package/vscode/src/vs/base/common/numbers.js +18 -1
- package/vscode/src/vs/base/common/observableInternal/api.js +11 -0
- package/vscode/src/vs/base/common/observableInternal/autorun.js +18 -1
- package/vscode/src/vs/base/common/observableInternal/base.d.ts +8 -1
- package/vscode/src/vs/base/common/observableInternal/base.js +2 -5
- package/vscode/src/vs/base/common/observableInternal/derived.js +13 -3
- package/vscode/src/vs/base/common/observableInternal/lazyObservableValue.js +109 -0
- package/vscode/src/vs/base/common/observableInternal/promise.js +3 -0
- package/vscode/src/vs/base/common/observableInternal/utils.d.ts +7 -0
- package/vscode/src/vs/base/common/observableInternal/utils.js +64 -12
- package/vscode/src/vs/base/common/prefixTree.d.ts +52 -0
- package/vscode/src/vs/base/common/product.d.ts +1 -0
- package/vscode/src/vs/base/parts/ipc/common/ipc.js +1 -1
- package/vscode/src/vs/editor/browser/config/charWidthReader.js +1 -1
- package/vscode/src/vs/editor/browser/controller/textAreaHandler.js +1 -1
- package/vscode/src/vs/editor/browser/coreCommands.js +2 -1
- package/vscode/src/vs/editor/browser/observableCodeEditor.js +230 -0
- package/vscode/src/vs/editor/browser/services/abstractCodeEditorService.js +1 -1
- package/vscode/src/vs/editor/browser/services/hoverService/hoverService.js +26 -26
- package/vscode/src/vs/editor/browser/services/hoverService/updatableHoverWidget.js +2 -2
- package/vscode/src/vs/editor/browser/view/domLineBreaksComputer.js +1 -1
- package/vscode/src/vs/editor/browser/view/viewLayer.js +4 -12
- package/vscode/src/vs/editor/browser/viewParts/contentWidgets/contentWidgets.js +1 -1
- package/vscode/src/vs/editor/browser/viewParts/glyphMargin/glyphMargin.js +1 -1
- package/vscode/src/vs/editor/browser/viewParts/viewZones/viewZones.js +2 -2
- package/vscode/src/vs/editor/browser/widget/codeEditor/codeEditorWidget.js +15 -4
- package/vscode/src/vs/editor/browser/widget/diffEditor/components/diffEditorEditors.js +8 -8
- package/vscode/src/vs/editor/browser/widget/diffEditor/components/diffEditorViewZones/diffEditorViewZones.js +4 -4
- package/vscode/src/vs/editor/browser/widget/diffEditor/diffEditorOptions.js +1 -1
- package/vscode/src/vs/editor/browser/widget/diffEditor/diffEditorViewModel.js +1 -1
- package/vscode/src/vs/editor/browser/widget/diffEditor/diffEditorWidget.js +14 -2
- package/vscode/src/vs/editor/browser/widget/diffEditor/features/gutterFeature.js +1 -1
- package/vscode/src/vs/editor/browser/widget/diffEditor/features/movedBlocksLinesFeature.js +2 -2
- package/vscode/src/vs/editor/browser/widget/diffEditor/registrations.contribution.js +2 -2
- package/vscode/src/vs/editor/browser/widget/diffEditor/utils/editorGutter.js +3 -3
- package/vscode/src/vs/editor/browser/widget/diffEditor/utils.js +2 -2
- package/vscode/src/vs/editor/browser/widget/multiDiffEditor/colors.js +1 -1
- package/vscode/src/vs/editor/browser/widget/multiDiffEditor/multiDiffEditorWidgetImpl.js +2 -2
- package/vscode/src/vs/editor/common/config/editorOptions.d.ts +5 -0
- package/vscode/src/vs/editor/common/config/editorOptions.js +83 -65
- package/vscode/src/vs/editor/common/core/editorColorRegistry.js +43 -43
- package/vscode/src/vs/editor/common/cursor/cursor.js +3 -2
- package/vscode/src/vs/editor/common/cursor/cursorTypeEditOperations.js +911 -0
- package/vscode/src/vs/editor/common/cursor/cursorTypeOperations.js +36 -799
- package/vscode/src/vs/editor/common/cursor/cursorWordOperations.js +6 -5
- package/vscode/src/vs/editor/common/languageFeatureRegistry.d.ts +1 -0
- package/vscode/src/vs/editor/common/languageFeatureRegistry.js +3 -0
- package/vscode/src/vs/editor/common/languages/autoIndent.js +23 -1
- package/vscode/src/vs/editor/common/languages.d.ts +20 -3
- package/vscode/src/vs/editor/common/model/bracketPairsTextModelPart/bracketPairsImpl.js +6 -6
- package/vscode/src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeBase.js +19 -0
- package/vscode/src/vs/editor/common/model/pieceTreeTextBuffer/pieceTreeTextBuffer.js +3 -0
- package/vscode/src/vs/editor/common/model/textModel.js +6 -2
- package/vscode/src/vs/editor/common/model/tokenizationTextModelPart.js +5 -5
- package/vscode/src/vs/editor/common/model.d.ts +4 -0
- package/vscode/src/vs/editor/common/services/getIconClasses.js +1 -1
- package/vscode/src/vs/editor/common/services/semanticTokensProviderStyling.js +2 -15
- package/vscode/src/vs/editor/common/standalone/standaloneEnums.js +63 -62
- package/vscode/src/vs/editor/common/viewModel/viewModelImpl.js +11 -8
- package/vscode/src/vs/editor/contrib/bracketMatching/browser/bracketMatching.js +1 -1
- package/vscode/src/vs/editor/contrib/codeAction/browser/codeActionController.js +2 -17
- package/vscode/src/vs/editor/contrib/codeAction/browser/lightBulbWidget.css.js +1 -1
- package/vscode/src/vs/editor/contrib/codeAction/browser/lightBulbWidget.js +18 -5
- package/vscode/src/vs/editor/contrib/colorPicker/browser/colorHoverParticipant.js +55 -27
- package/vscode/src/vs/editor/contrib/colorPicker/browser/colorPickerWidget.js +7 -4
- package/vscode/src/vs/editor/contrib/colorPicker/browser/standaloneColorPickerWidget.js +9 -9
- package/vscode/src/vs/editor/contrib/contextmenu/browser/contextmenu.js +1 -1
- package/vscode/src/vs/editor/contrib/dropOrPasteInto/browser/copyPasteController.js +103 -47
- package/vscode/src/vs/editor/contrib/dropOrPasteInto/browser/defaultProviders.js +8 -2
- package/vscode/src/vs/editor/contrib/dropOrPasteInto/browser/dropIntoEditorController.js +18 -10
- package/vscode/src/vs/editor/contrib/find/browser/findWidget.js +2 -4
- package/vscode/src/vs/editor/contrib/folding/browser/folding.css.js +1 -1
- package/vscode/src/vs/editor/contrib/folding/browser/folding.js +33 -13
- package/vscode/src/vs/editor/contrib/folding/browser/foldingDecorations.js +12 -7
- package/vscode/src/vs/editor/contrib/gotoError/browser/gotoErrorWidget.js +1 -1
- package/vscode/src/vs/editor/contrib/gotoSymbol/browser/peek/referencesWidget.js +2 -2
- package/vscode/src/vs/editor/contrib/hover/browser/contentHoverController.js +161 -185
- package/vscode/src/vs/editor/contrib/hover/browser/contentHoverRendered.js +321 -0
- package/vscode/src/vs/editor/contrib/hover/browser/contentHoverStatusBar.js +4 -1
- package/vscode/src/vs/editor/contrib/hover/browser/contentHoverTypes.js +6 -21
- package/vscode/src/vs/editor/contrib/hover/browser/contentHoverWidget.js +39 -40
- package/vscode/src/vs/editor/contrib/hover/browser/hoverAccessibleViews.js +55 -46
- package/vscode/src/vs/editor/contrib/hover/browser/hoverActions.js +12 -2
- package/vscode/src/vs/editor/contrib/hover/browser/hoverController.js +15 -9
- package/vscode/src/vs/editor/contrib/hover/browser/hoverTypes.js +11 -1
- package/vscode/src/vs/editor/contrib/hover/browser/markdownHoverParticipant.js +141 -93
- package/vscode/src/vs/editor/contrib/hover/browser/markerHoverParticipant.js +24 -7
- package/vscode/src/vs/editor/contrib/indentation/browser/indentation.js +36 -1
- package/vscode/src/vs/editor/contrib/inlayHints/browser/inlayHintsHover.js +5 -3
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/ghostTextWidget.js +1 -1
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/hoverParticipant.js +25 -12
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsController.js +88 -118
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsHintsWidget.js +1 -1
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsModel.js +34 -33
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/inlineCompletionsSource.js +2 -2
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/provideInlineCompletions.js +11 -4
- package/vscode/src/vs/editor/contrib/inlineCompletions/browser/suggestWidgetInlineCompletionProvider.js +10 -19
- package/vscode/src/vs/editor/contrib/inlineEdit/browser/ghostTextWidget.js +1 -1
- package/vscode/src/vs/editor/contrib/inlineEdit/browser/hoverParticipant.js +45 -27
- package/vscode/src/vs/editor/contrib/inlineEdit/browser/inlineEditController.js +4 -4
- package/vscode/src/vs/editor/contrib/inlineEdit/browser/inlineEditHintsWidget.js +1 -1
- package/vscode/src/vs/editor/contrib/inlineEdits/browser/commands.js +126 -0
- package/vscode/src/vs/editor/contrib/inlineEdits/browser/consts.js +9 -0
- package/vscode/src/vs/editor/contrib/inlineEdits/browser/inlineEdits.contribution.js +9 -0
- package/vscode/src/vs/editor/contrib/inlineEdits/browser/inlineEditsController.js +82 -0
- package/vscode/src/vs/editor/contrib/inlineEdits/browser/inlineEditsModel.js +240 -0
- package/vscode/src/vs/editor/contrib/inlineEdits/browser/inlineEditsWidget.css.js +4 -0
- package/vscode/src/vs/editor/contrib/inlineEdits/browser/inlineEditsWidget.js +322 -0
- package/vscode/src/vs/editor/contrib/inlineProgress/browser/inlineProgress.js +8 -4
- package/vscode/src/vs/editor/contrib/linesOperations/browser/linesOperations.js +3 -2
- package/vscode/src/vs/editor/contrib/parameterHints/browser/parameterHintsWidget.js +1 -1
- package/vscode/src/vs/editor/contrib/peekView/browser/peekView.js +2 -2
- package/vscode/src/vs/editor/contrib/placeholderText/browser/placeholderText.contribution.js +60 -0
- package/vscode/src/vs/editor/contrib/placeholderText/browser/placeholderText.css.js +4 -0
- package/vscode/src/vs/editor/contrib/rename/browser/renameWidget.js +1 -1
- package/vscode/src/vs/editor/contrib/stickyScroll/browser/stickyScroll.css.js +1 -1
- package/vscode/src/vs/editor/contrib/stickyScroll/browser/stickyScrollController.js +38 -20
- package/vscode/src/vs/editor/contrib/stickyScroll/browser/stickyScrollWidget.js +3 -0
- package/vscode/src/vs/editor/contrib/suggest/browser/suggestWidget.js +9 -9
- package/vscode/src/vs/editor/contrib/suggest/browser/suggestWidgetStatus.js +10 -32
- package/vscode/src/vs/editor/contrib/symbolIcons/browser/symbolIcons.js +23 -138
- package/vscode/src/vs/editor/contrib/unicodeHighlighter/browser/unicodeHighlighter.js +3 -0
- package/vscode/src/vs/editor/contrib/wordHighlighter/browser/highlightDecorations.js +5 -5
- package/vscode/src/vs/editor/contrib/wordOperations/browser/wordOperations.js +13 -12
- package/vscode/src/vs/editor/contrib/wordPartOperations/browser/wordPartOperations.js +3 -3
- package/vscode/src/vs/editor/editor.api.d.ts +31 -5
- package/vscode/src/vs/platform/accessibility/browser/accessibilityService.js +21 -0
- package/vscode/src/vs/platform/accessibilitySignal/browser/accessibilitySignalService.js +5 -6
- package/vscode/src/vs/platform/actionWidget/browser/actionWidget.js +1 -1
- package/vscode/src/vs/platform/actions/browser/buttonbar.js +27 -6
- package/vscode/src/vs/platform/actions/browser/floatingMenu.js +1 -1
- package/vscode/src/vs/platform/actions/browser/menuEntryActionViewItem.css.js +1 -1
- package/vscode/src/vs/platform/actions/browser/menuEntryActionViewItem.js +33 -3
- package/vscode/src/vs/platform/actions/browser/toolbar.js +2 -1
- package/vscode/src/vs/platform/actions/common/actions.d.ts +3 -0
- package/vscode/src/vs/platform/actions/common/actions.js +3 -0
- package/vscode/src/vs/platform/actions/common/menuService.js +3 -2
- package/vscode/src/vs/platform/clipboard/browser/clipboardService.js +1 -1
- package/vscode/src/vs/platform/configuration/common/configurationRegistry.d.ts +7 -5
- package/vscode/src/vs/platform/configuration/common/configurationRegistry.js +109 -13
- package/vscode/src/vs/platform/diagnostics/common/diagnostics.d.ts +2 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.d.ts +12 -6
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +2 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.service.d.ts +3 -3
- package/vscode/src/vs/platform/extensionManagement/common/extensionsScannerService.js +20 -10
- package/vscode/src/vs/platform/extensions/common/extensionValidator.js +46 -8
- package/vscode/src/vs/platform/extensions/common/extensions.d.ts +1 -1
- package/vscode/src/vs/platform/extensions/common/extensions.js +12 -3
- package/vscode/src/vs/platform/extensions/common/extensionsApiProposals.js +368 -0
- package/vscode/src/vs/platform/files/common/watcher.js +21 -24
- package/vscode/src/vs/platform/list/browser/listService.js +2 -1
- package/vscode/src/vs/platform/observable/common/platformObservableUtils.js +2 -2
- package/vscode/src/vs/platform/opener/browser/link.js +1 -1
- package/vscode/src/vs/platform/product/common/product.js +1 -1
- package/vscode/src/vs/platform/quickinput/browser/quickInputTree.js +1 -1
- package/vscode/src/vs/platform/remote/common/remoteExtensionsScanner.service.d.ts +0 -2
- package/vscode/src/vs/platform/request/common/request.js +18 -8
- package/vscode/src/vs/platform/terminal/common/capabilities/capabilities.d.ts +2 -6
- package/vscode/src/vs/platform/terminal/common/capabilities/commandDetection/promptInputModel.d.ts +8 -1
- package/vscode/src/vs/platform/theme/common/colorUtils.d.ts +1 -1
- package/vscode/src/vs/platform/theme/common/colorUtils.js +25 -5
- package/vscode/src/vs/platform/theme/common/colors/baseColors.js +1 -1
- package/vscode/src/vs/platform/theme/common/colors/chartsColors.js +6 -6
- package/vscode/src/vs/platform/theme/common/colors/editorColors.js +35 -35
- package/vscode/src/vs/platform/theme/common/colors/inputColors.js +9 -9
- package/vscode/src/vs/platform/theme/common/colors/listColors.js +11 -11
- package/vscode/src/vs/platform/theme/common/colors/menuColors.js +4 -4
- package/vscode/src/vs/platform/theme/common/colors/minimapColors.js +5 -5
- package/vscode/src/vs/platform/theme/common/colors/miscColors.js +1 -1
- package/vscode/src/vs/platform/theme/common/colors/quickpickColors.js +5 -5
- package/vscode/src/vs/platform/tunnel/common/tunnel.js +4 -1
- package/vscode/src/vs/platform/userDataProfile/common/userDataProfile.js +75 -19
- package/vscode/src/vs/platform/window/common/window.d.ts +2 -2
- package/vscode/src/vs/workbench/api/common/extHost.api.impl.js +32 -25
- package/vscode/src/vs/workbench/api/common/extHost.common.services.js +2 -0
- package/vscode/src/vs/workbench/api/common/extHost.protocol.js +2 -0
- package/vscode/src/vs/workbench/api/common/extHostAuthentication.js +5 -11
- package/vscode/src/vs/workbench/api/common/extHostChatAgents2.js +5 -15
- package/vscode/src/vs/workbench/api/common/extHostChatVariables.js +2 -5
- package/vscode/src/vs/workbench/api/common/extHostComments.js +9 -3
- package/vscode/src/vs/workbench/api/common/extHostDebugService.js +32 -22
- package/vscode/src/vs/workbench/api/common/extHostExtensionService.js +3 -3
- package/vscode/src/vs/workbench/api/common/extHostLanguageFeatures.js +109 -40
- package/vscode/src/vs/workbench/api/common/extHostLanguageModelTools.js +46 -0
- package/vscode/src/vs/workbench/api/common/extHostLanguageModels.js +84 -35
- package/vscode/src/vs/workbench/api/common/extHostNotebook.js +2 -2
- package/vscode/src/vs/workbench/api/common/extHostSCM.js +50 -41
- package/vscode/src/vs/workbench/api/common/extHostSearch.js +2 -2
- package/vscode/src/vs/workbench/api/common/extHostSecrets.js +11 -8
- package/vscode/src/vs/workbench/api/common/extHostTerminalService.js +7 -6
- package/vscode/src/vs/workbench/api/common/extHostTesting.js +63 -70
- package/vscode/src/vs/workbench/api/common/extHostTextEditors.js +5 -3
- package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +75 -16
- package/vscode/src/vs/workbench/api/common/extHostTypes.js +29 -4
- package/vscode/src/vs/workbench/api/common/extHostWorkspace.js +1 -1
- package/vscode/src/vs/workbench/browser/actions/developerActions.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/editor/editorActions.js +127 -107
- package/vscode/src/vs/workbench/browser/parts/editor/editorCommands.js +2 -2
- package/vscode/src/vs/workbench/browser/parts/editor/editorPanes.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/editor/editorStatus.js +33 -21
- package/vscode/src/vs/workbench/browser/parts/editor/sideBySideEditor.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/globalCompositeBar.js +5 -5
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsToasts.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsViewer.js +2 -2
- package/vscode/src/vs/workbench/browser/parts/views/checkbox.js +2 -2
- package/vscode/src/vs/workbench/browser/parts/views/treeView.js +23 -6
- package/vscode/src/vs/workbench/browser/parts/views/viewFilter.js +3 -1
- package/vscode/src/vs/workbench/browser/parts/views/viewPane.js +3 -3
- package/vscode/src/vs/workbench/browser/parts/views/viewPaneContainer.js +1 -1
- package/vscode/src/vs/workbench/browser/web.api.js +8 -0
- package/vscode/src/vs/workbench/browser/workbench.contribution.js +199 -194
- package/vscode/src/vs/workbench/common/configuration.js +1 -1
- package/vscode/src/vs/workbench/common/contributions.js +8 -1
- package/vscode/src/vs/workbench/common/editor.js +5 -1
- package/vscode/src/vs/workbench/common/theme.js +79 -454
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.js +221 -239
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +17 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatExecuteActions.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatAgentHover.js +4 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCollections.js +27 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatCommandContentPart.js +35 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatConfirmationContentPart.js +51 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/{chatConfirmationWidget.js → chatContentParts/chatConfirmationWidget.js} +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatMarkdownContentPart.js +131 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatProgressContentPart.js +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatReferencesContentPart.js +263 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTaskContentPart.js +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTextEditContentPart.js +160 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatTreeContentPart.js +171 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatContentParts/chatWarningContentPart.js +34 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/{media → chatContentParts/media}/chatConfirmationWidget.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatInputPart.js +91 -44
- package/vscode/src/vs/workbench/contrib/chat/browser/chatListRenderer.js +292 -1019
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownDecorationsRenderer.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatMarkdownRenderer.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWidget.js +22 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/codeBlockPart.js +61 -54
- package/vscode/src/vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables.js +23 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chat.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/media/chatAgentHover.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatAgents.js +8 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatColors.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/common/chatWordCounter.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/common/codeBlockModelCollection.js +16 -0
- package/vscode/src/vs/workbench/contrib/chat/common/languageModelToolsService.service.js +3 -0
- package/vscode/src/vs/workbench/contrib/chat/common/languageModels.js +2 -2
- package/vscode/src/vs/workbench/contrib/codeActions/browser/codeActionsContribution.js +43 -16
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.js +1 -1
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/find/simpleFindWidget.js +1 -3
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleMultiCursorModifier.js +7 -5
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.js +7 -7
- package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +3 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +2 -2
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +2 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +2 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +8 -5
- package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +1 -1
- package/vscode/src/vs/workbench/contrib/contextmenu/browser/contextmenu.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/debug/browser/baseDebugView.js +14 -7
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointEditorContribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointWidget.js +8 -7
- package/vscode/src/vs/workbench/contrib/debug/browser/breakpointsView.js +19 -16
- package/vscode/src/vs/workbench/contrib/debug/browser/debugColors.js +13 -12
- package/vscode/src/vs/workbench/contrib/debug/common/debug.d.ts +19 -2
- package/vscode/src/vs/workbench/contrib/debug/common/debug.js +9 -4
- package/vscode/src/vs/workbench/contrib/debug/common/debugModel.js +10 -5
- package/vscode/src/vs/workbench/contrib/debug/common/replModel.js +4 -4
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.js +235 -173
- package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionActions.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/common/extensions.js +2 -1
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.js +17 -5
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution._configuration.js +62 -44
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution._editorPane.js +2 -2
- package/vscode/src/vs/workbench/contrib/files/browser/views/openEditorsView.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +114 -107
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatContentWidget.js +33 -25
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatController.js +71 -101
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSession.js +38 -43
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +11 -33
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatStrategies.js +3 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatWidget.js +49 -86
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatZoneWidget.js +60 -71
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChat.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/media/inlineChatContentWidget.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +116 -113
- package/vscode/src/vs/workbench/contrib/markdown/browser/markdownDocumentRenderer.js +6 -10
- package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.js +1 -0
- package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/scmMultiDiffSourceResolver.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.js +12 -23
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +0 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/findModel.js +7 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.js +88 -61
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +1 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/cellOutputActions.js +39 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +2 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController.js +12 -11
- package/vscode/src/vs/workbench/contrib/notebook/browser/media/notebookCellChat.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityProvider.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookBrowser.js +3 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +40 -105
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookIcons.js +27 -26
- package/vscode/src/vs/workbench/contrib/notebook/browser/notebookOptions.js +14 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellActionView.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellComments.js +43 -46
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellDnd.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellOutput.js +4 -4
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellStatusPart.js +12 -9
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/cellToolbars.js +19 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCell.js +2 -2
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/codeCellRunToolbar.js +9 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/cellParts/markupCell.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.js +5 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/cellRenderer.js +3 -3
- package/vscode/src/vs/workbench/contrib/notebook/browser/view/renderers/webviewPreloads.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/baseCellViewModel.js +16 -6
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel.js +8 -8
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.service.js +3 -0
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookViewModelImpl.js +11 -12
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorStickyScroll.js +12 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookEditorToolbar.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewParts/notebookTopCellToolbar.js +5 -3
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.js +9 -2
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorInput.js +37 -36
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +18 -8
- package/vscode/src/vs/workbench/contrib/preferences/browser/preferencesWidgets.js +1 -1
- package/vscode/src/vs/workbench/contrib/preferences/browser/settingsTreeModels.js +14 -5
- package/vscode/src/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry.js +17 -22
- package/vscode/src/vs/workbench/contrib/remote/browser/media/tunnelView.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/remote/browser/tunnelView.js +7 -10
- package/vscode/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.js +7 -27
- package/vscode/src/vs/workbench/contrib/search/browser/anythingQuickAccess.js +3 -4
- package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js +2 -2
- package/vscode/src/vs/workbench/contrib/search/browser/searchActionsFind.js +4 -0
- package/vscode/src/vs/workbench/contrib/search/browser/searchModel.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/terminal/common/terminal.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/terminal/common/terminalColorRegistry.js +13 -37
- package/vscode/src/vs/workbench/contrib/testing/common/testCoverage.d.ts +88 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testCoverage.js +48 -31
- package/vscode/src/vs/workbench/contrib/testing/common/testId.d.ts +115 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testResult.d.ts +226 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testTypes.d.ts +319 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testTypes.js +2 -3
- package/vscode/src/vs/workbench/contrib/testing/common/testingStates.d.ts +10 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewWindowDragMonitor.js +21 -2
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewIconManager.js +7 -8
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +3 -3
- package/vscode/src/vs/workbench/services/authentication/common/authentication.d.ts +10 -5
- package/vscode/src/vs/workbench/services/editor/common/customEditorLabelService.js +54 -21
- package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagement.service.d.ts +1 -0
- package/vscode/src/vs/workbench/services/extensions/browser/extensionService.d.ts +1 -2
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.d.ts +2 -4
- package/vscode/src/vs/workbench/services/extensions/common/extensions.js +5 -3
- package/vscode/src/vs/workbench/services/extensions/common/extensions.service.d.ts +3 -1
- package/vscode/src/vs/workbench/services/extensions/common/extensionsRegistry.js +59 -41
- package/vscode/src/vs/workbench/services/extensions/common/rpcProtocol.js +1 -1
- package/vscode/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js +3 -2
- package/vscode/src/vs/workbench/services/host/browser/host.service.d.ts +1 -0
- package/vscode/src/vs/workbench/services/language/common/languageService.js +7 -0
- package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +1 -1
- package/vscode/src/vs/workbench/services/preferences/common/preferences.d.ts +2 -2
- package/vscode/src/vs/workbench/services/search/common/search.js +2 -1
- package/vscode/src/vs/workbench/services/search/common/textSearchManager.js +2 -2
- package/vscode/src/vs/workbench/services/statusbar/browser/statusbar.d.ts +2 -2
- package/vscode/src/vs/workbench/services/textfile/common/encoding.js +69 -26
- package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModel.js +23 -4
- package/vscode/src/vs/workbench/services/textfile/common/textfiles.d.ts +5 -1
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfileIcons.js +1 -1
- package/vscode/src/vs/workbench/services/views/browser/viewsService.js +12 -5
- package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopy.js +38 -19
- package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyFileService.service.d.ts +2 -1
- package/vscode-dts/vscode.proposed.aiTextSearchProvider.d.ts +0 -196
- package/vscode-dts/vscode.proposed.attributableCoverage.d.ts +28 -10
- package/vscode-dts/vscode.proposed.authGetSessions.d.ts +30 -22
- package/vscode-dts/vscode.proposed.chatProvider.d.ts +17 -8
- package/vscode-dts/vscode.proposed.chatVariableResolver.d.ts +0 -9
- package/vscode-dts/vscode.proposed.commentReveal.d.ts +32 -0
- package/vscode-dts/vscode.proposed.commentThreadApplicability.d.ts +10 -0
- package/vscode-dts/vscode.proposed.createFileSystemWatcher.d.ts +1 -1
- package/vscode-dts/vscode.proposed.fileComments.d.ts +12 -53
- package/vscode-dts/vscode.proposed.fileSearchProvider.d.ts +6 -0
- package/vscode-dts/vscode.proposed.inlineCompletionsAdditions.d.ts +6 -0
- package/vscode-dts/vscode.proposed.lmTools.d.ts +91 -0
- package/vscode-dts/vscode.proposed.mappedEditsProvider.d.ts +1 -1
- package/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts +10 -6
- package/vscode-dts/vscode.proposed.terminalShellIntegration.d.ts +38 -13
- package/vscode/src/vs/editor/browser/observableUtilities.js +0 -58
- package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineProviderFactory.service.js +0 -3
- package/vscode/src/vs/workbench/services/extensions/common/extensionsApiProposals.js +0 -122
|
@@ -0,0 +1,911 @@
|
|
|
1
|
+
import { CharCode } from '../../../base/common/charCode.js';
|
|
2
|
+
import { onUnexpectedError } from '../../../base/common/errors.js';
|
|
3
|
+
import { getLeadingWhitespace, firstNonWhitespaceIndex, splitLines, lastNonWhitespaceIndex } from '../../../base/common/strings.js';
|
|
4
|
+
import { ReplaceCommandWithoutChangingPosition, ReplaceCommandWithOffsetCursorState, ReplaceCommand, ReplaceCommandThatPreservesSelection } from '../commands/replaceCommand.js';
|
|
5
|
+
import { ShiftCommand } from '../commands/shiftCommand.js';
|
|
6
|
+
import { SurroundSelectionCommand } from '../commands/surroundSelectionCommand.js';
|
|
7
|
+
import { EditOperationResult, EditOperationType, isQuote } from '../cursorCommon.js';
|
|
8
|
+
import { getMapForWordSeparators, WordCharacterClass } from '../core/wordCharacterClassifier.js';
|
|
9
|
+
import { Range } from '../core/range.js';
|
|
10
|
+
import { Position } from '../core/position.js';
|
|
11
|
+
import { IndentAction } from '../languages/languageConfiguration.js';
|
|
12
|
+
import { getIndentationAtPosition } from '../languages/languageConfigurationRegistry.js';
|
|
13
|
+
import { EditorAutoIndentStrategy } from '../config/editorOptions.js';
|
|
14
|
+
import { createScopedLineTokens } from '../languages/supports.js';
|
|
15
|
+
import { getIndentForEnter, getIndentActionForType, getInheritIndentForLine } from '../languages/autoIndent.js';
|
|
16
|
+
import { getEnterAction } from '../languages/enterAction.js';
|
|
17
|
+
class AutoIndentOperation {
|
|
18
|
+
static getEdits(config, model, selections, ch, isDoingComposition) {
|
|
19
|
+
if (!isDoingComposition && this._isAutoIndentType(config, model, selections)) {
|
|
20
|
+
const indentationForSelections = [];
|
|
21
|
+
for (const selection of selections) {
|
|
22
|
+
const indentation = this._findActualIndentationForSelection(config, model, selection, ch);
|
|
23
|
+
if (indentation === null) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
indentationForSelections.push({ selection, indentation });
|
|
27
|
+
}
|
|
28
|
+
const autoClosingPairClose = AutoClosingOpenCharTypeOperation.getAutoClosingPairClose(config, model, selections, ch, false);
|
|
29
|
+
return this._getIndentationAndAutoClosingPairEdits(config, model, indentationForSelections, ch, autoClosingPairClose);
|
|
30
|
+
}
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
static _isAutoIndentType(config, model, selections) {
|
|
34
|
+
if (config.autoIndent < EditorAutoIndentStrategy.Full) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
for (let i = 0, len = selections.length; i < len; i++) {
|
|
38
|
+
if (!model.tokenization.isCheapToTokenize(selections[i].getEndPosition().lineNumber)) {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
static _findActualIndentationForSelection(config, model, selection, ch) {
|
|
45
|
+
const actualIndentation = getIndentActionForType(config, model, selection, ch, {
|
|
46
|
+
shiftIndent: (indentation) => {
|
|
47
|
+
return shiftIndent(config, indentation);
|
|
48
|
+
},
|
|
49
|
+
unshiftIndent: (indentation) => {
|
|
50
|
+
return unshiftIndent(config, indentation);
|
|
51
|
+
},
|
|
52
|
+
}, config.languageConfigurationService);
|
|
53
|
+
if (actualIndentation === null) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
const currentIndentation = getIndentationAtPosition(model, selection.startLineNumber, selection.startColumn);
|
|
57
|
+
if (actualIndentation === config.normalizeIndentation(currentIndentation)) {
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
return actualIndentation;
|
|
61
|
+
}
|
|
62
|
+
static _getIndentationAndAutoClosingPairEdits(config, model, indentationForSelections, ch, autoClosingPairClose) {
|
|
63
|
+
const commands = ( indentationForSelections.map(({ selection, indentation }) => {
|
|
64
|
+
if (autoClosingPairClose !== null) {
|
|
65
|
+
const indentationEdit = this._getEditFromIndentationAndSelection(config, model, indentation, selection, ch, false);
|
|
66
|
+
return ( new TypeWithIndentationAndAutoClosingCommand(indentationEdit, selection, ch, autoClosingPairClose));
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const indentationEdit = this._getEditFromIndentationAndSelection(config, model, indentation, selection, ch, true);
|
|
70
|
+
return typeCommand(indentationEdit.range, indentationEdit.text, false);
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
const editOptions = { shouldPushStackElementBefore: true, shouldPushStackElementAfter: false };
|
|
74
|
+
return ( new EditOperationResult(EditOperationType.TypingOther, commands, editOptions));
|
|
75
|
+
}
|
|
76
|
+
static _getEditFromIndentationAndSelection(config, model, indentation, selection, ch, includeChInEdit = true) {
|
|
77
|
+
const startLineNumber = selection.startLineNumber;
|
|
78
|
+
const firstNonWhitespaceColumn = model.getLineFirstNonWhitespaceColumn(startLineNumber);
|
|
79
|
+
let text = config.normalizeIndentation(indentation);
|
|
80
|
+
if (firstNonWhitespaceColumn !== 0) {
|
|
81
|
+
const startLine = model.getLineContent(startLineNumber);
|
|
82
|
+
text += startLine.substring(firstNonWhitespaceColumn - 1, selection.startColumn - 1);
|
|
83
|
+
}
|
|
84
|
+
text += includeChInEdit ? ch : '';
|
|
85
|
+
const range = ( new Range(startLineNumber, 1, selection.endLineNumber, selection.endColumn));
|
|
86
|
+
return { range, text };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
class AutoClosingOvertypeOperation {
|
|
90
|
+
static getEdits(prevEditOperationType, config, model, selections, autoClosedCharacters, ch) {
|
|
91
|
+
if (isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch)) {
|
|
92
|
+
return this._runAutoClosingOvertype(prevEditOperationType, selections, ch);
|
|
93
|
+
}
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
static _runAutoClosingOvertype(prevEditOperationType, selections, ch) {
|
|
97
|
+
const commands = [];
|
|
98
|
+
for (let i = 0, len = selections.length; i < len; i++) {
|
|
99
|
+
const selection = selections[i];
|
|
100
|
+
const position = selection.getPosition();
|
|
101
|
+
const typeSelection = ( new Range(
|
|
102
|
+
position.lineNumber,
|
|
103
|
+
position.column,
|
|
104
|
+
position.lineNumber,
|
|
105
|
+
position.column + 1
|
|
106
|
+
));
|
|
107
|
+
commands[i] = ( new ReplaceCommand(typeSelection, ch));
|
|
108
|
+
}
|
|
109
|
+
return ( new EditOperationResult(EditOperationType.TypingOther, commands, {
|
|
110
|
+
shouldPushStackElementBefore: shouldPushStackElementBetween(prevEditOperationType, EditOperationType.TypingOther),
|
|
111
|
+
shouldPushStackElementAfter: false
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
class AutoClosingOvertypeWithInterceptorsOperation {
|
|
116
|
+
static getEdits(config, model, selections, autoClosedCharacters, ch) {
|
|
117
|
+
if (isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch)) {
|
|
118
|
+
const commands = ( selections.map(s => ( new ReplaceCommand(( new Range(
|
|
119
|
+
s.positionLineNumber,
|
|
120
|
+
s.positionColumn,
|
|
121
|
+
s.positionLineNumber,
|
|
122
|
+
s.positionColumn + 1
|
|
123
|
+
)), '', false))));
|
|
124
|
+
return ( new EditOperationResult(EditOperationType.TypingOther, commands, {
|
|
125
|
+
shouldPushStackElementBefore: true,
|
|
126
|
+
shouldPushStackElementAfter: false
|
|
127
|
+
}));
|
|
128
|
+
}
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
class AutoClosingOpenCharTypeOperation {
|
|
133
|
+
static getEdits(config, model, selections, ch, chIsAlreadyTyped, isDoingComposition) {
|
|
134
|
+
if (!isDoingComposition) {
|
|
135
|
+
const autoClosingPairClose = this.getAutoClosingPairClose(config, model, selections, ch, chIsAlreadyTyped);
|
|
136
|
+
if (autoClosingPairClose !== null) {
|
|
137
|
+
return this._runAutoClosingOpenCharType(selections, ch, chIsAlreadyTyped, autoClosingPairClose);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
static _runAutoClosingOpenCharType(selections, ch, chIsAlreadyTyped, autoClosingPairClose) {
|
|
143
|
+
const commands = [];
|
|
144
|
+
for (let i = 0, len = selections.length; i < len; i++) {
|
|
145
|
+
const selection = selections[i];
|
|
146
|
+
commands[i] = ( new TypeWithAutoClosingCommand(selection, ch, !chIsAlreadyTyped, autoClosingPairClose));
|
|
147
|
+
}
|
|
148
|
+
return ( new EditOperationResult(EditOperationType.TypingOther, commands, {
|
|
149
|
+
shouldPushStackElementBefore: true,
|
|
150
|
+
shouldPushStackElementAfter: false
|
|
151
|
+
}));
|
|
152
|
+
}
|
|
153
|
+
static getAutoClosingPairClose(config, model, selections, ch, chIsAlreadyTyped) {
|
|
154
|
+
for (const selection of selections) {
|
|
155
|
+
if (!selection.isEmpty()) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
const positions = ( selections.map((s) => {
|
|
160
|
+
const position = s.getPosition();
|
|
161
|
+
if (chIsAlreadyTyped) {
|
|
162
|
+
return { lineNumber: position.lineNumber, beforeColumn: position.column - ch.length, afterColumn: position.column };
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
return { lineNumber: position.lineNumber, beforeColumn: position.column, afterColumn: position.column };
|
|
166
|
+
}
|
|
167
|
+
}));
|
|
168
|
+
const pair = this._findAutoClosingPairOpen(config, model, ( positions.map(p => ( new Position(p.lineNumber, p.beforeColumn)))), ch);
|
|
169
|
+
if (!pair) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
let autoCloseConfig;
|
|
173
|
+
let shouldAutoCloseBefore;
|
|
174
|
+
const chIsQuote = isQuote(ch);
|
|
175
|
+
if (chIsQuote) {
|
|
176
|
+
autoCloseConfig = config.autoClosingQuotes;
|
|
177
|
+
shouldAutoCloseBefore = config.shouldAutoCloseBefore.quote;
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
const pairIsForComments = config.blockCommentStartToken ? pair.open.includes(config.blockCommentStartToken) : false;
|
|
181
|
+
if (pairIsForComments) {
|
|
182
|
+
autoCloseConfig = config.autoClosingComments;
|
|
183
|
+
shouldAutoCloseBefore = config.shouldAutoCloseBefore.comment;
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
autoCloseConfig = config.autoClosingBrackets;
|
|
187
|
+
shouldAutoCloseBefore = config.shouldAutoCloseBefore.bracket;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
if (autoCloseConfig === 'never') {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
const containedPair = this._findContainedAutoClosingPair(config, pair);
|
|
194
|
+
const containedPairClose = containedPair ? containedPair.close : '';
|
|
195
|
+
let isContainedPairPresent = true;
|
|
196
|
+
for (const position of positions) {
|
|
197
|
+
const { lineNumber, beforeColumn, afterColumn } = position;
|
|
198
|
+
const lineText = model.getLineContent(lineNumber);
|
|
199
|
+
const lineBefore = lineText.substring(0, beforeColumn - 1);
|
|
200
|
+
const lineAfter = lineText.substring(afterColumn - 1);
|
|
201
|
+
if (!lineAfter.startsWith(containedPairClose)) {
|
|
202
|
+
isContainedPairPresent = false;
|
|
203
|
+
}
|
|
204
|
+
if (lineAfter.length > 0) {
|
|
205
|
+
const characterAfter = lineAfter.charAt(0);
|
|
206
|
+
const isBeforeCloseBrace = this._isBeforeClosingBrace(config, lineAfter);
|
|
207
|
+
if (!isBeforeCloseBrace && !shouldAutoCloseBefore(characterAfter)) {
|
|
208
|
+
return null;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (pair.open.length === 1 && (ch === '\'' || ch === '"') && autoCloseConfig !== 'always') {
|
|
212
|
+
const wordSeparators = getMapForWordSeparators(config.wordSeparators, []);
|
|
213
|
+
if (lineBefore.length > 0) {
|
|
214
|
+
const characterBefore = lineBefore.charCodeAt(lineBefore.length - 1);
|
|
215
|
+
if (wordSeparators.get(characterBefore) === WordCharacterClass.Regular) {
|
|
216
|
+
return null;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
if (!model.tokenization.isCheapToTokenize(lineNumber)) {
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
model.tokenization.forceTokenization(lineNumber);
|
|
224
|
+
const lineTokens = model.tokenization.getLineTokens(lineNumber);
|
|
225
|
+
const scopedLineTokens = createScopedLineTokens(lineTokens, beforeColumn - 1);
|
|
226
|
+
if (!pair.shouldAutoClose(scopedLineTokens, beforeColumn - scopedLineTokens.firstCharOffset)) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
const neutralCharacter = pair.findNeutralCharacter();
|
|
230
|
+
if (neutralCharacter) {
|
|
231
|
+
const tokenType = model.tokenization.getTokenTypeIfInsertingCharacter(lineNumber, beforeColumn, neutralCharacter);
|
|
232
|
+
if (!pair.isOK(tokenType)) {
|
|
233
|
+
return null;
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
if (isContainedPairPresent) {
|
|
238
|
+
return pair.close.substring(0, pair.close.length - containedPairClose.length);
|
|
239
|
+
}
|
|
240
|
+
else {
|
|
241
|
+
return pair.close;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
static _findContainedAutoClosingPair(config, pair) {
|
|
245
|
+
if (pair.open.length <= 1) {
|
|
246
|
+
return null;
|
|
247
|
+
}
|
|
248
|
+
const lastChar = pair.close.charAt(pair.close.length - 1);
|
|
249
|
+
const candidates = config.autoClosingPairs.autoClosingPairsCloseByEnd.get(lastChar) || [];
|
|
250
|
+
let result = null;
|
|
251
|
+
for (const candidate of candidates) {
|
|
252
|
+
if (candidate.open !== pair.open && pair.open.includes(candidate.open) && pair.close.endsWith(candidate.close)) {
|
|
253
|
+
if (!result || candidate.open.length > result.open.length) {
|
|
254
|
+
result = candidate;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return result;
|
|
259
|
+
}
|
|
260
|
+
static _findAutoClosingPairOpen(config, model, positions, ch) {
|
|
261
|
+
const candidates = config.autoClosingPairs.autoClosingPairsOpenByEnd.get(ch);
|
|
262
|
+
if (!candidates) {
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
let result = null;
|
|
266
|
+
for (const candidate of candidates) {
|
|
267
|
+
if (result === null || candidate.open.length > result.open.length) {
|
|
268
|
+
let candidateIsMatch = true;
|
|
269
|
+
for (const position of positions) {
|
|
270
|
+
const relevantText = model.getValueInRange(( new Range(
|
|
271
|
+
position.lineNumber,
|
|
272
|
+
position.column - candidate.open.length + 1,
|
|
273
|
+
position.lineNumber,
|
|
274
|
+
position.column
|
|
275
|
+
)));
|
|
276
|
+
if (relevantText + ch !== candidate.open) {
|
|
277
|
+
candidateIsMatch = false;
|
|
278
|
+
break;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
if (candidateIsMatch) {
|
|
282
|
+
result = candidate;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return result;
|
|
287
|
+
}
|
|
288
|
+
static _isBeforeClosingBrace(config, lineAfter) {
|
|
289
|
+
const nextChar = lineAfter.charAt(0);
|
|
290
|
+
const potentialStartingBraces = config.autoClosingPairs.autoClosingPairsOpenByStart.get(nextChar) || [];
|
|
291
|
+
const potentialClosingBraces = config.autoClosingPairs.autoClosingPairsCloseByStart.get(nextChar) || [];
|
|
292
|
+
const isBeforeStartingBrace = ( potentialStartingBraces.some(x => lineAfter.startsWith(x.open)));
|
|
293
|
+
const isBeforeClosingBrace = ( potentialClosingBraces.some(x => lineAfter.startsWith(x.close)));
|
|
294
|
+
return !isBeforeStartingBrace && isBeforeClosingBrace;
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
class SurroundSelectionOperation {
|
|
298
|
+
static getEdits(config, model, selections, ch, isDoingComposition) {
|
|
299
|
+
if (!isDoingComposition && this._isSurroundSelectionType(config, model, selections, ch)) {
|
|
300
|
+
return this._runSurroundSelectionType(config, selections, ch);
|
|
301
|
+
}
|
|
302
|
+
return;
|
|
303
|
+
}
|
|
304
|
+
static _runSurroundSelectionType(config, selections, ch) {
|
|
305
|
+
const commands = [];
|
|
306
|
+
for (let i = 0, len = selections.length; i < len; i++) {
|
|
307
|
+
const selection = selections[i];
|
|
308
|
+
const closeCharacter = config.surroundingPairs[ch];
|
|
309
|
+
commands[i] = ( new SurroundSelectionCommand(selection, ch, closeCharacter));
|
|
310
|
+
}
|
|
311
|
+
return ( new EditOperationResult(EditOperationType.Other, commands, {
|
|
312
|
+
shouldPushStackElementBefore: true,
|
|
313
|
+
shouldPushStackElementAfter: true
|
|
314
|
+
}));
|
|
315
|
+
}
|
|
316
|
+
static _isSurroundSelectionType(config, model, selections, ch) {
|
|
317
|
+
if (!shouldSurroundChar(config, ch) || !config.surroundingPairs.hasOwnProperty(ch)) {
|
|
318
|
+
return false;
|
|
319
|
+
}
|
|
320
|
+
const isTypingAQuoteCharacter = isQuote(ch);
|
|
321
|
+
for (const selection of selections) {
|
|
322
|
+
if (selection.isEmpty()) {
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
let selectionContainsOnlyWhitespace = true;
|
|
326
|
+
for (let lineNumber = selection.startLineNumber; lineNumber <= selection.endLineNumber; lineNumber++) {
|
|
327
|
+
const lineText = model.getLineContent(lineNumber);
|
|
328
|
+
const startIndex = (lineNumber === selection.startLineNumber ? selection.startColumn - 1 : 0);
|
|
329
|
+
const endIndex = (lineNumber === selection.endLineNumber ? selection.endColumn - 1 : lineText.length);
|
|
330
|
+
const selectedText = lineText.substring(startIndex, endIndex);
|
|
331
|
+
if (/[^ \t]/.test(selectedText)) {
|
|
332
|
+
selectionContainsOnlyWhitespace = false;
|
|
333
|
+
break;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
if (selectionContainsOnlyWhitespace) {
|
|
337
|
+
return false;
|
|
338
|
+
}
|
|
339
|
+
if (isTypingAQuoteCharacter && selection.startLineNumber === selection.endLineNumber && selection.startColumn + 1 === selection.endColumn) {
|
|
340
|
+
const selectionText = model.getValueInRange(selection);
|
|
341
|
+
if (isQuote(selectionText)) {
|
|
342
|
+
return false;
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return true;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
class InterceptorElectricCharOperation {
|
|
350
|
+
static getEdits(prevEditOperationType, config, model, selections, ch, isDoingComposition) {
|
|
351
|
+
if (!isDoingComposition && this._isTypeInterceptorElectricChar(config, model, selections)) {
|
|
352
|
+
const r = this._typeInterceptorElectricChar(prevEditOperationType, config, model, selections[0], ch);
|
|
353
|
+
if (r) {
|
|
354
|
+
return r;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
static _isTypeInterceptorElectricChar(config, model, selections) {
|
|
360
|
+
if (selections.length === 1 && model.tokenization.isCheapToTokenize(selections[0].getEndPosition().lineNumber)) {
|
|
361
|
+
return true;
|
|
362
|
+
}
|
|
363
|
+
return false;
|
|
364
|
+
}
|
|
365
|
+
static _typeInterceptorElectricChar(prevEditOperationType, config, model, selection, ch) {
|
|
366
|
+
if (!config.electricChars.hasOwnProperty(ch) || !selection.isEmpty()) {
|
|
367
|
+
return null;
|
|
368
|
+
}
|
|
369
|
+
const position = selection.getPosition();
|
|
370
|
+
model.tokenization.forceTokenization(position.lineNumber);
|
|
371
|
+
const lineTokens = model.tokenization.getLineTokens(position.lineNumber);
|
|
372
|
+
let electricAction;
|
|
373
|
+
try {
|
|
374
|
+
electricAction = config.onElectricCharacter(ch, lineTokens, position.column);
|
|
375
|
+
}
|
|
376
|
+
catch (e) {
|
|
377
|
+
onUnexpectedError(e);
|
|
378
|
+
return null;
|
|
379
|
+
}
|
|
380
|
+
if (!electricAction) {
|
|
381
|
+
return null;
|
|
382
|
+
}
|
|
383
|
+
if (electricAction.matchOpenBracket) {
|
|
384
|
+
const endColumn = (lineTokens.getLineContent() + ch).lastIndexOf(electricAction.matchOpenBracket) + 1;
|
|
385
|
+
const match = model.bracketPairs.findMatchingBracketUp(electricAction.matchOpenBracket, {
|
|
386
|
+
lineNumber: position.lineNumber,
|
|
387
|
+
column: endColumn
|
|
388
|
+
}, 500 );
|
|
389
|
+
if (match) {
|
|
390
|
+
if (match.startLineNumber === position.lineNumber) {
|
|
391
|
+
return null;
|
|
392
|
+
}
|
|
393
|
+
const matchLine = model.getLineContent(match.startLineNumber);
|
|
394
|
+
const matchLineIndentation = getLeadingWhitespace(matchLine);
|
|
395
|
+
const newIndentation = config.normalizeIndentation(matchLineIndentation);
|
|
396
|
+
const lineText = model.getLineContent(position.lineNumber);
|
|
397
|
+
const lineFirstNonBlankColumn = model.getLineFirstNonWhitespaceColumn(position.lineNumber) || position.column;
|
|
398
|
+
const prefix = lineText.substring(lineFirstNonBlankColumn - 1, position.column - 1);
|
|
399
|
+
const typeText = newIndentation + prefix + ch;
|
|
400
|
+
const typeSelection = ( new Range(position.lineNumber, 1, position.lineNumber, position.column));
|
|
401
|
+
const command = ( new ReplaceCommand(typeSelection, typeText));
|
|
402
|
+
return ( new EditOperationResult(getTypingOperation(typeText, prevEditOperationType), [command], {
|
|
403
|
+
shouldPushStackElementBefore: false,
|
|
404
|
+
shouldPushStackElementAfter: true
|
|
405
|
+
}));
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
return null;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
class SimpleCharacterTypeOperation {
|
|
412
|
+
static getEdits(prevEditOperationType, selections, ch) {
|
|
413
|
+
const commands = [];
|
|
414
|
+
for (let i = 0, len = selections.length; i < len; i++) {
|
|
415
|
+
commands[i] = ( new ReplaceCommand(selections[i], ch));
|
|
416
|
+
}
|
|
417
|
+
const opType = getTypingOperation(ch, prevEditOperationType);
|
|
418
|
+
return ( new EditOperationResult(opType, commands, {
|
|
419
|
+
shouldPushStackElementBefore: shouldPushStackElementBetween(prevEditOperationType, opType),
|
|
420
|
+
shouldPushStackElementAfter: false
|
|
421
|
+
}));
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
class EnterOperation {
|
|
425
|
+
static getEdits(config, model, selections, ch, isDoingComposition) {
|
|
426
|
+
if (!isDoingComposition && ch === '\n') {
|
|
427
|
+
const commands = [];
|
|
428
|
+
for (let i = 0, len = selections.length; i < len; i++) {
|
|
429
|
+
commands[i] = this._enter(config, model, false, selections[i]);
|
|
430
|
+
}
|
|
431
|
+
return ( new EditOperationResult(EditOperationType.TypingOther, commands, {
|
|
432
|
+
shouldPushStackElementBefore: true,
|
|
433
|
+
shouldPushStackElementAfter: false,
|
|
434
|
+
}));
|
|
435
|
+
}
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
static _enter(config, model, keepPosition, range) {
|
|
439
|
+
if (config.autoIndent === EditorAutoIndentStrategy.None) {
|
|
440
|
+
return typeCommand(range, '\n', keepPosition);
|
|
441
|
+
}
|
|
442
|
+
if (!model.tokenization.isCheapToTokenize(range.getStartPosition().lineNumber) || config.autoIndent === EditorAutoIndentStrategy.Keep) {
|
|
443
|
+
const lineText = model.getLineContent(range.startLineNumber);
|
|
444
|
+
const indentation = getLeadingWhitespace(lineText).substring(0, range.startColumn - 1);
|
|
445
|
+
return typeCommand(range, '\n' + config.normalizeIndentation(indentation), keepPosition);
|
|
446
|
+
}
|
|
447
|
+
const r = getEnterAction(config.autoIndent, model, range, config.languageConfigurationService);
|
|
448
|
+
if (r) {
|
|
449
|
+
if (r.indentAction === IndentAction.None) {
|
|
450
|
+
return typeCommand(range, '\n' + config.normalizeIndentation(r.indentation + r.appendText), keepPosition);
|
|
451
|
+
}
|
|
452
|
+
else if (r.indentAction === IndentAction.Indent) {
|
|
453
|
+
return typeCommand(range, '\n' + config.normalizeIndentation(r.indentation + r.appendText), keepPosition);
|
|
454
|
+
}
|
|
455
|
+
else if (r.indentAction === IndentAction.IndentOutdent) {
|
|
456
|
+
const normalIndent = config.normalizeIndentation(r.indentation);
|
|
457
|
+
const increasedIndent = config.normalizeIndentation(r.indentation + r.appendText);
|
|
458
|
+
const typeText = '\n' + increasedIndent + '\n' + normalIndent;
|
|
459
|
+
if (keepPosition) {
|
|
460
|
+
return ( new ReplaceCommandWithoutChangingPosition(range, typeText, true));
|
|
461
|
+
}
|
|
462
|
+
else {
|
|
463
|
+
return ( new ReplaceCommandWithOffsetCursorState(range, typeText, -1, increasedIndent.length - normalIndent.length, true));
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
else if (r.indentAction === IndentAction.Outdent) {
|
|
467
|
+
const actualIndentation = unshiftIndent(config, r.indentation);
|
|
468
|
+
return typeCommand(range, '\n' + config.normalizeIndentation(actualIndentation + r.appendText), keepPosition);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
const lineText = model.getLineContent(range.startLineNumber);
|
|
472
|
+
const indentation = getLeadingWhitespace(lineText).substring(0, range.startColumn - 1);
|
|
473
|
+
if (config.autoIndent >= EditorAutoIndentStrategy.Full) {
|
|
474
|
+
const ir = getIndentForEnter(config.autoIndent, model, range, {
|
|
475
|
+
unshiftIndent: (indent) => {
|
|
476
|
+
return unshiftIndent(config, indent);
|
|
477
|
+
},
|
|
478
|
+
shiftIndent: (indent) => {
|
|
479
|
+
return shiftIndent(config, indent);
|
|
480
|
+
},
|
|
481
|
+
normalizeIndentation: (indent) => {
|
|
482
|
+
return config.normalizeIndentation(indent);
|
|
483
|
+
}
|
|
484
|
+
}, config.languageConfigurationService);
|
|
485
|
+
if (ir) {
|
|
486
|
+
let oldEndViewColumn = config.visibleColumnFromColumn(model, range.getEndPosition());
|
|
487
|
+
const oldEndColumn = range.endColumn;
|
|
488
|
+
const newLineContent = model.getLineContent(range.endLineNumber);
|
|
489
|
+
const firstNonWhitespace = firstNonWhitespaceIndex(newLineContent);
|
|
490
|
+
if (firstNonWhitespace >= 0) {
|
|
491
|
+
range = range.setEndPosition(range.endLineNumber, Math.max(range.endColumn, firstNonWhitespace + 1));
|
|
492
|
+
}
|
|
493
|
+
else {
|
|
494
|
+
range = range.setEndPosition(range.endLineNumber, model.getLineMaxColumn(range.endLineNumber));
|
|
495
|
+
}
|
|
496
|
+
if (keepPosition) {
|
|
497
|
+
return ( new ReplaceCommandWithoutChangingPosition(range, '\n' + config.normalizeIndentation(ir.afterEnter), true));
|
|
498
|
+
}
|
|
499
|
+
else {
|
|
500
|
+
let offset = 0;
|
|
501
|
+
if (oldEndColumn <= firstNonWhitespace + 1) {
|
|
502
|
+
if (!config.insertSpaces) {
|
|
503
|
+
oldEndViewColumn = Math.ceil(oldEndViewColumn / config.indentSize);
|
|
504
|
+
}
|
|
505
|
+
offset = Math.min(oldEndViewColumn + 1 - config.normalizeIndentation(ir.afterEnter).length - 1, 0);
|
|
506
|
+
}
|
|
507
|
+
return ( new ReplaceCommandWithOffsetCursorState(range, '\n' + config.normalizeIndentation(ir.afterEnter), 0, offset, true));
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
return typeCommand(range, '\n' + config.normalizeIndentation(indentation), keepPosition);
|
|
512
|
+
}
|
|
513
|
+
static lineInsertBefore(config, model, selections) {
|
|
514
|
+
if (model === null || selections === null) {
|
|
515
|
+
return [];
|
|
516
|
+
}
|
|
517
|
+
const commands = [];
|
|
518
|
+
for (let i = 0, len = selections.length; i < len; i++) {
|
|
519
|
+
let lineNumber = selections[i].positionLineNumber;
|
|
520
|
+
if (lineNumber === 1) {
|
|
521
|
+
commands[i] = ( new ReplaceCommandWithoutChangingPosition(( new Range(1, 1, 1, 1)), '\n'));
|
|
522
|
+
}
|
|
523
|
+
else {
|
|
524
|
+
lineNumber--;
|
|
525
|
+
const column = model.getLineMaxColumn(lineNumber);
|
|
526
|
+
commands[i] = this._enter(config, model, false, ( new Range(lineNumber, column, lineNumber, column)));
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
return commands;
|
|
530
|
+
}
|
|
531
|
+
static lineInsertAfter(config, model, selections) {
|
|
532
|
+
if (model === null || selections === null) {
|
|
533
|
+
return [];
|
|
534
|
+
}
|
|
535
|
+
const commands = [];
|
|
536
|
+
for (let i = 0, len = selections.length; i < len; i++) {
|
|
537
|
+
const lineNumber = selections[i].positionLineNumber;
|
|
538
|
+
const column = model.getLineMaxColumn(lineNumber);
|
|
539
|
+
commands[i] = this._enter(config, model, false, ( new Range(lineNumber, column, lineNumber, column)));
|
|
540
|
+
}
|
|
541
|
+
return commands;
|
|
542
|
+
}
|
|
543
|
+
static lineBreakInsert(config, model, selections) {
|
|
544
|
+
const commands = [];
|
|
545
|
+
for (let i = 0, len = selections.length; i < len; i++) {
|
|
546
|
+
commands[i] = this._enter(config, model, true, selections[i]);
|
|
547
|
+
}
|
|
548
|
+
return commands;
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
class PasteOperation {
|
|
552
|
+
static getEdits(config, model, selections, text, pasteOnNewLine, multicursorText) {
|
|
553
|
+
const distributedPaste = this._distributePasteToCursors(config, selections, text, pasteOnNewLine, multicursorText);
|
|
554
|
+
if (distributedPaste) {
|
|
555
|
+
selections = selections.sort(Range.compareRangesUsingStarts);
|
|
556
|
+
return this._distributedPaste(config, model, selections, distributedPaste);
|
|
557
|
+
}
|
|
558
|
+
else {
|
|
559
|
+
return this._simplePaste(config, model, selections, text, pasteOnNewLine);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
static _distributePasteToCursors(config, selections, text, pasteOnNewLine, multicursorText) {
|
|
563
|
+
if (pasteOnNewLine) {
|
|
564
|
+
return null;
|
|
565
|
+
}
|
|
566
|
+
if (selections.length === 1) {
|
|
567
|
+
return null;
|
|
568
|
+
}
|
|
569
|
+
if (multicursorText && multicursorText.length === selections.length) {
|
|
570
|
+
return multicursorText;
|
|
571
|
+
}
|
|
572
|
+
if (config.multiCursorPaste === 'spread') {
|
|
573
|
+
if (text.charCodeAt(text.length - 1) === CharCode.LineFeed) {
|
|
574
|
+
text = text.substring(0, text.length - 1);
|
|
575
|
+
}
|
|
576
|
+
if (text.charCodeAt(text.length - 1) === CharCode.CarriageReturn) {
|
|
577
|
+
text = text.substring(0, text.length - 1);
|
|
578
|
+
}
|
|
579
|
+
const lines = splitLines(text);
|
|
580
|
+
if (lines.length === selections.length) {
|
|
581
|
+
return lines;
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
return null;
|
|
585
|
+
}
|
|
586
|
+
static _distributedPaste(config, model, selections, text) {
|
|
587
|
+
const commands = [];
|
|
588
|
+
for (let i = 0, len = selections.length; i < len; i++) {
|
|
589
|
+
commands[i] = ( new ReplaceCommand(selections[i], text[i]));
|
|
590
|
+
}
|
|
591
|
+
return ( new EditOperationResult(EditOperationType.Other, commands, {
|
|
592
|
+
shouldPushStackElementBefore: true,
|
|
593
|
+
shouldPushStackElementAfter: true
|
|
594
|
+
}));
|
|
595
|
+
}
|
|
596
|
+
static _simplePaste(config, model, selections, text, pasteOnNewLine) {
|
|
597
|
+
const commands = [];
|
|
598
|
+
for (let i = 0, len = selections.length; i < len; i++) {
|
|
599
|
+
const selection = selections[i];
|
|
600
|
+
const position = selection.getPosition();
|
|
601
|
+
if (pasteOnNewLine && !selection.isEmpty()) {
|
|
602
|
+
pasteOnNewLine = false;
|
|
603
|
+
}
|
|
604
|
+
if (pasteOnNewLine && text.indexOf('\n') !== text.length - 1) {
|
|
605
|
+
pasteOnNewLine = false;
|
|
606
|
+
}
|
|
607
|
+
if (pasteOnNewLine) {
|
|
608
|
+
const typeSelection = ( new Range(position.lineNumber, 1, position.lineNumber, 1));
|
|
609
|
+
commands[i] = ( new ReplaceCommandThatPreservesSelection(typeSelection, text, selection, true));
|
|
610
|
+
}
|
|
611
|
+
else {
|
|
612
|
+
commands[i] = ( new ReplaceCommand(selection, text));
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
return ( new EditOperationResult(EditOperationType.Other, commands, {
|
|
616
|
+
shouldPushStackElementBefore: true,
|
|
617
|
+
shouldPushStackElementAfter: true
|
|
618
|
+
}));
|
|
619
|
+
}
|
|
620
|
+
}
|
|
621
|
+
class CompositionOperation {
|
|
622
|
+
static getEdits(prevEditOperationType, config, model, selections, text, replacePrevCharCnt, replaceNextCharCnt, positionDelta) {
|
|
623
|
+
const commands = ( selections.map(
|
|
624
|
+
selection => this._compositionType(model, selection, text, replacePrevCharCnt, replaceNextCharCnt, positionDelta)
|
|
625
|
+
));
|
|
626
|
+
return ( new EditOperationResult(EditOperationType.TypingOther, commands, {
|
|
627
|
+
shouldPushStackElementBefore: shouldPushStackElementBetween(prevEditOperationType, EditOperationType.TypingOther),
|
|
628
|
+
shouldPushStackElementAfter: false
|
|
629
|
+
}));
|
|
630
|
+
}
|
|
631
|
+
static _compositionType(model, selection, text, replacePrevCharCnt, replaceNextCharCnt, positionDelta) {
|
|
632
|
+
if (!selection.isEmpty()) {
|
|
633
|
+
return null;
|
|
634
|
+
}
|
|
635
|
+
const pos = selection.getPosition();
|
|
636
|
+
const startColumn = Math.max(1, pos.column - replacePrevCharCnt);
|
|
637
|
+
const endColumn = Math.min(model.getLineMaxColumn(pos.lineNumber), pos.column + replaceNextCharCnt);
|
|
638
|
+
const range = ( new Range(pos.lineNumber, startColumn, pos.lineNumber, endColumn));
|
|
639
|
+
const oldText = model.getValueInRange(range);
|
|
640
|
+
if (oldText === text && positionDelta === 0) {
|
|
641
|
+
return null;
|
|
642
|
+
}
|
|
643
|
+
return ( new ReplaceCommandWithOffsetCursorState(range, text, 0, positionDelta));
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
class TypeWithoutInterceptorsOperation {
|
|
647
|
+
static getEdits(prevEditOperationType, selections, str) {
|
|
648
|
+
const commands = [];
|
|
649
|
+
for (let i = 0, len = selections.length; i < len; i++) {
|
|
650
|
+
commands[i] = ( new ReplaceCommand(selections[i], str));
|
|
651
|
+
}
|
|
652
|
+
const opType = getTypingOperation(str, prevEditOperationType);
|
|
653
|
+
return ( new EditOperationResult(opType, commands, {
|
|
654
|
+
shouldPushStackElementBefore: shouldPushStackElementBetween(prevEditOperationType, opType),
|
|
655
|
+
shouldPushStackElementAfter: false
|
|
656
|
+
}));
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
class TabOperation {
|
|
660
|
+
static getCommands(config, model, selections) {
|
|
661
|
+
const commands = [];
|
|
662
|
+
for (let i = 0, len = selections.length; i < len; i++) {
|
|
663
|
+
const selection = selections[i];
|
|
664
|
+
if (selection.isEmpty()) {
|
|
665
|
+
const lineText = model.getLineContent(selection.startLineNumber);
|
|
666
|
+
if (/^\s*$/.test(lineText) && model.tokenization.isCheapToTokenize(selection.startLineNumber)) {
|
|
667
|
+
let goodIndent = this._goodIndentForLine(config, model, selection.startLineNumber);
|
|
668
|
+
goodIndent = goodIndent || '\t';
|
|
669
|
+
const possibleTypeText = config.normalizeIndentation(goodIndent);
|
|
670
|
+
if (!lineText.startsWith(possibleTypeText)) {
|
|
671
|
+
commands[i] = ( new ReplaceCommand(( new Range(
|
|
672
|
+
selection.startLineNumber,
|
|
673
|
+
1,
|
|
674
|
+
selection.startLineNumber,
|
|
675
|
+
lineText.length + 1
|
|
676
|
+
)), possibleTypeText, true));
|
|
677
|
+
continue;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
commands[i] = this._replaceJumpToNextIndent(config, model, selection, true);
|
|
681
|
+
}
|
|
682
|
+
else {
|
|
683
|
+
if (selection.startLineNumber === selection.endLineNumber) {
|
|
684
|
+
const lineMaxColumn = model.getLineMaxColumn(selection.startLineNumber);
|
|
685
|
+
if (selection.startColumn !== 1 || selection.endColumn !== lineMaxColumn) {
|
|
686
|
+
commands[i] = this._replaceJumpToNextIndent(config, model, selection, false);
|
|
687
|
+
continue;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
commands[i] = ( new ShiftCommand(selection, {
|
|
691
|
+
isUnshift: false,
|
|
692
|
+
tabSize: config.tabSize,
|
|
693
|
+
indentSize: config.indentSize,
|
|
694
|
+
insertSpaces: config.insertSpaces,
|
|
695
|
+
useTabStops: config.useTabStops,
|
|
696
|
+
autoIndent: config.autoIndent
|
|
697
|
+
}, config.languageConfigurationService));
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
return commands;
|
|
701
|
+
}
|
|
702
|
+
static _goodIndentForLine(config, model, lineNumber) {
|
|
703
|
+
let action = null;
|
|
704
|
+
let indentation = '';
|
|
705
|
+
const expectedIndentAction = getInheritIndentForLine(config.autoIndent, model, lineNumber, false, config.languageConfigurationService);
|
|
706
|
+
if (expectedIndentAction) {
|
|
707
|
+
action = expectedIndentAction.action;
|
|
708
|
+
indentation = expectedIndentAction.indentation;
|
|
709
|
+
}
|
|
710
|
+
else if (lineNumber > 1) {
|
|
711
|
+
let lastLineNumber;
|
|
712
|
+
for (lastLineNumber = lineNumber - 1; lastLineNumber >= 1; lastLineNumber--) {
|
|
713
|
+
const lineText = model.getLineContent(lastLineNumber);
|
|
714
|
+
const nonWhitespaceIdx = lastNonWhitespaceIndex(lineText);
|
|
715
|
+
if (nonWhitespaceIdx >= 0) {
|
|
716
|
+
break;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
if (lastLineNumber < 1) {
|
|
720
|
+
return null;
|
|
721
|
+
}
|
|
722
|
+
const maxColumn = model.getLineMaxColumn(lastLineNumber);
|
|
723
|
+
const expectedEnterAction = getEnterAction(config.autoIndent, model, ( new Range(lastLineNumber, maxColumn, lastLineNumber, maxColumn)), config.languageConfigurationService);
|
|
724
|
+
if (expectedEnterAction) {
|
|
725
|
+
indentation = expectedEnterAction.indentation + expectedEnterAction.appendText;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
if (action) {
|
|
729
|
+
if (action === IndentAction.Indent) {
|
|
730
|
+
indentation = shiftIndent(config, indentation);
|
|
731
|
+
}
|
|
732
|
+
if (action === IndentAction.Outdent) {
|
|
733
|
+
indentation = unshiftIndent(config, indentation);
|
|
734
|
+
}
|
|
735
|
+
indentation = config.normalizeIndentation(indentation);
|
|
736
|
+
}
|
|
737
|
+
if (!indentation) {
|
|
738
|
+
return null;
|
|
739
|
+
}
|
|
740
|
+
return indentation;
|
|
741
|
+
}
|
|
742
|
+
static _replaceJumpToNextIndent(config, model, selection, insertsAutoWhitespace) {
|
|
743
|
+
let typeText = '';
|
|
744
|
+
const position = selection.getStartPosition();
|
|
745
|
+
if (config.insertSpaces) {
|
|
746
|
+
const visibleColumnFromColumn = config.visibleColumnFromColumn(model, position);
|
|
747
|
+
const indentSize = config.indentSize;
|
|
748
|
+
const spacesCnt = indentSize - (visibleColumnFromColumn % indentSize);
|
|
749
|
+
for (let i = 0; i < spacesCnt; i++) {
|
|
750
|
+
typeText += ' ';
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
else {
|
|
754
|
+
typeText = '\t';
|
|
755
|
+
}
|
|
756
|
+
return ( new ReplaceCommand(selection, typeText, insertsAutoWhitespace));
|
|
757
|
+
}
|
|
758
|
+
}
|
|
759
|
+
class BaseTypeWithAutoClosingCommand extends ReplaceCommandWithOffsetCursorState {
|
|
760
|
+
constructor(selection, text, lineNumberDeltaOffset, columnDeltaOffset, openCharacter, closeCharacter) {
|
|
761
|
+
super(selection, text, lineNumberDeltaOffset, columnDeltaOffset);
|
|
762
|
+
this._openCharacter = openCharacter;
|
|
763
|
+
this._closeCharacter = closeCharacter;
|
|
764
|
+
this.closeCharacterRange = null;
|
|
765
|
+
this.enclosingRange = null;
|
|
766
|
+
}
|
|
767
|
+
_computeCursorStateWithRange(model, range, helper) {
|
|
768
|
+
this.closeCharacterRange = ( new Range(
|
|
769
|
+
range.startLineNumber,
|
|
770
|
+
range.endColumn - this._closeCharacter.length,
|
|
771
|
+
range.endLineNumber,
|
|
772
|
+
range.endColumn
|
|
773
|
+
));
|
|
774
|
+
this.enclosingRange = ( new Range(
|
|
775
|
+
range.startLineNumber,
|
|
776
|
+
range.endColumn - this._openCharacter.length - this._closeCharacter.length,
|
|
777
|
+
range.endLineNumber,
|
|
778
|
+
range.endColumn
|
|
779
|
+
));
|
|
780
|
+
return super.computeCursorState(model, helper);
|
|
781
|
+
}
|
|
782
|
+
}
|
|
783
|
+
class TypeWithAutoClosingCommand extends BaseTypeWithAutoClosingCommand {
|
|
784
|
+
constructor(selection, openCharacter, insertOpenCharacter, closeCharacter) {
|
|
785
|
+
const text = (insertOpenCharacter ? openCharacter : '') + closeCharacter;
|
|
786
|
+
const lineNumberDeltaOffset = 0;
|
|
787
|
+
const columnDeltaOffset = -closeCharacter.length;
|
|
788
|
+
super(selection, text, lineNumberDeltaOffset, columnDeltaOffset, openCharacter, closeCharacter);
|
|
789
|
+
}
|
|
790
|
+
computeCursorState(model, helper) {
|
|
791
|
+
const inverseEditOperations = helper.getInverseEditOperations();
|
|
792
|
+
const range = inverseEditOperations[0].range;
|
|
793
|
+
return this._computeCursorStateWithRange(model, range, helper);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
class TypeWithIndentationAndAutoClosingCommand extends BaseTypeWithAutoClosingCommand {
|
|
797
|
+
constructor(autoIndentationEdit, selection, openCharacter, closeCharacter) {
|
|
798
|
+
const text = openCharacter + closeCharacter;
|
|
799
|
+
const lineNumberDeltaOffset = 0;
|
|
800
|
+
const columnDeltaOffset = openCharacter.length;
|
|
801
|
+
super(selection, text, lineNumberDeltaOffset, columnDeltaOffset, openCharacter, closeCharacter);
|
|
802
|
+
this._autoIndentationEdit = autoIndentationEdit;
|
|
803
|
+
this._autoClosingEdit = { range: selection, text };
|
|
804
|
+
}
|
|
805
|
+
getEditOperations(model, builder) {
|
|
806
|
+
builder.addTrackedEditOperation(this._autoIndentationEdit.range, this._autoIndentationEdit.text);
|
|
807
|
+
builder.addTrackedEditOperation(this._autoClosingEdit.range, this._autoClosingEdit.text);
|
|
808
|
+
}
|
|
809
|
+
computeCursorState(model, helper) {
|
|
810
|
+
const inverseEditOperations = helper.getInverseEditOperations();
|
|
811
|
+
if (inverseEditOperations.length !== 2) {
|
|
812
|
+
throw ( new Error('There should be two inverse edit operations!'));
|
|
813
|
+
}
|
|
814
|
+
const range1 = inverseEditOperations[0].range;
|
|
815
|
+
const range2 = inverseEditOperations[1].range;
|
|
816
|
+
const range = range1.plusRange(range2);
|
|
817
|
+
return this._computeCursorStateWithRange(model, range, helper);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
function getTypingOperation(typedText, previousTypingOperation) {
|
|
821
|
+
if (typedText === ' ') {
|
|
822
|
+
return previousTypingOperation === EditOperationType.TypingFirstSpace
|
|
823
|
+
|| previousTypingOperation === EditOperationType.TypingConsecutiveSpace
|
|
824
|
+
? EditOperationType.TypingConsecutiveSpace
|
|
825
|
+
: EditOperationType.TypingFirstSpace;
|
|
826
|
+
}
|
|
827
|
+
return EditOperationType.TypingOther;
|
|
828
|
+
}
|
|
829
|
+
function shouldPushStackElementBetween(previousTypingOperation, typingOperation) {
|
|
830
|
+
if (isTypingOperation(previousTypingOperation) && !isTypingOperation(typingOperation)) {
|
|
831
|
+
return true;
|
|
832
|
+
}
|
|
833
|
+
if (previousTypingOperation === EditOperationType.TypingFirstSpace) {
|
|
834
|
+
return false;
|
|
835
|
+
}
|
|
836
|
+
return normalizeOperationType(previousTypingOperation) !== normalizeOperationType(typingOperation);
|
|
837
|
+
}
|
|
838
|
+
function normalizeOperationType(type) {
|
|
839
|
+
return (type === EditOperationType.TypingConsecutiveSpace || type === EditOperationType.TypingFirstSpace)
|
|
840
|
+
? 'space'
|
|
841
|
+
: type;
|
|
842
|
+
}
|
|
843
|
+
function isTypingOperation(type) {
|
|
844
|
+
return type === EditOperationType.TypingOther
|
|
845
|
+
|| type === EditOperationType.TypingFirstSpace
|
|
846
|
+
|| type === EditOperationType.TypingConsecutiveSpace;
|
|
847
|
+
}
|
|
848
|
+
function isAutoClosingOvertype(config, model, selections, autoClosedCharacters, ch) {
|
|
849
|
+
if (config.autoClosingOvertype === 'never') {
|
|
850
|
+
return false;
|
|
851
|
+
}
|
|
852
|
+
if (!( config.autoClosingPairs.autoClosingPairsCloseSingleChar.has(ch))) {
|
|
853
|
+
return false;
|
|
854
|
+
}
|
|
855
|
+
for (let i = 0, len = selections.length; i < len; i++) {
|
|
856
|
+
const selection = selections[i];
|
|
857
|
+
if (!selection.isEmpty()) {
|
|
858
|
+
return false;
|
|
859
|
+
}
|
|
860
|
+
const position = selection.getPosition();
|
|
861
|
+
const lineText = model.getLineContent(position.lineNumber);
|
|
862
|
+
const afterCharacter = lineText.charAt(position.column - 1);
|
|
863
|
+
if (afterCharacter !== ch) {
|
|
864
|
+
return false;
|
|
865
|
+
}
|
|
866
|
+
const chIsQuote = isQuote(ch);
|
|
867
|
+
const beforeCharacter = position.column > 2 ? lineText.charCodeAt(position.column - 2) : CharCode.Null;
|
|
868
|
+
if (beforeCharacter === CharCode.Backslash && chIsQuote) {
|
|
869
|
+
return false;
|
|
870
|
+
}
|
|
871
|
+
if (config.autoClosingOvertype === 'auto') {
|
|
872
|
+
let found = false;
|
|
873
|
+
for (let j = 0, lenJ = autoClosedCharacters.length; j < lenJ; j++) {
|
|
874
|
+
const autoClosedCharacter = autoClosedCharacters[j];
|
|
875
|
+
if (position.lineNumber === autoClosedCharacter.startLineNumber && position.column === autoClosedCharacter.startColumn) {
|
|
876
|
+
found = true;
|
|
877
|
+
break;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
if (!found) {
|
|
881
|
+
return false;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
}
|
|
885
|
+
return true;
|
|
886
|
+
}
|
|
887
|
+
function typeCommand(range, text, keepPosition) {
|
|
888
|
+
if (keepPosition) {
|
|
889
|
+
return ( new ReplaceCommandWithoutChangingPosition(range, text, true));
|
|
890
|
+
}
|
|
891
|
+
else {
|
|
892
|
+
return ( new ReplaceCommand(range, text, true));
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
function shiftIndent(config, indentation, count) {
|
|
896
|
+
count = count || 1;
|
|
897
|
+
return ShiftCommand.shiftIndent(indentation, indentation.length + count, config.tabSize, config.indentSize, config.insertSpaces);
|
|
898
|
+
}
|
|
899
|
+
function unshiftIndent(config, indentation, count) {
|
|
900
|
+
count = count || 1;
|
|
901
|
+
return ShiftCommand.unshiftIndent(indentation, indentation.length + count, config.tabSize, config.indentSize, config.insertSpaces);
|
|
902
|
+
}
|
|
903
|
+
function shouldSurroundChar(config, ch) {
|
|
904
|
+
if (isQuote(ch)) {
|
|
905
|
+
return (config.autoSurround === 'quotes' || config.autoSurround === 'languageDefined');
|
|
906
|
+
}
|
|
907
|
+
else {
|
|
908
|
+
return (config.autoSurround === 'brackets' || config.autoSurround === 'languageDefined');
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
export { AutoClosingOpenCharTypeOperation, AutoClosingOvertypeOperation, AutoClosingOvertypeWithInterceptorsOperation, AutoIndentOperation, BaseTypeWithAutoClosingCommand, CompositionOperation, EnterOperation, InterceptorElectricCharOperation, PasteOperation, SimpleCharacterTypeOperation, SurroundSelectionOperation, TabOperation, TypeWithoutInterceptorsOperation, shiftIndent, shouldSurroundChar, unshiftIndent };
|