@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.
Files changed (328) hide show
  1. package/api.js +13 -7
  2. package/assets/clear.mp3 +0 -0
  3. package/assets/format.mp3 +0 -0
  4. package/assets/save.mp3 +0 -0
  5. package/extensions.d.ts +13 -3
  6. package/external/{xterm-addon-image/typings/xterm-addon-image.d.ts → @xterm/addon-image/typings/addon-image.d.ts} +1 -1
  7. package/external/{xterm-addon-serialize/typings/xterm-addon-serialize.d.ts → @xterm/addon-serialize/typings/addon-serialize.d.ts} +20 -3
  8. package/external/{xterm → @xterm/xterm}/typings/xterm.d.ts +13 -1
  9. package/lifecycle.js +2 -2
  10. package/localExtensionHost.js +3 -1
  11. package/missing-services.js +160 -25
  12. package/monaco-editor-treemending.patch +6884 -18018
  13. package/monaco-treemending.js +2 -2
  14. package/package.json +7 -7
  15. package/service-override/tools/editor.d.ts +8 -8
  16. package/service-override/tools/editor.js +44 -19
  17. package/services.d.ts +2 -2
  18. package/services.js +3 -3
  19. package/vscode/src/vs/base/browser/broadcast.js +6 -5
  20. package/vscode/src/vs/base/browser/dnd.d.ts +6 -0
  21. package/vscode/src/vs/base/browser/mouseEvent.d.ts +1 -1
  22. package/vscode/src/vs/base/browser/touch.d.ts +10 -0
  23. package/vscode/src/vs/base/browser/ui/actionbar/actionbar.d.ts +1 -0
  24. package/vscode/src/vs/base/browser/ui/iconLabel/iconHoverDelegate.d.ts +22 -15
  25. package/vscode/src/vs/base/browser/ui/menu/menubar.js +4 -3
  26. package/vscode/src/vs/base/browser/ui/splitview/paneview.css.js +1 -1
  27. package/vscode/src/vs/base/browser/ui/splitview/paneview.d.ts +3 -0
  28. package/vscode/src/vs/base/browser/ui/splitview/paneview.js +34 -11
  29. package/vscode/src/vs/base/common/actions.d.ts +1 -15
  30. package/vscode/src/vs/base/common/async.d.ts +1 -31
  31. package/vscode/src/vs/base/common/event.d.ts +2 -1
  32. package/vscode/src/vs/base/common/observableInternal/base.d.ts +23 -10
  33. package/vscode/src/vs/base/common/prefixTree.js +21 -11
  34. package/vscode/src/vs/base/common/product.d.ts +16 -2
  35. package/vscode/src/vs/base/common/resourceTree.js +135 -0
  36. package/vscode/src/vs/base/common/skipList.js +1 -0
  37. package/vscode/src/vs/base/common/tfIdf.js +137 -0
  38. package/vscode/src/vs/base/common/types.d.ts +13 -1
  39. package/vscode/src/vs/base/common/verifier.js +62 -0
  40. package/vscode/src/vs/editor/browser/editorBrowser.d.ts +4 -2
  41. package/vscode/src/vs/editor/common/config/editorOptions.d.ts +23 -4
  42. package/vscode/src/vs/editor/common/core/lineRange.d.ts +1 -0
  43. package/vscode/src/vs/editor/common/core/offsetRange.d.ts +3 -0
  44. package/vscode/src/vs/editor/common/core/position.d.ts +1 -0
  45. package/vscode/src/vs/editor/common/editorCommon.d.ts +2 -1
  46. package/vscode/src/vs/editor/common/languages.d.ts +23 -1
  47. package/vscode/src/vs/editor/common/services/languageFeatures.d.ts +2 -1
  48. package/vscode/src/vs/editor/common/services/resolverService.d.ts +11 -2
  49. package/vscode/src/vs/platform/accessibility/common/accessibility.d.ts +16 -1
  50. package/vscode/src/vs/platform/action/common/action.d.ts +8 -0
  51. package/vscode/src/vs/platform/actions/browser/dropdownWithPrimaryActionViewItem.js +4 -0
  52. package/vscode/src/vs/platform/actions/common/actions.d.ts +8 -0
  53. package/vscode/src/vs/platform/audioCues/browser/audioCueService.d.ts +6 -0
  54. package/vscode/src/vs/platform/commands/common/commands.d.ts +13 -5
  55. package/vscode/src/vs/platform/dialogs/common/dialogs.d.ts +9 -3
  56. package/vscode/src/vs/platform/dialogs/common/dialogs.js +5 -2
  57. package/vscode/src/vs/platform/editor/common/editor.d.ts +3 -15
  58. package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.d.ts +1 -0
  59. package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +3 -15
  60. package/vscode/src/vs/platform/extensionManagement/common/implicitActivationEvents.js +5 -0
  61. package/vscode/src/vs/platform/extensions/common/extensions.d.ts +0 -1
  62. package/vscode/src/vs/platform/files/common/files.d.ts +72 -8
  63. package/vscode/src/vs/platform/files/common/watcher.js +77 -0
  64. package/vscode/src/vs/platform/keybinding/common/keybindingsRegistry.d.ts +2 -2
  65. package/vscode/src/vs/platform/layout/browser/layoutService.d.ts +52 -21
  66. package/vscode/src/vs/platform/request/browser/requestService.js +3 -0
  67. package/vscode/src/vs/platform/request/common/requestIpc.js +17 -0
  68. package/vscode/src/vs/platform/storage/common/storage.js +2 -2
  69. package/vscode/src/vs/platform/telemetry/common/telemetry.d.ts +1 -0
  70. package/vscode/src/vs/platform/terminal/common/capabilities/capabilities.d.ts +12 -7
  71. package/vscode/src/vs/platform/terminal/common/capabilities/{commandDetectionCapability.d.ts → commandDetection/terminalCommand.d.ts} +3 -2
  72. package/vscode/src/vs/platform/terminal/common/capabilities/commandDetection/terminalCommand.js +257 -0
  73. package/vscode/src/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +439 -354
  74. package/vscode/src/vs/platform/window/common/window.d.ts +9 -2
  75. package/vscode/src/vs/platform/window/common/window.js +6 -1
  76. package/vscode/src/vs/platform/workspaces/common/workspaces.d.ts +2 -43
  77. package/vscode/src/vs/workbench/api/common/extHost.api.impl.js +113 -81
  78. package/vscode/src/vs/workbench/api/common/extHost.protocol.js +5 -4
  79. package/vscode/src/vs/workbench/api/common/extHostApiCommands.js +25 -3
  80. package/vscode/src/vs/workbench/api/common/extHostChat.js +13 -163
  81. package/vscode/src/vs/workbench/api/common/extHostChatAgents2.js +412 -0
  82. package/vscode/src/vs/workbench/api/common/extHostChatProvider.js +79 -11
  83. package/vscode/src/vs/workbench/api/common/extHostCommands.js +13 -12
  84. package/vscode/src/vs/workbench/api/common/extHostComments.js +1 -1
  85. package/vscode/src/vs/workbench/api/common/extHostEditorTabs.js +8 -6
  86. package/vscode/src/vs/workbench/api/common/extHostExtensionService.js +1 -1
  87. package/vscode/src/vs/workbench/api/common/extHostFileSystemEventService.js +36 -19
  88. package/vscode/src/vs/workbench/api/common/extHostInlineChat.js +52 -31
  89. package/vscode/src/vs/workbench/api/common/extHostIssueReporter.js +38 -0
  90. package/vscode/src/vs/workbench/api/common/extHostLanguageFeatures.js +28 -3
  91. package/vscode/src/vs/workbench/api/common/extHostLanguages.js +10 -0
  92. package/vscode/src/vs/workbench/api/common/extHostNotebook.js +117 -2
  93. package/vscode/src/vs/workbench/api/common/extHostNotebookKernels.js +32 -4
  94. package/vscode/src/vs/workbench/api/common/extHostSCM.js +85 -23
  95. package/vscode/src/vs/workbench/api/common/extHostSearch.js +3 -0
  96. package/vscode/src/vs/workbench/api/common/extHostSpeech.js +42 -0
  97. package/vscode/src/vs/workbench/api/common/extHostTask.js +2 -1
  98. package/vscode/src/vs/workbench/api/common/extHostTelemetry.js +1 -0
  99. package/vscode/src/vs/workbench/api/common/extHostTerminalService.js +3 -3
  100. package/vscode/src/vs/workbench/api/common/extHostTesting.js +97 -47
  101. package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +115 -16
  102. package/vscode/src/vs/workbench/api/common/extHostTypes.js +66 -36
  103. package/vscode/src/vs/workbench/api/common/extHostWorkspace.js +6 -1
  104. package/vscode/src/vs/workbench/browser/actions/layoutActions.js +182 -75
  105. package/vscode/src/vs/workbench/browser/actions/windowActions.js +176 -4
  106. package/vscode/src/vs/workbench/browser/actions/workspaceActions.js +143 -2
  107. package/vscode/src/vs/workbench/browser/actions/workspaceCommands.js +237 -0
  108. package/vscode/src/vs/workbench/browser/composite.d.ts +0 -4
  109. package/vscode/src/vs/workbench/browser/composite.js +5 -4
  110. package/vscode/src/vs/workbench/browser/dnd.js +72 -23
  111. package/vscode/src/vs/workbench/browser/labels.js +7 -3
  112. package/vscode/src/vs/workbench/browser/media/part.css.js +1 -1
  113. package/vscode/src/vs/workbench/browser/panecomposite.d.ts +2 -2
  114. package/vscode/src/vs/workbench/browser/panecomposite.js +2 -0
  115. package/vscode/src/vs/workbench/browser/part.js +33 -2
  116. package/vscode/src/vs/workbench/browser/parts/compositeBarActions.js +99 -117
  117. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +173 -33
  118. package/vscode/src/vs/workbench/browser/parts/editor/editor.js +102 -6
  119. package/vscode/src/vs/workbench/browser/parts/editor/editorActions.js +256 -17
  120. package/vscode/src/vs/workbench/browser/parts/editor/editorAutoSave.js +4 -0
  121. package/vscode/src/vs/workbench/browser/parts/editor/editorCommands.js +68 -35
  122. package/vscode/src/vs/workbench/browser/parts/editor/editorPlaceholder.js +5 -5
  123. package/vscode/src/vs/workbench/browser/parts/editor/editorStatus.js +35 -16
  124. package/vscode/src/vs/workbench/browser/parts/editor/editorTabsControl.js +348 -0
  125. package/vscode/src/vs/workbench/browser/parts/editor/editorsObserver.js +43 -31
  126. package/vscode/src/vs/workbench/browser/parts/editor/media/editortabscontrol.css.js +4 -0
  127. package/vscode/src/vs/workbench/browser/parts/editor/sideBySideEditor.js +1 -0
  128. package/vscode/src/vs/workbench/browser/parts/editor/textCodeEditor.js +1 -0
  129. package/vscode/src/vs/workbench/browser/parts/editor/textDiffEditor.js +14 -2
  130. package/vscode/src/vs/workbench/browser/parts/editor/textEditor.js +4 -4
  131. package/vscode/src/vs/workbench/browser/parts/globalCompositeBar.js +277 -0
  132. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCommands.js +5 -2
  133. package/vscode/src/vs/workbench/browser/parts/panel/media/panelpart.css.js +1 -1
  134. package/vscode/src/vs/workbench/browser/parts/panel/panelActions.js +3 -38
  135. package/vscode/src/vs/workbench/browser/parts/statusbar/statusbarPart.d.ts +54 -52
  136. package/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.js +2 -1
  137. package/vscode/src/vs/workbench/browser/parts/titlebar/titlebarPart.d.ts +25 -0
  138. package/vscode/src/vs/workbench/browser/parts/titlebar/windowTitle.js +258 -0
  139. package/vscode/src/vs/workbench/browser/parts/views/media/paneviewlet.css.js +1 -1
  140. package/vscode/src/vs/workbench/browser/parts/views/viewPane.d.ts +2 -5
  141. package/vscode/src/vs/workbench/browser/parts/views/viewPane.js +157 -117
  142. package/vscode/src/vs/workbench/browser/parts/views/viewPaneContainer.js +50 -23
  143. package/vscode/src/vs/workbench/browser/parts/views/viewsService.js +26 -11
  144. package/vscode/src/vs/workbench/browser/parts/views/viewsViewlet.js +10 -6
  145. package/vscode/src/vs/workbench/browser/style.js +2 -1
  146. package/vscode/src/vs/workbench/browser/web.api.d.ts +39 -2
  147. package/vscode/src/vs/workbench/browser/window.js +55 -0
  148. package/vscode/src/vs/workbench/browser/workbench.contribution.js +220 -40
  149. package/vscode/src/vs/workbench/common/activity.js +3 -0
  150. package/vscode/src/vs/workbench/common/contextkeys.js +35 -5
  151. package/vscode/src/vs/workbench/common/contributions.js +4 -3
  152. package/vscode/src/vs/workbench/common/editor/diffEditorInput.js +14 -4
  153. package/vscode/src/vs/workbench/common/editor/diffEditorModel.js +1 -1
  154. package/vscode/src/vs/workbench/common/editor/editorGroupModel.js +22 -19
  155. package/vscode/src/vs/workbench/common/editor/editorInput.d.ts +4 -3
  156. package/vscode/src/vs/workbench/common/editor/editorModel.d.ts +1 -2
  157. package/vscode/src/vs/workbench/common/editor/sideBySideEditorInput.js +22 -4
  158. package/vscode/src/vs/workbench/common/editor/textResourceEditorInput.js +3 -3
  159. package/vscode/src/vs/workbench/common/editor.d.ts +60 -30
  160. package/vscode/src/vs/workbench/common/editor.js +11 -3
  161. package/vscode/src/vs/workbench/common/theme.js +2 -2
  162. package/vscode/src/vs/workbench/common/views.d.ts +4 -4
  163. package/vscode/src/vs/workbench/common/views.js +3 -1
  164. package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.js +97 -8
  165. package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityContributions.js +17 -99
  166. package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibleView.js +103 -37
  167. package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibleViewActions.js +2 -3
  168. package/vscode/src/vs/workbench/contrib/accessibility/browser/editorAccessibilityHelp.js +127 -0
  169. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +71 -0
  170. package/vscode/src/vs/workbench/contrib/chat/browser/chat.js +2 -1
  171. package/vscode/src/vs/workbench/contrib/chat/common/chatAgents.js +33 -110
  172. package/vscode/src/vs/workbench/contrib/chat/common/chatContextKeys.js +64 -0
  173. package/vscode/src/vs/workbench/contrib/chat/common/chatParserTypes.js +94 -0
  174. package/vscode/src/vs/workbench/contrib/chat/common/chatService.js +6 -1
  175. package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +1 -88
  176. package/vscode/src/vs/workbench/contrib/codeActions/browser/codeActionsContribution.js +4 -4
  177. package/vscode/src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.js +3 -2
  178. package/vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess.js +3 -1
  179. package/vscode/src/vs/workbench/contrib/codeEditor/browser/saveParticipants.js +15 -16
  180. package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.js +9 -3
  181. package/vscode/src/vs/workbench/contrib/comments/browser/comments.contribution.js +3 -1
  182. package/vscode/src/vs/workbench/contrib/comments/browser/simpleCommentEditor.js +2 -3
  183. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInput.js +1 -0
  184. package/vscode/src/vs/workbench/contrib/debug/common/debug.d.ts +9 -1
  185. package/vscode/src/vs/workbench/contrib/debug/common/debug.js +10 -1
  186. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.js +114 -22
  187. package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionActions.css.js +1 -1
  188. package/vscode/src/vs/workbench/contrib/extensions/common/extensions.js +4 -1
  189. package/vscode/src/vs/workbench/contrib/files/browser/explorerFileContrib.js +19 -0
  190. package/vscode/src/vs/workbench/contrib/files/browser/explorerViewlet.js +10 -8
  191. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.js +62 -10
  192. package/vscode/src/vs/workbench/contrib/files/browser/fileConstants.js +2 -1
  193. package/vscode/src/vs/workbench/contrib/files/browser/fileImportExport.js +9 -8
  194. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +10 -1
  195. package/vscode/src/vs/workbench/contrib/files/browser/files.d.ts +1 -0
  196. package/vscode/src/vs/workbench/contrib/files/browser/files.js +7 -3
  197. package/vscode/src/vs/workbench/contrib/files/browser/views/emptyView.js +4 -4
  198. package/vscode/src/vs/workbench/contrib/files/browser/views/explorerView.js +64 -36
  199. package/vscode/src/vs/workbench/contrib/files/browser/views/explorerViewer.js +42 -17
  200. package/vscode/src/vs/workbench/contrib/files/browser/views/openEditorsView.js +145 -25
  201. package/vscode/src/vs/workbench/contrib/format/browser/formatActionsMultiple.js +1 -1
  202. package/vscode/src/vs/workbench/contrib/format/browser/formatModified.js +1 -1
  203. package/vscode/src/vs/workbench/contrib/inlineChat/common/inlineChat.js +36 -0
  204. package/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.js +3 -1
  205. package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +24 -3
  206. package/vscode/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.js +11 -6
  207. package/vscode/src/vs/workbench/contrib/scm/common/scm.js +1 -2
  208. package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/searchNotebookHelpers.js +31 -0
  209. package/vscode/src/vs/workbench/contrib/search/browser/searchModel.js +61 -41
  210. package/vscode/src/vs/workbench/contrib/search/{browser/searchNotebookHelpers.js → common/cellSearchModel.js} +4 -63
  211. package/vscode/src/vs/workbench/contrib/search/common/searchNotebookHelpers.js +40 -0
  212. package/vscode/src/vs/workbench/contrib/snippets/browser/snippetsFile.js +2 -2
  213. package/vscode/src/vs/workbench/{services/editor/browser/editorDropService.js → contrib/speech/common/speechService.js} +2 -2
  214. package/vscode/src/vs/workbench/contrib/terminal/browser/detachedTerminal.js +29 -4
  215. package/vscode/src/vs/workbench/contrib/terminal/browser/terminal.d.ts +100 -79
  216. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalConfigHelper.d.ts +3 -3
  217. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalEditorInput.js +1 -1
  218. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalIcon.js +7 -4
  219. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +5 -3
  220. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +143 -41
  221. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.d.ts +17 -11
  222. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +41 -26
  223. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm-private.d.ts +5 -2
  224. package/vscode/src/vs/workbench/contrib/terminal/common/terminal.d.ts +2 -8
  225. package/vscode/src/vs/workbench/contrib/terminal/common/terminal.js +2 -0
  226. package/vscode/src/vs/workbench/contrib/testing/common/testCoverage.js +115 -0
  227. package/vscode/src/vs/workbench/contrib/testing/common/testCoverageService.js +74 -0
  228. package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +3 -3
  229. package/vscode/src/vs/workbench/contrib/testing/common/testTypes.js +64 -1
  230. package/vscode/src/vs/workbench/contrib/testing/common/testingContextKeys.js +9 -0
  231. package/vscode/src/vs/workbench/contrib/webview/browser/webviewWindowDragMonitor.js +4 -3
  232. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditor.js +8 -9
  233. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput.js +1 -1
  234. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewIconManager.js +5 -2
  235. package/vscode/src/vs/workbench/services/activity/browser/activityService.d.ts +16 -10
  236. package/vscode/src/vs/workbench/services/activity/common/activity.d.ts +14 -1
  237. package/vscode/src/vs/workbench/services/activity/common/activity.js +1 -7
  238. package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +9 -28
  239. package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +273 -0
  240. package/vscode/src/vs/workbench/services/configurationResolver/common/configurationResolver.js +1 -0
  241. package/vscode/src/vs/workbench/services/configurationResolver/common/variableResolver.js +2 -0
  242. package/vscode/src/vs/workbench/services/decorations/browser/decorationsService.js +2 -3
  243. package/vscode/src/vs/workbench/services/editor/browser/editorService.d.ts +7 -5
  244. package/vscode/src/vs/workbench/services/editor/browser/editorService.js +59 -37
  245. package/vscode/src/vs/workbench/services/editor/common/editorGroupsService.d.ts +193 -94
  246. package/vscode/src/vs/workbench/services/editor/common/editorGroupsService.js +2 -2
  247. package/vscode/src/vs/workbench/services/editor/common/editorResolverService.d.ts +8 -2
  248. package/vscode/src/vs/workbench/services/editor/common/editorService.d.ts +8 -1
  249. package/vscode/src/vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig.js +62 -16
  250. package/vscode/src/vs/workbench/services/extensions/browser/extensionUrlHandler.js +5 -3
  251. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.d.ts +3 -2
  252. package/vscode/src/vs/workbench/services/extensions/common/extensionDescriptionRegistry.js +4 -9
  253. package/vscode/src/vs/workbench/services/extensions/common/{extensionHostManager.d.ts → extensionHostManagers.d.ts} +2 -0
  254. package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.d.ts +1 -1
  255. package/vscode/src/vs/workbench/services/extensions/common/extensions.d.ts +9 -0
  256. package/vscode/src/vs/workbench/services/extensions/common/extensions.js +22 -0
  257. package/vscode/src/vs/workbench/services/extensions/common/extensionsApiProposals.js +14 -3
  258. package/vscode/src/vs/workbench/services/extensions/common/extensionsRegistry.js +9 -0
  259. package/vscode/src/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js +3 -3
  260. package/vscode/src/vs/workbench/services/history/common/history.d.ts +2 -2
  261. package/vscode/src/vs/workbench/services/host/browser/browserHostService.js +49 -18
  262. package/vscode/src/vs/workbench/services/host/browser/host.d.ts +29 -7
  263. package/vscode/src/vs/workbench/services/hover/browser/hover.d.ts +51 -28
  264. package/vscode/src/vs/workbench/services/hover/browser/hoverService.d.ts +5 -2
  265. package/vscode/src/vs/workbench/services/keybinding/browser/unboundCommands.js +2 -2
  266. package/vscode/src/vs/workbench/services/languageStatus/common/languageStatusService.d.ts +4 -1
  267. package/vscode/src/vs/workbench/services/layout/browser/layoutService.d.ts +40 -36
  268. package/vscode/src/vs/workbench/services/panecomposite/browser/panecomposite.d.ts +0 -6
  269. package/vscode/src/vs/workbench/services/preferences/common/preferences.d.ts +3 -0
  270. package/vscode/src/vs/workbench/services/progress/browser/progressIndicator.js +2 -2
  271. package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.d.ts +18 -3
  272. package/vscode/src/vs/workbench/services/request/browser/requestService.js +48 -0
  273. package/vscode/src/vs/workbench/services/search/common/searchHelpers.js +4 -4
  274. package/vscode/src/vs/workbench/services/statusbar/browser/statusbar.d.ts +10 -51
  275. package/vscode/src/vs/workbench/services/suggest/browser/simpleSuggestWidget.js +2 -2
  276. package/vscode/src/vs/workbench/services/textfile/browser/textFileService.js +32 -1
  277. package/vscode/src/vs/workbench/services/textfile/common/textEditorService.js +1 -5
  278. package/vscode/src/vs/workbench/services/themes/browser/browserHostColorSchemeService.js +4 -3
  279. package/vscode/src/vs/workbench/services/themes/common/iconExtensionPoint.js +9 -3
  280. package/vscode/src/vs/workbench/services/title/browser/titleService.d.ts +18 -0
  281. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorInput.js +18 -3
  282. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorModel.js +16 -7
  283. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorService.d.ts +6 -0
  284. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorService.js +13 -0
  285. package/vscode/src/vs/workbench/services/url/browser/urlService.js +2 -1
  286. package/vscode/src/vs/workbench/services/userActivity/common/userActivityService.js +2 -2
  287. package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfileIcons.js +9 -0
  288. package/vscode-dts/vscode.proposed.chatAgents2.d.ts +375 -0
  289. package/vscode-dts/vscode.proposed.chatAgents2Additions.d.ts +80 -0
  290. package/vscode-dts/vscode.proposed.chatProvider.d.ts +5 -1
  291. package/vscode-dts/vscode.proposed.chatRequestAccess.d.ts +68 -10
  292. package/vscode-dts/vscode.proposed.chatTab.d.ts +21 -0
  293. package/vscode-dts/vscode.proposed.chatVariables.d.ts +5 -1
  294. package/vscode-dts/vscode.proposed.codeActionAI.d.ts +16 -0
  295. package/vscode-dts/vscode.proposed.contribSourceControlInputBoxMenu.d.ts +7 -0
  296. package/vscode-dts/vscode.proposed.createFileSystemWatcher.d.ts +51 -0
  297. package/vscode-dts/vscode.proposed.defaultChatAgent.d.ts +30 -0
  298. package/vscode-dts/vscode.proposed.handleIssueUri.d.ts +26 -0
  299. package/vscode-dts/vscode.proposed.interactive.d.ts +26 -100
  300. package/vscode-dts/vscode.proposed.interactiveUserActions.d.ts +14 -7
  301. package/vscode-dts/vscode.proposed.languageStatusText.d.ts +12 -0
  302. package/vscode-dts/vscode.proposed.multiDocumentHighlightProvider.d.ts +63 -0
  303. package/vscode-dts/vscode.proposed.notebookVariableProvider.d.ts +43 -0
  304. package/vscode-dts/vscode.proposed.resolvers.d.ts +100 -1
  305. package/vscode-dts/vscode.proposed.scmHistoryProvider.d.ts +9 -1
  306. package/vscode-dts/vscode.proposed.scmInputBoxActionButton.d.ts +19 -0
  307. package/vscode-dts/vscode.proposed.scmInputBoxValueProvider.d.ts +25 -0
  308. package/vscode-dts/vscode.proposed.speech.d.ts +35 -0
  309. package/vscode-dts/vscode.proposed.terminalQuickFixProvider.d.ts +11 -7
  310. package/vscode-dts/vscode.proposed.testCoverage.d.ts +6 -1
  311. package/vscode-dts/vscode.proposed.testingActiveProfile.d.ts +21 -0
  312. package/external/xterm-headless/typings/xterm-headless.d.ts +0 -49
  313. package/vscode/src/vs/platform/backup/common/backup.d.ts +0 -14
  314. package/vscode/src/vs/platform/update/common/update.d.ts +0 -112
  315. package/vscode/src/vs/workbench/api/common/extHostChatAgents.js +0 -62
  316. package/vscode/src/vs/workbench/api/common/extHostChatSlashCommand.js +0 -62
  317. package/vscode/src/vs/workbench/browser/parts/paneCompositePart.d.ts +0 -56
  318. package/vscode/src/vs/workbench/services/files/common/files.js +0 -4
  319. package/vscode/src/vs/workbench/services/host/browser/browserHostService.d.ts +0 -41
  320. package/vscode/src/vs/workbench/services/title/common/titleService.d.ts +0 -31
  321. package/vscode-dts/vscode.proposed.chatAgents.d.ts +0 -39
  322. package/vscode-dts/vscode.proposed.chatSlashCommands.d.ts +0 -47
  323. package/vscode-dts/vscode.proposed.testMessageContextValue.d.ts +0 -45
  324. /package/external/{xterm-addon-canvas/typings/xterm-addon-canvas.d.ts → @xterm/addon-canvas/typings/addon-canvas.d.ts} +0 -0
  325. /package/external/{xterm-addon-search/typings/xterm-addon-search.d.ts → @xterm/addon-search/typings/addon-search.d.ts} +0 -0
  326. /package/external/{xterm-addon-unicode11/typings/xterm-addon-unicode11.d.ts → @xterm/addon-unicode11/typings/addon-unicode11.d.ts} +0 -0
  327. /package/external/{xterm-addon-webgl/typings/xterm-addon-webgl.d.ts → @xterm/addon-webgl/typings/addon-webgl.d.ts} +0 -0
  328. /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 { timeout } from 'monaco-editor/esm/vs/base/common/async.js';
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
- if (this._isWindowsPty) {
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._isWindowsPty = value;
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 reversed = [...this._commands].reverse();
174
- return reversed.find(c => c.marker.line <= line - 1)?.cwd;
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
- this._currentCommand.promptStartMarker = options?.marker || this._terminal.registerMarker(0);
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
- if (this._isWindowsPty) {
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
- if (this._isWindowsPty) {
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
- if (this._isWindowsPty) {
309
- this._preHandleCommandFinishedWindows();
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
- this._exitCode = lastCommand.exitCode;
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
- if (this._exitCode === undefined && command === undefined) {
325
- command = '';
326
- }
327
- if ((command !== undefined && !command.startsWith('\\')) || this._handleCommandStartOptions?.ignoreCommandLine) {
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._logService.debug('CommandDetectionCapability#onCommandFinished', newCommand);
349
- this._onBeforeCommandFinished.fire(newCommand);
350
- if (!this._currentCommand.isInvalid) {
351
- this._onCommandFinished.fire(newCommand);
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.previousCommandMarker = this._currentCommand.commandStartMarker;
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
- return {
394
- startLine: e.marker?.line,
395
- startX: undefined,
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._isWindowsPty,
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._currentCommand.commandStartMarker = marker;
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 endMarker = e.endLine !== undefined ? this._terminal.registerMarker(e.endLine - (buffer.baseY + buffer.cursorY)) : undefined;
446
- const executedMarker = e.executedLine !== undefined ? this._terminal.registerMarker(e.executedLine - (buffer.baseY + buffer.cursorY)) : undefined;
447
- const newCommand = {
448
- command: this.__isCommandStorageDisabled ? '' : e.command,
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
- function getOutputForCommand(executedMarker, endMarker, buffer) {
473
- if (!executedMarker || !endMarker) {
474
- return undefined;
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
- const startLine = executedMarker.line;
477
- const endLine = endMarker.line;
478
- if (startLine === endLine) {
479
- return undefined;
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
- let output = '';
482
- let line;
483
- for (let i = startLine; i < endLine; i++) {
484
- line = buffer.getLine(i);
485
- if (!line) {
486
- continue;
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
- output += line.translateToString(!line.isWrapped) + (line.isWrapped ? '' : '\n');
351
+ this._hooks.onCommandExecutedEmitter.fire();
489
352
  }
490
- return output === '' ? undefined : output;
491
353
  }
492
- function getOutputMatchForCommand(executedMarker, endMarker, buffer, cols, outputMatcher) {
493
- if (!executedMarker || !endMarker) {
494
- return undefined;
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
- const endLine = endMarker.line;
497
- if (endLine === -1) {
498
- return undefined;
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
- const startLine = Math.max(executedMarker.line, 0);
501
- const matcher = outputMatcher.lineMatcher;
502
- const linesToCheck = typeof matcher === 'string' ? 1 : outputMatcher.length || countNewLines(matcher);
503
- const lines = [];
504
- let match;
505
- if (outputMatcher.anchor === 'bottom') {
506
- for (let i = endLine - (outputMatcher.offset || 0); i >= startLine; i--) {
507
- let wrappedLineStart = i;
508
- const wrappedLineEnd = i;
509
- while (wrappedLineStart >= startLine && buffer.getLine(wrappedLineStart)?.isWrapped) {
510
- wrappedLineStart--;
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
- i = wrappedLineStart;
513
- lines.unshift(getXtermLineContent(buffer, wrappedLineStart, wrappedLineEnd, cols));
514
- if (!match) {
515
- match = lines[0].match(matcher);
457
+ scannedLineCount++;
458
+ }
459
+ if (scannedLineCount < 5 ) {
460
+ this._tryAdjustCommandStartMarkerScannedLineCount = scannedLineCount;
461
+ if (this._tryAdjustCommandStartMarkerPollCount < 50 ) {
462
+ this._tryAdjustCommandStartMarkerScheduler?.schedule();
516
463
  }
517
- if (lines.length >= linesToCheck) {
518
- break;
464
+ else {
465
+ this._flushPendingHandleCommandStartTask();
519
466
  }
520
467
  }
468
+ else {
469
+ this._flushPendingHandleCommandStartTask();
470
+ }
521
471
  }
522
- else {
523
- for (let i = startLine + (outputMatcher.offset || 0); i < endLine; i++) {
524
- const wrappedLineStart = i;
525
- let wrappedLineEnd = i;
526
- while (wrappedLineEnd + 1 < endLine && buffer.getLine(wrappedLineEnd + 1)?.isWrapped) {
527
- wrappedLineEnd++;
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
- i = wrappedLineEnd;
530
- lines.push(getXtermLineContent(buffer, wrappedLineStart, wrappedLineEnd, cols));
531
- if (!match) {
532
- match = lines[lines.length - 1].match(matcher);
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 (lines.length >= linesToCheck) {
555
+ if (found) {
535
556
  break;
536
557
  }
537
558
  }
538
559
  }
539
- return match ? { regexMatch: match, outputLines: lines } : undefined;
540
- }
541
- function getXtermLineContent(buffer, lineStart, lineEnd, cols) {
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
- return content;
552
- }
553
- function countNewLines(regex) {
554
- if (!regex.multiline) {
555
- return 1;
556
- }
557
- const source = regex.source;
558
- let count = 1;
559
- let i = source.indexOf('\\n');
560
- while (i !== -1) {
561
- count++;
562
- i = source.indexOf('\\n', i + 1);
563
- }
564
- return count;
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 };