@codingame/monaco-vscode-api 1.79.1 → 1.79.2-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 (467) hide show
  1. package/README.md +11 -2
  2. package/dist/api.js +10 -8
  3. package/dist/composite.d.ts +65 -0
  4. package/dist/configurationRegistry.d.ts +212 -0
  5. package/dist/contextkey.d.ts +1 -1
  6. package/dist/default-extensions/json.js +1 -0
  7. package/dist/default-extensions/theme-defaults.js +2 -2
  8. package/dist/editorBrowser.d.ts +272 -3
  9. package/dist/event.d.ts +6 -1
  10. package/dist/{extension-tools-0c4c1ad7.js → extension-tools-3c2bf0a4.js} +698 -507
  11. package/dist/extensions.d.ts +3 -2
  12. package/dist/extensions.d2.ts +6 -17
  13. package/dist/extensionsRegistry.d.ts +15 -9
  14. package/dist/files.d.ts +71 -7
  15. package/dist/jsonSchema.d.ts +1 -1
  16. package/dist/keybinding.d.ts +2 -2
  17. package/dist/languageFeatures.d.ts +703 -61
  18. package/dist/monaco.d.ts +5 -4
  19. package/dist/override/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js +2 -0
  20. package/dist/override/vs/workbench/contrib/notebook/browser/notebookEditor.js +2 -0
  21. package/dist/override/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js +2 -0
  22. package/dist/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +2 -1
  23. package/dist/platform.d.ts +11 -0
  24. package/dist/rollup-extension-directory-plugin.js +1 -1
  25. package/dist/rollup-vsix-plugin.js +2 -2
  26. package/dist/service-override/configuration.d.ts +5 -206
  27. package/dist/service-override/dialogs.js +16 -1
  28. package/dist/service-override/files.d.ts +2 -2
  29. package/dist/service-override/files.js +1 -1
  30. package/dist/service-override/markers.d.ts +7 -0
  31. package/dist/service-override/markers.js +6 -0
  32. package/dist/service-override/output.d.ts +7 -0
  33. package/dist/service-override/output.js +22 -0
  34. package/dist/service-override/preferences.js +7 -1
  35. package/dist/service-override/quickaccess.js +0 -9
  36. package/dist/service-override/search.d.ts +7 -0
  37. package/dist/service-override/search.js +19 -0
  38. package/dist/service-override/terminal.d.ts +607 -0
  39. package/dist/service-override/terminal.js +98 -0
  40. package/dist/service-override/tools/editor.js +1 -1
  41. package/dist/service-override/views.d.ts +561 -335
  42. package/dist/service-override/views.js +51 -11
  43. package/dist/services.d.ts +2627 -108
  44. package/dist/services.js +3 -0
  45. package/dist/severity.d.ts +16 -0
  46. package/dist/uri.d.ts +22 -11
  47. package/dist/views.d.ts +270 -0
  48. package/dist/vscode/vs/base/common/processes.js +24 -0
  49. package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/decorations.js +20 -0
  50. package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/delegatingEditorImpl.js +106 -0
  51. package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/diffEditorSash.js +59 -0
  52. package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/diffEditorWidget2.contribution.js +41 -0
  53. package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/diffEditorWidget2.js +369 -0
  54. package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/diffModel.js +247 -0
  55. package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/lineAlignment.js +179 -0
  56. package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/overviewRulerPart.js +121 -0
  57. package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/style.css.js +4 -0
  58. package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/unchangedRanges.js +184 -0
  59. package/dist/vscode/vs/editor/browser/widget/diffEditorWidget2/utils.js +88 -0
  60. package/dist/vscode/vs/platform/extensionManagement/common/extensionManagement.js +38 -1
  61. package/dist/vscode/vs/platform/extensionManagement/common/extensionManagementUtil.js +5 -1
  62. package/dist/vscode/vs/platform/extensionResourceLoader/common/extensionResourceLoader.js +13 -5
  63. package/dist/vscode/vs/platform/files/common/fileService.js +43 -5
  64. package/dist/vscode/vs/platform/files/common/files.js +3 -1
  65. package/dist/vscode/vs/platform/languagePacks/common/languagePacks.js +4 -1
  66. package/dist/vscode/vs/platform/log/common/bufferLog.js +34 -0
  67. package/dist/vscode/vs/platform/log/common/fileLog.js +105 -0
  68. package/dist/vscode/vs/platform/quickinput/browser/quickPickPin.js +1 -1
  69. package/dist/vscode/vs/platform/remote/common/remoteAuthorityResolver.js +20 -1
  70. package/dist/vscode/vs/platform/request/browser/requestService.js +1 -1
  71. package/dist/vscode/vs/platform/request/common/request.js +3 -3
  72. package/dist/vscode/vs/platform/storage/common/storage.js +3 -0
  73. package/dist/vscode/vs/platform/terminal/common/capabilities/bufferMarkCapability.js +39 -0
  74. package/dist/vscode/vs/platform/terminal/common/capabilities/commandDetectionCapability.js +565 -0
  75. package/dist/vscode/vs/platform/terminal/common/capabilities/cwdDetectionCapability.js +27 -0
  76. package/dist/vscode/vs/platform/terminal/common/capabilities/naiveCwdDetectionCapability.js +22 -0
  77. package/dist/vscode/vs/platform/terminal/common/capabilities/partialCommandDetectionCapability.js +46 -0
  78. package/dist/vscode/vs/platform/terminal/common/capabilities/terminalCapabilityStore.js +80 -0
  79. package/dist/vscode/vs/platform/terminal/common/environmentVariable.js +7 -0
  80. package/dist/vscode/vs/platform/terminal/common/environmentVariableCollection.js +196 -0
  81. package/dist/vscode/vs/platform/terminal/common/environmentVariableShared.js +23 -0
  82. package/dist/vscode/vs/platform/terminal/common/terminal.js +21 -1
  83. package/dist/vscode/vs/platform/terminal/common/terminalDataBuffering.js +45 -0
  84. package/dist/vscode/vs/platform/terminal/common/terminalEnvironment.js +37 -0
  85. package/dist/vscode/vs/platform/terminal/common/terminalPlatformConfiguration.js +622 -0
  86. package/dist/vscode/vs/platform/terminal/common/terminalProfiles.js +107 -0
  87. package/dist/vscode/vs/platform/terminal/common/terminalRecorder.js +66 -0
  88. package/dist/vscode/vs/platform/terminal/common/terminalStrings.js +16 -0
  89. package/dist/vscode/vs/platform/terminal/common/xterm/shellIntegrationAddon.js +321 -0
  90. package/dist/vscode/vs/platform/userDataSync/common/settingsMerge.js +39 -1
  91. package/dist/vscode/vs/platform/userDataSync/common/userDataSync.js +19 -0
  92. package/dist/vscode/vs/platform/window/common/window.js +7 -1
  93. package/dist/vscode/vs/platform/workspace/common/canonicalUri.js +3 -0
  94. package/dist/vscode/vs/platform/workspace/common/virtualWorkspace.js +4 -1
  95. package/dist/vscode/vs/platform/workspaces/common/workspaces.js +2 -2
  96. package/dist/vscode/vs/workbench/api/browser/mainThreadCommands.js +2 -3
  97. package/dist/vscode/vs/workbench/api/browser/mainThreadEditorTabs.js +473 -0
  98. package/dist/vscode/vs/workbench/api/browser/mainThreadLanguageFeatures.js +45 -38
  99. package/dist/vscode/vs/workbench/api/browser/mainThreadSearch.js +146 -0
  100. package/dist/vscode/vs/workbench/api/browser/mainThreadStatusBar.js +33 -52
  101. package/dist/vscode/vs/workbench/api/browser/mainThreadTerminalService.js +395 -0
  102. package/dist/vscode/vs/workbench/api/browser/mainThreadTheming.js +22 -0
  103. package/dist/vscode/vs/workbench/api/browser/mainThreadTreeViews.js +10 -5
  104. package/dist/vscode/vs/workbench/api/browser/mainThreadWindow.js +11 -4
  105. package/dist/vscode/vs/workbench/api/browser/mainThreadWorkspace.js +34 -11
  106. package/dist/vscode/vs/workbench/api/browser/statusBarExtensionPoint.js +81 -0
  107. package/dist/vscode/vs/workbench/api/common/extHost.protocol.js +7 -2
  108. package/dist/vscode/vs/workbench/api/common/extHostDebugService.js +4 -13
  109. package/dist/vscode/vs/workbench/api/common/extHostExtensionService.js +30 -15
  110. package/dist/vscode/vs/workbench/api/common/extHostFileSystemConsumer.js +20 -6
  111. package/dist/vscode/vs/workbench/api/common/extHostLanguageFeatures.js +41 -8
  112. package/dist/vscode/vs/workbench/api/common/extHostManagedSockets.js +3 -0
  113. package/dist/vscode/vs/workbench/api/common/extHostSearch.js +109 -0
  114. package/dist/vscode/vs/workbench/api/common/extHostStatusBar.js +33 -6
  115. package/dist/vscode/vs/workbench/api/common/extHostTerminalService.js +879 -1
  116. package/dist/vscode/vs/workbench/api/common/extHostTheming.js +38 -0
  117. package/dist/vscode/vs/workbench/api/common/extHostTreeViews.js +8 -5
  118. package/dist/vscode/vs/workbench/api/common/extHostTypeConverters.js +15 -17
  119. package/dist/vscode/vs/workbench/api/common/extHostTypes.js +117 -4
  120. package/dist/vscode/vs/workbench/api/common/extHostWindow.js +28 -6
  121. package/dist/vscode/vs/workbench/api/common/extHostWorkspace.js +28 -0
  122. package/dist/vscode/vs/workbench/api/common/shared/dataTransferCache.js +11 -14
  123. package/dist/vscode/vs/workbench/api/node/extHostTerminalService.js +22 -0
  124. package/dist/vscode/vs/workbench/browser/actions/layoutActions.js +2 -1
  125. package/dist/vscode/vs/workbench/browser/actions/windowActions.js +2 -2
  126. package/dist/vscode/vs/workbench/browser/dnd.js +56 -2
  127. package/dist/vscode/vs/workbench/browser/parts/compositePart.js +1 -1
  128. package/dist/vscode/vs/workbench/browser/parts/dialogs/dialogHandler.js +2 -2
  129. package/dist/vscode/vs/workbench/browser/parts/editor/editor.contribution.js +1 -0
  130. package/dist/vscode/vs/workbench/browser/parts/editor/editor.js +1 -0
  131. package/dist/vscode/vs/workbench/browser/parts/editor/editorCommands.js +9 -10
  132. package/dist/vscode/vs/workbench/browser/parts/editor/editorGroupView.js +15 -9
  133. package/dist/vscode/vs/workbench/browser/parts/editor/editorGroupWatermark.js +13 -17
  134. package/dist/vscode/vs/workbench/browser/parts/editor/editorStatus.js +1 -1
  135. package/dist/vscode/vs/workbench/browser/parts/editor/editorsObserver.js +2 -2
  136. package/dist/vscode/vs/workbench/browser/parts/editor/media/editorgroupview.css.js +1 -1
  137. package/dist/vscode/vs/workbench/browser/parts/editor/media/tabstitlecontrol.css.js +1 -1
  138. package/dist/vscode/vs/workbench/browser/parts/editor/noTabsTitleControl.js +3 -1
  139. package/dist/vscode/vs/workbench/browser/parts/editor/tabsTitleControl.js +60 -11
  140. package/dist/vscode/vs/workbench/browser/parts/editor/textDiffEditor.js +16 -10
  141. package/dist/vscode/vs/workbench/browser/parts/editor/textResourceEditor.js +1 -1
  142. package/dist/vscode/vs/workbench/browser/parts/statusbar/media/statusbarpart.css.js +1 -1
  143. package/dist/vscode/vs/workbench/browser/parts/views/checkbox.js +10 -0
  144. package/dist/vscode/vs/workbench/browser/parts/views/treeView.js +78 -14
  145. package/dist/vscode/vs/workbench/browser/parts/views/viewPaneContainer.js +1 -1
  146. package/dist/vscode/vs/workbench/browser/workbench.contribution.js +65 -6
  147. package/dist/vscode/vs/workbench/common/configuration.js +8 -1
  148. package/dist/vscode/vs/workbench/common/contextkeys.js +9 -1
  149. package/dist/vscode/vs/workbench/common/editor/editorGroupModel.js +5 -1
  150. package/dist/vscode/vs/workbench/common/editor/resourceEditorInput.js +6 -3
  151. package/dist/vscode/vs/workbench/common/editor/textResourceEditorInput.js +9 -6
  152. package/dist/vscode/vs/workbench/common/editor.js +1 -5
  153. package/dist/vscode/vs/workbench/common/resources.js +111 -34
  154. package/dist/vscode/vs/workbench/contrib/bulkEdit/browser/bulkEditService.js +1 -1
  155. package/dist/vscode/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.js +1 -1
  156. package/dist/vscode/vs/workbench/contrib/chat/browser/chat.js +3 -0
  157. package/dist/vscode/vs/workbench/contrib/chat/common/chatService.js +3 -0
  158. package/dist/vscode/vs/workbench/contrib/codeEditor/browser/languageConfigurationExtensionPoint.js +6 -4
  159. package/dist/vscode/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.css.js +4 -0
  160. package/dist/vscode/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.js +250 -0
  161. package/dist/vscode/vs/workbench/contrib/customEditor/browser/customEditorInput.js +290 -0
  162. package/dist/vscode/vs/workbench/contrib/customEditor/common/customEditor.js +3 -0
  163. package/dist/vscode/vs/workbench/contrib/debug/browser/debugActionViewItems.js +1 -0
  164. package/dist/vscode/vs/workbench/contrib/debug/browser/debugCommands.js +2 -1
  165. package/dist/vscode/vs/workbench/contrib/debug/browser/debugConfigurationManager.js +20 -20
  166. package/dist/vscode/vs/workbench/contrib/debug/browser/debugEditorActions.js +5 -3
  167. package/dist/vscode/vs/workbench/contrib/debug/browser/debugEditorContribution.js +5 -2
  168. package/dist/vscode/vs/workbench/contrib/debug/browser/debugHover.js +33 -6
  169. package/dist/vscode/vs/workbench/contrib/debug/browser/debugSession.js +1 -1
  170. package/dist/vscode/vs/workbench/contrib/debug/browser/debugTaskRunner.js +1 -1
  171. package/dist/vscode/vs/workbench/contrib/debug/browser/repl.js +3 -3
  172. package/dist/vscode/vs/workbench/contrib/debug/common/debugModel.js +29 -17
  173. package/dist/vscode/vs/workbench/contrib/debug/common/debugStorage.js +11 -10
  174. package/dist/vscode/vs/workbench/contrib/debug/common/debugger.js +10 -6
  175. package/dist/vscode/vs/workbench/contrib/extensions/browser/extensionsActions.js +2514 -0
  176. package/dist/vscode/vs/workbench/contrib/extensions/browser/extensionsIcons.js +82 -0
  177. package/dist/vscode/vs/workbench/contrib/extensions/browser/media/extensionActions.css.js +4 -0
  178. package/dist/vscode/vs/workbench/contrib/extensions/common/extensions.js +6 -1
  179. package/dist/vscode/vs/workbench/contrib/extensions/common/extensionsFileTemplate.js +16 -0
  180. package/dist/vscode/vs/workbench/contrib/files/browser/editors/fileEditorInput.js +2 -3
  181. package/dist/vscode/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +2 -0
  182. package/dist/vscode/vs/workbench/contrib/files/browser/explorerService.js +10 -6
  183. package/dist/vscode/vs/workbench/contrib/files/browser/explorerViewlet.js +3 -18
  184. package/dist/vscode/vs/workbench/contrib/files/browser/fileActions.contribution.js +37 -2
  185. package/dist/vscode/vs/workbench/contrib/files/browser/fileActions.js +65 -3
  186. package/dist/vscode/vs/workbench/contrib/files/browser/fileCommands.js +3 -3
  187. package/dist/vscode/vs/workbench/contrib/files/browser/fileConstants.js +3 -1
  188. package/dist/vscode/vs/workbench/contrib/files/browser/files.contribution.js +41 -6
  189. package/dist/vscode/vs/workbench/contrib/files/browser/files.js +1 -0
  190. package/dist/vscode/vs/workbench/contrib/files/browser/views/explorerView.js +3 -3
  191. package/dist/vscode/vs/workbench/contrib/files/browser/views/explorerViewer.js +6 -2
  192. package/dist/vscode/vs/workbench/contrib/files/common/explorerModel.js +16 -9
  193. package/dist/vscode/vs/workbench/contrib/files/common/files.js +1 -6
  194. package/dist/vscode/vs/workbench/contrib/interactive/browser/interactiveDocumentService.js +3 -0
  195. package/dist/vscode/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +200 -0
  196. package/dist/vscode/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +3 -0
  197. package/dist/vscode/vs/workbench/contrib/markers/browser/markers.contribution.js +586 -0
  198. package/dist/vscode/vs/workbench/contrib/markers/browser/markersFilterOptions.js +75 -0
  199. package/dist/vscode/vs/workbench/contrib/markers/browser/markersModel.js +201 -0
  200. package/dist/vscode/vs/workbench/contrib/markers/browser/markersTable.js +451 -0
  201. package/dist/vscode/vs/workbench/contrib/markers/browser/markersTreeViewer.js +670 -0
  202. package/dist/vscode/vs/workbench/contrib/markers/browser/markersView.js +857 -0
  203. package/dist/vscode/vs/workbench/contrib/markers/browser/markersViewActions.css.js +4 -0
  204. package/dist/vscode/vs/workbench/contrib/markers/browser/markersViewActions.js +132 -0
  205. package/dist/vscode/vs/workbench/contrib/markers/browser/media/markers.css.js +4 -0
  206. package/dist/vscode/vs/workbench/contrib/markers/browser/messages.js +171 -0
  207. package/dist/vscode/vs/workbench/contrib/markers/common/markers.js +15 -1
  208. package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +135 -0
  209. package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +421 -0
  210. package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +5 -0
  211. package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +55 -0
  212. package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/editing.js +54 -0
  213. package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +108 -0
  214. package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +334 -0
  215. package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +606 -0
  216. package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +307 -0
  217. package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +36 -0
  218. package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +165 -0
  219. package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/telemetry.js +78 -0
  220. package/dist/vscode/vs/workbench/contrib/mergeEditor/browser/utils.js +68 -0
  221. package/dist/vscode/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +2 -0
  222. package/dist/vscode/vs/workbench/contrib/notebook/browser/contrib/find/findFilters.js +70 -0
  223. package/dist/vscode/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.css.js +4 -0
  224. package/dist/vscode/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindReplaceWidget.js +158 -0
  225. package/dist/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser.js +6 -1
  226. package/dist/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.js +3 -0
  227. package/dist/vscode/vs/workbench/contrib/notebook/common/notebookCommon.js +16 -1
  228. package/dist/vscode/vs/workbench/contrib/notebook/common/notebookService.js +3 -0
  229. package/dist/vscode/vs/workbench/contrib/output/browser/logViewer.js +64 -0
  230. package/dist/vscode/vs/workbench/contrib/output/browser/output.contribution.js +378 -0
  231. package/dist/vscode/vs/workbench/contrib/output/browser/outputServices.js +39 -3
  232. package/dist/vscode/vs/workbench/contrib/output/browser/outputView.js +220 -0
  233. package/dist/vscode/vs/workbench/contrib/output/common/outputChannelModel.js +12 -3
  234. package/dist/vscode/vs/workbench/contrib/output/common/outputLinkComputer.js +129 -0
  235. package/dist/vscode/vs/workbench/contrib/preferences/browser/keybindingWidgets.js +270 -0
  236. package/dist/vscode/vs/workbench/contrib/preferences/browser/keybindingsEditor.js +1080 -0
  237. package/dist/vscode/vs/workbench/contrib/preferences/browser/media/keybindings.css.js +4 -0
  238. package/dist/vscode/vs/workbench/contrib/preferences/browser/media/keybindingsEditor.css.js +4 -0
  239. package/dist/vscode/vs/workbench/contrib/preferences/browser/media/preferences.css.js +4 -0
  240. package/dist/vscode/vs/workbench/contrib/preferences/browser/media/settingsEditor2.css.js +4 -0
  241. package/dist/vscode/vs/workbench/contrib/preferences/browser/media/settingsWidgets.css.js +4 -0
  242. package/dist/vscode/vs/workbench/contrib/preferences/browser/preferences.contribution.js +1154 -0
  243. package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesActions.js +94 -0
  244. package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesEditor.js +47 -0
  245. package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesIcons.js +37 -0
  246. package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesRenderers.js +731 -0
  247. package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesSearch.js +271 -0
  248. package/dist/vscode/vs/workbench/contrib/preferences/browser/preferencesWidgets.js +479 -0
  249. package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsEditor2.js +1465 -0
  250. package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsEditorSettingIndicators.js +506 -0
  251. package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsLayout.js +296 -0
  252. package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsSearchMenu.js +79 -0
  253. package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsTree.js +1984 -0
  254. package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsTreeModels.js +759 -0
  255. package/dist/vscode/vs/workbench/contrib/preferences/browser/settingsWidgets.js +1008 -0
  256. package/dist/vscode/vs/workbench/contrib/preferences/browser/tocTree.js +196 -0
  257. package/dist/vscode/vs/workbench/contrib/preferences/common/preferences.js +68 -0
  258. package/dist/vscode/vs/workbench/contrib/preferences/common/preferencesContribution.js +157 -0
  259. package/dist/vscode/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry.js +67 -0
  260. package/dist/vscode/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +16 -16
  261. package/dist/vscode/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.js +1 -2
  262. package/dist/vscode/vs/workbench/contrib/remote/browser/remoteExplorer.js +23 -2
  263. package/dist/vscode/vs/workbench/contrib/remote/browser/tunnelView.js +5 -5
  264. package/dist/vscode/vs/workbench/contrib/search/browser/media/searchview.css.js +4 -0
  265. package/dist/vscode/vs/workbench/contrib/search/browser/patternInputWidget.js +217 -0
  266. package/dist/vscode/vs/workbench/contrib/search/browser/replace.js +3 -0
  267. package/dist/vscode/vs/workbench/contrib/search/browser/replaceContributions.js +7 -0
  268. package/dist/vscode/vs/workbench/contrib/search/browser/replaceService.js +222 -0
  269. package/dist/vscode/vs/workbench/contrib/search/browser/search.contribution.js +54 -15
  270. package/dist/vscode/vs/workbench/contrib/search/browser/searchActionsBase.js +17 -0
  271. package/dist/vscode/vs/workbench/contrib/search/browser/searchFindInput.js +41 -0
  272. package/dist/vscode/vs/workbench/contrib/search/browser/searchIcons.js +35 -0
  273. package/dist/vscode/vs/workbench/contrib/search/browser/searchMessage.js +58 -0
  274. package/dist/vscode/vs/workbench/contrib/search/browser/searchModel.js +1842 -0
  275. package/dist/vscode/vs/workbench/contrib/search/browser/searchNotebookHelpers.js +49 -0
  276. package/dist/vscode/vs/workbench/contrib/search/browser/searchResultsView.js +379 -0
  277. package/dist/vscode/vs/workbench/contrib/search/browser/searchView.js +1867 -0
  278. package/dist/vscode/vs/workbench/contrib/search/browser/searchWidget.js +628 -0
  279. package/dist/vscode/vs/workbench/contrib/search/common/constants.js +30 -1
  280. package/dist/vscode/vs/workbench/contrib/search/common/search.js +9 -1
  281. package/dist/vscode/vs/workbench/contrib/search/common/searchHistoryService.js +42 -0
  282. package/dist/vscode/vs/workbench/contrib/searchEditor/browser/constants.js +11 -0
  283. package/dist/vscode/vs/workbench/contrib/searchEditor/browser/media/searchEditor.css.js +4 -0
  284. package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditor.contribution.js +477 -0
  285. package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditor.js +697 -0
  286. package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditorActions.js +188 -0
  287. package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditorInput.js +295 -0
  288. package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditorModel.js +135 -0
  289. package/dist/vscode/vs/workbench/contrib/searchEditor/browser/searchEditorSerialization.js +268 -0
  290. package/dist/vscode/vs/workbench/contrib/snippets/browser/tabCompletion.js +2 -2
  291. package/dist/vscode/vs/workbench/contrib/tasks/common/taskService.js +16 -1
  292. package/dist/vscode/vs/workbench/contrib/terminal/browser/environmentVariableInfo.js +119 -0
  293. package/dist/vscode/vs/workbench/contrib/terminal/browser/media/scrollbar.css.js +4 -0
  294. package/dist/vscode/vs/workbench/contrib/terminal/browser/media/terminal.css.js +4 -0
  295. package/dist/vscode/vs/workbench/contrib/terminal/browser/media/widgets.css.js +4 -0
  296. package/dist/vscode/vs/workbench/contrib/terminal/browser/media/xterm.css.js +4 -0
  297. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminal.contribution.js +238 -0
  298. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminal.js +4 -1
  299. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalActions.js +1930 -0
  300. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalCommands.js +22 -0
  301. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalConfigHelper.js +213 -0
  302. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalContextMenu.js +17 -0
  303. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalEditor.js +186 -0
  304. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalEditorInput.js +199 -0
  305. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalEditorService.js +239 -0
  306. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalExtensions.js +22 -0
  307. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalGroup.js +482 -0
  308. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalGroupService.js +372 -0
  309. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalIcon.js +60 -1
  310. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalIcons.js +37 -0
  311. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalInstance.js +2123 -0
  312. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalInstanceService.js +79 -0
  313. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalMainContribution.js +82 -0
  314. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalMenus.js +850 -0
  315. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +142 -0
  316. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProcessManager.js +618 -0
  317. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProfileQuickpick.js +278 -0
  318. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProfileResolverService.js +417 -0
  319. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalProfileService.js +213 -0
  320. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalQuickAccess.js +144 -0
  321. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalRunRecentQuickPick.js +267 -0
  322. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalService.js +1063 -0
  323. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalStatusList.js +108 -0
  324. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalTabbedView.js +417 -0
  325. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalTabsList.js +680 -0
  326. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalTooltip.js +72 -0
  327. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalUri.js +39 -0
  328. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalView.js +535 -0
  329. package/dist/vscode/vs/workbench/contrib/terminal/browser/widgets/widgetManager.js +36 -0
  330. package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/decorationAddon.js +469 -0
  331. package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/decorationStyles.js +97 -0
  332. package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/lineDataEventAddon.js +56 -0
  333. package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/markNavigationAddon.js +416 -0
  334. package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/suggestAddon.js +390 -0
  335. package/dist/vscode/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.js +587 -0
  336. package/dist/vscode/vs/workbench/contrib/terminal/common/environmentVariable.js +3 -0
  337. package/dist/vscode/vs/workbench/contrib/terminal/common/environmentVariableService.js +94 -0
  338. package/dist/vscode/vs/workbench/contrib/terminal/common/history.js +356 -0
  339. package/dist/vscode/vs/workbench/contrib/terminal/common/terminal.js +266 -0
  340. package/dist/vscode/vs/workbench/contrib/terminal/common/terminalColorRegistry.js +23 -16
  341. package/dist/vscode/vs/workbench/contrib/terminal/common/terminalConfiguration.js +965 -0
  342. package/dist/vscode/vs/workbench/contrib/terminal/common/terminalContextKey.js +157 -0
  343. package/dist/vscode/vs/workbench/contrib/terminal/common/terminalEnvironment.js +272 -0
  344. package/dist/vscode/vs/workbench/contrib/terminal/common/terminalExtensionPoints.js +27 -0
  345. package/dist/vscode/vs/workbench/contrib/terminal/common/terminalStrings.js +86 -0
  346. package/dist/vscode/vs/workbench/contrib/terminal/electron-sandbox/terminalProfileResolverService.js +46 -0
  347. package/dist/vscode/vs/workbench/contrib/terminalContrib/links/browser/links.js +3 -0
  348. package/dist/vscode/vs/workbench/contrib/terminalContrib/links/browser/terminalLinkProviderService.js +26 -0
  349. package/dist/vscode/vs/workbench/contrib/terminalContrib/quickFix/browser/quickFix.js +3 -0
  350. package/dist/vscode/vs/workbench/contrib/terminalContrib/quickFix/browser/terminalQuickFixService.js +143 -0
  351. package/dist/vscode/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput.js +85 -0
  352. package/dist/vscode/vs/workbench/contrib/webviewPanel/browser/webviewWorkbenchService.js +52 -0
  353. package/dist/vscode/vs/workbench/services/actions/common/menusExtensionPoint.js +14 -6
  354. package/dist/vscode/vs/workbench/services/assignment/common/assignmentService.js +3 -0
  355. package/dist/vscode/vs/workbench/services/configuration/browser/configurationService.js +13 -13
  356. package/dist/vscode/vs/workbench/services/configuration/common/configuration.js +2 -1
  357. package/dist/vscode/vs/workbench/services/configuration/common/configurationEditing.js +2 -2
  358. package/dist/vscode/vs/workbench/services/configuration/common/jsonEditingService.js +2 -2
  359. package/dist/vscode/vs/workbench/services/dialogs/browser/abstractFileDialogService.js +302 -0
  360. package/dist/vscode/vs/workbench/services/dialogs/browser/simpleFileDialog.js +971 -0
  361. package/dist/vscode/vs/workbench/services/extensionManagement/common/extensionManagement.js +3 -2
  362. package/dist/vscode/vs/workbench/services/extensionRecommendations/common/extensionRecommendations.js +4 -0
  363. package/dist/vscode/vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig.js +2 -0
  364. package/dist/vscode/vs/workbench/services/extensions/common/extensionManifestPropertiesService.js +3 -0
  365. package/dist/vscode/vs/workbench/services/extensions/common/extensions.js +14 -2
  366. package/dist/vscode/vs/workbench/services/extensions/common/extensionsApiProposals.js +10 -1
  367. package/dist/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.js +70 -3
  368. package/dist/vscode/vs/workbench/services/hover/browser/hoverService.js +1 -1
  369. package/dist/vscode/vs/workbench/services/hover/browser/hoverWidget.js +2 -1
  370. package/dist/vscode/vs/workbench/services/hover/browser/media/hover.css.js +1 -1
  371. package/dist/vscode/vs/workbench/services/keybinding/common/keybindingEditing.js +275 -0
  372. package/dist/vscode/vs/workbench/services/localization/common/locale.js +3 -0
  373. package/dist/vscode/vs/workbench/services/log/common/logConstants.js +2 -0
  374. package/dist/vscode/vs/workbench/services/output/common/output.js +4 -1
  375. package/dist/vscode/vs/workbench/services/preferences/common/preferences.js +22 -1
  376. package/dist/vscode/vs/workbench/services/preferences/common/preferencesModels.js +6 -0
  377. package/dist/vscode/vs/workbench/services/preferences/common/preferencesValidation.js +37 -1
  378. package/dist/vscode/vs/workbench/services/remote/common/remoteAgentService.js +69 -0
  379. package/dist/vscode/vs/workbench/services/remote/common/remoteExplorerService.js +66 -27
  380. package/dist/vscode/vs/workbench/services/search/common/fileSearchManager.js +265 -0
  381. package/dist/vscode/vs/workbench/services/search/common/queryBuilder.js +6 -0
  382. package/dist/vscode/vs/workbench/services/search/common/replace.js +203 -0
  383. package/dist/vscode/vs/workbench/services/search/common/search.js +227 -1
  384. package/dist/vscode/vs/workbench/services/search/common/searchExtTypes.js +6 -0
  385. package/dist/vscode/vs/workbench/services/search/common/searchHelpers.js +72 -0
  386. package/dist/vscode/vs/workbench/services/search/common/searchService.js +355 -0
  387. package/dist/vscode/vs/workbench/services/search/common/textSearchManager.js +309 -0
  388. package/dist/vscode/vs/workbench/services/suggest/browser/media/suggest.css.js +4 -0
  389. package/dist/vscode/vs/workbench/services/suggest/browser/simpleCompletionItem.js +10 -0
  390. package/dist/vscode/vs/workbench/services/suggest/browser/simpleCompletionModel.js +98 -0
  391. package/dist/vscode/vs/workbench/services/suggest/browser/simpleSuggestWidget.js +399 -0
  392. package/dist/vscode/vs/workbench/services/suggest/browser/simpleSuggestWidgetRenderer.js +83 -0
  393. package/dist/vscode/vs/workbench/services/terminal/common/embedderTerminalService.js +3 -0
  394. package/dist/vscode/vs/workbench/services/textfile/browser/textFileService.js +1 -1
  395. package/dist/vscode/vs/workbench/services/textfile/common/textFileEditorModel.js +10 -3
  396. package/dist/vscode/vs/workbench/services/themes/browser/fileIconThemeData.js +3 -3
  397. package/dist/vscode/vs/workbench/services/themes/browser/productIconThemeData.js +3 -3
  398. package/dist/vscode/vs/workbench/services/themes/common/colorThemeData.js +3 -3
  399. package/dist/vscode/vs/workbench/services/untitled/common/untitledTextEditorInput.js +6 -4
  400. package/dist/vscode/vs/workbench/services/untitled/common/untitledTextEditorModel.js +3 -0
  401. package/dist/vscode/vs/workbench/services/untitled/common/untitledTextEditorService.js +4 -0
  402. package/dist/vscode/vs/workbench/services/userActivity/common/userActivityRegistry.js +15 -0
  403. package/dist/vscode/vs/workbench/services/userActivity/common/userActivityService.js +37 -0
  404. package/dist/vscode/vs/workbench/services/userDataSync/common/userDataSync.js +7 -0
  405. package/dist/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService.js +40 -0
  406. package/dist/vscode/vs/workbench/services/workingCopy/common/workingCopyService.js +12 -0
  407. package/dist/vscode/vs/workbench/services/workspaces/common/canonicalUriService.js +19 -0
  408. package/dist/vscode-default-extensions/css/syntaxes/css.tmLanguage.json.extensionResource.js +1 -1
  409. package/dist/vscode-default-extensions/json/package.json.js +1 -1
  410. package/dist/vscode-default-extensions/json/syntaxes/JSONC.tmLanguage.json.extensionResource.js +1 -1
  411. package/dist/vscode-default-extensions/json/syntaxes/JSONL.tmLanguage.json.extensionResource.js +2 -0
  412. package/dist/vscode-default-extensions/latex/syntaxes/Bibtex.tmLanguage.json.extensionResource.js +1 -1
  413. package/dist/vscode-default-extensions/latex/syntaxes/LaTeX.tmLanguage.json.extensionResource.js +1 -1
  414. package/dist/vscode-default-extensions/latex/syntaxes/TeX.tmLanguage.json.extensionResource.js +1 -1
  415. package/dist/vscode-default-extensions/latex/syntaxes/cpp-grammar-bailout.tmLanguage.json.extensionResource.js +1 -1
  416. package/dist/vscode-default-extensions/latex/syntaxes/markdown-latex-combined.tmLanguage.json.extensionResource.js +1 -1
  417. package/dist/vscode-default-extensions/lua/syntaxes/lua.tmLanguage.json.extensionResource.js +1 -1
  418. package/dist/vscode-default-extensions/perl/package.json.js +1 -1
  419. package/dist/vscode-default-extensions/php/snippets/php.code-snippets.extensionResource.js +1 -1
  420. package/dist/vscode-default-extensions/sql/language-configuration.json.extensionResource.js +1 -1
  421. package/dist/vscode-default-extensions/theme-abyss/themes/abyss-color-theme.json.extensionResource.js +1 -1
  422. package/dist/vscode-default-extensions/theme-defaults/package.json.js +1 -1
  423. package/dist/vscode-default-extensions/theme-defaults/themes/dark_modern.json.extensionResource.js +2 -0
  424. package/dist/vscode-default-extensions/theme-defaults/themes/dark_vs.json.extensionResource.js +1 -1
  425. package/dist/vscode-default-extensions/theme-defaults/themes/hc_black.json.extensionResource.js +1 -1
  426. package/dist/vscode-default-extensions/theme-defaults/themes/hc_light.json.extensionResource.js +1 -1
  427. package/dist/vscode-default-extensions/theme-defaults/themes/light_modern.json.extensionResource.js +2 -0
  428. package/dist/vscode-default-extensions/theme-defaults/themes/light_vs.json.extensionResource.js +1 -1
  429. package/dist/vscode-default-extensions/theme-kimbie-dark/themes/kimbie-dark-color-theme.json.extensionResource.js +1 -1
  430. package/dist/vscode-default-extensions/theme-monokai/themes/monokai-color-theme.json.extensionResource.js +1 -1
  431. package/dist/vscode-default-extensions/theme-monokai-dimmed/themes/dimmed-monokai-color-theme.json.extensionResource.js +1 -1
  432. package/dist/vscode-default-extensions/theme-quietlight/themes/quietlight-color-theme.json.extensionResource.js +1 -1
  433. package/dist/vscode-default-extensions/theme-red/themes/Red-color-theme.json.extensionResource.js +1 -1
  434. package/dist/vscode-default-extensions/theme-seti/icons/vs-seti-icon-theme.json.extensionResource.js +1 -1
  435. package/dist/vscode-default-extensions/theme-solarized-dark/themes/solarized-dark-color-theme.json.extensionResource.js +1 -1
  436. package/dist/vscode-default-extensions/theme-solarized-light/themes/solarized-light-color-theme.json.extensionResource.js +1 -1
  437. package/dist/vscode-default-extensions/theme-tomorrow-night-blue/themes/tomorrow-night-blue-color-theme.json.extensionResource.js +1 -1
  438. package/dist/vscode-default-extensions/vb/language-configuration.json.extensionResource.js +1 -1
  439. package/dist/vscode-services/env.js +4 -2
  440. package/dist/vscode-services/extHost.js +32 -48
  441. package/dist/vscode-services/missing-services.js +407 -29
  442. package/dist/vscode-services/window.js +59 -65
  443. package/dist/vscode-services/workspace.js +19 -5
  444. package/dist/workers/outputLinkComputer.worker.d.ts +2 -0
  445. package/dist/workers/outputLinkComputer.worker.js +3 -0
  446. package/dist/workspace.d.ts +1 -1
  447. package/monaco-editor-treemending.patch +1305 -1184
  448. package/package.json +65 -19
  449. package/dist/activity.d.ts +0 -2802
  450. package/dist/collections.d.ts +0 -7
  451. package/dist/colorRegistry.d.ts +0 -710
  452. package/dist/vscode/vs/platform/product/common/product.js +0 -48
  453. package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionFollowups.js +0 -30
  454. package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionInputPart.js +0 -196
  455. package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionListRenderer.js +0 -622
  456. package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionOptions.js +0 -77
  457. package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionWidget.js +0 -311
  458. package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/media/interactiveSession.css.js +0 -4
  459. package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionContextKeys.js +0 -56
  460. package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionModel.js +0 -305
  461. package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionService.js +0 -13
  462. package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionServiceImpl.js +0 -379
  463. package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionViewModel.js +0 -207
  464. package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionWidgetHistoryService.js +0 -3
  465. package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionWordCounter.js +0 -25
  466. package/dist/vscode-default-extensions/theme-defaults/themes/dark_plus_experimental.json.extensionResource.js +0 -2
  467. package/dist/vscode-default-extensions/theme-defaults/themes/light_plus_experimental.json.extensionResource.js +0 -2
@@ -0,0 +1,2123 @@
1
+ import { __decorate, __param } from '../../../../../../node_modules/tslib/tslib.es6.js';
2
+ import { isFirefox } from 'monaco-editor/esm/vs/base/browser/browser.js';
3
+ import { BrowserFeatures } from 'monaco-editor/esm/vs/base/browser/canIUse.js';
4
+ import { DataTransfers } from 'monaco-editor/esm/vs/base/browser/dnd.js';
5
+ import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
6
+ import { StandardKeyboardEvent } from 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
7
+ import { DomScrollableElement } from 'monaco-editor/esm/vs/base/browser/ui/scrollbar/scrollableElement.js';
8
+ import { AutoOpenBarrier, timeout, Promises } from 'monaco-editor/esm/vs/base/common/async.js';
9
+ import { Codicon, getAllCodicons } from 'monaco-editor/esm/vs/base/common/codicons.js';
10
+ import { debounce } from 'monaco-editor/esm/vs/base/common/decorators.js';
11
+ import { onUnexpectedError, ErrorNoTelemetry } from 'monaco-editor/esm/vs/base/common/errors.js';
12
+ import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
13
+ import { template } from 'monaco-editor/esm/vs/base/common/labels.js';
14
+ import { Disposable, toDisposable, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
15
+ import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
16
+ import * as path from 'monaco-editor/esm/vs/base/common/path.js';
17
+ import { OS, isMacintosh, isWindows } from 'monaco-editor/esm/vs/base/common/platform.js';
18
+ import { withNullAsUndefined } from 'monaco-editor/esm/vs/base/common/types.js';
19
+ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
20
+ import { TabFocus } from 'monaco-editor/esm/vs/editor/browser/config/tabFocus.js';
21
+ import * as nls from 'monaco-editor/esm/vs/nls.js';
22
+ import { IAccessibilityService } from 'monaco-editor/esm/vs/platform/accessibility/common/accessibility.js';
23
+ import { IClipboardService } from 'monaco-editor/esm/vs/platform/clipboard/common/clipboardService.js';
24
+ import { ICommandService } from 'monaco-editor/esm/vs/platform/commands/common/commands.js';
25
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
26
+ import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
27
+ import { IDialogService } from 'monaco-editor/esm/vs/platform/dialogs/common/dialogs.js';
28
+ import { containsDragType, CodeDataTransfers } from 'monaco-editor/esm/vs/platform/dnd/browser/dnd.js';
29
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
30
+ import { ServiceCollection } from 'monaco-editor/esm/vs/platform/instantiation/common/serviceCollection.js';
31
+ import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
32
+ import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
33
+ import { Severity, INotificationService } from 'monaco-editor/esm/vs/platform/notification/common/notification.js';
34
+ import { IOpenerService } from 'monaco-editor/esm/vs/platform/opener/common/opener.js';
35
+ import { IProductService } from 'monaco-editor/esm/vs/platform/product/common/productService.js';
36
+ import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
37
+ import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
38
+ import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
39
+ import { TerminalCapabilityStoreMultiplexer } from '../../../../platform/terminal/common/capabilities/terminalCapabilityStore.js';
40
+ import { TitleEventSource, TerminalLocation, TerminalExitReason } from '../../../../platform/terminal/common/terminal.js';
41
+ import { formatMessageForTerminal } from '../../../../platform/terminal/common/terminalStrings.js';
42
+ import { getIconRegistry } from 'monaco-editor/esm/vs/platform/theme/common/iconRegistry.js';
43
+ import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
44
+ import { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
45
+ import { IWorkspaceTrustRequestService } from 'monaco-editor/esm/vs/platform/workspace/common/workspaceTrust.js';
46
+ import { IViewsService, IViewDescriptorService } from '../../../common/views.js';
47
+ import { TerminalLaunchHelpAction } from './terminalActions.js';
48
+ import { TerminalEditorInput } from './terminalEditorInput.js';
49
+ import { getStandardColors, getColorStyleElement, getColorClass } from './terminalIcon.js';
50
+ import { TerminalProcessManager } from './terminalProcessManager.js';
51
+ import { showRunRecentQuickPick } from './terminalRunRecentQuickPick.js';
52
+ import { TerminalStatusList } from './terminalStatusList.js';
53
+ import { getTerminalUri, getTerminalResourcesFromDragEvent } from './terminalUri.js';
54
+ import { TerminalWidgetManager } from './widgets/widgetManager.js';
55
+ import { LineDataEventAddon } from './xterm/lineDataEventAddon.js';
56
+ import { XtermTerminal } from './xterm/xtermTerminal.js';
57
+ import { deserializeEnvironmentVariableCollections } from '../../../../platform/terminal/common/environmentVariableShared.js';
58
+ import { getDirectoryHistory, getCommandHistory } from '../common/history.js';
59
+ import { TERMINAL_VIEW_ID, TERMINAL_CREATION_COMMANDS, DEFAULT_COMMANDS_TO_SKIP_SHELL, ITerminalProfileResolverService } from '../common/terminal.js';
60
+ import { TerminalContextKeys } from '../common/terminalContextKey.js';
61
+ import { IEditorService } from '../../../services/editor/common/editorService.js';
62
+ import { IWorkbenchEnvironmentService } from '../../../services/environment/common/environmentService.js';
63
+ import { IHistoryService } from '../../../services/history/common/history.js';
64
+ import { IWorkbenchLayoutService } from '../../../services/layout/browser/layoutService.js';
65
+ import { IPathService } from '../../../services/path/common/pathService.js';
66
+ import { IPreferencesService } from '../../../services/preferences/common/preferences.js';
67
+ import { AudioCue, IAudioCueService } from 'monaco-editor/esm/vs/platform/audioCues/browser/audioCueService.js';
68
+ import { IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
69
+ import { preparePathForShell, getWorkspaceForTerminal } from '../common/terminalEnvironment.js';
70
+ import { TERMINAL_BACKGROUND_COLOR } from '../common/terminalColorRegistry.js';
71
+ import { editorBackground } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
72
+ import { PANEL_BACKGROUND, SIDE_BAR_BACKGROUND } from '../../../common/theme.js';
73
+ import { TerminalExtensionsRegistry } from './terminalExtensions.js';
74
+ let xtermConstructor;
75
+ function getXtermConstructor(keybinding) {
76
+ if (xtermConstructor) {
77
+ return xtermConstructor;
78
+ }
79
+ xtermConstructor = Promises.withAsyncBody(async (resolve) => {
80
+ const Terminal = (await import('xterm').then(module => module.default ?? module)).Terminal;
81
+ Terminal.strings.promptLabel = ( nls.localize('terminal.integrated.a11yPromptLabel', 'Terminal input'));
82
+ Terminal.strings.tooMuchOutput = keybinding ? ( nls.localize(
83
+ 'terminal.integrated.useAccessibleBuffer',
84
+ 'Use the accessible buffer {0} to manually review output',
85
+ keybinding.getLabel()
86
+ )) : ( nls.localize(
87
+ 'terminal.integrated.useAccessibleBufferNoKb',
88
+ 'Use the Terminal: Focus Accessible Buffer command to manually review output'
89
+ ));
90
+ resolve(Terminal);
91
+ });
92
+ return xtermConstructor;
93
+ }
94
+ const shellIntegrationSupportedShellTypes = [
95
+ "bash" ,
96
+ "zsh" ,
97
+ "pwsh" ,
98
+ "pwsh"
99
+ ];
100
+ let TerminalInstance = class TerminalInstance extends Disposable {
101
+ get domElement() { return this._wrapperElement; }
102
+ get usedShellIntegrationInjection() { return this._usedShellIntegrationInjection; }
103
+ get extEnvironmentVariableCollection() { return this._processManager.extEnvironmentVariableCollection; }
104
+ get waitOnExit() { return this._shellLaunchConfig.attachPersistentProcess?.waitOnExit || this._shellLaunchConfig.waitOnExit; }
105
+ set waitOnExit(value) {
106
+ this._shellLaunchConfig.waitOnExit = value;
107
+ }
108
+ get target() { return this._target; }
109
+ set target(value) { this._target = value; }
110
+ get instanceId() { return this._instanceId; }
111
+ get resource() { return this._resource; }
112
+ get cols() {
113
+ if (this._fixedCols !== undefined) {
114
+ return this._fixedCols;
115
+ }
116
+ if (this._dimensionsOverride && this._dimensionsOverride.cols) {
117
+ if (this._dimensionsOverride.forceExactSize) {
118
+ return this._dimensionsOverride.cols;
119
+ }
120
+ return Math.min(Math.max(this._dimensionsOverride.cols, 2), this._cols);
121
+ }
122
+ return this._cols;
123
+ }
124
+ get rows() {
125
+ if (this._fixedRows !== undefined) {
126
+ return this._fixedRows;
127
+ }
128
+ if (this._dimensionsOverride && this._dimensionsOverride.rows) {
129
+ if (this._dimensionsOverride.forceExactSize) {
130
+ return this._dimensionsOverride.rows;
131
+ }
132
+ return Math.min(Math.max(this._dimensionsOverride.rows, 2), this._rows);
133
+ }
134
+ return this._rows;
135
+ }
136
+ get isDisposed() { return this._isDisposed; }
137
+ get fixedCols() { return this._fixedCols; }
138
+ get fixedRows() { return this._fixedRows; }
139
+ get maxCols() { return this._cols; }
140
+ get maxRows() { return this._rows; }
141
+ get processId() { return this._processManager.shellProcessId; }
142
+ get processReady() { return this._processManager.ptyProcessReady; }
143
+ get hasChildProcesses() { return this.shellLaunchConfig.attachPersistentProcess?.hasChildProcesses || this._processManager.hasChildProcesses; }
144
+ get reconnectionProperties() { return this.shellLaunchConfig.attachPersistentProcess?.reconnectionProperties || this.shellLaunchConfig.reconnectionProperties; }
145
+ get areLinksReady() { return this._areLinksReady; }
146
+ get initialDataEvents() { return this._initialDataEvents; }
147
+ get exitCode() { return this._exitCode; }
148
+ get exitReason() { return this._exitReason; }
149
+ get hadFocusOnExit() { return this._hadFocusOnExit; }
150
+ get isTitleSetByProcess() { return !!this._messageTitleDisposable; }
151
+ get shellLaunchConfig() { return this._shellLaunchConfig; }
152
+ get shellType() { return this._shellType; }
153
+ get os() { return this._processManager.os; }
154
+ get isRemote() { return this._processManager.remoteAuthority !== undefined; }
155
+ get remoteAuthority() { return this._processManager.remoteAuthority; }
156
+ get hasFocus() { return this._wrapperElement.contains(document.activeElement) ?? false; }
157
+ get title() { return this._title; }
158
+ get titleSource() { return this._titleSource; }
159
+ get icon() { return this._getIcon(); }
160
+ get color() { return this._getColor(); }
161
+ get processName() { return this._processName; }
162
+ get sequence() { return this._sequence; }
163
+ get staticTitle() { return this._staticTitle; }
164
+ get workspaceFolder() { return this._workspaceFolder; }
165
+ get cwd() { return this._cwd; }
166
+ get initialCwd() { return this._initialCwd; }
167
+ get description() {
168
+ if (this._description) {
169
+ return this._description;
170
+ }
171
+ const type = this.shellLaunchConfig.attachPersistentProcess?.type || this.shellLaunchConfig.type;
172
+ if (type) {
173
+ if (type === 'Task') {
174
+ return ( nls.localize('terminalTypeTask', "Task"));
175
+ }
176
+ return ( nls.localize('terminalTypeLocal', "Local"));
177
+ }
178
+ return undefined;
179
+ }
180
+ get userHome() { return this._userHome; }
181
+ get shellIntegrationNonce() { return this._processManager.shellIntegrationNonce; }
182
+ get injectedArgs() { return this._injectedArgs; }
183
+ constructor(_terminalShellTypeContextKey, _terminalInRunCommandPicker, _terminalSuggestWidgetVisibleContextKey, _configHelper, _shellLaunchConfig, _contextKeyService, instantiationService, _terminalProfileResolverService, _pathService, _keybindingService, _notificationService, _preferencesService, _viewsService, _clipboardService, _themeService, _configurationService, _logService, _dialogService, _storageService, _accessibilityService, _productService, _quickInputService, workbenchEnvironmentService, _workspaceContextService, _editorService, _workspaceTrustRequestService, _historyService, _telemetryService, _openerService, _commandService, _audioCueService, _viewDescriptorService) {
184
+ super();
185
+ this._terminalShellTypeContextKey = _terminalShellTypeContextKey;
186
+ this._terminalInRunCommandPicker = _terminalInRunCommandPicker;
187
+ this._terminalSuggestWidgetVisibleContextKey = _terminalSuggestWidgetVisibleContextKey;
188
+ this._configHelper = _configHelper;
189
+ this._shellLaunchConfig = _shellLaunchConfig;
190
+ this._contextKeyService = _contextKeyService;
191
+ this._terminalProfileResolverService = _terminalProfileResolverService;
192
+ this._pathService = _pathService;
193
+ this._keybindingService = _keybindingService;
194
+ this._notificationService = _notificationService;
195
+ this._preferencesService = _preferencesService;
196
+ this._viewsService = _viewsService;
197
+ this._clipboardService = _clipboardService;
198
+ this._themeService = _themeService;
199
+ this._configurationService = _configurationService;
200
+ this._logService = _logService;
201
+ this._dialogService = _dialogService;
202
+ this._storageService = _storageService;
203
+ this._accessibilityService = _accessibilityService;
204
+ this._productService = _productService;
205
+ this._quickInputService = _quickInputService;
206
+ this._workspaceContextService = _workspaceContextService;
207
+ this._editorService = _editorService;
208
+ this._workspaceTrustRequestService = _workspaceTrustRequestService;
209
+ this._historyService = _historyService;
210
+ this._telemetryService = _telemetryService;
211
+ this._openerService = _openerService;
212
+ this._commandService = _commandService;
213
+ this._audioCueService = _audioCueService;
214
+ this._viewDescriptorService = _viewDescriptorService;
215
+ this._contributions = ( new Map());
216
+ this._latestXtermWriteData = 0;
217
+ this._latestXtermParseData = 0;
218
+ this._title = '';
219
+ this._titleSource = TitleEventSource.Process;
220
+ this._cols = 0;
221
+ this._rows = 0;
222
+ this._cwd = undefined;
223
+ this._initialCwd = undefined;
224
+ this._injectedArgs = undefined;
225
+ this._layoutSettingsChanged = true;
226
+ this._areLinksReady = false;
227
+ this._initialDataEvents = [];
228
+ this._widgetManager = ( new TerminalWidgetManager());
229
+ this._processName = '';
230
+ this._usedShellIntegrationInjection = false;
231
+ this.capabilities = ( new TerminalCapabilityStoreMultiplexer());
232
+ this.disableLayout = false;
233
+ this._onExit = ( new Emitter());
234
+ this.onExit = this._onExit.event;
235
+ this._onDisposed = this._register(( new Emitter()));
236
+ this.onDisposed = this._onDisposed.event;
237
+ this._onProcessIdReady = this._register(( new Emitter()));
238
+ this.onProcessIdReady = this._onProcessIdReady.event;
239
+ this._onTitleChanged = this._register(( new Emitter()));
240
+ this.onTitleChanged = this._onTitleChanged.event;
241
+ this._onIconChanged = this._register(( new Emitter()));
242
+ this.onIconChanged = this._onIconChanged.event;
243
+ this._onData = this._register(( new Emitter()));
244
+ this.onData = this._onData.event;
245
+ this._onBinary = this._register(( new Emitter()));
246
+ this.onBinary = this._onBinary.event;
247
+ this._onLineData = this._register(( new Emitter({
248
+ onDidAddFirstListener: () => this._onLineDataSetup()
249
+ })));
250
+ this.onLineData = this._onLineData.event;
251
+ this._onRequestExtHostProcess = this._register(( new Emitter()));
252
+ this.onRequestExtHostProcess = this._onRequestExtHostProcess.event;
253
+ this._onDimensionsChanged = this._register(( new Emitter()));
254
+ this.onDimensionsChanged = this._onDimensionsChanged.event;
255
+ this._onMaximumDimensionsChanged = this._register(( new Emitter()));
256
+ this.onMaximumDimensionsChanged = this._onMaximumDimensionsChanged.event;
257
+ this._onDidFocus = this._register(( new Emitter()));
258
+ this.onDidFocus = this._onDidFocus.event;
259
+ this._onDidRequestFocus = this._register(( new Emitter()));
260
+ this.onDidRequestFocus = this._onDidRequestFocus.event;
261
+ this._onDidBlur = this._register(( new Emitter()));
262
+ this.onDidBlur = this._onDidBlur.event;
263
+ this._onDidInputData = this._register(( new Emitter()));
264
+ this.onDidInputData = this._onDidInputData.event;
265
+ this._onRequestAddInstanceToGroup = this._register(( new Emitter()));
266
+ this.onRequestAddInstanceToGroup = this._onRequestAddInstanceToGroup.event;
267
+ this._onDidChangeHasChildProcesses = this._register(( new Emitter()));
268
+ this.onDidChangeHasChildProcesses = this._onDidChangeHasChildProcesses.event;
269
+ this._wrapperElement = document.createElement('div');
270
+ this._wrapperElement.classList.add('terminal-wrapper');
271
+ this._skipTerminalCommands = [];
272
+ this._isExiting = false;
273
+ this._hadFocusOnExit = false;
274
+ this._isVisible = false;
275
+ this._isDisposed = false;
276
+ this._instanceId = TerminalInstance._instanceIdCounter++;
277
+ this._hasHadInput = false;
278
+ this._fixedRows = _shellLaunchConfig.attachPersistentProcess?.fixedDimensions?.rows;
279
+ this._fixedCols = _shellLaunchConfig.attachPersistentProcess?.fixedDimensions?.cols;
280
+ this._resource = getTerminalUri(this._workspaceContextService.getWorkspace().id, this.instanceId, this.title);
281
+ if (this._shellLaunchConfig.attachPersistentProcess?.hideFromUser) {
282
+ this._shellLaunchConfig.hideFromUser = this._shellLaunchConfig.attachPersistentProcess.hideFromUser;
283
+ }
284
+ if (this._shellLaunchConfig.attachPersistentProcess?.isFeatureTerminal) {
285
+ this._shellLaunchConfig.isFeatureTerminal = this._shellLaunchConfig.attachPersistentProcess.isFeatureTerminal;
286
+ }
287
+ if (this._shellLaunchConfig.attachPersistentProcess?.type) {
288
+ this._shellLaunchConfig.type = this._shellLaunchConfig.attachPersistentProcess.type;
289
+ }
290
+ if (this.shellLaunchConfig.cwd) {
291
+ const cwdUri = typeof this._shellLaunchConfig.cwd === 'string' ? ( URI.from({
292
+ scheme: Schemas.file,
293
+ path: this._shellLaunchConfig.cwd
294
+ })) : this._shellLaunchConfig.cwd;
295
+ if (cwdUri) {
296
+ this._workspaceFolder = withNullAsUndefined(this._workspaceContextService.getWorkspaceFolder(cwdUri));
297
+ }
298
+ }
299
+ if (!this._workspaceFolder) {
300
+ const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot();
301
+ this._workspaceFolder = activeWorkspaceRootUri ? withNullAsUndefined(this._workspaceContextService.getWorkspaceFolder(activeWorkspaceRootUri)) : undefined;
302
+ }
303
+ const scopedContextKeyService = this._register(_contextKeyService.createScoped(this._wrapperElement));
304
+ this._scopedInstantiationService = instantiationService.createChild(( new ServiceCollection([IContextKeyService, scopedContextKeyService])));
305
+ this._terminalFocusContextKey = TerminalContextKeys.focus.bindTo(scopedContextKeyService);
306
+ this._terminalHasFixedWidth = TerminalContextKeys.terminalHasFixedWidth.bindTo(scopedContextKeyService);
307
+ this._terminalHasTextContextKey = TerminalContextKeys.textSelected.bindTo(scopedContextKeyService);
308
+ this._terminalAltBufferActiveContextKey = TerminalContextKeys.altBufferActive.bindTo(scopedContextKeyService);
309
+ this._terminalShellIntegrationEnabledContextKey = TerminalContextKeys.terminalShellIntegrationEnabled.bindTo(scopedContextKeyService);
310
+ this._logService.trace(`terminalInstance#ctor (instanceId: ${this.instanceId})`, this._shellLaunchConfig);
311
+ this._register(this.capabilities.onDidAddCapability(e => {
312
+ this._logService.debug('terminalInstance added capability', e);
313
+ if (e === 0 ) {
314
+ this.capabilities.get(0 )?.onDidChangeCwd(e => {
315
+ this._cwd = e;
316
+ this._setTitle(this.title, TitleEventSource.Config);
317
+ this._scopedInstantiationService.invokeFunction(getDirectoryHistory)?.add(e, { remoteAuthority: this.remoteAuthority });
318
+ });
319
+ }
320
+ else if (e === 2 ) {
321
+ const commandCapability = this.capabilities.get(2 );
322
+ commandCapability?.onCommandFinished(e => {
323
+ if (e.command.trim().length > 0) {
324
+ this._scopedInstantiationService.invokeFunction(getCommandHistory)?.add(e.command, { shellType: this._shellType });
325
+ }
326
+ });
327
+ }
328
+ }));
329
+ this._register(this.capabilities.onDidRemoveCapability(e => this._logService.debug('terminalInstance removed capability', e)));
330
+ if (!this.shellLaunchConfig.executable && !workbenchEnvironmentService.remoteAuthority) {
331
+ this._terminalProfileResolverService.resolveIcon(this._shellLaunchConfig, OS);
332
+ }
333
+ this._icon = _shellLaunchConfig.attachPersistentProcess?.icon || _shellLaunchConfig.icon;
334
+ if (this.shellLaunchConfig.customPtyImplementation) {
335
+ this._setTitle(this._shellLaunchConfig.name, TitleEventSource.Api);
336
+ }
337
+ this.statusList = this._scopedInstantiationService.createInstance(TerminalStatusList);
338
+ this._initDimensions();
339
+ this._processManager = this._createProcessManager();
340
+ this._register(toDisposable(() => this._dndObserver?.dispose()));
341
+ this._containerReadyBarrier = ( new AutoOpenBarrier(100 ));
342
+ this._attachBarrier = ( new AutoOpenBarrier(1000));
343
+ this._xtermReadyPromise = this._createXterm();
344
+ this._xtermReadyPromise.then(async () => {
345
+ await this._containerReadyBarrier.wait();
346
+ if (!this.shellLaunchConfig.customPtyImplementation && this._configHelper.config.shellIntegration?.enabled && !this.shellLaunchConfig.executable) {
347
+ const os = await this._processManager.getBackendOS();
348
+ const defaultProfile = (await this._terminalProfileResolverService.getDefaultProfile({ remoteAuthority: this.remoteAuthority, os }));
349
+ this.shellLaunchConfig.executable = defaultProfile.path;
350
+ this.shellLaunchConfig.args = defaultProfile.args;
351
+ if (this.shellLaunchConfig.isExtensionOwnedTerminal) {
352
+ this.shellLaunchConfig.icon ??= defaultProfile.icon;
353
+ this.shellLaunchConfig.color ??= defaultProfile.color;
354
+ }
355
+ else {
356
+ this.shellLaunchConfig.icon = defaultProfile.icon;
357
+ this.shellLaunchConfig.color = defaultProfile.color;
358
+ }
359
+ }
360
+ await this._createProcess();
361
+ if (this.shellLaunchConfig.attachPersistentProcess) {
362
+ this._cwd = this.shellLaunchConfig.attachPersistentProcess.cwd;
363
+ this._setTitle(this.shellLaunchConfig.attachPersistentProcess.title, this.shellLaunchConfig.attachPersistentProcess.titleSource);
364
+ this.setShellType(this.shellType);
365
+ }
366
+ if (this._fixedCols) {
367
+ await this._addScrollbar();
368
+ }
369
+ }).catch((err) => {
370
+ if (!this._isDisposed) {
371
+ throw err;
372
+ }
373
+ });
374
+ this._register(this._configurationService.onDidChangeConfiguration(async (e) => {
375
+ if (e.affectsConfiguration("accessibility.verbosity.terminal" )) {
376
+ this._setAriaLabel(this.xterm?.raw, this._instanceId, this.title);
377
+ }
378
+ if (e.affectsConfiguration('terminal.integrated')) {
379
+ this.updateConfig();
380
+ this.setVisible(this._isVisible);
381
+ }
382
+ const layoutSettings = [
383
+ "terminal.integrated.fontSize" ,
384
+ "terminal.integrated.fontFamily" ,
385
+ "terminal.integrated.fontWeight" ,
386
+ "terminal.integrated.fontWeightBold" ,
387
+ "terminal.integrated.letterSpacing" ,
388
+ "terminal.integrated.lineHeight" ,
389
+ 'editor.fontFamily'
390
+ ];
391
+ if (( layoutSettings.some(id => e.affectsConfiguration(id)))) {
392
+ this._layoutSettingsChanged = true;
393
+ await this._resize();
394
+ }
395
+ if (e.affectsConfiguration("terminal.integrated.unicodeVersion" )) {
396
+ this._updateUnicodeVersion();
397
+ }
398
+ if (e.affectsConfiguration('editor.accessibilitySupport')) {
399
+ this.updateAccessibilitySupport();
400
+ }
401
+ if (e.affectsConfiguration("terminal.integrated.tabs.title" ) ||
402
+ e.affectsConfiguration("terminal.integrated.tabs.separator" ) ||
403
+ e.affectsConfiguration("terminal.integrated.tabs.description" )) {
404
+ this._labelComputer?.refreshLabel();
405
+ }
406
+ }));
407
+ this._register(this._workspaceContextService.onDidChangeWorkspaceFolders(() => this._labelComputer?.refreshLabel()));
408
+ this._register(this.onDidBlur(() => this.xterm?.suggestController?.hideSuggestWidget()));
409
+ let initialDataEventsTimeout = window.setTimeout(() => {
410
+ initialDataEventsTimeout = undefined;
411
+ this._initialDataEvents = undefined;
412
+ }, 10000);
413
+ this._register(toDisposable(() => {
414
+ if (initialDataEventsTimeout) {
415
+ window.clearTimeout(initialDataEventsTimeout);
416
+ }
417
+ }));
418
+ const contributionDescs = TerminalExtensionsRegistry.getTerminalContributions();
419
+ for (const desc of contributionDescs) {
420
+ if (( this._contributions.has(desc.id))) {
421
+ onUnexpectedError(( new Error(`Cannot have two terminal contributions with the same id ${desc.id}`)));
422
+ continue;
423
+ }
424
+ let contribution;
425
+ try {
426
+ contribution = this._scopedInstantiationService.createInstance(desc.ctor, this, this._processManager, this._widgetManager);
427
+ this._contributions.set(desc.id, contribution);
428
+ }
429
+ catch (err) {
430
+ onUnexpectedError(err);
431
+ }
432
+ this._xtermReadyPromise.then(xterm => {
433
+ contribution.xtermReady?.(xterm);
434
+ });
435
+ this.onDisposed(() => {
436
+ contribution.dispose();
437
+ });
438
+ }
439
+ }
440
+ getContribution(id) {
441
+ return this._contributions.get(id);
442
+ }
443
+ _getIcon() {
444
+ if (!this._icon) {
445
+ this._icon = this._processManager.processState >= 2
446
+ ? getIconRegistry().getIcon(this._configurationService.getValue("terminal.integrated.tabs.defaultIcon" ))
447
+ : undefined;
448
+ }
449
+ return this._icon;
450
+ }
451
+ _getColor() {
452
+ if (this.shellLaunchConfig.color) {
453
+ return this.shellLaunchConfig.color;
454
+ }
455
+ if (this.shellLaunchConfig?.attachPersistentProcess?.color) {
456
+ return this.shellLaunchConfig.attachPersistentProcess.color;
457
+ }
458
+ if (this._processManager.processState >= 2 ) {
459
+ return undefined;
460
+ }
461
+ return undefined;
462
+ }
463
+ _initDimensions() {
464
+ if (!this._container) {
465
+ this._cols = 80 ;
466
+ this._rows = 30 ;
467
+ return;
468
+ }
469
+ const computedStyle = window.getComputedStyle(this._container);
470
+ const width = parseInt(computedStyle.width);
471
+ const height = parseInt(computedStyle.height);
472
+ this._evaluateColsAndRows(width, height);
473
+ }
474
+ _evaluateColsAndRows(width, height) {
475
+ if (!width || !height) {
476
+ this._setLastKnownColsAndRows();
477
+ return null;
478
+ }
479
+ const dimension = this._getDimension(width, height);
480
+ if (!dimension) {
481
+ this._setLastKnownColsAndRows();
482
+ return null;
483
+ }
484
+ const font = this.xterm ? this.xterm.getFont() : this._configHelper.getFont();
485
+ if (!font.charWidth || !font.charHeight) {
486
+ this._setLastKnownColsAndRows();
487
+ return null;
488
+ }
489
+ const scaledWidthAvailable = dimension.width * window.devicePixelRatio;
490
+ const scaledCharWidth = font.charWidth * window.devicePixelRatio + font.letterSpacing;
491
+ const newCols = Math.max(Math.floor(scaledWidthAvailable / scaledCharWidth), 1);
492
+ const scaledHeightAvailable = dimension.height * window.devicePixelRatio;
493
+ const scaledCharHeight = Math.ceil(font.charHeight * window.devicePixelRatio);
494
+ const scaledLineHeight = Math.floor(scaledCharHeight * font.lineHeight);
495
+ const newRows = Math.max(Math.floor(scaledHeightAvailable / scaledLineHeight), 1);
496
+ if (this._cols !== newCols || this._rows !== newRows) {
497
+ this._cols = newCols;
498
+ this._rows = newRows;
499
+ this._fireMaximumDimensionsChanged();
500
+ }
501
+ return dimension.width;
502
+ }
503
+ _setLastKnownColsAndRows() {
504
+ if (TerminalInstance._lastKnownGridDimensions) {
505
+ this._cols = TerminalInstance._lastKnownGridDimensions.cols;
506
+ this._rows = TerminalInstance._lastKnownGridDimensions.rows;
507
+ }
508
+ }
509
+ _fireMaximumDimensionsChanged() {
510
+ this._onMaximumDimensionsChanged.fire();
511
+ }
512
+ _getDimension(width, height) {
513
+ const font = this.xterm ? this.xterm.getFont() : this._configHelper.getFont();
514
+ if (!font || !font.charWidth || !font.charHeight) {
515
+ return undefined;
516
+ }
517
+ if (!this.xterm?.raw.element) {
518
+ return undefined;
519
+ }
520
+ const computedStyle = window.getComputedStyle(this.xterm.raw.element);
521
+ const horizontalPadding = parseInt(computedStyle.paddingLeft) + parseInt(computedStyle.paddingRight);
522
+ const verticalPadding = parseInt(computedStyle.paddingTop) + parseInt(computedStyle.paddingBottom);
523
+ TerminalInstance._lastKnownCanvasDimensions = new dom.Dimension(Math.min(8000 , width - horizontalPadding), height + (this._hasScrollBar && !this._horizontalScrollbar ? -5 : 0) - 2 - verticalPadding);
524
+ return TerminalInstance._lastKnownCanvasDimensions;
525
+ }
526
+ get persistentProcessId() { return this._processManager.persistentProcessId; }
527
+ get shouldPersist() { return this._processManager.shouldPersist && !this.shellLaunchConfig.isTransient && (!this.reconnectionProperties || this._configurationService.getValue("task.reconnection" ) === true); }
528
+ async _createXterm() {
529
+ const Terminal = await getXtermConstructor(this._keybindingService.lookupKeybinding("workbench.action.terminal.focusAccessibleBuffer" , this._contextKeyService));
530
+ if (this._isDisposed) {
531
+ throw new ErrorNoTelemetry('Terminal disposed of during xterm.js creation');
532
+ }
533
+ const disableShellIntegrationReporting = (this.shellLaunchConfig.hideFromUser || this.shellLaunchConfig.executable === undefined || this.shellType === undefined) || !shellIntegrationSupportedShellTypes.includes(this.shellType);
534
+ const xterm = this._scopedInstantiationService.createInstance(XtermTerminal, Terminal, this._configHelper, this._cols, this._rows, {
535
+ getBackgroundColor: (theme) => {
536
+ const terminalBackground = theme.getColor(TERMINAL_BACKGROUND_COLOR);
537
+ if (terminalBackground) {
538
+ return terminalBackground;
539
+ }
540
+ if (this.target === TerminalLocation.Editor) {
541
+ return theme.getColor(editorBackground);
542
+ }
543
+ const location = this._viewDescriptorService.getViewLocationById(TERMINAL_VIEW_ID);
544
+ if (location === 1 ) {
545
+ return theme.getColor(PANEL_BACKGROUND);
546
+ }
547
+ return theme.getColor(SIDE_BAR_BACKGROUND);
548
+ }
549
+ }, this.capabilities, this._processManager.shellIntegrationNonce, this._terminalSuggestWidgetVisibleContextKey, disableShellIntegrationReporting);
550
+ this.xterm = xterm;
551
+ this.updateAccessibilitySupport();
552
+ this.xterm.onDidRequestRunCommand(e => {
553
+ if (e.copyAsHtml) {
554
+ this.copySelection(true, e.command);
555
+ }
556
+ else {
557
+ this.sendText(e.command.command, e.noNewLine ? false : true);
558
+ }
559
+ });
560
+ this.xterm.onDidRequestFocus(() => this.focus());
561
+ this.xterm.onDidRequestSendText(e => this.sendText(e, false));
562
+ const initialTextWrittenPromise = this._shellLaunchConfig.initialText ? ( new Promise(r => this._writeInitialText(xterm, r))) : undefined;
563
+ const lineDataEventAddon = ( new LineDataEventAddon(initialTextWrittenPromise));
564
+ lineDataEventAddon.onLineData(e => this._onLineData.fire(e));
565
+ this._lineDataEventAddon = lineDataEventAddon;
566
+ setTimeout(() => {
567
+ xterm.raw.onBell(() => {
568
+ if (this._configHelper.config.enableBell) {
569
+ this.statusList.add({
570
+ id: "bell" ,
571
+ severity: Severity.Warning,
572
+ icon: Codicon.bell,
573
+ tooltip: ( nls.localize('bellStatus', "Bell"))
574
+ }, this._configHelper.config.bellDuration);
575
+ this._audioCueService.playSound(AudioCue.terminalBell.sound);
576
+ }
577
+ });
578
+ }, 1000);
579
+ xterm.raw.onSelectionChange(async () => this._onSelectionChange());
580
+ xterm.raw.buffer.onBufferChange(() => this._refreshAltBufferContextKey());
581
+ this._processManager.onProcessData(e => this._onProcessData(e));
582
+ xterm.raw.onData(async (data) => {
583
+ await this._processManager.write(data);
584
+ this._onDidInputData.fire(this);
585
+ });
586
+ xterm.raw.onBinary(data => this._processManager.processBinary(data));
587
+ this._processManager.onProcessReady(async (processTraits) => {
588
+ if (this._processManager.os) {
589
+ lineDataEventAddon.setOperatingSystem(this._processManager.os);
590
+ }
591
+ if (this._processManager.os === 1 ) {
592
+ xterm.raw.options.windowsMode = processTraits.requiresWindowsMode || false;
593
+ }
594
+ });
595
+ this._processManager.onRestoreCommands(e => this.xterm?.shellIntegration.deserialize(e));
596
+ this._register(this._viewDescriptorService.onDidChangeLocation(({ views }) => {
597
+ if (( views.some(v => v.id === TERMINAL_VIEW_ID))) {
598
+ xterm.refresh();
599
+ }
600
+ }));
601
+ if (!( this.capabilities.has(0 ))) {
602
+ let onKeyListener = xterm.raw.onKey(e => {
603
+ const event = ( new StandardKeyboardEvent(e.domEvent));
604
+ if (event.equals(3 )) {
605
+ this._updateProcessCwd();
606
+ }
607
+ });
608
+ this._register(this.capabilities.onDidAddCapability(e => {
609
+ if (e === 0 ) {
610
+ onKeyListener?.dispose();
611
+ onKeyListener = undefined;
612
+ }
613
+ }));
614
+ }
615
+ this._pathService.userHome().then(userHome => {
616
+ this._userHome = userHome.fsPath;
617
+ });
618
+ if (this._isVisible) {
619
+ this._open();
620
+ }
621
+ return xterm;
622
+ }
623
+ async _onLineDataSetup() {
624
+ const xterm = this.xterm || (await this._xtermReadyPromise);
625
+ xterm.raw.loadAddon(this._lineDataEventAddon);
626
+ }
627
+ async runCommand(commandLine, addNewLine) {
628
+ if (this.capabilities.get(2 )?.hasInput !== false) {
629
+ await this.sendText('\x03', false);
630
+ await timeout(100);
631
+ }
632
+ await this.sendText(commandLine, addNewLine, !addNewLine);
633
+ }
634
+ async runRecent(type, filterMode, value) {
635
+ return this._scopedInstantiationService.invokeFunction(showRunRecentQuickPick, this, this._terminalInRunCommandPicker, type, filterMode, value);
636
+ }
637
+ detachFromElement() {
638
+ this._wrapperElement.remove();
639
+ this._container = undefined;
640
+ }
641
+ attachToElement(container) {
642
+ if (this._container === container) {
643
+ return;
644
+ }
645
+ this._attachBarrier.open();
646
+ this._container = container;
647
+ this._container.appendChild(this._wrapperElement);
648
+ this.xterm?.refresh();
649
+ setTimeout(() => this._initDragAndDrop(container));
650
+ }
651
+ _open() {
652
+ if (!this.xterm || this.xterm.raw.element) {
653
+ return;
654
+ }
655
+ if (!this._container || !this._container.isConnected) {
656
+ throw new Error('A container element needs to be set with `attachToElement` and be part of the DOM before calling `_open`');
657
+ }
658
+ const xtermElement = document.createElement('div');
659
+ this._wrapperElement.appendChild(xtermElement);
660
+ this._container.appendChild(this._wrapperElement);
661
+ const xterm = this.xterm;
662
+ this._wrapperElement.xterm = xterm.raw;
663
+ const screenElement = xterm.attachToElement(xtermElement);
664
+ this._register(xterm.shellIntegration.onDidChangeStatus(() => {
665
+ if (this.hasFocus) {
666
+ this._setShellIntegrationContextKey();
667
+ }
668
+ else {
669
+ this._terminalShellIntegrationEnabledContextKey.reset();
670
+ }
671
+ }));
672
+ if (!xterm.raw.element || !xterm.raw.textarea) {
673
+ throw new Error('xterm elements not set after open');
674
+ }
675
+ this._setAriaLabel(xterm.raw, this._instanceId, this._title);
676
+ xterm.raw.attachCustomKeyEventHandler((event) => {
677
+ if (this._isExiting) {
678
+ return false;
679
+ }
680
+ const standardKeyboardEvent = ( new StandardKeyboardEvent(event));
681
+ const resolveResult = this._keybindingService.softDispatch(standardKeyboardEvent, standardKeyboardEvent.target);
682
+ const isValidChord = resolveResult.kind === 1 && this._configHelper.config.allowChords && event.key !== 'Escape';
683
+ if (this._keybindingService.inChordMode || isValidChord) {
684
+ event.preventDefault();
685
+ return false;
686
+ }
687
+ const SHOW_TERMINAL_CONFIG_PROMPT_KEY = 'terminal.integrated.showTerminalConfigPrompt';
688
+ const EXCLUDED_KEYS = ['RightArrow', 'LeftArrow', 'UpArrow', 'DownArrow', 'Space', 'Meta', 'Control', 'Shift', 'Alt', '', 'Delete', 'Backspace', 'Tab'];
689
+ if (this._storageService.getBoolean(SHOW_TERMINAL_CONFIG_PROMPT_KEY, -1 , true) &&
690
+ !EXCLUDED_KEYS.includes(event.key) &&
691
+ !event.ctrlKey &&
692
+ !event.shiftKey &&
693
+ !event.altKey) {
694
+ this._hasHadInput = true;
695
+ }
696
+ if (resolveResult.kind === 2 && resolveResult.commandId && ( this._skipTerminalCommands.some(k => k === resolveResult.commandId)) && !this._configHelper.config.sendKeybindingsToShell) {
697
+ if (this._storageService.getBoolean(SHOW_TERMINAL_CONFIG_PROMPT_KEY, -1 , true) &&
698
+ this._hasHadInput &&
699
+ !TERMINAL_CREATION_COMMANDS.includes(resolveResult.commandId)) {
700
+ this._notificationService.prompt(Severity.Info, ( nls.localize(
701
+ 'keybindingHandling',
702
+ "Some keybindings don't go to the terminal by default and are handled by {0} instead.",
703
+ this._productService.nameLong
704
+ )), [
705
+ {
706
+ label: ( nls.localize('configureTerminalSettings', "Configure Terminal Settings")),
707
+ run: () => {
708
+ this._preferencesService.openSettings({ jsonEditor: false, query: `@id:${"terminal.integrated.commandsToSkipShell" },${"terminal.integrated.sendKeybindingsToShell" },${"terminal.integrated.allowChords" }` });
709
+ }
710
+ }
711
+ ]);
712
+ this._storageService.store(SHOW_TERMINAL_CONFIG_PROMPT_KEY, false, -1 , 0 );
713
+ }
714
+ event.preventDefault();
715
+ return false;
716
+ }
717
+ if (this._configHelper.config.allowMnemonics && !isMacintosh && event.altKey) {
718
+ return false;
719
+ }
720
+ if (TabFocus.getTabFocusMode("terminalFocus" ) && event.key === 'Tab') {
721
+ return false;
722
+ }
723
+ if (isWindows && event.altKey && event.key === 'F4' && !event.ctrlKey) {
724
+ return false;
725
+ }
726
+ if (!BrowserFeatures.clipboard.readText && event.key === 'v' && event.ctrlKey) {
727
+ return false;
728
+ }
729
+ return true;
730
+ });
731
+ this._register(dom.addDisposableListener(xterm.raw.element, 'mousedown', () => {
732
+ const listener = dom.addDisposableListener(document, 'mouseup', () => {
733
+ setTimeout(() => this._refreshSelectionContextKey(), 0);
734
+ listener.dispose();
735
+ });
736
+ }));
737
+ this._register(dom.addDisposableListener(xterm.raw.element, 'touchstart', () => {
738
+ xterm.raw.focus();
739
+ }));
740
+ this._register(dom.addDisposableListener(xterm.raw.element, 'keyup', () => {
741
+ setTimeout(() => this._refreshSelectionContextKey(), 0);
742
+ }));
743
+ this._register(dom.addDisposableListener(xterm.raw.textarea, 'focus', () => this._setFocus(true)));
744
+ this._register(dom.addDisposableListener(xterm.raw.textarea, 'blur', () => this._setFocus(false)));
745
+ this._register(dom.addDisposableListener(xterm.raw.textarea, 'focusout', () => this._setFocus(false)));
746
+ this._initDragAndDrop(this._container);
747
+ this._widgetManager.attachToElement(screenElement);
748
+ if (this._lastLayoutDimensions) {
749
+ this.layout(this._lastLayoutDimensions);
750
+ }
751
+ this.updateConfig();
752
+ if (xterm.raw.options.disableStdin) {
753
+ this._attachPressAnyKeyToCloseListener(xterm.raw);
754
+ }
755
+ }
756
+ _setFocus(focused) {
757
+ if (focused) {
758
+ this._terminalFocusContextKey.set(true);
759
+ this._setShellIntegrationContextKey();
760
+ this._onDidFocus.fire(this);
761
+ }
762
+ else {
763
+ this.resetFocusContextKey();
764
+ this._onDidBlur.fire(this);
765
+ this._refreshSelectionContextKey();
766
+ }
767
+ }
768
+ _setShellIntegrationContextKey() {
769
+ if (this.xterm) {
770
+ this._terminalShellIntegrationEnabledContextKey.set(this.xterm.shellIntegration.status === 2 );
771
+ }
772
+ }
773
+ resetFocusContextKey() {
774
+ this._terminalFocusContextKey.reset();
775
+ this._terminalShellIntegrationEnabledContextKey.reset();
776
+ }
777
+ _initDragAndDrop(container) {
778
+ this._dndObserver?.dispose();
779
+ const dndController = this._scopedInstantiationService.createInstance(TerminalInstanceDragAndDropController, container);
780
+ dndController.onDropTerminal(e => this._onRequestAddInstanceToGroup.fire(e));
781
+ dndController.onDropFile(async (path) => {
782
+ this.focus();
783
+ await this.sendPath(path, false);
784
+ });
785
+ this._dndObserver = new dom.DragAndDropObserver(container, dndController);
786
+ }
787
+ hasSelection() {
788
+ return this.xterm ? this.xterm.raw.hasSelection() : false;
789
+ }
790
+ async copySelection(asHtml, command) {
791
+ const xterm = await this._xtermReadyPromise;
792
+ if (this.hasSelection() || (asHtml && command)) {
793
+ if (asHtml) {
794
+ const textAsHtml = await xterm.getSelectionAsHtml(command);
795
+ function listener(e) {
796
+ if (!e.clipboardData.types.includes('text/plain')) {
797
+ e.clipboardData.setData('text/plain', command?.getOutput() ?? '');
798
+ }
799
+ e.clipboardData.setData('text/html', textAsHtml);
800
+ e.preventDefault();
801
+ }
802
+ document.addEventListener('copy', listener);
803
+ document.execCommand('copy');
804
+ document.removeEventListener('copy', listener);
805
+ }
806
+ else {
807
+ await this._clipboardService.writeText(xterm.raw.getSelection());
808
+ }
809
+ }
810
+ else {
811
+ this._notificationService.warn(( nls.localize(
812
+ 'terminal.integrated.copySelection.noSelection',
813
+ 'The terminal has no selection to copy'
814
+ )));
815
+ }
816
+ }
817
+ get selection() {
818
+ return this.xterm && this.hasSelection() ? this.xterm.raw.getSelection() : undefined;
819
+ }
820
+ clearSelection() {
821
+ this.xterm?.raw.clearSelection();
822
+ }
823
+ selectAll() {
824
+ this.xterm?.raw.focus();
825
+ this.xterm?.raw.selectAll();
826
+ }
827
+ _refreshAltBufferContextKey() {
828
+ this._terminalAltBufferActiveContextKey.set(!!(this.xterm && this.xterm.raw.buffer.active === this.xterm.raw.buffer.alternate));
829
+ }
830
+ async _shouldPasteText(text) {
831
+ if (this.xterm?.raw.modes.bracketedPasteMode) {
832
+ return true;
833
+ }
834
+ const textForLines = text.split(/\r?\n/);
835
+ if (textForLines.length === 2 && textForLines[1].trim().length === 0) {
836
+ return true;
837
+ }
838
+ if (textForLines.length === 1 || !this._configurationService.getValue("terminal.integrated.enableMultiLinePasteWarning" )) {
839
+ return true;
840
+ }
841
+ const displayItemsCount = 3;
842
+ const maxPreviewLineLength = 30;
843
+ let detail = ( nls.localize('preview', "Preview:"));
844
+ for (let i = 0; i < Math.min(textForLines.length, displayItemsCount); i++) {
845
+ const line = textForLines[i];
846
+ const cleanedLine = line.length > maxPreviewLineLength ? `${line.slice(0, maxPreviewLineLength)}…` : line;
847
+ detail += `\n${cleanedLine}`;
848
+ }
849
+ if (textForLines.length > displayItemsCount) {
850
+ detail += `\n…`;
851
+ }
852
+ const { confirmed, checkboxChecked } = await this._dialogService.confirm({
853
+ message: ( nls.localize(
854
+ 'confirmMoveTrashMessageFilesAndDirectories',
855
+ "Are you sure you want to paste {0} lines of text into the terminal?",
856
+ textForLines.length
857
+ )),
858
+ detail,
859
+ primaryButton: ( nls.localize(
860
+ { key: 'multiLinePasteButton', comment: ['&& denotes a mnemonic'] },
861
+ "&&Paste"
862
+ )),
863
+ checkbox: {
864
+ label: ( nls.localize('doNotAskAgain', "Do not ask me again"))
865
+ }
866
+ });
867
+ if (confirmed && checkboxChecked) {
868
+ await this._configurationService.updateValue("terminal.integrated.enableMultiLinePasteWarning" , false);
869
+ }
870
+ return confirmed;
871
+ }
872
+ dispose(reason) {
873
+ if (this._isDisposed) {
874
+ return;
875
+ }
876
+ this._isDisposed = true;
877
+ this._logService.trace(`terminalInstance#dispose (instanceId: ${this.instanceId})`);
878
+ dispose(this._widgetManager);
879
+ if (this.xterm?.raw.element) {
880
+ this._hadFocusOnExit = this.hasFocus;
881
+ }
882
+ if (this._wrapperElement.xterm) {
883
+ this._wrapperElement.xterm = undefined;
884
+ }
885
+ if (this._horizontalScrollbar) {
886
+ this._horizontalScrollbar.dispose();
887
+ this._horizontalScrollbar = undefined;
888
+ }
889
+ try {
890
+ this.xterm?.dispose();
891
+ }
892
+ catch (err) {
893
+ this._logService.error('Exception occurred during xterm disposal', err);
894
+ }
895
+ if (isFirefox) {
896
+ this.resetFocusContextKey();
897
+ this._terminalHasTextContextKey.reset();
898
+ this._onDidBlur.fire(this);
899
+ }
900
+ if (this._pressAnyKeyToCloseListener) {
901
+ this._pressAnyKeyToCloseListener.dispose();
902
+ this._pressAnyKeyToCloseListener = undefined;
903
+ }
904
+ if (this._exitReason === undefined) {
905
+ this._exitReason = reason ?? TerminalExitReason.Unknown;
906
+ }
907
+ this._processManager.dispose();
908
+ this._onProcessExit(undefined);
909
+ this._onDisposed.fire(this);
910
+ super.dispose();
911
+ }
912
+ async detachProcessAndDispose(reason) {
913
+ await this._processManager.detachFromProcess(reason === TerminalExitReason.User);
914
+ this.dispose(reason);
915
+ }
916
+ focus(force) {
917
+ this._refreshAltBufferContextKey();
918
+ if (!this.xterm) {
919
+ return;
920
+ }
921
+ if (force || !window.getSelection()?.toString()) {
922
+ this.xterm.raw.focus();
923
+ this._onDidRequestFocus.fire();
924
+ }
925
+ }
926
+ async focusWhenReady(force) {
927
+ await this._xtermReadyPromise;
928
+ await this._attachBarrier.wait();
929
+ this.focus(force);
930
+ }
931
+ async paste() {
932
+ if (!this.xterm) {
933
+ return;
934
+ }
935
+ const currentText = await this._clipboardService.readText();
936
+ if (!(await this._shouldPasteText(currentText))) {
937
+ return;
938
+ }
939
+ this.focus();
940
+ this.xterm.raw.paste(currentText);
941
+ }
942
+ async pasteSelection() {
943
+ if (!this.xterm) {
944
+ return;
945
+ }
946
+ const currentText = await this._clipboardService.readText('selection');
947
+ if (!(await this._shouldPasteText(currentText))) {
948
+ return;
949
+ }
950
+ this.focus();
951
+ this.xterm.raw.paste(currentText);
952
+ }
953
+ async sendText(text, addNewLine, bracketedPasteMode) {
954
+ if (bracketedPasteMode && this.xterm?.raw.modes.bracketedPasteMode) {
955
+ text = `\x1b[200~${text}\x1b[201~`;
956
+ }
957
+ text = text.replace(/\r?\n/g, '\r');
958
+ if (addNewLine && !text.endsWith('\r')) {
959
+ text += '\r';
960
+ }
961
+ await this._processManager.write(text);
962
+ this._onDidInputData.fire(this);
963
+ this.xterm?.suggestController?.handleNonXtermData(text);
964
+ this.xterm?.scrollToBottom();
965
+ }
966
+ async sendPath(originalPath, addNewLine) {
967
+ return this.sendText(await this.preparePathForShell(originalPath), addNewLine);
968
+ }
969
+ async preparePathForShell(originalPath) {
970
+ await this.processReady;
971
+ return preparePathForShell(originalPath, this.shellLaunchConfig.executable, this.title, this.shellType, this._processManager.backend, this._processManager.os);
972
+ }
973
+ setVisible(visible) {
974
+ this._isVisible = visible;
975
+ this._wrapperElement.classList.toggle('active', visible);
976
+ if (visible && this.xterm) {
977
+ this._open();
978
+ this._resize();
979
+ setTimeout(() => this.xterm.forceRefresh(), 0);
980
+ }
981
+ }
982
+ scrollDownLine() {
983
+ this.xterm?.scrollDownLine();
984
+ }
985
+ scrollDownPage() {
986
+ this.xterm?.scrollDownPage();
987
+ }
988
+ scrollToBottom() {
989
+ this.xterm?.scrollToBottom();
990
+ }
991
+ scrollUpLine() {
992
+ this.xterm?.scrollUpLine();
993
+ }
994
+ scrollUpPage() {
995
+ this.xterm?.scrollUpPage();
996
+ }
997
+ scrollToTop() {
998
+ this.xterm?.scrollToTop();
999
+ }
1000
+ clearBuffer() {
1001
+ this.xterm?.clearBuffer();
1002
+ }
1003
+ _refreshSelectionContextKey() {
1004
+ const isActive = !!this._viewsService.getActiveViewWithId(TERMINAL_VIEW_ID);
1005
+ let isEditorActive = false;
1006
+ const editor = this._editorService.activeEditor;
1007
+ if (editor) {
1008
+ isEditorActive = editor instanceof TerminalEditorInput;
1009
+ }
1010
+ this._terminalHasTextContextKey.set((isActive || isEditorActive) && this.hasSelection());
1011
+ }
1012
+ _createProcessManager() {
1013
+ let deserializedCollections;
1014
+ if (this.shellLaunchConfig.attachPersistentProcess?.environmentVariableCollections) {
1015
+ deserializedCollections = deserializeEnvironmentVariableCollections(this.shellLaunchConfig.attachPersistentProcess.environmentVariableCollections);
1016
+ }
1017
+ const processManager = this._scopedInstantiationService.createInstance(TerminalProcessManager, this._instanceId, this._configHelper, this.shellLaunchConfig?.cwd, deserializedCollections, this.shellLaunchConfig.attachPersistentProcess?.shellIntegrationNonce);
1018
+ this.capabilities.add(processManager.capabilities);
1019
+ processManager.onProcessReady(async (e) => {
1020
+ this._onProcessIdReady.fire(this);
1021
+ this._initialCwd = await this.getInitialCwd();
1022
+ if (!this._labelComputer) {
1023
+ this._labelComputer = this._register(this._scopedInstantiationService.createInstance(TerminalLabelComputer, this._configHelper, this));
1024
+ this._labelComputer.onDidChangeLabel(e => {
1025
+ this._title = e.title;
1026
+ this._description = e.description;
1027
+ this._onTitleChanged.fire(this);
1028
+ });
1029
+ }
1030
+ if (this._shellLaunchConfig.name) {
1031
+ this._setTitle(this._shellLaunchConfig.name, TitleEventSource.Api);
1032
+ }
1033
+ else {
1034
+ setTimeout(() => {
1035
+ this._xtermReadyPromise.then(xterm => {
1036
+ this._messageTitleDisposable = xterm.raw.onTitleChange(e => this._onTitleChange(e));
1037
+ });
1038
+ });
1039
+ this._setTitle(this._shellLaunchConfig.executable, TitleEventSource.Process);
1040
+ }
1041
+ });
1042
+ processManager.onProcessExit(exitCode => this._onProcessExit(exitCode));
1043
+ processManager.onDidChangeProperty(({ type, value }) => {
1044
+ switch (type) {
1045
+ case "cwd" :
1046
+ this._cwd = value;
1047
+ this._labelComputer?.refreshLabel();
1048
+ break;
1049
+ case "initialCwd" :
1050
+ this._initialCwd = value;
1051
+ this._cwd = this._initialCwd;
1052
+ this._setTitle(this.title, TitleEventSource.Config);
1053
+ this._icon = this._shellLaunchConfig.attachPersistentProcess?.icon || this._shellLaunchConfig.icon;
1054
+ this._onIconChanged.fire({ instance: this, userInitiated: false });
1055
+ break;
1056
+ case "title" :
1057
+ this._setTitle(value ?? '', TitleEventSource.Process);
1058
+ break;
1059
+ case "overrideDimensions" :
1060
+ this.setOverrideDimensions(value, true);
1061
+ break;
1062
+ case "resolvedShellLaunchConfig" :
1063
+ this._setResolvedShellLaunchConfig(value);
1064
+ break;
1065
+ case "shellType" :
1066
+ this.setShellType(value);
1067
+ break;
1068
+ case "hasChildProcesses" :
1069
+ this._onDidChangeHasChildProcesses.fire(value);
1070
+ break;
1071
+ case "usedShellIntegrationInjection" :
1072
+ this._usedShellIntegrationInjection = true;
1073
+ break;
1074
+ }
1075
+ });
1076
+ processManager.onProcessData(ev => {
1077
+ this._initialDataEvents?.push(ev.data);
1078
+ this._onData.fire(ev.data);
1079
+ });
1080
+ processManager.onEnvironmentVariableInfoChanged(e => this._onEnvironmentVariableInfoChanged(e));
1081
+ processManager.onPtyDisconnect(() => {
1082
+ if (this.xterm) {
1083
+ this.xterm.raw.options.disableStdin = true;
1084
+ }
1085
+ this.statusList.add({
1086
+ id: "disconnected" ,
1087
+ severity: Severity.Error,
1088
+ icon: Codicon.debugDisconnect,
1089
+ tooltip: ( nls.localize('disconnectStatus', "Lost connection to process"))
1090
+ });
1091
+ });
1092
+ processManager.onPtyReconnect(() => {
1093
+ if (this.xterm) {
1094
+ this.xterm.raw.options.disableStdin = false;
1095
+ }
1096
+ this.statusList.remove("disconnected" );
1097
+ });
1098
+ return processManager;
1099
+ }
1100
+ async _createProcess() {
1101
+ if (this._isDisposed) {
1102
+ return;
1103
+ }
1104
+ const activeWorkspaceRootUri = this._historyService.getLastActiveWorkspaceRoot(Schemas.file);
1105
+ if (activeWorkspaceRootUri) {
1106
+ const trusted = await this._trust();
1107
+ if (!trusted) {
1108
+ this._onProcessExit({ message: ( nls.localize(
1109
+ 'workspaceNotTrustedCreateTerminal',
1110
+ "Cannot launch a terminal process in an untrusted workspace"
1111
+ )) });
1112
+ }
1113
+ }
1114
+ else if (this._cwd && this._userHome && this._cwd !== this._userHome) {
1115
+ this._onProcessExit({
1116
+ message: ( nls.localize(
1117
+ 'workspaceNotTrustedCreateTerminalCwd',
1118
+ "Cannot launch a terminal process in an untrusted workspace with cwd {0} and userHome {1}",
1119
+ this._cwd,
1120
+ this._userHome
1121
+ ))
1122
+ });
1123
+ }
1124
+ if (this._container && this._cols === 0 && this._rows === 0) {
1125
+ this._initDimensions();
1126
+ this.xterm?.raw.resize(this._cols || 80 , this._rows || 30 );
1127
+ }
1128
+ const originalIcon = this.shellLaunchConfig.icon;
1129
+ await this._processManager.createProcess(this._shellLaunchConfig, this._cols || 80 , this._rows || 30 ).then(result => {
1130
+ if (result) {
1131
+ if ('message' in result) {
1132
+ this._onProcessExit(result);
1133
+ }
1134
+ else if ('injectedArgs' in result) {
1135
+ this._injectedArgs = result.injectedArgs;
1136
+ }
1137
+ }
1138
+ });
1139
+ if (this.xterm?.shellIntegration) {
1140
+ this.capabilities.add(this.xterm.shellIntegration.capabilities);
1141
+ }
1142
+ if (originalIcon !== this.shellLaunchConfig.icon || this.shellLaunchConfig.color) {
1143
+ this._icon = this._shellLaunchConfig.attachPersistentProcess?.icon || this._shellLaunchConfig.icon;
1144
+ this._onIconChanged.fire({ instance: this, userInitiated: false });
1145
+ }
1146
+ }
1147
+ registerMarker() {
1148
+ return this.xterm?.raw.registerMarker();
1149
+ }
1150
+ addBufferMarker(properties) {
1151
+ this.capabilities.get(4 )?.addMark(properties);
1152
+ }
1153
+ scrollToMark(startMarkId, endMarkId, highlight) {
1154
+ this.xterm?.markTracker.scrollToClosestMarker(startMarkId, endMarkId, highlight);
1155
+ }
1156
+ async freePortKillProcess(port, command) {
1157
+ await this._processManager?.freePortKillProcess(port);
1158
+ this.runCommand(command, false);
1159
+ }
1160
+ _onProcessData(ev) {
1161
+ const messageId = ++this._latestXtermWriteData;
1162
+ if (ev.trackCommit) {
1163
+ ev.writePromise = ( new Promise(r => {
1164
+ this.xterm?.raw.write(ev.data, () => {
1165
+ this._latestXtermParseData = messageId;
1166
+ this._processManager.acknowledgeDataEvent(ev.data.length);
1167
+ r();
1168
+ });
1169
+ }));
1170
+ }
1171
+ else {
1172
+ this.xterm?.raw.write(ev.data, () => {
1173
+ this._latestXtermParseData = messageId;
1174
+ this._processManager.acknowledgeDataEvent(ev.data.length);
1175
+ });
1176
+ }
1177
+ }
1178
+ async _onProcessExit(exitCodeOrError) {
1179
+ if (this._isExiting) {
1180
+ return;
1181
+ }
1182
+ const parsedExitResult = parseExitResult(exitCodeOrError, this.shellLaunchConfig, this._processManager.processState, this._initialCwd);
1183
+ if (this._usedShellIntegrationInjection && this._processManager.processState === 4 && parsedExitResult?.code !== 0) {
1184
+ this._relaunchWithShellIntegrationDisabled(parsedExitResult?.message);
1185
+ this._onExit.fire(exitCodeOrError);
1186
+ return;
1187
+ }
1188
+ this._isExiting = true;
1189
+ await this._flushXtermData();
1190
+ this._logService.debug(`Terminal process exit (instanceId: ${this.instanceId}) with code ${this._exitCode}`);
1191
+ this._exitCode = parsedExitResult?.code;
1192
+ const exitMessage = parsedExitResult?.message;
1193
+ this._logService.debug(`Terminal process exit (instanceId: ${this.instanceId}) state ${this._processManager.processState}`);
1194
+ const waitOnExit = this.waitOnExit;
1195
+ if (waitOnExit && this._processManager.processState !== 5 ) {
1196
+ this._xtermReadyPromise.then(xterm => {
1197
+ if (exitMessage) {
1198
+ xterm.raw.write(formatMessageForTerminal(exitMessage));
1199
+ }
1200
+ switch (typeof waitOnExit) {
1201
+ case 'string':
1202
+ xterm.raw.write(formatMessageForTerminal(waitOnExit, { excludeLeadingNewLine: true }));
1203
+ break;
1204
+ case 'function':
1205
+ if (this.exitCode !== undefined) {
1206
+ xterm.raw.write(formatMessageForTerminal(waitOnExit(this.exitCode), { excludeLeadingNewLine: true }));
1207
+ }
1208
+ break;
1209
+ }
1210
+ xterm.raw.options.disableStdin = true;
1211
+ if (xterm.raw.textarea) {
1212
+ this._attachPressAnyKeyToCloseListener(xterm.raw);
1213
+ }
1214
+ });
1215
+ }
1216
+ else {
1217
+ this.dispose(TerminalExitReason.Process);
1218
+ if (exitMessage) {
1219
+ const failedDuringLaunch = this._processManager.processState === 4 ;
1220
+ if (failedDuringLaunch || this._configHelper.config.showExitAlert) {
1221
+ this._notificationService.notify({
1222
+ message: exitMessage,
1223
+ severity: Severity.Error,
1224
+ actions: { primary: [this._scopedInstantiationService.createInstance(TerminalLaunchHelpAction)] }
1225
+ });
1226
+ }
1227
+ else {
1228
+ this._logService.warn(exitMessage);
1229
+ }
1230
+ }
1231
+ }
1232
+ this._onExit.fire(exitCodeOrError);
1233
+ if (this._isDisposed) {
1234
+ this._onExit.dispose();
1235
+ }
1236
+ }
1237
+ _relaunchWithShellIntegrationDisabled(exitMessage) {
1238
+ this._shellLaunchConfig.ignoreShellIntegration = true;
1239
+ this.relaunch();
1240
+ this.statusList.add({
1241
+ id: "shell-integration-attention-needed" ,
1242
+ severity: Severity.Warning,
1243
+ icon: Codicon.warning,
1244
+ tooltip: (`${exitMessage} ` ?? '') + ( nls.localize(
1245
+ 'launchFailed.exitCodeOnlyShellIntegration',
1246
+ 'Disabling shell integration in user settings might help.'
1247
+ )),
1248
+ hoverActions: [{
1249
+ commandId: "workbench.action.terminal.learnMore" ,
1250
+ label: ( nls.localize('shellIntegration.learnMore', "Learn more about shell integration")),
1251
+ run: () => {
1252
+ this._openerService.open('https://code.visualstudio.com/docs/editor/integrated-terminal#_shell-integration');
1253
+ }
1254
+ }, {
1255
+ commandId: 'workbench.action.openSettings',
1256
+ label: ( nls.localize('shellIntegration.openSettings', "Open user settings")),
1257
+ run: () => {
1258
+ this._commandService.executeCommand('workbench.action.openSettings', 'terminal.integrated.shellIntegration.enabled');
1259
+ }
1260
+ }]
1261
+ });
1262
+ this._telemetryService.publicLog2('terminal/shellIntegrationFailureProcessExit');
1263
+ }
1264
+ _flushXtermData() {
1265
+ if (this._latestXtermWriteData === this._latestXtermParseData) {
1266
+ return Promise.resolve();
1267
+ }
1268
+ let retries = 0;
1269
+ return ( new Promise(r => {
1270
+ const interval = setInterval(() => {
1271
+ if (this._latestXtermWriteData === this._latestXtermParseData || ++retries === 5) {
1272
+ clearInterval(interval);
1273
+ r();
1274
+ }
1275
+ }, 20);
1276
+ }));
1277
+ }
1278
+ _attachPressAnyKeyToCloseListener(xterm) {
1279
+ if (xterm.textarea && !this._pressAnyKeyToCloseListener) {
1280
+ this._pressAnyKeyToCloseListener = dom.addDisposableListener(xterm.textarea, 'keypress', (event) => {
1281
+ if (this._pressAnyKeyToCloseListener) {
1282
+ this._pressAnyKeyToCloseListener.dispose();
1283
+ this._pressAnyKeyToCloseListener = undefined;
1284
+ this.dispose(TerminalExitReason.Process);
1285
+ event.preventDefault();
1286
+ }
1287
+ });
1288
+ }
1289
+ }
1290
+ _writeInitialText(xterm, callback) {
1291
+ if (!this._shellLaunchConfig.initialText) {
1292
+ callback?.();
1293
+ return;
1294
+ }
1295
+ const text = typeof this._shellLaunchConfig.initialText === 'string'
1296
+ ? this._shellLaunchConfig.initialText
1297
+ : this._shellLaunchConfig.initialText?.text;
1298
+ if (typeof this._shellLaunchConfig.initialText === 'string') {
1299
+ xterm.raw.writeln(text, callback);
1300
+ }
1301
+ else {
1302
+ if (this._shellLaunchConfig.initialText.trailingNewLine) {
1303
+ xterm.raw.writeln(text, callback);
1304
+ }
1305
+ else {
1306
+ xterm.raw.write(text, callback);
1307
+ }
1308
+ }
1309
+ }
1310
+ async reuseTerminal(shell, reset = false) {
1311
+ this._pressAnyKeyToCloseListener?.dispose();
1312
+ this._pressAnyKeyToCloseListener = undefined;
1313
+ const xterm = this.xterm;
1314
+ if (xterm) {
1315
+ if (!reset) {
1316
+ await ( new Promise(r => xterm.raw.write('\n\x1b[G', r)));
1317
+ }
1318
+ if (shell.initialText) {
1319
+ this._shellLaunchConfig.initialText = shell.initialText;
1320
+ await ( new Promise(r => this._writeInitialText(xterm, r)));
1321
+ }
1322
+ if (this._isExiting && this._shellLaunchConfig.waitOnExit) {
1323
+ xterm.raw.options.disableStdin = false;
1324
+ this._isExiting = false;
1325
+ }
1326
+ if (reset) {
1327
+ xterm.clearDecorations();
1328
+ }
1329
+ }
1330
+ this.statusList.remove("relaunch-needed" );
1331
+ if (!reset) {
1332
+ shell.initialText = ' ';
1333
+ }
1334
+ this._shellLaunchConfig = shell;
1335
+ await this._processManager.relaunch(this._shellLaunchConfig, this._cols || 80 , this._rows || 30 , reset).then(result => {
1336
+ if (result) {
1337
+ if ('message' in result) {
1338
+ this._onProcessExit(result);
1339
+ }
1340
+ else if ('injectedArgs' in result) {
1341
+ this._injectedArgs = result.injectedArgs;
1342
+ }
1343
+ }
1344
+ });
1345
+ }
1346
+ async setEscapeSequenceLogging(enable) {
1347
+ const xterm = await this._xtermReadyPromise;
1348
+ xterm.raw.options.logLevel = enable ? 'debug' : 'info';
1349
+ }
1350
+ relaunch() {
1351
+ this.reuseTerminal(this._shellLaunchConfig, true);
1352
+ }
1353
+ _onTitleChange(title) {
1354
+ if (this.isTitleSetByProcess) {
1355
+ this._setTitle(title, TitleEventSource.Sequence);
1356
+ }
1357
+ }
1358
+ async _trust() {
1359
+ return (await this._workspaceTrustRequestService.requestWorkspaceTrust({
1360
+ message: ( nls.localize(
1361
+ 'terminal.requestTrust',
1362
+ "Creating a terminal process requires executing code"
1363
+ ))
1364
+ })) === true;
1365
+ }
1366
+ async _onSelectionChange() {
1367
+ if (this._configurationService.getValue("terminal.integrated.copyOnSelection" )) {
1368
+ if (this.hasSelection()) {
1369
+ await this.copySelection();
1370
+ }
1371
+ }
1372
+ }
1373
+ async _updateProcessCwd() {
1374
+ if (this._isDisposed || this.shellLaunchConfig.customPtyImplementation) {
1375
+ return;
1376
+ }
1377
+ try {
1378
+ const cwd = await this._refreshProperty("cwd" );
1379
+ if (typeof cwd !== 'string') {
1380
+ throw new Error(`cwd is not a string ${cwd}`);
1381
+ }
1382
+ }
1383
+ catch (e) {
1384
+ if (e instanceof Error && e.message === 'Cannot refresh property when process is not set') {
1385
+ return;
1386
+ }
1387
+ throw e;
1388
+ }
1389
+ }
1390
+ updateConfig() {
1391
+ this._setCommandsToSkipShell(this._configHelper.config.commandsToSkipShell);
1392
+ this._refreshEnvironmentVariableInfoWidgetState(this._processManager.environmentVariableInfo);
1393
+ }
1394
+ async _updateUnicodeVersion() {
1395
+ this._processManager.setUnicodeVersion(this._configHelper.config.unicodeVersion);
1396
+ }
1397
+ updateAccessibilitySupport() {
1398
+ this.xterm.raw.options.screenReaderMode = this._accessibilityService.isScreenReaderOptimized();
1399
+ }
1400
+ _setCommandsToSkipShell(commands) {
1401
+ const excludeCommands = ( commands.filter(command => command[0] === '-').map(command => command.slice(1)));
1402
+ this._skipTerminalCommands = DEFAULT_COMMANDS_TO_SKIP_SHELL.filter(defaultCommand => {
1403
+ return !excludeCommands.includes(defaultCommand);
1404
+ }).concat(commands);
1405
+ }
1406
+ layout(dimension) {
1407
+ this._lastLayoutDimensions = dimension;
1408
+ if (this.disableLayout) {
1409
+ return;
1410
+ }
1411
+ if (dimension.width <= 0 || dimension.height <= 0) {
1412
+ return;
1413
+ }
1414
+ const terminalWidth = this._evaluateColsAndRows(dimension.width, dimension.height);
1415
+ if (!terminalWidth) {
1416
+ return;
1417
+ }
1418
+ this._resize();
1419
+ this._containerReadyBarrier.open();
1420
+ for (const contribution of ( this._contributions.values())) {
1421
+ if (!this.xterm) {
1422
+ this._xtermReadyPromise.then(xterm => contribution.layout?.(xterm, dimension));
1423
+ }
1424
+ else {
1425
+ contribution.layout?.(this.xterm, dimension);
1426
+ }
1427
+ }
1428
+ }
1429
+ async _resize() {
1430
+ this._resizeNow(false);
1431
+ }
1432
+ async _resizeNow(immediate) {
1433
+ let cols = this.cols;
1434
+ let rows = this.rows;
1435
+ if (this.xterm) {
1436
+ if (this._isVisible && this._layoutSettingsChanged) {
1437
+ const font = this.xterm.getFont();
1438
+ const config = this._configHelper.config;
1439
+ this.xterm.raw.options.letterSpacing = font.letterSpacing;
1440
+ this.xterm.raw.options.lineHeight = font.lineHeight;
1441
+ this.xterm.raw.options.fontSize = font.fontSize;
1442
+ this.xterm.raw.options.fontFamily = font.fontFamily;
1443
+ this.xterm.raw.options.fontWeight = config.fontWeight;
1444
+ this.xterm.raw.options.fontWeightBold = config.fontWeightBold;
1445
+ this._initDimensions();
1446
+ cols = this.cols;
1447
+ rows = this.rows;
1448
+ this._layoutSettingsChanged = false;
1449
+ }
1450
+ if (isNaN(cols) || isNaN(rows)) {
1451
+ return;
1452
+ }
1453
+ if (cols !== this.xterm.raw.cols || rows !== this.xterm.raw.rows) {
1454
+ if (this._fixedRows || this._fixedCols) {
1455
+ await this._updateProperty("fixedDimensions" , { cols: this._fixedCols, rows: this._fixedRows });
1456
+ }
1457
+ this._onDimensionsChanged.fire();
1458
+ }
1459
+ this.xterm.raw.resize(cols, rows);
1460
+ TerminalInstance._lastKnownGridDimensions = { cols, rows };
1461
+ if (this._isVisible) {
1462
+ this.xterm.forceUnpause();
1463
+ }
1464
+ }
1465
+ if (immediate) {
1466
+ this._processManager.setDimensions(cols, rows, true);
1467
+ }
1468
+ else {
1469
+ await this._processManager.setDimensions(cols, rows);
1470
+ }
1471
+ }
1472
+ setShellType(shellType) {
1473
+ this._shellType = shellType;
1474
+ if (shellType) {
1475
+ this._terminalShellTypeContextKey.set(shellType?.toString());
1476
+ }
1477
+ }
1478
+ _setAriaLabel(xterm, terminalId, title) {
1479
+ const labelParts = [];
1480
+ if (xterm && xterm.textarea) {
1481
+ if (title && title.length > 0) {
1482
+ labelParts.push(( nls.localize(
1483
+ 'terminalTextBoxAriaLabelNumberAndTitle',
1484
+ "Terminal {0}, {1}",
1485
+ terminalId,
1486
+ title
1487
+ )));
1488
+ }
1489
+ else {
1490
+ labelParts.push(( nls.localize('terminalTextBoxAriaLabel', "Terminal {0}", terminalId)));
1491
+ }
1492
+ const screenReaderOptimized = this._accessibilityService.isScreenReaderOptimized();
1493
+ if (!screenReaderOptimized) {
1494
+ labelParts.push(( nls.localize(
1495
+ 'terminalScreenReaderMode',
1496
+ "Run the command: Toggle Screen Reader Accessibility Mode for an optimized screen reader experience"
1497
+ )));
1498
+ }
1499
+ const accessibilityHelpKeybinding = this._keybindingService.lookupKeybinding("workbench.action.terminal.showAccessibilityHelp" )?.getLabel();
1500
+ if (this._configurationService.getValue("accessibility.verbosity.terminal" ) && accessibilityHelpKeybinding) {
1501
+ labelParts.push(( nls.localize(
1502
+ 'terminalHelpAriaLabel',
1503
+ "Use {0} for terminal accessibility help",
1504
+ accessibilityHelpKeybinding
1505
+ )));
1506
+ }
1507
+ xterm.textarea.setAttribute('aria-label', labelParts.join('\n'));
1508
+ }
1509
+ }
1510
+ _updateTitleProperties(title, eventSource) {
1511
+ if (!title) {
1512
+ return this._processName;
1513
+ }
1514
+ switch (eventSource) {
1515
+ case TitleEventSource.Process:
1516
+ if (this._processManager.os === 1 ) {
1517
+ title = path.win32.parse(title).name;
1518
+ }
1519
+ else {
1520
+ const firstSpaceIndex = title.indexOf(' ');
1521
+ if (title.startsWith('/')) {
1522
+ title = path.basename(title);
1523
+ }
1524
+ else if (firstSpaceIndex > -1) {
1525
+ title = title.substring(0, firstSpaceIndex);
1526
+ }
1527
+ }
1528
+ this._processName = title;
1529
+ break;
1530
+ case TitleEventSource.Api:
1531
+ this._staticTitle = title;
1532
+ dispose(this._messageTitleDisposable);
1533
+ this._messageTitleDisposable = undefined;
1534
+ break;
1535
+ case TitleEventSource.Sequence:
1536
+ this._sequence = title;
1537
+ if (this._processManager.os === 1 ) {
1538
+ if (title.match(/^[a-zA-Z]:\\.+\.[a-zA-Z]{1,3}/)) {
1539
+ title = path.win32.parse(title).name;
1540
+ this._sequence = title;
1541
+ }
1542
+ else {
1543
+ this._sequence = undefined;
1544
+ }
1545
+ }
1546
+ break;
1547
+ }
1548
+ this._titleSource = eventSource;
1549
+ return title;
1550
+ }
1551
+ setOverrideDimensions(dimensions, immediate = false) {
1552
+ if (this._dimensionsOverride && this._dimensionsOverride.forceExactSize && !dimensions && this._rows === 0 && this._cols === 0) {
1553
+ this._cols = this._dimensionsOverride.cols;
1554
+ this._rows = this._dimensionsOverride.rows;
1555
+ }
1556
+ this._dimensionsOverride = dimensions;
1557
+ if (immediate) {
1558
+ this._resizeNow(true);
1559
+ }
1560
+ else {
1561
+ this._resize();
1562
+ }
1563
+ }
1564
+ async setFixedDimensions() {
1565
+ const cols = await this._quickInputService.input({
1566
+ title: ( nls.localize('setTerminalDimensionsColumn', "Set Fixed Dimensions: Column")),
1567
+ placeHolder: 'Enter a number of columns or leave empty for automatic width',
1568
+ validateInput: async (text) => text.length > 0 && !text.match(/^\d+$/) ? { content: 'Enter a number or leave empty size automatically', severity: Severity.Error } : undefined
1569
+ });
1570
+ if (cols === undefined) {
1571
+ return;
1572
+ }
1573
+ this._fixedCols = this._parseFixedDimension(cols);
1574
+ this._labelComputer?.refreshLabel();
1575
+ this._terminalHasFixedWidth.set(!!this._fixedCols);
1576
+ const rows = await this._quickInputService.input({
1577
+ title: ( nls.localize('setTerminalDimensionsRow', "Set Fixed Dimensions: Row")),
1578
+ placeHolder: 'Enter a number of rows or leave empty for automatic height',
1579
+ validateInput: async (text) => text.length > 0 && !text.match(/^\d+$/) ? { content: 'Enter a number or leave empty size automatically', severity: Severity.Error } : undefined
1580
+ });
1581
+ if (rows === undefined) {
1582
+ return;
1583
+ }
1584
+ this._fixedRows = this._parseFixedDimension(rows);
1585
+ this._labelComputer?.refreshLabel();
1586
+ await this._refreshScrollbar();
1587
+ this._resize();
1588
+ this.focus();
1589
+ }
1590
+ _parseFixedDimension(value) {
1591
+ if (value === '') {
1592
+ return undefined;
1593
+ }
1594
+ const parsed = parseInt(value);
1595
+ if (parsed <= 0) {
1596
+ throw new Error(`Could not parse dimension "${value}"`);
1597
+ }
1598
+ return parsed;
1599
+ }
1600
+ async toggleSizeToContentWidth() {
1601
+ if (!this.xterm?.raw.buffer.active) {
1602
+ return;
1603
+ }
1604
+ if (this._hasScrollBar) {
1605
+ this._terminalHasFixedWidth.set(false);
1606
+ this._fixedCols = undefined;
1607
+ this._fixedRows = undefined;
1608
+ this._hasScrollBar = false;
1609
+ this._initDimensions();
1610
+ await this._resize();
1611
+ }
1612
+ else {
1613
+ const proposedCols = Math.max(this.maxCols, Math.min(this.xterm.getLongestViewportWrappedLineLength(), 5000 ));
1614
+ if (proposedCols > this.xterm.raw.cols) {
1615
+ this._fixedCols = proposedCols;
1616
+ }
1617
+ }
1618
+ await this._refreshScrollbar();
1619
+ this._labelComputer?.refreshLabel();
1620
+ this.focus();
1621
+ }
1622
+ _refreshScrollbar() {
1623
+ if (this._fixedCols || this._fixedRows) {
1624
+ return this._addScrollbar();
1625
+ }
1626
+ return this._removeScrollbar();
1627
+ }
1628
+ async _addScrollbar() {
1629
+ const charWidth = (this.xterm ? this.xterm.getFont() : this._configHelper.getFont()).charWidth;
1630
+ if (!this.xterm?.raw.element || !this._container || !charWidth || !this._fixedCols) {
1631
+ return;
1632
+ }
1633
+ this._wrapperElement.classList.add('fixed-dims');
1634
+ this._hasScrollBar = true;
1635
+ this._initDimensions();
1636
+ this._fixedRows = this._rows - 1;
1637
+ await this._resize();
1638
+ this._terminalHasFixedWidth.set(true);
1639
+ if (!this._horizontalScrollbar) {
1640
+ this._horizontalScrollbar = this._register(( new DomScrollableElement(this._wrapperElement, {
1641
+ vertical: 2 ,
1642
+ horizontal: 1 ,
1643
+ useShadows: false,
1644
+ scrollYToX: false,
1645
+ consumeMouseWheelIfScrollbarIsNeeded: false
1646
+ })));
1647
+ this._container.appendChild(this._horizontalScrollbar.getDomNode());
1648
+ }
1649
+ this._horizontalScrollbar.setScrollDimensions({
1650
+ width: this.xterm.raw.element.clientWidth,
1651
+ scrollWidth: this._fixedCols * charWidth + 40
1652
+ });
1653
+ this._horizontalScrollbar.getDomNode().style.paddingBottom = '16px';
1654
+ if (isWindows) {
1655
+ for (let i = this.xterm.raw.buffer.active.viewportY; i < this.xterm.raw.buffer.active.length; i++) {
1656
+ const line = this.xterm.raw.buffer.active.getLine(i);
1657
+ line._line.isWrapped = false;
1658
+ }
1659
+ }
1660
+ }
1661
+ async _removeScrollbar() {
1662
+ if (!this._container || !this._horizontalScrollbar) {
1663
+ return;
1664
+ }
1665
+ this._horizontalScrollbar.getDomNode().remove();
1666
+ this._horizontalScrollbar.dispose();
1667
+ this._horizontalScrollbar = undefined;
1668
+ this._wrapperElement.remove();
1669
+ this._wrapperElement.classList.remove('fixed-dims');
1670
+ this._container.appendChild(this._wrapperElement);
1671
+ }
1672
+ _setResolvedShellLaunchConfig(shellLaunchConfig) {
1673
+ this._shellLaunchConfig.args = shellLaunchConfig.args;
1674
+ this._shellLaunchConfig.cwd = shellLaunchConfig.cwd;
1675
+ this._shellLaunchConfig.executable = shellLaunchConfig.executable;
1676
+ this._shellLaunchConfig.env = shellLaunchConfig.env;
1677
+ }
1678
+ _onEnvironmentVariableInfoChanged(info) {
1679
+ if (info.requiresAction) {
1680
+ this.xterm?.raw.textarea?.setAttribute('aria-label', ( nls.localize(
1681
+ 'terminalStaleTextBoxAriaLabel',
1682
+ "Terminal {0} environment is stale, run the 'Show Environment Information' command for more information",
1683
+ this._instanceId
1684
+ )));
1685
+ }
1686
+ this._refreshEnvironmentVariableInfoWidgetState(info);
1687
+ }
1688
+ _refreshEnvironmentVariableInfoWidgetState(info) {
1689
+ if (!info) {
1690
+ this.statusList.remove("relaunch-needed" );
1691
+ this.statusList.remove("env-var-info-changes-active" );
1692
+ return;
1693
+ }
1694
+ if (info.requiresAction &&
1695
+ this._configHelper.config.environmentChangesRelaunch &&
1696
+ !this._processManager.hasWrittenData &&
1697
+ (!this._shellLaunchConfig.isFeatureTerminal || (this.reconnectionProperties && this._configurationService.getValue("task.reconnection" ) === true)) &&
1698
+ !this._shellLaunchConfig.customPtyImplementation
1699
+ && !this._shellLaunchConfig.isExtensionOwnedTerminal &&
1700
+ !this._shellLaunchConfig.attachPersistentProcess) {
1701
+ this.relaunch();
1702
+ return;
1703
+ }
1704
+ const workspaceFolder = getWorkspaceForTerminal(this.shellLaunchConfig.cwd, this._workspaceContextService, this._historyService);
1705
+ this.statusList.add(info.getStatus({ workspaceFolder }));
1706
+ }
1707
+ async toggleEscapeSequenceLogging() {
1708
+ const xterm = await this._xtermReadyPromise;
1709
+ xterm.raw.options.logLevel = xterm.raw.options.logLevel === 'debug' ? 'info' : 'debug';
1710
+ return xterm.raw.options.logLevel === 'debug';
1711
+ }
1712
+ async getInitialCwd() {
1713
+ if (!this._initialCwd) {
1714
+ this._initialCwd = this._processManager.initialCwd;
1715
+ }
1716
+ return this._initialCwd;
1717
+ }
1718
+ async getCwd() {
1719
+ if (( this.capabilities.has(0 ))) {
1720
+ return this.capabilities.get(0 ).getCwd();
1721
+ }
1722
+ else if (( this.capabilities.has(1 ))) {
1723
+ return this.capabilities.get(1 ).getCwd();
1724
+ }
1725
+ return this._processManager.initialCwd;
1726
+ }
1727
+ async _refreshProperty(type) {
1728
+ await this.processReady;
1729
+ return this._processManager.refreshProperty(type);
1730
+ }
1731
+ async _updateProperty(type, value) {
1732
+ return this._processManager.updateProperty(type, value);
1733
+ }
1734
+ async rename(title) {
1735
+ this._setTitle(title, TitleEventSource.Api);
1736
+ }
1737
+ _setTitle(title, eventSource) {
1738
+ const reset = !title;
1739
+ title = this._updateTitleProperties(title, eventSource);
1740
+ const titleChanged = title !== this._title;
1741
+ this._title = title;
1742
+ this._labelComputer?.refreshLabel(reset);
1743
+ this._setAriaLabel(this.xterm?.raw, this._instanceId, this._title);
1744
+ if (titleChanged) {
1745
+ this._onTitleChanged.fire(this);
1746
+ }
1747
+ }
1748
+ async changeIcon() {
1749
+ const items = [];
1750
+ for (const icon of getAllCodicons()) {
1751
+ items.push({ label: `$(${icon.id})`, description: `${icon.id}`, icon });
1752
+ }
1753
+ const result = await this._quickInputService.pick(items, {
1754
+ matchOnDescription: true
1755
+ });
1756
+ if (result) {
1757
+ this._icon = result.icon;
1758
+ this._onIconChanged.fire({ instance: this, userInitiated: true });
1759
+ }
1760
+ }
1761
+ async changeColor() {
1762
+ const icon = this._getIcon();
1763
+ if (!icon) {
1764
+ return;
1765
+ }
1766
+ const colorTheme = this._themeService.getColorTheme();
1767
+ const standardColors = getStandardColors(colorTheme);
1768
+ const styleElement = getColorStyleElement(colorTheme);
1769
+ const items = [];
1770
+ for (const colorKey of standardColors) {
1771
+ const colorClass = getColorClass(colorKey);
1772
+ items.push({
1773
+ label: `$(${Codicon.circleFilled.id}) ${colorKey.replace('terminal.ansi', '')}`, id: colorKey, description: colorKey, iconClasses: [colorClass]
1774
+ });
1775
+ }
1776
+ items.push({ type: 'separator' });
1777
+ const showAllColorsItem = { label: 'Reset to default' };
1778
+ items.push(showAllColorsItem);
1779
+ document.body.appendChild(styleElement);
1780
+ const quickPick = this._quickInputService.createQuickPick();
1781
+ quickPick.items = items;
1782
+ quickPick.matchOnDescription = true;
1783
+ quickPick.show();
1784
+ const disposables = [];
1785
+ const result = await ( new Promise(r => {
1786
+ disposables.push(quickPick.onDidHide(() => r(undefined)));
1787
+ disposables.push(quickPick.onDidAccept(() => r(quickPick.selectedItems[0])));
1788
+ }));
1789
+ dispose(disposables);
1790
+ if (result) {
1791
+ this.shellLaunchConfig.color = result.id;
1792
+ this._onIconChanged.fire({ instance: this, userInitiated: true });
1793
+ }
1794
+ quickPick.hide();
1795
+ document.body.removeChild(styleElement);
1796
+ }
1797
+ selectPreviousSuggestion() {
1798
+ this.xterm?.suggestController?.selectPreviousSuggestion();
1799
+ }
1800
+ selectPreviousPageSuggestion() {
1801
+ this.xterm?.suggestController?.selectPreviousPageSuggestion();
1802
+ }
1803
+ selectNextSuggestion() {
1804
+ this.xterm?.suggestController?.selectNextSuggestion();
1805
+ }
1806
+ selectNextPageSuggestion() {
1807
+ this.xterm?.suggestController?.selectNextPageSuggestion();
1808
+ }
1809
+ async acceptSelectedSuggestion(suggestion) {
1810
+ this.xterm?.suggestController?.acceptSelectedSuggestion(suggestion);
1811
+ }
1812
+ hideSuggestWidget() {
1813
+ this.xterm?.suggestController?.hideSuggestWidget();
1814
+ }
1815
+ forceScrollbarVisibility() {
1816
+ this._wrapperElement.classList.add('force-scrollbar');
1817
+ }
1818
+ resetScrollbarVisibility() {
1819
+ this._wrapperElement.classList.remove('force-scrollbar');
1820
+ }
1821
+ };
1822
+ TerminalInstance._instanceIdCounter = 1;
1823
+ TerminalInstance.__decorator = ( __decorate([
1824
+ debounce(50)
1825
+ ], TerminalInstance.prototype, "_fireMaximumDimensionsChanged", null));
1826
+ TerminalInstance.__decorator = ( __decorate([
1827
+ debounce(1000)
1828
+ ], TerminalInstance.prototype, "relaunch", null));
1829
+ TerminalInstance.__decorator = ( __decorate([
1830
+ debounce(2000)
1831
+ ], TerminalInstance.prototype, "_updateProcessCwd", null));
1832
+ TerminalInstance.__decorator = ( __decorate([
1833
+ debounce(50)
1834
+ ], TerminalInstance.prototype, "_resize", null));
1835
+ TerminalInstance = ( __decorate([
1836
+ ( __param(5, IContextKeyService)),
1837
+ ( __param(6, IInstantiationService)),
1838
+ ( __param(7, ITerminalProfileResolverService)),
1839
+ ( __param(8, IPathService)),
1840
+ ( __param(9, IKeybindingService)),
1841
+ ( __param(10, INotificationService)),
1842
+ ( __param(11, IPreferencesService)),
1843
+ ( __param(12, IViewsService)),
1844
+ ( __param(13, IClipboardService)),
1845
+ ( __param(14, IThemeService)),
1846
+ ( __param(15, IConfigurationService)),
1847
+ ( __param(16, ILogService)),
1848
+ ( __param(17, IDialogService)),
1849
+ ( __param(18, IStorageService)),
1850
+ ( __param(19, IAccessibilityService)),
1851
+ ( __param(20, IProductService)),
1852
+ ( __param(21, IQuickInputService)),
1853
+ ( __param(22, IWorkbenchEnvironmentService)),
1854
+ ( __param(23, IWorkspaceContextService)),
1855
+ ( __param(24, IEditorService)),
1856
+ ( __param(25, IWorkspaceTrustRequestService)),
1857
+ ( __param(26, IHistoryService)),
1858
+ ( __param(27, ITelemetryService)),
1859
+ ( __param(28, IOpenerService)),
1860
+ ( __param(29, ICommandService)),
1861
+ ( __param(30, IAudioCueService)),
1862
+ ( __param(31, IViewDescriptorService))
1863
+ ], TerminalInstance));
1864
+ let TerminalInstanceDragAndDropController = class TerminalInstanceDragAndDropController extends Disposable {
1865
+ get onDropFile() { return this._onDropFile.event; }
1866
+ get onDropTerminal() { return this._onDropTerminal.event; }
1867
+ constructor(_container, _layoutService, _viewDescriptorService) {
1868
+ super();
1869
+ this._container = _container;
1870
+ this._layoutService = _layoutService;
1871
+ this._viewDescriptorService = _viewDescriptorService;
1872
+ this._onDropFile = ( new Emitter());
1873
+ this._onDropTerminal = ( new Emitter());
1874
+ this._register(toDisposable(() => this._clearDropOverlay()));
1875
+ }
1876
+ _clearDropOverlay() {
1877
+ if (this._dropOverlay && this._dropOverlay.parentElement) {
1878
+ this._dropOverlay.parentElement.removeChild(this._dropOverlay);
1879
+ }
1880
+ this._dropOverlay = undefined;
1881
+ }
1882
+ onDragEnter(e) {
1883
+ if (!containsDragType(e, DataTransfers.FILES, DataTransfers.RESOURCES, "Terminals" , CodeDataTransfers.FILES)) {
1884
+ return;
1885
+ }
1886
+ if (!this._dropOverlay) {
1887
+ this._dropOverlay = document.createElement('div');
1888
+ this._dropOverlay.classList.add('terminal-drop-overlay');
1889
+ }
1890
+ if (containsDragType(e, "Terminals" )) {
1891
+ const side = this._getDropSide(e);
1892
+ this._dropOverlay.classList.toggle('drop-before', side === 'before');
1893
+ this._dropOverlay.classList.toggle('drop-after', side === 'after');
1894
+ }
1895
+ if (!this._dropOverlay.parentElement) {
1896
+ this._container.appendChild(this._dropOverlay);
1897
+ }
1898
+ }
1899
+ onDragLeave(e) {
1900
+ this._clearDropOverlay();
1901
+ }
1902
+ onDragEnd(e) {
1903
+ this._clearDropOverlay();
1904
+ }
1905
+ onDragOver(e) {
1906
+ if (!e.dataTransfer || !this._dropOverlay) {
1907
+ return;
1908
+ }
1909
+ if (containsDragType(e, "Terminals" )) {
1910
+ const side = this._getDropSide(e);
1911
+ this._dropOverlay.classList.toggle('drop-before', side === 'before');
1912
+ this._dropOverlay.classList.toggle('drop-after', side === 'after');
1913
+ }
1914
+ this._dropOverlay.style.opacity = '1';
1915
+ }
1916
+ async onDrop(e) {
1917
+ this._clearDropOverlay();
1918
+ if (!e.dataTransfer) {
1919
+ return;
1920
+ }
1921
+ const terminalResources = getTerminalResourcesFromDragEvent(e);
1922
+ if (terminalResources) {
1923
+ for (const uri of terminalResources) {
1924
+ const side = this._getDropSide(e);
1925
+ this._onDropTerminal.fire({ uri, side });
1926
+ }
1927
+ return;
1928
+ }
1929
+ let path;
1930
+ const rawResources = e.dataTransfer.getData(DataTransfers.RESOURCES);
1931
+ if (rawResources) {
1932
+ path = ( URI.parse(JSON.parse(rawResources)[0]));
1933
+ }
1934
+ const rawCodeFiles = e.dataTransfer.getData(CodeDataTransfers.FILES);
1935
+ if (!path && rawCodeFiles) {
1936
+ path = URI.file(JSON.parse(rawCodeFiles)[0]);
1937
+ }
1938
+ if (!path && e.dataTransfer.files.length > 0 && e.dataTransfer.files[0].path ) {
1939
+ path = URI.file(e.dataTransfer.files[0].path);
1940
+ }
1941
+ if (!path) {
1942
+ return;
1943
+ }
1944
+ this._onDropFile.fire(path);
1945
+ }
1946
+ _getDropSide(e) {
1947
+ const target = this._container;
1948
+ if (!target) {
1949
+ return 'after';
1950
+ }
1951
+ const rect = target.getBoundingClientRect();
1952
+ return this._getViewOrientation() === 1
1953
+ ? (e.clientX - rect.left < rect.width / 2 ? 'before' : 'after')
1954
+ : (e.clientY - rect.top < rect.height / 2 ? 'before' : 'after');
1955
+ }
1956
+ _getViewOrientation() {
1957
+ const panelPosition = this._layoutService.getPanelPosition();
1958
+ const terminalLocation = this._viewDescriptorService.getViewLocationById(TERMINAL_VIEW_ID);
1959
+ return terminalLocation === 1 && panelPosition === 2
1960
+ ? 1
1961
+ : 0 ;
1962
+ }
1963
+ };
1964
+ TerminalInstanceDragAndDropController = ( __decorate([
1965
+ ( __param(1, IWorkbenchLayoutService)),
1966
+ ( __param(2, IViewDescriptorService))
1967
+ ], TerminalInstanceDragAndDropController));
1968
+ let TerminalLabelComputer = class TerminalLabelComputer extends Disposable {
1969
+ get title() { return this._title; }
1970
+ get description() { return this._description; }
1971
+ constructor(_configHelper, _instance, _fileService, _workspaceContextService) {
1972
+ super();
1973
+ this._configHelper = _configHelper;
1974
+ this._instance = _instance;
1975
+ this._fileService = _fileService;
1976
+ this._workspaceContextService = _workspaceContextService;
1977
+ this._title = '';
1978
+ this._description = '';
1979
+ this._onDidChangeLabel = this._register(( new Emitter()));
1980
+ this.onDidChangeLabel = this._onDidChangeLabel.event;
1981
+ }
1982
+ refreshLabel(reset) {
1983
+ this._title = this.computeLabel(this._configHelper.config.tabs.title, "title" , reset);
1984
+ this._description = this.computeLabel(this._configHelper.config.tabs.description, "description" );
1985
+ if (this._title !== this._instance.title || this._description !== this._instance.description || reset) {
1986
+ this._onDidChangeLabel.fire({ title: this._title, description: this._description });
1987
+ }
1988
+ }
1989
+ computeLabel(labelTemplate, labelType, reset) {
1990
+ const type = this._instance.shellLaunchConfig.attachPersistentProcess?.type || this._instance.shellLaunchConfig.type;
1991
+ const templateProperties = {
1992
+ cwd: this._instance.cwd || this._instance.initialCwd || '',
1993
+ cwdFolder: '',
1994
+ workspaceFolder: this._instance.workspaceFolder ? path.basename(this._instance.workspaceFolder.uri.fsPath) : undefined,
1995
+ local: type === 'Local' ? type : undefined,
1996
+ process: this._instance.processName,
1997
+ sequence: this._instance.sequence,
1998
+ task: type === 'Task' ? type : undefined,
1999
+ fixedDimensions: this._instance.fixedCols
2000
+ ? (this._instance.fixedRows ? `\u2194${this._instance.fixedCols} \u2195${this._instance.fixedRows}` : `\u2194${this._instance.fixedCols}`)
2001
+ : (this._instance.fixedRows ? `\u2195${this._instance.fixedRows}` : ''),
2002
+ separator: { label: this._configHelper.config.tabs.separator }
2003
+ };
2004
+ labelTemplate = labelTemplate.trim();
2005
+ if (!labelTemplate) {
2006
+ return labelType === "title" ? (this._instance.processName || '') : '';
2007
+ }
2008
+ if (!reset && this._instance.staticTitle && labelType === "title" ) {
2009
+ return this._instance.staticTitle.replace(/[\n\r\t]/g, '') || templateProperties.process?.replace(/[\n\r\t]/g, '') || '';
2010
+ }
2011
+ const detection = ( this._instance.capabilities.has(0 )) || ( this._instance.capabilities.has(1 ));
2012
+ const folders = this._workspaceContextService.getWorkspace().folders;
2013
+ const multiRootWorkspace = folders.length > 1;
2014
+ if (templateProperties.cwd && detection && ((!this._instance.shellLaunchConfig.isFeatureTerminal || labelType === "title") )) {
2015
+ const cwdUri = ( URI.from({
2016
+ scheme: this._instance.workspaceFolder?.uri.scheme || Schemas.file,
2017
+ path: this._instance.cwd ? path.resolve(this._instance.cwd) : undefined
2018
+ }));
2019
+ let showCwd = false;
2020
+ if (multiRootWorkspace) {
2021
+ showCwd = true;
2022
+ }
2023
+ else if (this._instance.workspaceFolder?.uri) {
2024
+ const caseSensitive = this._fileService.hasCapability(this._instance.workspaceFolder.uri, 1024 );
2025
+ showCwd = cwdUri.fsPath.localeCompare(this._instance.workspaceFolder.uri.fsPath, undefined, { sensitivity: caseSensitive ? 'case' : 'base' }) !== 0;
2026
+ }
2027
+ if (showCwd) {
2028
+ templateProperties.cwdFolder = path.basename(templateProperties.cwd);
2029
+ }
2030
+ }
2031
+ const label = template(labelTemplate, templateProperties).replace(/[\n\r\t]/g, '').trim();
2032
+ return label === '' && labelType === "title" ? (this._instance.processName || '') : label;
2033
+ }
2034
+ };
2035
+ TerminalLabelComputer = ( __decorate([
2036
+ ( __param(2, IFileService)),
2037
+ ( __param(3, IWorkspaceContextService))
2038
+ ], TerminalLabelComputer));
2039
+ function parseExitResult(exitCodeOrError, shellLaunchConfig, processState, initialCwd) {
2040
+ if (exitCodeOrError === undefined || exitCodeOrError === 0) {
2041
+ return { code: exitCodeOrError, message: undefined };
2042
+ }
2043
+ const code = typeof exitCodeOrError === 'number' ? exitCodeOrError : exitCodeOrError.code;
2044
+ let message = undefined;
2045
+ switch (typeof exitCodeOrError) {
2046
+ case 'number': {
2047
+ let commandLine = undefined;
2048
+ if (shellLaunchConfig.executable) {
2049
+ commandLine = shellLaunchConfig.executable;
2050
+ if (typeof shellLaunchConfig.args === 'string') {
2051
+ commandLine += ` ${shellLaunchConfig.args}`;
2052
+ }
2053
+ else if (shellLaunchConfig.args && shellLaunchConfig.args.length) {
2054
+ commandLine += ( shellLaunchConfig.args.map(a => ` '${a}'`)).join();
2055
+ }
2056
+ }
2057
+ if (processState === 4 ) {
2058
+ if (commandLine) {
2059
+ message = ( nls.localize(
2060
+ 'launchFailed.exitCodeAndCommandLine',
2061
+ "The terminal process \"{0}\" failed to launch (exit code: {1}).",
2062
+ commandLine,
2063
+ code
2064
+ ));
2065
+ }
2066
+ else {
2067
+ message = ( nls.localize(
2068
+ 'launchFailed.exitCodeOnly',
2069
+ "The terminal process failed to launch (exit code: {0}).",
2070
+ code
2071
+ ));
2072
+ }
2073
+ }
2074
+ else {
2075
+ if (commandLine) {
2076
+ message = ( nls.localize(
2077
+ 'terminated.exitCodeAndCommandLine',
2078
+ "The terminal process \"{0}\" terminated with exit code: {1}.",
2079
+ commandLine,
2080
+ code
2081
+ ));
2082
+ }
2083
+ else {
2084
+ message = ( nls.localize(
2085
+ 'terminated.exitCodeOnly',
2086
+ "The terminal process terminated with exit code: {0}.",
2087
+ code
2088
+ ));
2089
+ }
2090
+ }
2091
+ break;
2092
+ }
2093
+ case 'object': {
2094
+ if (( exitCodeOrError.message.toString()).includes('Could not find pty with id')) {
2095
+ break;
2096
+ }
2097
+ let innerMessage = exitCodeOrError.message;
2098
+ const conptyError = exitCodeOrError.message.match(/.*error code:\s*(\d+).*$/);
2099
+ if (conptyError) {
2100
+ const errorCode = conptyError.length > 1 ? parseInt(conptyError[1]) : undefined;
2101
+ switch (errorCode) {
2102
+ case 5:
2103
+ innerMessage = `Access was denied to the path containing your executable "${shellLaunchConfig.executable}". Manage and change your permissions to get this to work`;
2104
+ break;
2105
+ case 267:
2106
+ innerMessage = `Invalid starting directory "${initialCwd}", review your terminal.integrated.cwd setting`;
2107
+ break;
2108
+ case 1260:
2109
+ innerMessage = `Windows cannot open this program because it has been prevented by a software restriction policy. For more information, open Event Viewer or contact your system Administrator`;
2110
+ break;
2111
+ }
2112
+ }
2113
+ message = ( nls.localize(
2114
+ 'launchFailed.errorMessage',
2115
+ "The terminal process failed to launch: {0}.",
2116
+ innerMessage
2117
+ ));
2118
+ break;
2119
+ }
2120
+ }
2121
+ return { code, message };
2122
+ }
2123
+ export { TerminalInstance, TerminalLabelComputer, parseExitResult };