@codingame/monaco-vscode-api 1.83.16 → 1.85.0-next.1
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/api.js +13 -7
- package/assets/clear.mp3 +0 -0
- package/assets/format.mp3 +0 -0
- package/assets/save.mp3 +0 -0
- package/extensions.d.ts +13 -3
- package/external/{xterm-addon-image/typings/xterm-addon-image.d.ts → @xterm/addon-image/typings/addon-image.d.ts} +1 -1
- package/external/{xterm-addon-serialize/typings/xterm-addon-serialize.d.ts → @xterm/addon-serialize/typings/addon-serialize.d.ts} +20 -3
- package/external/{xterm → @xterm/xterm}/typings/xterm.d.ts +13 -1
- package/lifecycle.js +2 -2
- package/localExtensionHost.js +3 -1
- package/missing-services.js +160 -25
- package/monaco-editor-treemending.patch +6884 -18018
- package/monaco-treemending.js +2 -2
- package/package.json +7 -7
- package/service-override/tools/editor.d.ts +8 -8
- package/service-override/tools/editor.js +44 -19
- package/services.d.ts +2 -2
- package/services.js +3 -3
- package/vscode/src/vs/base/browser/broadcast.js +6 -5
- package/vscode/src/vs/base/browser/dnd.d.ts +6 -0
- package/vscode/src/vs/base/browser/mouseEvent.d.ts +1 -1
- package/vscode/src/vs/base/browser/touch.d.ts +10 -0
- package/vscode/src/vs/base/browser/ui/actionbar/actionbar.d.ts +1 -0
- package/vscode/src/vs/base/browser/ui/iconLabel/iconHoverDelegate.d.ts +22 -15
- package/vscode/src/vs/base/browser/ui/menu/menubar.js +4 -3
- package/vscode/src/vs/base/browser/ui/splitview/paneview.css.js +1 -1
- package/vscode/src/vs/base/browser/ui/splitview/paneview.d.ts +3 -0
- package/vscode/src/vs/base/browser/ui/splitview/paneview.js +34 -11
- package/vscode/src/vs/base/common/actions.d.ts +1 -15
- package/vscode/src/vs/base/common/async.d.ts +1 -31
- package/vscode/src/vs/base/common/event.d.ts +2 -1
- package/vscode/src/vs/base/common/observableInternal/base.d.ts +23 -10
- package/vscode/src/vs/base/common/prefixTree.js +21 -11
- package/vscode/src/vs/base/common/product.d.ts +16 -2
- package/vscode/src/vs/base/common/resourceTree.js +135 -0
- package/vscode/src/vs/base/common/skipList.js +1 -0
- package/vscode/src/vs/base/common/tfIdf.js +137 -0
- package/vscode/src/vs/base/common/types.d.ts +13 -1
- package/vscode/src/vs/base/common/verifier.js +62 -0
- package/vscode/src/vs/editor/browser/editorBrowser.d.ts +4 -2
- package/vscode/src/vs/editor/common/config/editorOptions.d.ts +23 -4
- package/vscode/src/vs/editor/common/core/lineRange.d.ts +1 -0
- package/vscode/src/vs/editor/common/core/offsetRange.d.ts +3 -0
- package/vscode/src/vs/editor/common/core/position.d.ts +1 -0
- package/vscode/src/vs/editor/common/editorCommon.d.ts +2 -1
- package/vscode/src/vs/editor/common/languages.d.ts +23 -1
- package/vscode/src/vs/editor/common/services/languageFeatures.d.ts +2 -1
- package/vscode/src/vs/editor/common/services/resolverService.d.ts +11 -2
- package/vscode/src/vs/platform/accessibility/common/accessibility.d.ts +16 -1
- package/vscode/src/vs/platform/action/common/action.d.ts +8 -0
- package/vscode/src/vs/platform/actions/browser/dropdownWithPrimaryActionViewItem.js +4 -0
- package/vscode/src/vs/platform/actions/common/actions.d.ts +8 -0
- package/vscode/src/vs/platform/audioCues/browser/audioCueService.d.ts +6 -0
- package/vscode/src/vs/platform/commands/common/commands.d.ts +13 -5
- package/vscode/src/vs/platform/dialogs/common/dialogs.d.ts +9 -3
- package/vscode/src/vs/platform/dialogs/common/dialogs.js +5 -2
- package/vscode/src/vs/platform/editor/common/editor.d.ts +3 -15
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.d.ts +1 -0
- package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +3 -15
- package/vscode/src/vs/platform/extensionManagement/common/implicitActivationEvents.js +5 -0
- package/vscode/src/vs/platform/extensions/common/extensions.d.ts +0 -1
- package/vscode/src/vs/platform/files/common/files.d.ts +72 -8
- package/vscode/src/vs/platform/files/common/watcher.js +77 -0
- package/vscode/src/vs/platform/keybinding/common/keybindingsRegistry.d.ts +2 -2
- package/vscode/src/vs/platform/layout/browser/layoutService.d.ts +52 -21
- package/vscode/src/vs/platform/request/browser/requestService.js +3 -0
- package/vscode/src/vs/platform/request/common/requestIpc.js +17 -0
- package/vscode/src/vs/platform/storage/common/storage.js +2 -2
- package/vscode/src/vs/platform/telemetry/common/telemetry.d.ts +1 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/capabilities.d.ts +12 -7
- package/vscode/src/vs/platform/terminal/common/capabilities/{commandDetectionCapability.d.ts → commandDetection/terminalCommand.d.ts} +3 -2
- package/vscode/src/vs/platform/terminal/common/capabilities/commandDetection/terminalCommand.js +257 -0
- package/vscode/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +439 -354
- package/vscode/src/vs/platform/window/common/window.d.ts +9 -2
- package/vscode/src/vs/platform/window/common/window.js +6 -1
- package/vscode/src/vs/platform/workspaces/common/workspaces.d.ts +2 -43
- package/vscode/src/vs/workbench/api/common/extHost.api.impl.js +113 -81
- package/vscode/src/vs/workbench/api/common/extHost.protocol.js +5 -4
- package/vscode/src/vs/workbench/api/common/extHostApiCommands.js +25 -3
- package/vscode/src/vs/workbench/api/common/extHostChat.js +13 -163
- package/vscode/src/vs/workbench/api/common/extHostChatAgents2.js +412 -0
- package/vscode/src/vs/workbench/api/common/extHostChatProvider.js +79 -11
- package/vscode/src/vs/workbench/api/common/extHostCommands.js +13 -12
- package/vscode/src/vs/workbench/api/common/extHostComments.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostEditorTabs.js +8 -6
- package/vscode/src/vs/workbench/api/common/extHostExtensionService.js +1 -1
- package/vscode/src/vs/workbench/api/common/extHostFileSystemEventService.js +36 -19
- package/vscode/src/vs/workbench/api/common/extHostInlineChat.js +52 -31
- package/vscode/src/vs/workbench/api/common/extHostIssueReporter.js +38 -0
- package/vscode/src/vs/workbench/api/common/extHostLanguageFeatures.js +28 -3
- package/vscode/src/vs/workbench/api/common/extHostLanguages.js +10 -0
- package/vscode/src/vs/workbench/api/common/extHostNotebook.js +117 -2
- package/vscode/src/vs/workbench/api/common/extHostNotebookKernels.js +32 -4
- package/vscode/src/vs/workbench/api/common/extHostSCM.js +85 -23
- package/vscode/src/vs/workbench/api/common/extHostSearch.js +3 -0
- package/vscode/src/vs/workbench/api/common/extHostSpeech.js +42 -0
- package/vscode/src/vs/workbench/api/common/extHostTask.js +2 -1
- package/vscode/src/vs/workbench/api/common/extHostTelemetry.js +1 -0
- package/vscode/src/vs/workbench/api/common/extHostTerminalService.js +3 -3
- package/vscode/src/vs/workbench/api/common/extHostTesting.js +97 -47
- package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +115 -16
- package/vscode/src/vs/workbench/api/common/extHostTypes.js +66 -36
- package/vscode/src/vs/workbench/api/common/extHostWorkspace.js +6 -1
- package/vscode/src/vs/workbench/browser/actions/layoutActions.js +182 -75
- package/vscode/src/vs/workbench/browser/actions/windowActions.js +176 -4
- package/vscode/src/vs/workbench/browser/actions/workspaceActions.js +143 -2
- package/vscode/src/vs/workbench/browser/actions/workspaceCommands.js +237 -0
- package/vscode/src/vs/workbench/browser/composite.d.ts +0 -4
- package/vscode/src/vs/workbench/browser/composite.js +5 -4
- package/vscode/src/vs/workbench/browser/dnd.js +72 -23
- package/vscode/src/vs/workbench/browser/labels.js +7 -3
- package/vscode/src/vs/workbench/browser/media/part.css.js +1 -1
- package/vscode/src/vs/workbench/browser/panecomposite.d.ts +2 -2
- package/vscode/src/vs/workbench/browser/panecomposite.js +2 -0
- package/vscode/src/vs/workbench/browser/part.js +33 -2
- package/vscode/src/vs/workbench/browser/parts/compositeBarActions.js +99 -117
- package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +173 -33
- package/vscode/src/vs/workbench/browser/parts/editor/editor.js +102 -6
- package/vscode/src/vs/workbench/browser/parts/editor/editorActions.js +256 -17
- package/vscode/src/vs/workbench/browser/parts/editor/editorAutoSave.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorCommands.js +68 -35
- package/vscode/src/vs/workbench/browser/parts/editor/editorPlaceholder.js +5 -5
- package/vscode/src/vs/workbench/browser/parts/editor/editorStatus.js +35 -16
- package/vscode/src/vs/workbench/browser/parts/editor/editorTabsControl.js +348 -0
- package/vscode/src/vs/workbench/browser/parts/editor/editorsObserver.js +43 -31
- package/vscode/src/vs/workbench/browser/parts/editor/media/editortabscontrol.css.js +4 -0
- package/vscode/src/vs/workbench/browser/parts/editor/sideBySideEditor.js +1 -0
- package/vscode/src/vs/workbench/browser/parts/editor/textCodeEditor.js +1 -0
- package/vscode/src/vs/workbench/browser/parts/editor/textDiffEditor.js +14 -2
- package/vscode/src/vs/workbench/browser/parts/editor/textEditor.js +4 -4
- package/vscode/src/vs/workbench/browser/parts/globalCompositeBar.js +277 -0
- package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCommands.js +5 -2
- package/vscode/src/vs/workbench/browser/parts/panel/media/panelpart.css.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/panel/panelActions.js +3 -38
- package/vscode/src/vs/workbench/browser/parts/statusbar/statusbarPart.d.ts +54 -52
- package/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.js +2 -1
- package/vscode/src/vs/workbench/browser/parts/titlebar/titlebarPart.d.ts +25 -0
- package/vscode/src/vs/workbench/browser/parts/titlebar/windowTitle.js +258 -0
- package/vscode/src/vs/workbench/browser/parts/views/media/paneviewlet.css.js +1 -1
- package/vscode/src/vs/workbench/browser/parts/views/viewPane.d.ts +2 -5
- package/vscode/src/vs/workbench/browser/parts/views/viewPane.js +157 -117
- package/vscode/src/vs/workbench/browser/parts/views/viewPaneContainer.js +50 -23
- package/vscode/src/vs/workbench/browser/parts/views/viewsService.js +26 -11
- package/vscode/src/vs/workbench/browser/parts/views/viewsViewlet.js +10 -6
- package/vscode/src/vs/workbench/browser/style.js +2 -1
- package/vscode/src/vs/workbench/browser/web.api.d.ts +39 -2
- package/vscode/src/vs/workbench/browser/window.js +55 -0
- package/vscode/src/vs/workbench/browser/workbench.contribution.js +220 -40
- package/vscode/src/vs/workbench/common/activity.js +3 -0
- package/vscode/src/vs/workbench/common/contextkeys.js +35 -5
- package/vscode/src/vs/workbench/common/contributions.js +4 -3
- package/vscode/src/vs/workbench/common/editor/diffEditorInput.js +14 -4
- package/vscode/src/vs/workbench/common/editor/diffEditorModel.js +1 -1
- package/vscode/src/vs/workbench/common/editor/editorGroupModel.js +22 -19
- package/vscode/src/vs/workbench/common/editor/editorInput.d.ts +4 -3
- package/vscode/src/vs/workbench/common/editor/editorModel.d.ts +1 -2
- package/vscode/src/vs/workbench/common/editor/sideBySideEditorInput.js +22 -4
- package/vscode/src/vs/workbench/common/editor/textResourceEditorInput.js +3 -3
- package/vscode/src/vs/workbench/common/editor.d.ts +60 -30
- package/vscode/src/vs/workbench/common/editor.js +11 -3
- package/vscode/src/vs/workbench/common/theme.js +2 -2
- package/vscode/src/vs/workbench/common/views.d.ts +4 -4
- package/vscode/src/vs/workbench/common/views.js +3 -1
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.js +97 -8
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityContributions.js +17 -99
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibleView.js +103 -37
- package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibleViewActions.js +2 -3
- package/vscode/src/vs/workbench/contrib/accessibility/browser/editorAccessibilityHelp.js +127 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +71 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatAgents.js +33 -110
- package/vscode/src/vs/workbench/contrib/chat/common/chatContextKeys.js +64 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatParserTypes.js +94 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatService.js +6 -1
- package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +1 -88
- package/vscode/src/vs/workbench/contrib/codeActions/browser/codeActionsContribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.js +3 -2
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess.js +3 -1
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/saveParticipants.js +15 -16
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.js +9 -3
- package/vscode/src/vs/workbench/contrib/comments/browser/comments.contribution.js +3 -1
- package/vscode/src/vs/workbench/contrib/comments/browser/simpleCommentEditor.js +2 -3
- package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInput.js +1 -0
- package/vscode/src/vs/workbench/contrib/debug/common/debug.d.ts +9 -1
- package/vscode/src/vs/workbench/contrib/debug/common/debug.js +10 -1
- package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.js +114 -22
- package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionActions.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/extensions/common/extensions.js +4 -1
- package/vscode/src/vs/workbench/contrib/files/browser/explorerFileContrib.js +19 -0
- package/vscode/src/vs/workbench/contrib/files/browser/explorerViewlet.js +10 -8
- package/vscode/src/vs/workbench/contrib/files/browser/fileActions.js +62 -10
- package/vscode/src/vs/workbench/contrib/files/browser/fileConstants.js +2 -1
- package/vscode/src/vs/workbench/contrib/files/browser/fileImportExport.js +9 -8
- package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +10 -1
- package/vscode/src/vs/workbench/contrib/files/browser/files.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/files/browser/files.js +7 -3
- package/vscode/src/vs/workbench/contrib/files/browser/views/emptyView.js +4 -4
- package/vscode/src/vs/workbench/contrib/files/browser/views/explorerView.js +64 -36
- package/vscode/src/vs/workbench/contrib/files/browser/views/explorerViewer.js +42 -17
- package/vscode/src/vs/workbench/contrib/files/browser/views/openEditorsView.js +145 -25
- package/vscode/src/vs/workbench/contrib/format/browser/formatActionsMultiple.js +1 -1
- package/vscode/src/vs/workbench/contrib/format/browser/formatModified.js +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +36 -0
- package/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.js +3 -1
- package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +24 -3
- package/vscode/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.js +11 -6
- package/vscode/src/vs/workbench/contrib/scm/common/scm.js +1 -2
- package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/searchNotebookHelpers.js +31 -0
- package/vscode/src/vs/workbench/contrib/search/browser/searchModel.js +61 -41
- package/vscode/src/vs/workbench/contrib/search/{browser/searchNotebookHelpers.js → common/cellSearchModel.js} +4 -63
- package/vscode/src/vs/workbench/contrib/search/common/searchNotebookHelpers.js +40 -0
- package/vscode/src/vs/workbench/contrib/snippets/browser/snippetsFile.js +2 -2
- package/vscode/src/vs/workbench/{services/editor/browser/editorDropService.js → contrib/speech/common/speechService.js} +2 -2
- package/vscode/src/vs/workbench/contrib/terminal/browser/detachedTerminal.js +29 -4
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminal.d.ts +100 -79
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.d.ts +3 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIcon.js +7 -4
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +5 -3
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +143 -41
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.d.ts +17 -11
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +41 -26
- package/vscode/src/vs/workbench/contrib/terminal/browser/xterm-private.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/terminal/common/terminal.d.ts +2 -8
- package/vscode/src/vs/workbench/contrib/terminal/common/terminal.js +2 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testCoverage.js +115 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testCoverageService.js +74 -0
- package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +3 -3
- package/vscode/src/vs/workbench/contrib/testing/common/testTypes.js +64 -1
- package/vscode/src/vs/workbench/contrib/testing/common/testingContextKeys.js +9 -0
- package/vscode/src/vs/workbench/contrib/webview/browser/webviewWindowDragMonitor.js +4 -3
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditor.js +8 -9
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewIconManager.js +5 -2
- package/vscode/src/vs/workbench/services/activity/browser/activityService.d.ts +16 -10
- package/vscode/src/vs/workbench/services/activity/common/activity.d.ts +14 -1
- package/vscode/src/vs/workbench/services/activity/common/activity.js +1 -7
- package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +9 -28
- package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +273 -0
- package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolver.js +1 -0
- package/vscode/src/vs/workbench/services/configurationResolver/common/variableResolver.js +2 -0
- package/vscode/src/vs/workbench/services/decorations/browser/decorationsService.js +2 -3
- package/vscode/src/vs/workbench/services/editor/browser/editorService.d.ts +7 -5
- package/vscode/src/vs/workbench/services/editor/browser/editorService.js +59 -37
- package/vscode/src/vs/workbench/services/editor/common/editorGroupsService.d.ts +193 -94
- package/vscode/src/vs/workbench/services/editor/common/editorGroupsService.js +2 -2
- package/vscode/src/vs/workbench/services/editor/common/editorResolverService.d.ts +8 -2
- package/vscode/src/vs/workbench/services/editor/common/editorService.d.ts +8 -1
- package/vscode/src/vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig.js +62 -16
- package/vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js +5 -3
- package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.d.ts +3 -2
- package/vscode/src/vs/workbench/services/extensions/common/extensionDescriptionRegistry.js +4 -9
- package/vscode/src/vs/workbench/services/extensions/common/{extensionHostManager.d.ts → extensionHostManagers.d.ts} +2 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.d.ts +1 -1
- package/vscode/src/vs/workbench/services/extensions/common/extensions.d.ts +9 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensions.js +22 -0
- package/vscode/src/vs/workbench/services/extensions/common/extensionsApiProposals.js +14 -3
- package/vscode/src/vs/workbench/services/extensions/common/extensionsRegistry.js +9 -0
- package/vscode/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js +3 -3
- package/vscode/src/vs/workbench/services/history/common/history.d.ts +2 -2
- package/vscode/src/vs/workbench/services/host/browser/browserHostService.js +49 -18
- package/vscode/src/vs/workbench/services/host/browser/host.d.ts +29 -7
- package/vscode/src/vs/workbench/services/hover/browser/hover.d.ts +51 -28
- package/vscode/src/vs/workbench/services/hover/browser/hoverService.d.ts +5 -2
- package/vscode/src/vs/workbench/services/keybinding/browser/unboundCommands.js +2 -2
- package/vscode/src/vs/workbench/services/languageStatus/common/languageStatusService.d.ts +4 -1
- package/vscode/src/vs/workbench/services/layout/browser/layoutService.d.ts +40 -36
- package/vscode/src/vs/workbench/services/panecomposite/browser/panecomposite.d.ts +0 -6
- package/vscode/src/vs/workbench/services/preferences/common/preferences.d.ts +3 -0
- package/vscode/src/vs/workbench/services/progress/browser/progressIndicator.js +2 -2
- package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.d.ts +18 -3
- package/vscode/src/vs/workbench/services/request/browser/requestService.js +48 -0
- package/vscode/src/vs/workbench/services/search/common/searchHelpers.js +4 -4
- package/vscode/src/vs/workbench/services/statusbar/browser/statusbar.d.ts +10 -51
- package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidget.js +2 -2
- package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +32 -1
- package/vscode/src/vs/workbench/services/textfile/common/textEditorService.js +1 -5
- package/vscode/src/vs/workbench/services/themes/browser/browserHostColorSchemeService.js +4 -3
- package/vscode/src/vs/workbench/services/themes/common/iconExtensionPoint.js +9 -3
- package/vscode/src/vs/workbench/services/title/browser/titleService.d.ts +18 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorInput.js +18 -3
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorModel.js +16 -7
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorService.d.ts +6 -0
- package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorService.js +13 -0
- package/vscode/src/vs/workbench/services/url/browser/urlService.js +2 -1
- package/vscode/src/vs/workbench/services/userActivity/common/userActivityService.js +2 -2
- package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfileIcons.js +9 -0
- package/vscode-dts/vscode.proposed.chatAgents2.d.ts +375 -0
- package/vscode-dts/vscode.proposed.chatAgents2Additions.d.ts +80 -0
- package/vscode-dts/vscode.proposed.chatProvider.d.ts +5 -1
- package/vscode-dts/vscode.proposed.chatRequestAccess.d.ts +68 -10
- package/vscode-dts/vscode.proposed.chatTab.d.ts +21 -0
- package/vscode-dts/vscode.proposed.chatVariables.d.ts +5 -1
- package/vscode-dts/vscode.proposed.codeActionAI.d.ts +16 -0
- package/vscode-dts/vscode.proposed.contribSourceControlInputBoxMenu.d.ts +7 -0
- package/vscode-dts/vscode.proposed.createFileSystemWatcher.d.ts +51 -0
- package/vscode-dts/vscode.proposed.defaultChatAgent.d.ts +30 -0
- package/vscode-dts/vscode.proposed.handleIssueUri.d.ts +26 -0
- package/vscode-dts/vscode.proposed.interactive.d.ts +26 -100
- package/vscode-dts/vscode.proposed.interactiveUserActions.d.ts +14 -7
- package/vscode-dts/vscode.proposed.languageStatusText.d.ts +12 -0
- package/vscode-dts/vscode.proposed.multiDocumentHighlightProvider.d.ts +63 -0
- package/vscode-dts/vscode.proposed.notebookVariableProvider.d.ts +43 -0
- package/vscode-dts/vscode.proposed.resolvers.d.ts +100 -1
- package/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts +9 -1
- package/vscode-dts/vscode.proposed.scmInputBoxActionButton.d.ts +19 -0
- package/vscode-dts/vscode.proposed.scmInputBoxValueProvider.d.ts +25 -0
- package/vscode-dts/vscode.proposed.speech.d.ts +35 -0
- package/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts +11 -7
- package/vscode-dts/vscode.proposed.testCoverage.d.ts +6 -1
- package/vscode-dts/vscode.proposed.testingActiveProfile.d.ts +21 -0
- package/external/xterm-headless/typings/xterm-headless.d.ts +0 -49
- package/vscode/src/vs/platform/backup/common/backup.d.ts +0 -14
- package/vscode/src/vs/platform/update/common/update.d.ts +0 -112
- package/vscode/src/vs/workbench/api/common/extHostChatAgents.js +0 -62
- package/vscode/src/vs/workbench/api/common/extHostChatSlashCommand.js +0 -62
- package/vscode/src/vs/workbench/browser/parts/paneCompositePart.d.ts +0 -56
- package/vscode/src/vs/workbench/services/files/common/files.js +0 -4
- package/vscode/src/vs/workbench/services/host/browser/browserHostService.d.ts +0 -41
- package/vscode/src/vs/workbench/services/title/common/titleService.d.ts +0 -31
- package/vscode-dts/vscode.proposed.chatAgents.d.ts +0 -39
- package/vscode-dts/vscode.proposed.chatSlashCommands.d.ts +0 -47
- package/vscode-dts/vscode.proposed.testMessageContextValue.d.ts +0 -45
- /package/external/{xterm-addon-canvas/typings/xterm-addon-canvas.d.ts → @xterm/addon-canvas/typings/addon-canvas.d.ts} +0 -0
- /package/external/{xterm-addon-search/typings/xterm-addon-search.d.ts → @xterm/addon-search/typings/addon-search.d.ts} +0 -0
- /package/external/{xterm-addon-unicode11/typings/xterm-addon-unicode11.d.ts → @xterm/addon-unicode11/typings/addon-unicode11.d.ts} +0 -0
- /package/external/{xterm-addon-webgl/typings/xterm-addon-webgl.d.ts → @xterm/addon-webgl/typings/addon-webgl.d.ts} +0 -0
- /package/vscode/src/vs/workbench/services/title/{common → browser}/titleService.js +0 -0
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { __decorate } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import {
|
|
1
|
+
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
+
import { RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
3
3
|
import { debounce } from 'monaco-editor/esm/vs/base/common/decorators.js';
|
|
4
4
|
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
5
|
-
import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
5
|
+
import { Disposable, MandatoryMutableDisposable, MutableDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
6
|
+
import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
|
|
7
|
+
import { PartialTerminalCommand, TerminalCommand } from './commandDetection/terminalCommand.js';
|
|
6
8
|
class CommandDetectionCapability extends Disposable {
|
|
7
9
|
get commands() { return this._commands; }
|
|
8
10
|
get executingCommand() { return this._currentCommand.command; }
|
|
@@ -38,8 +40,7 @@ class CommandDetectionCapability extends Disposable {
|
|
|
38
40
|
this._logService = _logService;
|
|
39
41
|
this.type = 2 ;
|
|
40
42
|
this._commands = [];
|
|
41
|
-
this._currentCommand =
|
|
42
|
-
this._isWindowsPty = false;
|
|
43
|
+
this._currentCommand = ( new PartialTerminalCommand(this._terminal));
|
|
43
44
|
this._commandMarkers = [];
|
|
44
45
|
this.__isCommandStorageDisabled = false;
|
|
45
46
|
this._onCommandStarted = this._register(( new Emitter()));
|
|
@@ -54,18 +55,31 @@ class CommandDetectionCapability extends Disposable {
|
|
|
54
55
|
this.onCommandInvalidated = this._onCommandInvalidated.event;
|
|
55
56
|
this._onCurrentCommandInvalidated = this._register(( new Emitter()));
|
|
56
57
|
this.onCurrentCommandInvalidated = this._onCurrentCommandInvalidated.event;
|
|
58
|
+
const that = this;
|
|
59
|
+
this._ptyHeuristicsHooks = new (class {
|
|
60
|
+
get onCurrentCommandInvalidatedEmitter() { return that._onCurrentCommandInvalidated; }
|
|
61
|
+
get onCommandStartedEmitter() { return that._onCommandStarted; }
|
|
62
|
+
get onCommandExecutedEmitter() { return that._onCommandExecuted; }
|
|
63
|
+
get dimensions() { return that._dimensions; }
|
|
64
|
+
get isCommandStorageDisabled() { return that.__isCommandStorageDisabled; }
|
|
65
|
+
get commandMarkers() { return that._commandMarkers; }
|
|
66
|
+
set commandMarkers(value) { that._commandMarkers = value; }
|
|
67
|
+
get clearCommandsInViewport() { return that._clearCommandsInViewport.bind(that); }
|
|
68
|
+
commitCommandFinished() {
|
|
69
|
+
that._commitCommandFinished?.flush();
|
|
70
|
+
that._commitCommandFinished = undefined;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
this._ptyHeuristics = this._register(( new MandatoryMutableDisposable(( new UnixPtyHeuristics(this._terminal, this, this._ptyHeuristicsHooks, this._logService)))));
|
|
57
74
|
this._dimensions = {
|
|
58
75
|
cols: this._terminal.cols,
|
|
59
76
|
rows: this._terminal.rows
|
|
60
77
|
};
|
|
61
78
|
this._register(this._terminal.onResize(e => this._handleResize(e)));
|
|
62
79
|
this._register(this._terminal.onCursorMove(() => this._handleCursorMove()));
|
|
63
|
-
this._setupClearListeners();
|
|
64
80
|
}
|
|
65
81
|
_handleResize(e) {
|
|
66
|
-
|
|
67
|
-
this._preHandleResizeWindows(e);
|
|
68
|
-
}
|
|
82
|
+
this._ptyHeuristics.value.preHandleResize?.(e);
|
|
69
83
|
this._dimensions.cols = e.cols;
|
|
70
84
|
this._dimensions.rows = e.rows;
|
|
71
85
|
}
|
|
@@ -78,53 +92,6 @@ class CommandDetectionCapability extends Disposable {
|
|
|
78
92
|
}
|
|
79
93
|
}
|
|
80
94
|
}
|
|
81
|
-
_setupClearListeners() {
|
|
82
|
-
this._register(this.onBeforeCommandFinished(command => {
|
|
83
|
-
if (this._isWindowsPty) {
|
|
84
|
-
if (command.command.trim().toLowerCase() === 'clear' || command.command.trim().toLowerCase() === 'cls') {
|
|
85
|
-
this._clearCommandsInViewport();
|
|
86
|
-
this._currentCommand.isInvalid = true;
|
|
87
|
-
this._onCurrentCommandInvalidated.fire({ reason: "windows" });
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}));
|
|
91
|
-
this._terminal.parser.registerCsiHandler({ final: 'J' }, params => {
|
|
92
|
-
if (!this._isWindowsPty) {
|
|
93
|
-
if (params.length >= 1 && (params[0] === 2 || params[0] === 3)) {
|
|
94
|
-
this._clearCommandsInViewport();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
return false;
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
_preHandleResizeWindows(e) {
|
|
101
|
-
const baseY = this._terminal.buffer.active.baseY;
|
|
102
|
-
const rowsDifference = e.rows - this._dimensions.rows;
|
|
103
|
-
if (rowsDifference > 0) {
|
|
104
|
-
this._waitForCursorMove().then(() => {
|
|
105
|
-
const potentialShiftedLineCount = Math.min(rowsDifference, baseY);
|
|
106
|
-
for (let i = this.commands.length - 1; i >= 0; i--) {
|
|
107
|
-
const command = this.commands[i];
|
|
108
|
-
if (!command.marker || command.marker.line < baseY || command.commandStartLineContent === undefined) {
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
const line = this._terminal.buffer.active.getLine(command.marker.line);
|
|
112
|
-
if (!line || line.translateToString(true) === command.commandStartLineContent) {
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
const shiftedY = command.marker.line - potentialShiftedLineCount;
|
|
116
|
-
const shiftedLine = this._terminal.buffer.active.getLine(shiftedY);
|
|
117
|
-
if (shiftedLine?.translateToString(true) !== command.commandStartLineContent) {
|
|
118
|
-
continue;
|
|
119
|
-
}
|
|
120
|
-
this._terminal._core._bufferService.buffer.lines.onDeleteEmitter.fire({
|
|
121
|
-
index: this._terminal.buffer.active.baseY,
|
|
122
|
-
amount: potentialShiftedLineCount
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
95
|
_clearCommandsInViewport() {
|
|
129
96
|
let count = 0;
|
|
130
97
|
for (let i = this._commands.length - 1; i >= 0; i--) {
|
|
@@ -138,43 +105,68 @@ class CommandDetectionCapability extends Disposable {
|
|
|
138
105
|
this._onCommandInvalidated.fire(this._commands.splice(this._commands.length - count, count));
|
|
139
106
|
}
|
|
140
107
|
}
|
|
141
|
-
_waitForCursorMove() {
|
|
142
|
-
const cursorX = this._terminal.buffer.active.cursorX;
|
|
143
|
-
const cursorY = this._terminal.buffer.active.cursorY;
|
|
144
|
-
let totalDelay = 0;
|
|
145
|
-
return ( new Promise((resolve, reject) => {
|
|
146
|
-
const interval = setInterval(() => {
|
|
147
|
-
if (cursorX !== this._terminal.buffer.active.cursorX || cursorY !== this._terminal.buffer.active.cursorY) {
|
|
148
|
-
resolve();
|
|
149
|
-
clearInterval(interval);
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
totalDelay += 10;
|
|
153
|
-
if (totalDelay > 1000) {
|
|
154
|
-
clearInterval(interval);
|
|
155
|
-
resolve();
|
|
156
|
-
}
|
|
157
|
-
}, 10);
|
|
158
|
-
}));
|
|
159
|
-
}
|
|
160
108
|
setCwd(value) {
|
|
161
109
|
this._cwd = value;
|
|
162
110
|
}
|
|
163
111
|
setIsWindowsPty(value) {
|
|
164
|
-
this.
|
|
112
|
+
if (value && !(this._ptyHeuristics.value instanceof WindowsPtyHeuristics)) {
|
|
113
|
+
const that = this;
|
|
114
|
+
this._ptyHeuristics.value = ( new WindowsPtyHeuristics(this._terminal, this, new (class {
|
|
115
|
+
get onCurrentCommandInvalidatedEmitter() { return that._onCurrentCommandInvalidated; }
|
|
116
|
+
get onCommandStartedEmitter() { return that._onCommandStarted; }
|
|
117
|
+
get onCommandExecutedEmitter() { return that._onCommandExecuted; }
|
|
118
|
+
get dimensions() { return that._dimensions; }
|
|
119
|
+
get isCommandStorageDisabled() { return that.__isCommandStorageDisabled; }
|
|
120
|
+
get commandMarkers() { return that._commandMarkers; }
|
|
121
|
+
set commandMarkers(value) { that._commandMarkers = value; }
|
|
122
|
+
get clearCommandsInViewport() { return that._clearCommandsInViewport.bind(that); }
|
|
123
|
+
commitCommandFinished() {
|
|
124
|
+
that._commitCommandFinished?.flush();
|
|
125
|
+
that._commitCommandFinished = undefined;
|
|
126
|
+
}
|
|
127
|
+
}), this._logService));
|
|
128
|
+
}
|
|
129
|
+
else if (!value && !(this._ptyHeuristics.value instanceof UnixPtyHeuristics)) {
|
|
130
|
+
this._ptyHeuristics.value = ( new UnixPtyHeuristics(this._terminal, this, this._ptyHeuristicsHooks, this._logService));
|
|
131
|
+
}
|
|
165
132
|
}
|
|
166
133
|
setIsCommandStorageDisabled() {
|
|
167
134
|
this.__isCommandStorageDisabled = true;
|
|
168
135
|
}
|
|
136
|
+
getCommandForLine(line) {
|
|
137
|
+
if (this._currentCommand.promptStartMarker && line >= this._currentCommand.promptStartMarker?.line) {
|
|
138
|
+
return this._currentCommand;
|
|
139
|
+
}
|
|
140
|
+
if (this._commands.length === 0) {
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
if ((this._commands[0].promptStartMarker ?? this._commands[0].marker).line > line) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
for (let i = this.commands.length - 1; i >= 0; i--) {
|
|
147
|
+
if ((this.commands[i].promptStartMarker ?? this.commands[i].marker).line <= line) {
|
|
148
|
+
return this.commands[i];
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
169
153
|
getCwdForLine(line) {
|
|
170
154
|
if (this._currentCommand.promptStartMarker && line >= this._currentCommand.promptStartMarker?.line) {
|
|
171
155
|
return this._cwd;
|
|
172
156
|
}
|
|
173
|
-
const
|
|
174
|
-
|
|
157
|
+
const command = this.getCommandForLine(line);
|
|
158
|
+
if (command && 'cwd' in command) {
|
|
159
|
+
return command.cwd;
|
|
160
|
+
}
|
|
161
|
+
return undefined;
|
|
175
162
|
}
|
|
176
163
|
handlePromptStart(options) {
|
|
177
|
-
|
|
164
|
+
const lastCommand = this.commands.at(-1);
|
|
165
|
+
if (lastCommand?.endMarker && lastCommand?.executedMarker && lastCommand.endMarker.line === lastCommand.executedMarker.line) {
|
|
166
|
+
this._logService.debug('CommandDetectionCapability#handlePromptStart adjusted commandFinished', `${lastCommand.endMarker.line} -> ${lastCommand.executedMarker.line + 1}`);
|
|
167
|
+
lastCommand.endMarker = cloneMarker(this._terminal, lastCommand.executedMarker, 1);
|
|
168
|
+
}
|
|
169
|
+
this._currentCommand.promptStartMarker = options?.marker || (lastCommand?.endMarker ? cloneMarker(this._terminal, lastCommand.endMarker) : this._terminal.registerMarker(0));
|
|
178
170
|
this._logService.debug('CommandDetectionCapability#handlePromptStart', this._terminal.buffer.active.cursorX, this._currentCommand.promptStartMarker?.line);
|
|
179
171
|
}
|
|
180
172
|
handleContinuationStart() {
|
|
@@ -212,46 +204,7 @@ class CommandDetectionCapability extends Disposable {
|
|
|
212
204
|
this._logService.debug('CommandDetectionCapability#handleCommandStart', this._currentCommand.commandStartX, this._currentCommand.commandStartMarker?.line);
|
|
213
205
|
return;
|
|
214
206
|
}
|
|
215
|
-
|
|
216
|
-
this._handleCommandStartWindows();
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
|
-
this._currentCommand.commandStartX = this._terminal.buffer.active.cursorX;
|
|
220
|
-
this._currentCommand.commandStartMarker = options?.marker || this._terminal.registerMarker(0);
|
|
221
|
-
this._currentCommand.commandExecutedMarker?.dispose();
|
|
222
|
-
this._currentCommand.commandExecutedMarker = undefined;
|
|
223
|
-
this._currentCommand.commandExecutedX = undefined;
|
|
224
|
-
for (const m of this._commandMarkers) {
|
|
225
|
-
m.dispose();
|
|
226
|
-
}
|
|
227
|
-
this._commandMarkers.length = 0;
|
|
228
|
-
this._onCommandStarted.fire({ marker: options?.marker || this._currentCommand.commandStartMarker, markProperties: options?.markProperties });
|
|
229
|
-
this._logService.debug('CommandDetectionCapability#handleCommandStart', this._currentCommand.commandStartX, this._currentCommand.commandStartMarker?.line);
|
|
230
|
-
}
|
|
231
|
-
_handleCommandStartWindows() {
|
|
232
|
-
this._currentCommand.commandStartX = this._terminal.buffer.active.cursorX;
|
|
233
|
-
this._commandMarkers.length = 0;
|
|
234
|
-
timeout(0).then(() => {
|
|
235
|
-
if (!this._currentCommand.commandExecutedMarker) {
|
|
236
|
-
this._onCursorMoveListener = this._terminal.onCursorMove(() => {
|
|
237
|
-
if (this._commandMarkers.length === 0 || this._commandMarkers[this._commandMarkers.length - 1].line !== this._terminal.buffer.active.cursorY) {
|
|
238
|
-
const marker = this._terminal.registerMarker(0);
|
|
239
|
-
if (marker) {
|
|
240
|
-
this._commandMarkers.push(marker);
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
}
|
|
245
|
-
this._currentCommand.commandStartMarker = this._terminal.registerMarker(0);
|
|
246
|
-
if (this._currentCommand.commandStartMarker) {
|
|
247
|
-
const line = this._terminal.buffer.active.getLine(this._currentCommand.commandStartMarker.line);
|
|
248
|
-
if (line) {
|
|
249
|
-
this._currentCommand.commandStartLineContent = line.translateToString(true);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
this._onCommandStarted.fire({ marker: this._currentCommand.commandStartMarker });
|
|
253
|
-
this._logService.debug('CommandDetectionCapability#_handleCommandStartWindows', this._currentCommand.commandStartX, this._currentCommand.commandStartMarker?.line);
|
|
254
|
-
});
|
|
207
|
+
this._ptyHeuristics.value.handleCommandStart(options);
|
|
255
208
|
}
|
|
256
209
|
handleGenericCommand(options) {
|
|
257
210
|
if (options?.markProperties?.disableCommandStorage) {
|
|
@@ -263,165 +216,50 @@ class CommandDetectionCapability extends Disposable {
|
|
|
263
216
|
this.handleCommandFinished(undefined, options);
|
|
264
217
|
}
|
|
265
218
|
handleCommandExecuted(options) {
|
|
266
|
-
|
|
267
|
-
this._handleCommandExecutedWindows();
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
this._currentCommand.commandExecutedMarker = options?.marker || this._terminal.registerMarker(0);
|
|
271
|
-
this._currentCommand.commandExecutedX = this._terminal.buffer.active.cursorX;
|
|
272
|
-
this._logService.debug('CommandDetectionCapability#handleCommandExecuted', this._currentCommand.commandExecutedX, this._currentCommand.commandExecutedMarker?.line);
|
|
273
|
-
if (!this._currentCommand.commandStartMarker || !this._currentCommand.commandExecutedMarker || this._currentCommand.commandStartX === undefined) {
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
this._currentCommand.command = this.__isCommandStorageDisabled ? '' : this._terminal.buffer.active.getLine(this._currentCommand.commandStartMarker.line)?.translateToString(true, this._currentCommand.commandStartX, this._currentCommand.commandRightPromptStartX).trim();
|
|
277
|
-
let y = this._currentCommand.commandStartMarker.line + 1;
|
|
278
|
-
const commandExecutedLine = this._currentCommand.commandExecutedMarker.line;
|
|
279
|
-
for (; y < commandExecutedLine; y++) {
|
|
280
|
-
const line = this._terminal.buffer.active.getLine(y);
|
|
281
|
-
if (line) {
|
|
282
|
-
const continuation = this._currentCommand.continuations?.find(e => e.marker.line === y);
|
|
283
|
-
if (continuation) {
|
|
284
|
-
this._currentCommand.command += '\n';
|
|
285
|
-
}
|
|
286
|
-
const startColumn = continuation?.end ?? 0;
|
|
287
|
-
this._currentCommand.command += line.translateToString(true, startColumn);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
if (y === commandExecutedLine) {
|
|
291
|
-
this._currentCommand.command += this._terminal.buffer.active.getLine(commandExecutedLine)?.translateToString(true, undefined, this._currentCommand.commandExecutedX) || '';
|
|
292
|
-
}
|
|
293
|
-
this._onCommandExecuted.fire();
|
|
294
|
-
}
|
|
295
|
-
_handleCommandExecutedWindows() {
|
|
296
|
-
this._onCursorMoveListener?.dispose();
|
|
297
|
-
this._onCursorMoveListener = undefined;
|
|
298
|
-
this._evaluateCommandMarkersWindows();
|
|
299
|
-
this._currentCommand.commandExecutedX = this._terminal.buffer.active.cursorX;
|
|
300
|
-
this._onCommandExecuted.fire();
|
|
301
|
-
this._logService.debug('CommandDetectionCapability#handleCommandExecuted', this._currentCommand.commandExecutedX, this._currentCommand.commandExecutedMarker?.line);
|
|
302
|
-
}
|
|
303
|
-
invalidateCurrentCommand(request) {
|
|
304
|
-
this._currentCommand.isInvalid = true;
|
|
305
|
-
this._onCurrentCommandInvalidated.fire(request);
|
|
219
|
+
this._ptyHeuristics.value.handleCommandExecuted(options);
|
|
306
220
|
}
|
|
307
221
|
handleCommandFinished(exitCode, options) {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
this._currentCommand.commandFinishedMarker = options?.marker || this._terminal.registerMarker(0);
|
|
312
|
-
let command = this._currentCommand.command;
|
|
313
|
-
this._logService.debug('CommandDetectionCapability#handleCommandFinished', this._terminal.buffer.active.cursorX, this._currentCommand.commandFinishedMarker?.line, this._currentCommand.command, this._currentCommand);
|
|
314
|
-
this._exitCode = exitCode;
|
|
315
|
-
if (this._exitCode === undefined) {
|
|
222
|
+
this._ptyHeuristics.value.preHandleCommandFinished?.();
|
|
223
|
+
this._logService.debug('CommandDetectionCapability#handleCommandFinished', this._terminal.buffer.active.cursorX, options?.marker?.line, this._currentCommand.command, this._currentCommand);
|
|
224
|
+
if (exitCode === undefined) {
|
|
316
225
|
const lastCommand = this.commands.length > 0 ? this.commands[this.commands.length - 1] : undefined;
|
|
317
|
-
if (command && command.length > 0 && lastCommand?.command === command) {
|
|
318
|
-
|
|
226
|
+
if (this._currentCommand.command && this._currentCommand.command.length > 0 && lastCommand?.command === this._currentCommand.command) {
|
|
227
|
+
exitCode = lastCommand.exitCode;
|
|
319
228
|
}
|
|
320
229
|
}
|
|
321
230
|
if (this._currentCommand.commandStartMarker === undefined || !this._terminal.buffer.active) {
|
|
322
231
|
return;
|
|
323
232
|
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
if (
|
|
328
|
-
const buffer = this._terminal.buffer.active;
|
|
329
|
-
const timestamp = Date.now();
|
|
330
|
-
const executedMarker = this._currentCommand.commandExecutedMarker;
|
|
331
|
-
const endMarker = this._currentCommand.commandFinishedMarker;
|
|
332
|
-
const newCommand = {
|
|
333
|
-
command: this._handleCommandStartOptions?.ignoreCommandLine ? '' : (command || ''),
|
|
334
|
-
isTrusted: !!this._currentCommand.isTrusted,
|
|
335
|
-
marker: this._currentCommand.commandStartMarker,
|
|
336
|
-
endMarker,
|
|
337
|
-
executedMarker,
|
|
338
|
-
timestamp,
|
|
339
|
-
cwd: this._cwd,
|
|
340
|
-
exitCode: this._exitCode,
|
|
341
|
-
commandStartLineContent: this._currentCommand.commandStartLineContent,
|
|
342
|
-
hasOutput: () => !executedMarker?.isDisposed && !endMarker?.isDisposed && !!(executedMarker && endMarker && executedMarker?.line < endMarker.line),
|
|
343
|
-
getOutput: () => getOutputForCommand(executedMarker, endMarker, buffer),
|
|
344
|
-
getOutputMatch: (outputMatcher) => getOutputMatchForCommand(this._isWindowsPty && (executedMarker?.line === endMarker?.line) ? this._currentCommand.commandStartMarker : executedMarker, endMarker, buffer, this._terminal.cols, outputMatcher),
|
|
345
|
-
markProperties: options?.markProperties
|
|
346
|
-
};
|
|
233
|
+
this._currentCommand.commandFinishedMarker = options?.marker || this._terminal.registerMarker(0);
|
|
234
|
+
this._ptyHeuristics.value.postHandleCommandFinished?.();
|
|
235
|
+
const newCommand = this._currentCommand.promoteToFullCommand(this._cwd, exitCode, this._handleCommandStartOptions?.ignoreCommandLine ?? false, options?.markProperties);
|
|
236
|
+
if (newCommand) {
|
|
347
237
|
this._commands.push(newCommand);
|
|
348
|
-
this.
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
238
|
+
this._commitCommandFinished = ( new RunOnceScheduler(() => {
|
|
239
|
+
this._onBeforeCommandFinished.fire(newCommand);
|
|
240
|
+
if (!this._currentCommand.isInvalid) {
|
|
241
|
+
this._logService.debug('CommandDetectionCapability#onCommandFinished', newCommand);
|
|
242
|
+
this._onCommandFinished.fire(newCommand);
|
|
243
|
+
}
|
|
244
|
+
}, 50));
|
|
245
|
+
this._commitCommandFinished.schedule();
|
|
353
246
|
}
|
|
354
|
-
this._currentCommand
|
|
355
|
-
this._currentCommand = {};
|
|
247
|
+
this._currentCommand = ( new PartialTerminalCommand(this._terminal));
|
|
356
248
|
this._handleCommandStartOptions = undefined;
|
|
357
249
|
}
|
|
358
|
-
_preHandleCommandFinishedWindows() {
|
|
359
|
-
if (this._currentCommand.commandExecutedMarker) {
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
if (this._commandMarkers.length === 0) {
|
|
363
|
-
if (!this._currentCommand.commandStartMarker) {
|
|
364
|
-
this._currentCommand.commandStartMarker = this._terminal.registerMarker(0);
|
|
365
|
-
}
|
|
366
|
-
if (this._currentCommand.commandStartMarker) {
|
|
367
|
-
this._commandMarkers.push(this._currentCommand.commandStartMarker);
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
this._evaluateCommandMarkersWindows();
|
|
371
|
-
}
|
|
372
|
-
_evaluateCommandMarkersWindows() {
|
|
373
|
-
if (this._commandMarkers.length === 0) {
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
this._commandMarkers = this._commandMarkers.sort((a, b) => a.line - b.line);
|
|
377
|
-
this._currentCommand.commandStartMarker = this._commandMarkers[0];
|
|
378
|
-
if (this._currentCommand.commandStartMarker) {
|
|
379
|
-
const line = this._terminal.buffer.active.getLine(this._currentCommand.commandStartMarker.line);
|
|
380
|
-
if (line) {
|
|
381
|
-
this._currentCommand.commandStartLineContent = line.translateToString(true);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
this._currentCommand.commandExecutedMarker = this._commandMarkers[this._commandMarkers.length - 1];
|
|
385
|
-
}
|
|
386
250
|
setCommandLine(commandLine, isTrusted) {
|
|
387
251
|
this._logService.debug('CommandDetectionCapability#setCommandLine', commandLine, isTrusted);
|
|
388
252
|
this._currentCommand.command = commandLine;
|
|
389
253
|
this._currentCommand.isTrusted = isTrusted;
|
|
390
254
|
}
|
|
391
255
|
serialize() {
|
|
392
|
-
const commands = ( this.commands.map(e =>
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
endLine: e.endMarker?.line,
|
|
397
|
-
executedLine: e.executedMarker?.line,
|
|
398
|
-
command: this.__isCommandStorageDisabled ? '' : e.command,
|
|
399
|
-
isTrusted: e.isTrusted,
|
|
400
|
-
cwd: e.cwd,
|
|
401
|
-
exitCode: e.exitCode,
|
|
402
|
-
commandStartLineContent: e.commandStartLineContent,
|
|
403
|
-
timestamp: e.timestamp,
|
|
404
|
-
markProperties: e.markProperties,
|
|
405
|
-
aliases: e.aliases
|
|
406
|
-
};
|
|
407
|
-
}));
|
|
408
|
-
if (this._currentCommand.commandStartMarker) {
|
|
409
|
-
commands.push({
|
|
410
|
-
startLine: this._currentCommand.commandStartMarker.line,
|
|
411
|
-
startX: this._currentCommand.commandStartX,
|
|
412
|
-
endLine: undefined,
|
|
413
|
-
executedLine: undefined,
|
|
414
|
-
command: '',
|
|
415
|
-
isTrusted: true,
|
|
416
|
-
cwd: this._cwd,
|
|
417
|
-
exitCode: undefined,
|
|
418
|
-
commandStartLineContent: undefined,
|
|
419
|
-
timestamp: 0,
|
|
420
|
-
markProperties: undefined
|
|
421
|
-
});
|
|
256
|
+
const commands = ( this.commands.map(e => e.serialize(this.__isCommandStorageDisabled)));
|
|
257
|
+
const partialCommand = this._currentCommand.serialize(this._cwd);
|
|
258
|
+
if (partialCommand) {
|
|
259
|
+
commands.push(partialCommand);
|
|
422
260
|
}
|
|
423
261
|
return {
|
|
424
|
-
isWindowsPty: this.
|
|
262
|
+
isWindowsPty: this._ptyHeuristics.value instanceof WindowsPtyHeuristics,
|
|
425
263
|
commands
|
|
426
264
|
};
|
|
427
265
|
}
|
|
@@ -431,35 +269,22 @@ class CommandDetectionCapability extends Disposable {
|
|
|
431
269
|
}
|
|
432
270
|
const buffer = this._terminal.buffer.normal;
|
|
433
271
|
for (const e of serialized.commands) {
|
|
434
|
-
const marker = e.startLine !== undefined ? this._terminal.registerMarker(e.startLine - (buffer.baseY + buffer.cursorY)) : undefined;
|
|
435
|
-
if (!marker) {
|
|
436
|
-
continue;
|
|
437
|
-
}
|
|
438
272
|
if (!e.endLine) {
|
|
439
|
-
this.
|
|
273
|
+
const marker = e.startLine !== undefined ? this._terminal.registerMarker(e.startLine - (buffer.baseY + buffer.cursorY)) : undefined;
|
|
274
|
+
if (!marker) {
|
|
275
|
+
continue;
|
|
276
|
+
}
|
|
277
|
+
this._currentCommand.commandStartMarker = e.startLine !== undefined ? this._terminal.registerMarker(e.startLine - (buffer.baseY + buffer.cursorY)) : undefined;
|
|
440
278
|
this._currentCommand.commandStartX = e.startX;
|
|
279
|
+
this._currentCommand.promptStartMarker = e.promptStartLine !== undefined ? this._terminal.registerMarker(e.promptStartLine - (buffer.baseY + buffer.cursorY)) : undefined;
|
|
441
280
|
this._cwd = e.cwd;
|
|
442
281
|
this._onCommandStarted.fire({ marker });
|
|
443
282
|
continue;
|
|
444
283
|
}
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
isTrusted: e.isTrusted,
|
|
450
|
-
marker,
|
|
451
|
-
endMarker,
|
|
452
|
-
executedMarker,
|
|
453
|
-
timestamp: e.timestamp,
|
|
454
|
-
cwd: e.cwd,
|
|
455
|
-
commandStartLineContent: e.commandStartLineContent,
|
|
456
|
-
exitCode: e.exitCode,
|
|
457
|
-
hasOutput: () => !executedMarker?.isDisposed && !endMarker?.isDisposed && !!(executedMarker && endMarker && executedMarker.line < endMarker.line),
|
|
458
|
-
getOutput: () => getOutputForCommand(executedMarker, endMarker, buffer),
|
|
459
|
-
getOutputMatch: (outputMatcher) => getOutputMatchForCommand(this._isWindowsPty && (executedMarker?.line === endMarker?.line) ? marker : executedMarker, endMarker, buffer, this._terminal.cols, outputMatcher),
|
|
460
|
-
markProperties: e.markProperties,
|
|
461
|
-
wasReplayed: true
|
|
462
|
-
};
|
|
284
|
+
const newCommand = TerminalCommand.deserialize(this._terminal, e, this.__isCommandStorageDisabled);
|
|
285
|
+
if (!newCommand) {
|
|
286
|
+
continue;
|
|
287
|
+
}
|
|
463
288
|
this._commands.push(newCommand);
|
|
464
289
|
this._logService.debug('CommandDetectionCapability#onCommandFinished', newCommand);
|
|
465
290
|
this._onCommandFinished.fire(newCommand);
|
|
@@ -469,98 +294,358 @@ class CommandDetectionCapability extends Disposable {
|
|
|
469
294
|
CommandDetectionCapability.__decorator = ( __decorate([
|
|
470
295
|
debounce(500)
|
|
471
296
|
], CommandDetectionCapability.prototype, "_handleCursorMove", null));
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
297
|
+
class UnixPtyHeuristics extends Disposable {
|
|
298
|
+
constructor(_terminal, _capability, _hooks, _logService) {
|
|
299
|
+
super();
|
|
300
|
+
this._terminal = _terminal;
|
|
301
|
+
this._capability = _capability;
|
|
302
|
+
this._hooks = _hooks;
|
|
303
|
+
this._logService = _logService;
|
|
304
|
+
this._register(_terminal.parser.registerCsiHandler({ final: 'J' }, params => {
|
|
305
|
+
if (params.length >= 1 && (params[0] === 2 || params[0] === 3)) {
|
|
306
|
+
_hooks.clearCommandsInViewport();
|
|
307
|
+
}
|
|
308
|
+
return false;
|
|
309
|
+
}));
|
|
475
310
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
311
|
+
async handleCommandStart(options) {
|
|
312
|
+
this._hooks.commitCommandFinished();
|
|
313
|
+
const currentCommand = this._capability.currentCommand;
|
|
314
|
+
currentCommand.commandStartX = this._terminal.buffer.active.cursorX;
|
|
315
|
+
currentCommand.commandStartMarker = options?.marker || this._terminal.registerMarker(0);
|
|
316
|
+
currentCommand.commandExecutedMarker?.dispose();
|
|
317
|
+
currentCommand.commandExecutedMarker = undefined;
|
|
318
|
+
currentCommand.commandExecutedX = undefined;
|
|
319
|
+
for (const m of this._hooks.commandMarkers) {
|
|
320
|
+
m.dispose();
|
|
321
|
+
}
|
|
322
|
+
this._hooks.commandMarkers.length = 0;
|
|
323
|
+
this._hooks.onCommandStartedEmitter.fire({ marker: options?.marker || currentCommand.commandStartMarker, markProperties: options?.markProperties });
|
|
324
|
+
this._logService.debug('CommandDetectionCapability#handleCommandStart', currentCommand.commandStartX, currentCommand.commandStartMarker?.line);
|
|
480
325
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
326
|
+
handleCommandExecuted(options) {
|
|
327
|
+
const currentCommand = this._capability.currentCommand;
|
|
328
|
+
currentCommand.commandExecutedMarker = options?.marker || this._terminal.registerMarker(0);
|
|
329
|
+
currentCommand.commandExecutedX = this._terminal.buffer.active.cursorX;
|
|
330
|
+
this._logService.debug('CommandDetectionCapability#handleCommandExecuted', currentCommand.commandExecutedX, currentCommand.commandExecutedMarker?.line);
|
|
331
|
+
if (!currentCommand.commandStartMarker || !currentCommand.commandExecutedMarker || currentCommand.commandStartX === undefined) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
currentCommand.command = this._hooks.isCommandStorageDisabled ? '' : this._terminal.buffer.active.getLine(currentCommand.commandStartMarker.line)?.translateToString(true, currentCommand.commandStartX, currentCommand.commandRightPromptStartX).trim();
|
|
335
|
+
let y = currentCommand.commandStartMarker.line + 1;
|
|
336
|
+
const commandExecutedLine = currentCommand.commandExecutedMarker.line;
|
|
337
|
+
for (; y < commandExecutedLine; y++) {
|
|
338
|
+
const line = this._terminal.buffer.active.getLine(y);
|
|
339
|
+
if (line) {
|
|
340
|
+
const continuation = currentCommand.continuations?.find(e => e.marker.line === y);
|
|
341
|
+
if (continuation) {
|
|
342
|
+
currentCommand.command += '\n';
|
|
343
|
+
}
|
|
344
|
+
const startColumn = continuation?.end ?? 0;
|
|
345
|
+
currentCommand.command += line.translateToString(true, startColumn);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (y === commandExecutedLine) {
|
|
349
|
+
currentCommand.command += this._terminal.buffer.active.getLine(commandExecutedLine)?.translateToString(true, undefined, currentCommand.commandExecutedX) || '';
|
|
487
350
|
}
|
|
488
|
-
|
|
351
|
+
this._hooks.onCommandExecutedEmitter.fire();
|
|
489
352
|
}
|
|
490
|
-
return output === '' ? undefined : output;
|
|
491
353
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
354
|
+
let WindowsPtyHeuristics = class WindowsPtyHeuristics extends Disposable {
|
|
355
|
+
constructor(_terminal, _capability, _hooks, _logService) {
|
|
356
|
+
super();
|
|
357
|
+
this._terminal = _terminal;
|
|
358
|
+
this._capability = _capability;
|
|
359
|
+
this._hooks = _hooks;
|
|
360
|
+
this._logService = _logService;
|
|
361
|
+
this._onCursorMoveListener = this._register(( new MutableDisposable()));
|
|
362
|
+
this._recentlyPerformedCsiJ = false;
|
|
363
|
+
this._tryAdjustCommandStartMarkerScannedLineCount = 0;
|
|
364
|
+
this._tryAdjustCommandStartMarkerPollCount = 0;
|
|
365
|
+
this._register(_terminal.parser.registerCsiHandler({ final: 'J' }, params => {
|
|
366
|
+
if (params.length >= 1 && (params[0] === 2 || params[0] === 3)) {
|
|
367
|
+
this._recentlyPerformedCsiJ = true;
|
|
368
|
+
this._hooks.clearCommandsInViewport();
|
|
369
|
+
}
|
|
370
|
+
return false;
|
|
371
|
+
}));
|
|
372
|
+
this._register(this._capability.onBeforeCommandFinished(command => {
|
|
373
|
+
if (this._recentlyPerformedCsiJ) {
|
|
374
|
+
this._recentlyPerformedCsiJ = false;
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
if (command.command.trim().toLowerCase() === 'clear' || command.command.trim().toLowerCase() === 'cls') {
|
|
378
|
+
this._tryAdjustCommandStartMarkerScheduler?.cancel();
|
|
379
|
+
this._tryAdjustCommandStartMarkerScheduler = undefined;
|
|
380
|
+
this._hooks.clearCommandsInViewport();
|
|
381
|
+
this._capability.currentCommand.isInvalid = true;
|
|
382
|
+
this._hooks.onCurrentCommandInvalidatedEmitter.fire({ reason: "windows" });
|
|
383
|
+
}
|
|
384
|
+
}));
|
|
495
385
|
}
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
386
|
+
preHandleResize(e) {
|
|
387
|
+
const baseY = this._terminal.buffer.active.baseY;
|
|
388
|
+
const rowsDifference = e.rows - this._hooks.dimensions.rows;
|
|
389
|
+
if (rowsDifference > 0) {
|
|
390
|
+
this._waitForCursorMove().then(() => {
|
|
391
|
+
const potentialShiftedLineCount = Math.min(rowsDifference, baseY);
|
|
392
|
+
for (let i = this._capability.commands.length - 1; i >= 0; i--) {
|
|
393
|
+
const command = this._capability.commands[i];
|
|
394
|
+
if (!command.marker || command.marker.line < baseY || command.commandStartLineContent === undefined) {
|
|
395
|
+
break;
|
|
396
|
+
}
|
|
397
|
+
const line = this._terminal.buffer.active.getLine(command.marker.line);
|
|
398
|
+
if (!line || line.translateToString(true) === command.commandStartLineContent) {
|
|
399
|
+
continue;
|
|
400
|
+
}
|
|
401
|
+
const shiftedY = command.marker.line - potentialShiftedLineCount;
|
|
402
|
+
const shiftedLine = this._terminal.buffer.active.getLine(shiftedY);
|
|
403
|
+
if (shiftedLine?.translateToString(true) !== command.commandStartLineContent) {
|
|
404
|
+
continue;
|
|
405
|
+
}
|
|
406
|
+
this._terminal._core._bufferService.buffer.lines.onDeleteEmitter.fire({
|
|
407
|
+
index: this._terminal.buffer.active.baseY,
|
|
408
|
+
amount: potentialShiftedLineCount
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
}
|
|
499
413
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
414
|
+
async handleCommandStart() {
|
|
415
|
+
this._capability.currentCommand.commandStartX = this._terminal.buffer.active.cursorX;
|
|
416
|
+
this._hooks.commandMarkers.length = 0;
|
|
417
|
+
const initialCommandStartMarker = this._capability.currentCommand.commandStartMarker = (this._capability.currentCommand.promptStartMarker
|
|
418
|
+
? cloneMarker(this._terminal, this._capability.currentCommand.promptStartMarker)
|
|
419
|
+
: this._terminal.registerMarker(0));
|
|
420
|
+
this._capability.currentCommand.commandStartX = 0;
|
|
421
|
+
this._tryAdjustCommandStartMarkerScannedLineCount = 0;
|
|
422
|
+
this._tryAdjustCommandStartMarkerPollCount = 0;
|
|
423
|
+
this._tryAdjustCommandStartMarkerScheduler = ( new RunOnceScheduler(
|
|
424
|
+
() => this._tryAdjustCommandStartMarker(initialCommandStartMarker),
|
|
425
|
+
20
|
|
426
|
+
));
|
|
427
|
+
this._tryAdjustCommandStartMarkerScheduler.schedule();
|
|
428
|
+
}
|
|
429
|
+
_tryAdjustCommandStartMarker(start) {
|
|
430
|
+
if (this._store.isDisposed) {
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
const buffer = this._terminal.buffer.active;
|
|
434
|
+
let scannedLineCount = this._tryAdjustCommandStartMarkerScannedLineCount;
|
|
435
|
+
while (scannedLineCount < 5 && start.line + scannedLineCount < buffer.baseY + this._terminal.rows) {
|
|
436
|
+
if (this._cursorOnNextLine()) {
|
|
437
|
+
const prompt = this._getWindowsPrompt(start.line + scannedLineCount);
|
|
438
|
+
if (prompt) {
|
|
439
|
+
const adjustedPrompt = typeof prompt === 'string' ? prompt : prompt.prompt;
|
|
440
|
+
this._capability.currentCommand.commandStartMarker = this._terminal.registerMarker(0);
|
|
441
|
+
if (typeof prompt === 'object' && prompt.likelySingleLine) {
|
|
442
|
+
this._logService.debug('CommandDetectionCapability#_tryAdjustCommandStartMarker adjusted promptStart', `${this._capability.currentCommand.promptStartMarker?.line} -> ${this._capability.currentCommand.commandStartMarker.line}`);
|
|
443
|
+
this._capability.currentCommand.promptStartMarker?.dispose();
|
|
444
|
+
this._capability.currentCommand.promptStartMarker = cloneMarker(this._terminal, this._capability.currentCommand.commandStartMarker);
|
|
445
|
+
const lastCommand = this._capability.commands.at(-1);
|
|
446
|
+
if (lastCommand && this._capability.currentCommand.commandStartMarker.line !== lastCommand.endMarker?.line) {
|
|
447
|
+
lastCommand.endMarker?.dispose();
|
|
448
|
+
lastCommand.endMarker = cloneMarker(this._terminal, this._capability.currentCommand.commandStartMarker);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
this._capability.currentCommand.commandStartX = adjustedPrompt.length;
|
|
452
|
+
this._logService.debug('CommandDetectionCapability#_tryAdjustCommandStartMarker adjusted commandStart', `${start.line} -> ${this._capability.currentCommand.commandStartMarker.line}:${this._capability.currentCommand.commandStartX}`);
|
|
453
|
+
this._flushPendingHandleCommandStartTask();
|
|
454
|
+
return;
|
|
455
|
+
}
|
|
511
456
|
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
457
|
+
scannedLineCount++;
|
|
458
|
+
}
|
|
459
|
+
if (scannedLineCount < 5 ) {
|
|
460
|
+
this._tryAdjustCommandStartMarkerScannedLineCount = scannedLineCount;
|
|
461
|
+
if (this._tryAdjustCommandStartMarkerPollCount < 50 ) {
|
|
462
|
+
this._tryAdjustCommandStartMarkerScheduler?.schedule();
|
|
516
463
|
}
|
|
517
|
-
|
|
518
|
-
|
|
464
|
+
else {
|
|
465
|
+
this._flushPendingHandleCommandStartTask();
|
|
519
466
|
}
|
|
520
467
|
}
|
|
468
|
+
else {
|
|
469
|
+
this._flushPendingHandleCommandStartTask();
|
|
470
|
+
}
|
|
521
471
|
}
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
472
|
+
_flushPendingHandleCommandStartTask() {
|
|
473
|
+
if (this._tryAdjustCommandStartMarkerScheduler) {
|
|
474
|
+
this._tryAdjustCommandStartMarkerPollCount = 50 ;
|
|
475
|
+
this._tryAdjustCommandStartMarkerScheduler.flush();
|
|
476
|
+
this._tryAdjustCommandStartMarkerScheduler = undefined;
|
|
477
|
+
}
|
|
478
|
+
this._hooks.commitCommandFinished();
|
|
479
|
+
if (!this._capability.currentCommand.commandExecutedMarker) {
|
|
480
|
+
this._onCursorMoveListener.value = this._terminal.onCursorMove(() => {
|
|
481
|
+
if (this._hooks.commandMarkers.length === 0 || this._hooks.commandMarkers[this._hooks.commandMarkers.length - 1].line !== this._terminal.buffer.active.cursorY) {
|
|
482
|
+
const marker = this._terminal.registerMarker(0);
|
|
483
|
+
if (marker) {
|
|
484
|
+
this._hooks.commandMarkers.push(marker);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
});
|
|
488
|
+
}
|
|
489
|
+
if (this._capability.currentCommand.commandStartMarker) {
|
|
490
|
+
const line = this._terminal.buffer.active.getLine(this._capability.currentCommand.commandStartMarker.line);
|
|
491
|
+
if (line) {
|
|
492
|
+
this._capability.currentCommand.commandStartLineContent = line.translateToString(true);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
this._hooks.onCommandStartedEmitter.fire({ marker: this._capability.currentCommand.commandStartMarker });
|
|
496
|
+
this._logService.debug('CommandDetectionCapability#_handleCommandStartWindows', this._capability.currentCommand.commandStartX, this._capability.currentCommand.commandStartMarker?.line);
|
|
497
|
+
}
|
|
498
|
+
handleCommandExecuted(options) {
|
|
499
|
+
if (this._tryAdjustCommandStartMarkerScheduler) {
|
|
500
|
+
this._flushPendingHandleCommandStartTask();
|
|
501
|
+
}
|
|
502
|
+
this._onCursorMoveListener.clear();
|
|
503
|
+
this._evaluateCommandMarkers();
|
|
504
|
+
this._capability.currentCommand.commandExecutedX = this._terminal.buffer.active.cursorX;
|
|
505
|
+
this._hooks.onCommandExecutedEmitter.fire();
|
|
506
|
+
this._logService.debug('CommandDetectionCapability#handleCommandExecuted', this._capability.currentCommand.commandExecutedX, this._capability.currentCommand.commandExecutedMarker?.line);
|
|
507
|
+
}
|
|
508
|
+
preHandleCommandFinished() {
|
|
509
|
+
if (this._capability.currentCommand.commandExecutedMarker) {
|
|
510
|
+
return;
|
|
511
|
+
}
|
|
512
|
+
if (this._hooks.commandMarkers.length === 0) {
|
|
513
|
+
if (!this._capability.currentCommand.commandStartMarker) {
|
|
514
|
+
this._capability.currentCommand.commandStartMarker = this._terminal.registerMarker(0);
|
|
515
|
+
}
|
|
516
|
+
if (this._capability.currentCommand.commandStartMarker) {
|
|
517
|
+
this._hooks.commandMarkers.push(this._capability.currentCommand.commandStartMarker);
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
this._evaluateCommandMarkers();
|
|
521
|
+
}
|
|
522
|
+
postHandleCommandFinished() {
|
|
523
|
+
const currentCommand = this._capability.currentCommand;
|
|
524
|
+
const commandText = currentCommand.command;
|
|
525
|
+
const commandLine = currentCommand.commandStartMarker?.line;
|
|
526
|
+
const executedLine = currentCommand.commandExecutedMarker?.line;
|
|
527
|
+
if (!commandText || commandText.length === 0 ||
|
|
528
|
+
commandLine === undefined || commandLine === -1 ||
|
|
529
|
+
executedLine === undefined || executedLine === -1) {
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
let current = 0;
|
|
533
|
+
let found = false;
|
|
534
|
+
for (let i = commandLine; i <= executedLine; i++) {
|
|
535
|
+
const line = this._terminal.buffer.active.getLine(i);
|
|
536
|
+
if (!line) {
|
|
537
|
+
break;
|
|
528
538
|
}
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
539
|
+
const text = line.translateToString(true);
|
|
540
|
+
for (let j = 0; j < text.length; j++) {
|
|
541
|
+
while (commandText.length < current && commandText[current] === ' ') {
|
|
542
|
+
current++;
|
|
543
|
+
}
|
|
544
|
+
if (text[j] === commandText[current]) {
|
|
545
|
+
current++;
|
|
546
|
+
}
|
|
547
|
+
if (current === commandText.length) {
|
|
548
|
+
const wrapsToNextLine = j >= this._terminal.cols - 1;
|
|
549
|
+
currentCommand.commandExecutedMarker = this._terminal.registerMarker(i - (this._terminal.buffer.active.baseY + this._terminal.buffer.active.cursorY) + (wrapsToNextLine ? 1 : 0));
|
|
550
|
+
currentCommand.commandExecutedX = wrapsToNextLine ? 0 : j + 1;
|
|
551
|
+
found = true;
|
|
552
|
+
break;
|
|
553
|
+
}
|
|
533
554
|
}
|
|
534
|
-
if (
|
|
555
|
+
if (found) {
|
|
535
556
|
break;
|
|
536
557
|
}
|
|
537
558
|
}
|
|
538
559
|
}
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
const maxLineLength = Math.max(2048 / cols * 2);
|
|
543
|
-
lineEnd = Math.min(lineEnd, lineStart + maxLineLength);
|
|
544
|
-
let content = '';
|
|
545
|
-
for (let i = lineStart; i <= lineEnd; i++) {
|
|
546
|
-
const line = buffer.getLine(i);
|
|
547
|
-
if (line) {
|
|
548
|
-
content += line.translateToString(true, 0, cols);
|
|
560
|
+
_evaluateCommandMarkers() {
|
|
561
|
+
if (this._hooks.commandMarkers.length === 0) {
|
|
562
|
+
return;
|
|
549
563
|
}
|
|
564
|
+
this._hooks.commandMarkers = this._hooks.commandMarkers.sort((a, b) => a.line - b.line);
|
|
565
|
+
this._capability.currentCommand.commandStartMarker = this._hooks.commandMarkers[0];
|
|
566
|
+
if (this._capability.currentCommand.commandStartMarker) {
|
|
567
|
+
const line = this._terminal.buffer.active.getLine(this._capability.currentCommand.commandStartMarker.line);
|
|
568
|
+
if (line) {
|
|
569
|
+
this._capability.currentCommand.commandStartLineContent = line.translateToString(true);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
this._capability.currentCommand.commandExecutedMarker = this._hooks.commandMarkers[this._hooks.commandMarkers.length - 1];
|
|
573
|
+
this._hooks.onCommandExecutedEmitter.fire();
|
|
550
574
|
}
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
575
|
+
_cursorOnNextLine() {
|
|
576
|
+
const lastCommand = this._capability.commands.at(-1);
|
|
577
|
+
if (!lastCommand) {
|
|
578
|
+
return true;
|
|
579
|
+
}
|
|
580
|
+
const cursorYAbsolute = this._terminal.buffer.active.baseY + this._terminal.buffer.active.cursorY;
|
|
581
|
+
const lastCommandYAbsolute = (lastCommand.endMarker ? lastCommand.endMarker.line : lastCommand.marker?.line) ?? -1;
|
|
582
|
+
return cursorYAbsolute > lastCommandYAbsolute;
|
|
583
|
+
}
|
|
584
|
+
_waitForCursorMove() {
|
|
585
|
+
const cursorX = this._terminal.buffer.active.cursorX;
|
|
586
|
+
const cursorY = this._terminal.buffer.active.cursorY;
|
|
587
|
+
let totalDelay = 0;
|
|
588
|
+
return ( new Promise((resolve, reject) => {
|
|
589
|
+
const interval = setInterval(() => {
|
|
590
|
+
if (cursorX !== this._terminal.buffer.active.cursorX || cursorY !== this._terminal.buffer.active.cursorY) {
|
|
591
|
+
resolve();
|
|
592
|
+
clearInterval(interval);
|
|
593
|
+
return;
|
|
594
|
+
}
|
|
595
|
+
totalDelay += 10;
|
|
596
|
+
if (totalDelay > 1000) {
|
|
597
|
+
clearInterval(interval);
|
|
598
|
+
resolve();
|
|
599
|
+
}
|
|
600
|
+
}, 10);
|
|
601
|
+
}));
|
|
602
|
+
}
|
|
603
|
+
_getWindowsPrompt(y = this._terminal.buffer.active.baseY + this._terminal.buffer.active.cursorY) {
|
|
604
|
+
const line = this._terminal.buffer.active.getLine(y);
|
|
605
|
+
if (!line) {
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
const lineText = line.translateToString(true);
|
|
609
|
+
if (!lineText) {
|
|
610
|
+
return;
|
|
611
|
+
}
|
|
612
|
+
const pwshPrompt = lineText.match(/(?<prompt>(\(.+\)\s)?(?:PS.+>\s?))/)?.groups?.prompt;
|
|
613
|
+
if (pwshPrompt) {
|
|
614
|
+
const adjustedPrompt = this._adjustPrompt(pwshPrompt, lineText, '>');
|
|
615
|
+
if (adjustedPrompt) {
|
|
616
|
+
return {
|
|
617
|
+
prompt: adjustedPrompt,
|
|
618
|
+
likelySingleLine: true
|
|
619
|
+
};
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
const customPrompt = lineText.match(/.*\u276f(?=[^\u276f]*$)/g)?.[0];
|
|
623
|
+
if (customPrompt) {
|
|
624
|
+
const adjustedPrompt = this._adjustPrompt(customPrompt, lineText, '\u276f');
|
|
625
|
+
if (adjustedPrompt) {
|
|
626
|
+
return adjustedPrompt;
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
const cmdMatch = lineText.match(/^(?<prompt>(\(.+\)\s)?(?:[A-Z]:\\.*>))/);
|
|
630
|
+
return cmdMatch?.groups?.prompt ? {
|
|
631
|
+
prompt: cmdMatch.groups.prompt,
|
|
632
|
+
likelySingleLine: true
|
|
633
|
+
} : undefined;
|
|
634
|
+
}
|
|
635
|
+
_adjustPrompt(prompt, lineText, char) {
|
|
636
|
+
if (!prompt) {
|
|
637
|
+
return;
|
|
638
|
+
}
|
|
639
|
+
if (lineText === prompt && prompt.endsWith(char)) {
|
|
640
|
+
prompt += ' ';
|
|
641
|
+
}
|
|
642
|
+
return prompt;
|
|
643
|
+
}
|
|
644
|
+
};
|
|
645
|
+
WindowsPtyHeuristics = ( __decorate([
|
|
646
|
+
( __param(3, ILogService))
|
|
647
|
+
], WindowsPtyHeuristics));
|
|
648
|
+
function cloneMarker(xterm, marker, offset = 0) {
|
|
649
|
+
return xterm.registerMarker(marker.line - (xterm.buffer.active.baseY + xterm.buffer.active.cursorY) + offset);
|
|
565
650
|
}
|
|
566
651
|
export { CommandDetectionCapability };
|