@codingame/monaco-vscode-api 1.79.0 → 1.79.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 (283) hide show
  1. package/README.md +7 -5
  2. package/dist/activity.d.ts +8 -108
  3. package/dist/api.js +3 -3
  4. package/dist/colorRegistry.d.ts +2 -2
  5. package/dist/contextkey.d.ts +2 -2
  6. package/dist/default-extension.js +23 -0
  7. package/dist/editor.d.ts +4 -320
  8. package/dist/editorBrowser.d.ts +327 -10
  9. package/dist/event.d.ts +1 -1
  10. package/dist/{extension-tools-d0cfdea1.js → extension-tools-0c4c1ad7.js} +345 -210
  11. package/dist/extensions.d.ts +3 -4
  12. package/dist/extensions.d2.ts +1 -1
  13. package/dist/extensions.js +4 -37
  14. package/dist/extensionsRegistry.d.ts +1 -1
  15. package/dist/files.d.ts +2 -2
  16. package/dist/keybinding.d.ts +1 -1
  17. package/dist/languageFeatures.d.ts +6 -7
  18. package/dist/log.d.ts +1 -1
  19. package/dist/monaco.d.ts +31 -32
  20. package/dist/monaco.js +62 -6
  21. package/dist/node_modules/rollup-plugin-styles/dist/runtime/inject-css.js +2 -0
  22. package/dist/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +4 -0
  23. package/dist/rollup-extension-directory-plugin.js +1 -2
  24. package/dist/rollup-vsix-plugin.js +1 -2
  25. package/dist/service-override/configuration.d.ts +2 -2
  26. package/dist/service-override/editor.d.ts +13 -0
  27. package/dist/service-override/{modelEditor.js → editor.js} +6 -62
  28. package/dist/service-override/files.d.ts +5 -5
  29. package/dist/service-override/files.js +14 -2
  30. package/dist/service-override/keybindings.js +3 -79
  31. package/dist/service-override/layout.js +6 -2
  32. package/dist/service-override/model.d.ts +7 -0
  33. package/dist/service-override/model.js +10 -0
  34. package/dist/service-override/quickaccess.d.ts +7 -0
  35. package/dist/service-override/quickaccess.js +80 -0
  36. package/dist/service-override/snippets.js +5 -1
  37. package/dist/service-override/textmate.js +7 -2
  38. package/dist/service-override/theme.d.ts +1 -1
  39. package/dist/service-override/tools/editor.js +73 -0
  40. package/dist/service-override/views.d.ts +63 -201
  41. package/dist/service-override/views.js +102 -8
  42. package/dist/services.d.ts +116 -19
  43. package/dist/vscode/vs/base/browser/ui/centered/centeredViewLayout.js +178 -0
  44. package/dist/vscode/vs/base/browser/ui/grid/grid.js +452 -0
  45. package/dist/vscode/vs/base/browser/ui/grid/gridview.css.js +4 -0
  46. package/dist/vscode/vs/base/browser/ui/grid/gridview.js +999 -0
  47. package/dist/vscode/vs/base/browser/ui/iconLabel/simpleIconLabel.js +14 -0
  48. package/dist/vscode/vs/base/browser/ui/menu/menubar.css.js +4 -0
  49. package/dist/vscode/vs/base/browser/ui/menu/menubar.js +1 -1
  50. package/dist/vscode/vs/base/browser/ui/splitview/paneview.css.js +4 -0
  51. package/dist/vscode/vs/base/browser/ui/splitview/paneview.js +1 -1
  52. package/dist/vscode/vs/platform/extensionManagement/common/extensionManagement.js +2 -1
  53. package/dist/vscode/vs/platform/extensionManagement/common/extensionStorage.js +1 -1
  54. package/dist/vscode/vs/platform/product/common/product.js +48 -0
  55. package/dist/vscode/vs/platform/quickinput/browser/quickPickPin.js +94 -0
  56. package/dist/vscode/vs/platform/terminal/common/terminal.js +3 -0
  57. package/dist/vscode/vs/platform/update/common/update.js +11 -1
  58. package/dist/vscode/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +1 -1
  59. package/dist/vscode/vs/workbench/api/browser/mainThreadStatusBar.js +68 -0
  60. package/dist/vscode/vs/workbench/api/common/extHostStatusBar.js +234 -0
  61. package/dist/vscode/vs/workbench/api/common/extHostTypes.js +6 -1
  62. package/dist/vscode/vs/workbench/browser/actions/layoutActions.js +20 -17
  63. package/dist/vscode/vs/workbench/browser/actions/quickAccessActions.js +204 -0
  64. package/dist/vscode/vs/workbench/browser/dnd.js +27 -2
  65. package/dist/vscode/vs/workbench/browser/editor.js +94 -0
  66. package/dist/vscode/vs/workbench/browser/labels.js +23 -2
  67. package/dist/vscode/vs/workbench/browser/media/part.css.js +4 -0
  68. package/dist/vscode/vs/workbench/browser/part.js +1 -1
  69. package/dist/vscode/vs/workbench/browser/parts/activitybar/activitybarActions.js +1 -1
  70. package/dist/vscode/vs/workbench/browser/parts/activitybar/activitybarPart.js +3 -3
  71. package/dist/vscode/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +4 -0
  72. package/dist/vscode/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +4 -0
  73. package/dist/vscode/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarActions.js +14 -26
  74. package/dist/vscode/vs/workbench/browser/parts/compositePart.js +1 -1
  75. package/dist/vscode/vs/workbench/browser/parts/editor/binaryDiffEditor.js +43 -0
  76. package/dist/vscode/vs/workbench/browser/parts/editor/binaryEditor.js +55 -0
  77. package/dist/vscode/vs/workbench/browser/parts/editor/breadcrumbs.js +330 -0
  78. package/dist/vscode/vs/workbench/browser/parts/editor/breadcrumbsControl.js +690 -0
  79. package/dist/vscode/vs/workbench/browser/parts/editor/breadcrumbsModel.js +142 -0
  80. package/dist/vscode/vs/workbench/browser/parts/editor/breadcrumbsPicker.js +414 -0
  81. package/dist/vscode/vs/workbench/browser/parts/editor/editor.contribution.js +800 -6
  82. package/dist/vscode/vs/workbench/browser/parts/editor/editor.js +56 -1
  83. package/dist/vscode/vs/workbench/browser/parts/editor/editorActions.js +1484 -107
  84. package/dist/vscode/vs/workbench/browser/parts/editor/editorCommands.js +1121 -4
  85. package/dist/vscode/vs/workbench/browser/parts/editor/editorDropTarget.js +499 -0
  86. package/dist/vscode/vs/workbench/browser/parts/editor/editorGroupView.js +1219 -0
  87. package/dist/vscode/vs/workbench/browser/parts/editor/editorGroupWatermark.js +137 -0
  88. package/dist/vscode/vs/workbench/browser/parts/editor/editorPane.js +242 -0
  89. package/dist/vscode/vs/workbench/browser/parts/editor/editorPanes.js +297 -0
  90. package/dist/vscode/vs/workbench/browser/parts/editor/editorPart.js +841 -0
  91. package/dist/vscode/vs/workbench/browser/parts/editor/editorPlaceholder.js +235 -0
  92. package/dist/vscode/vs/workbench/browser/parts/editor/editorQuickAccess.js +1 -1
  93. package/dist/vscode/vs/workbench/browser/parts/editor/editorStatus.js +1152 -0
  94. package/dist/vscode/vs/workbench/browser/parts/editor/editorWithViewState.js +139 -0
  95. package/dist/vscode/vs/workbench/browser/parts/editor/editorsObserver.js +339 -0
  96. package/dist/vscode/vs/workbench/browser/parts/editor/media/breadcrumbscontrol.css.js +4 -0
  97. package/dist/vscode/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +4 -0
  98. package/dist/vscode/vs/workbench/browser/parts/editor/media/editorgroupview.css.js +4 -0
  99. package/dist/vscode/vs/workbench/browser/parts/editor/media/editorplaceholder.css.js +4 -0
  100. package/dist/vscode/vs/workbench/browser/parts/editor/media/editorquickaccess.css.js +4 -0
  101. package/dist/vscode/vs/workbench/browser/parts/editor/media/editorstatus.css.js +4 -0
  102. package/dist/vscode/vs/workbench/browser/parts/editor/media/notabstitlecontrol.css.js +4 -0
  103. package/dist/vscode/vs/workbench/browser/parts/editor/media/sidebysideeditor.css.js +4 -0
  104. package/dist/vscode/vs/workbench/browser/parts/editor/media/tabstitlecontrol.css.js +4 -0
  105. package/dist/vscode/vs/workbench/browser/parts/editor/media/titlecontrol.css.js +4 -0
  106. package/dist/vscode/vs/workbench/browser/parts/editor/noTabsTitleControl.js +243 -0
  107. package/dist/vscode/vs/workbench/browser/parts/editor/sideBySideEditor.js +387 -0
  108. package/dist/vscode/vs/workbench/browser/parts/editor/tabFocus.js +77 -0
  109. package/dist/vscode/vs/workbench/browser/parts/editor/tabsTitleControl.js +1504 -0
  110. package/dist/vscode/vs/workbench/browser/parts/editor/textCodeEditor.js +79 -0
  111. package/dist/vscode/vs/workbench/browser/parts/editor/textDiffEditor.js +304 -0
  112. package/dist/vscode/vs/workbench/browser/parts/editor/textEditor.js +220 -0
  113. package/dist/vscode/vs/workbench/browser/parts/editor/textResourceEditor.js +149 -0
  114. package/dist/vscode/vs/workbench/browser/parts/editor/titleControl.js +284 -0
  115. package/dist/vscode/vs/workbench/browser/parts/media/compositepart.css.js +4 -0
  116. package/dist/vscode/vs/workbench/browser/parts/notifications/media/notificationsActions.css.js +4 -0
  117. package/dist/vscode/vs/workbench/browser/parts/notifications/media/notificationsCenter.css.js +4 -0
  118. package/dist/vscode/vs/workbench/browser/parts/notifications/media/notificationsList.css.js +4 -0
  119. package/dist/vscode/vs/workbench/browser/parts/notifications/media/notificationsToasts.css.js +4 -0
  120. package/dist/vscode/vs/workbench/browser/parts/notifications/notificationsActions.js +8 -8
  121. package/dist/vscode/vs/workbench/browser/parts/notifications/notificationsCenter.js +2 -2
  122. package/dist/vscode/vs/workbench/browser/parts/notifications/notificationsList.js +1 -1
  123. package/dist/vscode/vs/workbench/browser/parts/notifications/notificationsToasts.js +1 -1
  124. package/dist/vscode/vs/workbench/browser/parts/panel/media/basepanelpart.css.js +4 -0
  125. package/dist/vscode/vs/workbench/browser/parts/panel/media/panelpart.css.js +4 -0
  126. package/dist/vscode/vs/workbench/browser/parts/panel/panelActions.js +19 -5
  127. package/dist/vscode/vs/workbench/browser/parts/panel/panelPart.js +2 -2
  128. package/dist/vscode/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +4 -0
  129. package/dist/vscode/vs/workbench/browser/parts/sidebar/sidebarPart.js +1 -1
  130. package/dist/vscode/vs/workbench/browser/parts/statusbar/media/statusbarpart.css.js +4 -0
  131. package/dist/vscode/vs/workbench/browser/parts/statusbar/statusbarActions.js +109 -0
  132. package/dist/vscode/vs/workbench/browser/parts/statusbar/statusbarItem.js +224 -0
  133. package/dist/vscode/vs/workbench/browser/parts/statusbar/statusbarModel.js +251 -0
  134. package/dist/vscode/vs/workbench/browser/parts/statusbar/statusbarPart.js +439 -0
  135. package/dist/vscode/vs/workbench/browser/parts/titlebar/media/menubarControl.css.js +4 -0
  136. package/dist/vscode/vs/workbench/browser/parts/titlebar/menubarControl.js +76 -3
  137. package/dist/vscode/vs/workbench/browser/parts/views/media/paneviewlet.css.js +4 -0
  138. package/dist/vscode/vs/workbench/browser/parts/views/media/views.css.js +4 -0
  139. package/dist/vscode/vs/workbench/browser/parts/views/treeView.js +1 -1
  140. package/dist/vscode/vs/workbench/browser/parts/views/viewPane.js +5 -5
  141. package/dist/vscode/vs/workbench/browser/parts/views/viewPaneContainer.js +1 -1
  142. package/dist/vscode/vs/workbench/browser/parts/views/viewsService.js +4 -4
  143. package/dist/vscode/vs/workbench/browser/quickaccess.js +6 -2
  144. package/dist/vscode/vs/workbench/browser/workbench.contribution.js +1108 -0
  145. package/dist/vscode/vs/workbench/common/contextkeys.js +34 -1
  146. package/dist/vscode/vs/workbench/common/editor/editorGroupModel.js +674 -0
  147. package/dist/vscode/vs/workbench/common/editor.js +57 -1
  148. package/dist/vscode/vs/workbench/common/theme.js +35 -35
  149. package/dist/vscode/vs/workbench/common/views.js +1 -1
  150. package/dist/vscode/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +4 -4
  151. package/dist/vscode/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +1 -1
  152. package/dist/vscode/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +4 -0
  153. package/dist/vscode/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.js +77 -0
  154. package/dist/vscode/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoSymbolQuickAccess.js +217 -0
  155. package/dist/vscode/vs/workbench/contrib/codeEditor/browser/workbenchReferenceSearch.js +24 -0
  156. package/dist/vscode/vs/workbench/contrib/debug/browser/breakpointWidget.js +1 -1
  157. package/dist/vscode/vs/workbench/contrib/debug/browser/callStackEditorContribution.js +1 -1
  158. package/dist/vscode/vs/workbench/contrib/debug/browser/debug.contribution.js +30 -4
  159. package/dist/vscode/vs/workbench/contrib/debug/browser/debugCommands.js +13 -1
  160. package/dist/vscode/vs/workbench/contrib/debug/browser/debugIcons.js +77 -127
  161. package/dist/vscode/vs/workbench/contrib/debug/browser/debugToolBar.js +1 -1
  162. package/dist/vscode/vs/workbench/contrib/debug/browser/debugViewlet.js +1 -1
  163. package/dist/vscode/vs/workbench/contrib/debug/browser/disassemblyView.js +620 -0
  164. package/dist/vscode/vs/workbench/contrib/debug/browser/exceptionWidget.js +1 -1
  165. package/dist/vscode/vs/workbench/contrib/debug/browser/media/breakpointWidget.css.js +4 -0
  166. package/dist/vscode/vs/workbench/contrib/debug/browser/media/callStackEditorContribution.css.js +4 -0
  167. package/dist/vscode/vs/workbench/contrib/debug/browser/media/debug.contribution.css.js +4 -0
  168. package/dist/vscode/vs/workbench/contrib/debug/browser/media/debugHover.css.js +4 -0
  169. package/dist/vscode/vs/workbench/contrib/debug/browser/media/debugToolBar.css.js +4 -0
  170. package/dist/vscode/vs/workbench/contrib/debug/browser/media/debugViewlet.css.js +4 -0
  171. package/dist/vscode/vs/workbench/contrib/debug/browser/media/exceptionWidget.css.js +4 -0
  172. package/dist/vscode/vs/workbench/contrib/debug/browser/media/repl.css.js +4 -0
  173. package/dist/vscode/vs/workbench/contrib/debug/browser/repl.js +1 -1
  174. package/dist/vscode/vs/workbench/contrib/debug/common/debug.js +2 -1
  175. package/dist/vscode/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +71 -0
  176. package/dist/vscode/vs/workbench/contrib/files/browser/editors/textFileEditor.js +225 -0
  177. package/dist/vscode/vs/workbench/contrib/files/browser/explorerViewlet.js +5 -4
  178. package/dist/vscode/vs/workbench/contrib/files/browser/fileActions.contribution.js +270 -4
  179. package/dist/vscode/vs/workbench/contrib/files/browser/fileActions.js +4 -1
  180. package/dist/vscode/vs/workbench/contrib/files/browser/fileCommands.js +24 -6
  181. package/dist/vscode/vs/workbench/contrib/files/browser/fileConstants.js +8 -1
  182. package/dist/vscode/vs/workbench/contrib/files/browser/files.contribution.js +10 -0
  183. package/dist/vscode/vs/workbench/contrib/files/browser/media/explorerviewlet.css.js +4 -0
  184. package/dist/vscode/vs/workbench/contrib/files/browser/views/media/openeditors.css.js +4 -0
  185. package/dist/vscode/vs/workbench/contrib/files/browser/views/openEditorsView.js +608 -0
  186. package/dist/vscode/vs/workbench/contrib/files/common/files.js +2 -1
  187. package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionInputPart.js +1 -1
  188. package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/interactiveSessionWidget.js +1 -1
  189. package/dist/vscode/vs/workbench/contrib/interactiveSession/browser/media/interactiveSession.css.js +4 -0
  190. package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionContextKeys.js +9 -1
  191. package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionModel.js +305 -0
  192. package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionService.js +6 -1
  193. package/dist/vscode/vs/workbench/contrib/interactiveSession/common/interactiveSessionServiceImpl.js +379 -0
  194. package/dist/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser.js +2 -2
  195. package/dist/vscode/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +33 -1
  196. package/dist/vscode/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.js +130 -0
  197. package/dist/vscode/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.js +225 -0
  198. package/dist/vscode/vs/workbench/contrib/remote/browser/media/tunnelView.css.js +4 -0
  199. package/dist/vscode/vs/workbench/contrib/remote/browser/remoteIcons.js +21 -17
  200. package/dist/vscode/vs/workbench/contrib/remote/browser/tunnelView.js +1 -1
  201. package/dist/vscode/vs/workbench/contrib/search/browser/anythingQuickAccess.js +757 -0
  202. package/dist/vscode/vs/workbench/contrib/search/browser/media/anythingQuickAccess.css.js +4 -0
  203. package/dist/vscode/vs/workbench/contrib/search/browser/search.contribution.js +428 -0
  204. package/dist/vscode/vs/workbench/contrib/search/browser/symbolsQuickAccess.js +219 -0
  205. package/dist/vscode/vs/workbench/contrib/search/common/cacheState.js +85 -0
  206. package/dist/vscode/vs/workbench/contrib/search/common/constants.js +2 -0
  207. package/dist/vscode/vs/workbench/contrib/search/common/search.js +119 -1
  208. package/dist/vscode/vs/workbench/contrib/tasks/browser/taskQuickPick.js +385 -0
  209. package/dist/vscode/vs/workbench/contrib/tasks/browser/tasksQuickAccess.js +108 -0
  210. package/dist/vscode/vs/workbench/contrib/tasks/common/tasks.js +351 -0
  211. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminal.js +4 -0
  212. package/dist/vscode/vs/workbench/contrib/terminal/browser/terminalIcon.js +44 -0
  213. package/dist/vscode/vs/workbench/contrib/terminal/common/terminalColorRegistry.js +147 -1
  214. package/dist/vscode/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +4 -0
  215. package/dist/vscode/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +1 -1
  216. package/dist/vscode/vs/workbench/services/editor/browser/editorDropService.js +3 -0
  217. package/dist/vscode/vs/workbench/services/editor/browser/editorResolverService.js +619 -0
  218. package/dist/vscode/vs/workbench/services/editor/browser/editorService.js +720 -0
  219. package/dist/vscode/vs/workbench/services/editor/common/editorGroupFinder.js +116 -0
  220. package/dist/vscode/vs/workbench/services/editor/common/editorGroupsService.js +6 -1
  221. package/dist/vscode/vs/workbench/services/editor/common/editorResolverService.js +34 -1
  222. package/dist/vscode/vs/workbench/services/history/browser/historyService.js +1451 -0
  223. package/dist/vscode/vs/workbench/services/hover/browser/hoverService.js +1 -1
  224. package/dist/vscode/vs/workbench/services/hover/browser/media/hover.css.js +4 -0
  225. package/dist/vscode/vs/workbench/services/languageDetection/common/languageDetectionWorkerService.js +2 -1
  226. package/dist/vscode/vs/workbench/services/outline/browser/outline.js +3 -0
  227. package/dist/vscode/vs/workbench/services/progress/browser/progressIndicator.js +72 -1
  228. package/dist/vscode/vs/workbench/services/quickinput/browser/quickInputService.js +67 -0
  229. package/dist/vscode/vs/workbench/services/search/common/search.js +2 -112
  230. package/dist/vscode/vs/workbench/services/semanticSimilarity/common/semanticSimilarityService.js +54 -1
  231. package/dist/vscode/vs/workbench/services/statusbar/browser/statusbar.js +15 -0
  232. package/dist/vscode/vs/workbench/services/textMate/browser/worker/textMate.worker.js +90 -0
  233. package/dist/vscode/vs/workbench/services/textMate/browser/worker/textMateWorkerModel.js +133 -0
  234. package/dist/vscode/vs/workbench/services/untitled/common/untitledTextEditorService.js +110 -3
  235. package/dist/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.js +1 -1
  236. package/dist/vscode-services/extHost.js +12 -5
  237. package/dist/vscode-services/missing-services.js +117 -3
  238. package/dist/vscode-services/window.js +21 -2
  239. package/dist/vscode-services/workspace.js +2 -1
  240. package/dist/workbenchThemeService.d.ts +1 -1
  241. package/dist/workers/textMate.worker.d.ts +2 -0
  242. package/dist/workers/textMate.worker.js +3 -0
  243. package/dist/workspace.d.ts +1 -1
  244. package/monaco-editor-treemending.patch +535 -535
  245. package/package.json +42 -22
  246. package/dist/assets/activityaction.css +0 -224
  247. package/dist/assets/activitybarpart.css +0 -65
  248. package/dist/assets/basepanelpart.css +0 -221
  249. package/dist/assets/breakpointWidget.css +0 -31
  250. package/dist/assets/callHierarchy.css +0 -62
  251. package/dist/assets/callStackEditorContribution.css +0 -12
  252. package/dist/assets/compositepart.css +0 -17
  253. package/dist/assets/debug.contribution.css +0 -138
  254. package/dist/assets/debugHover.css +0 -80
  255. package/dist/assets/debugToolBar.css +0 -49
  256. package/dist/assets/debugViewlet.css +0 -337
  257. package/dist/assets/editorquickaccess.css +0 -8
  258. package/dist/assets/exceptionWidget.css +0 -52
  259. package/dist/assets/explorerviewlet.css +0 -129
  260. package/dist/assets/hover.css +0 -127
  261. package/dist/assets/interactiveSession.css +0 -340
  262. package/dist/assets/menubar.css +0 -111
  263. package/dist/assets/menubarControl.css +0 -61
  264. package/dist/assets/notificationsActions.css +0 -14
  265. package/dist/assets/notificationsCenter.css +0 -69
  266. package/dist/assets/notificationsList.css +0 -152
  267. package/dist/assets/notificationsToasts.css +0 -63
  268. package/dist/assets/panelpart.css +0 -75
  269. package/dist/assets/paneview.css +0 -148
  270. package/dist/assets/paneviewlet.css +0 -79
  271. package/dist/assets/part.css +0 -109
  272. package/dist/assets/repl.css +0 -145
  273. package/dist/assets/sidebarpart.css +0 -61
  274. package/dist/assets/tunnelView.css +0 -107
  275. package/dist/assets/typeHierarchy.css +0 -62
  276. package/dist/assets/views.css +0 -297
  277. package/dist/override/vs/workbench/browser/parts/editor/textEditor.js +0 -2
  278. package/dist/override/vs/workbench/contrib/files/browser/views/openEditorsView.js +0 -2
  279. package/dist/service-override/modelEditor.d.ts +0 -14
  280. package/dist/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput.js +0 -249
  281. package/dist/vscode/vs/workbench/contrib/notebook/common/notebookService.js +0 -10
  282. package/dist/vscode/vs/workbench/services/search/common/searchHelpers.js +0 -72
  283. package/dist/vscode/vs/workbench/services/search/common/searchService.js +0 -355
@@ -0,0 +1,1451 @@
1
+ import { __decorate, __param } from '../../../../../../node_modules/tslib/tslib.es6.js';
2
+ import { localize } from 'monaco-editor/esm/vs/nls.js';
3
+ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
4
+ import { isEditorPaneWithSelection, isEditorInput, EditorResourceAccessor, EditorCloseContext, SideBySideEditor, isSideBySideEditorInput, isResourceEditorInput } from '../../../common/editor.js';
5
+ import { IEditorService } from '../../editor/common/editorService.js';
6
+ import { FILES_EXCLUDE_CONFIG, FileChangesEvent, FileOperationEvent, IFileService } from 'monaco-editor/esm/vs/platform/files/common/files.js';
7
+ import { IWorkspaceContextService } from 'monaco-editor/esm/vs/platform/workspace/common/workspace.js';
8
+ import { Disposable, DisposableStore, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
9
+ import { IStorageService } from 'monaco-editor/esm/vs/platform/storage/common/storage.js';
10
+ import { Emitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
11
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
12
+ import { IEditorGroupsService } from '../../editor/common/editorGroupsService.js';
13
+ import { getExcludes, SEARCH_EXCLUDE_CONFIG } from '../../search/common/search.js';
14
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
15
+ import { IWorkbenchLayoutService } from '../../layout/browser/layoutService.js';
16
+ import { RawContextKey, IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
17
+ import { coalesce, remove } from 'monaco-editor/esm/vs/base/common/arrays.js';
18
+ import { EventHelper, addDisposableListener, EventType } from 'monaco-editor/esm/vs/base/browser/dom.js';
19
+ import { IWorkspacesService } from '../../../../platform/workspaces/common/workspaces.js';
20
+ import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
21
+ import { onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
22
+ import { IdleValue } from 'monaco-editor/esm/vs/base/common/async.js';
23
+ import { ResourceGlobMatcher } from '../../../common/resources.js';
24
+ import { IPathService } from '../../path/common/pathService.js';
25
+ import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
26
+ import { ILifecycleService } from '../../lifecycle/common/lifecycle.js';
27
+ import { LogLevel, ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
28
+ let HistoryService = class HistoryService extends Disposable {
29
+ constructor(editorService, editorGroupService, contextService, storageService, configurationService, fileService, workspacesService, instantiationService, layoutService, contextKeyService) {
30
+ super();
31
+ this.editorService = editorService;
32
+ this.editorGroupService = editorGroupService;
33
+ this.contextService = contextService;
34
+ this.storageService = storageService;
35
+ this.configurationService = configurationService;
36
+ this.fileService = fileService;
37
+ this.workspacesService = workspacesService;
38
+ this.instantiationService = instantiationService;
39
+ this.layoutService = layoutService;
40
+ this.contextKeyService = contextKeyService;
41
+ this.activeEditorListeners = this._register(( (new DisposableStore())));
42
+ this.lastActiveEditor = undefined;
43
+ this.editorHelper = this.instantiationService.createInstance(EditorHelper);
44
+ this.canNavigateBackContextKey = (( (new RawContextKey('canNavigateBack', false, (localize(
45
+ 'canNavigateBack',
46
+ "Whether it is possible to navigate back in editor history"
47
+ )))))).bindTo(this.contextKeyService);
48
+ this.canNavigateForwardContextKey = (( (new RawContextKey('canNavigateForward', false, (localize(
49
+ 'canNavigateForward',
50
+ "Whether it is possible to navigate forward in editor history"
51
+ )))))).bindTo(this.contextKeyService);
52
+ this.canNavigateBackInNavigationsContextKey = (( (new RawContextKey('canNavigateBackInNavigationLocations', false, (localize(
53
+ 'canNavigateBackInNavigationLocations',
54
+ "Whether it is possible to navigate back in editor navigation locations history"
55
+ )))))).bindTo(this.contextKeyService);
56
+ this.canNavigateForwardInNavigationsContextKey = (( (new RawContextKey('canNavigateForwardInNavigationLocations', false, (localize(
57
+ 'canNavigateForwardInNavigationLocations',
58
+ "Whether it is possible to navigate forward in editor navigation locations history"
59
+ )))))).bindTo(this.contextKeyService);
60
+ this.canNavigateToLastNavigationLocationContextKey = (( (new RawContextKey('canNavigateToLastNavigationLocation', false, (localize(
61
+ 'canNavigateToLastNavigationLocation',
62
+ "Whether it is possible to navigate to the last editor navigation location"
63
+ )))))).bindTo(this.contextKeyService);
64
+ this.canNavigateBackInEditsContextKey = (( (new RawContextKey('canNavigateBackInEditLocations', false, (localize(
65
+ 'canNavigateBackInEditLocations',
66
+ "Whether it is possible to navigate back in editor edit locations history"
67
+ )))))).bindTo(this.contextKeyService);
68
+ this.canNavigateForwardInEditsContextKey = (( (new RawContextKey('canNavigateForwardInEditLocations', false, (localize(
69
+ 'canNavigateForwardInEditLocations',
70
+ "Whether it is possible to navigate forward in editor edit locations history"
71
+ )))))).bindTo(this.contextKeyService);
72
+ this.canNavigateToLastEditLocationContextKey = (( (new RawContextKey('canNavigateToLastEditLocation', false, (localize(
73
+ 'canNavigateToLastEditLocation',
74
+ "Whether it is possible to navigate to the last editor edit location"
75
+ )))))).bindTo(this.contextKeyService);
76
+ this.canReopenClosedEditorContextKey = (( (new RawContextKey('canReopenClosedEditor', false, (localize(
77
+ 'canReopenClosedEditor',
78
+ "Whether it is possible to reopen the last closed editor"
79
+ )))))).bindTo(this.contextKeyService);
80
+ this._onDidChangeEditorNavigationStack = this._register(( (new Emitter())));
81
+ this.onDidChangeEditorNavigationStack = this._onDidChangeEditorNavigationStack.event;
82
+ this.defaultScopedEditorNavigationStack = undefined;
83
+ this.editorGroupScopedNavigationStacks = ( (new Map()));
84
+ this.editorScopedNavigationStacks = ( (new Map()));
85
+ this.editorNavigationScope = 0 ;
86
+ this.recentlyUsedEditorsStack = undefined;
87
+ this.recentlyUsedEditorsStackIndex = 0;
88
+ this.recentlyUsedEditorsInGroupStack = undefined;
89
+ this.recentlyUsedEditorsInGroupStackIndex = 0;
90
+ this.navigatingInRecentlyUsedEditorsStack = false;
91
+ this.navigatingInRecentlyUsedEditorsInGroupStack = false;
92
+ this.recentlyClosedEditors = [];
93
+ this.ignoreEditorCloseEvent = false;
94
+ this.history = undefined;
95
+ this.editorHistoryListeners = ( (new Map()));
96
+ this.resourceExcludeMatcher = this._register(( (new IdleValue(() => {
97
+ const matcher = this._register(this.instantiationService.createInstance(ResourceGlobMatcher, root => getExcludes(root ? this.configurationService.getValue({ resource: root }) : this.configurationService.getValue()) || Object.create(null), event => event.affectsConfiguration(FILES_EXCLUDE_CONFIG) || event.affectsConfiguration(SEARCH_EXCLUDE_CONFIG)));
98
+ this._register(matcher.onExpressionChange(() => this.removeExcludedFromHistory()));
99
+ return matcher;
100
+ }))));
101
+ this.registerListeners();
102
+ if (this.editorService.activeEditorPane) {
103
+ this.onDidActiveEditorChange();
104
+ }
105
+ }
106
+ registerListeners() {
107
+ this.registerMouseNavigationListener();
108
+ this._register(this.editorService.onDidActiveEditorChange(() => this.onDidActiveEditorChange()));
109
+ this._register(this.editorService.onDidOpenEditorFail(event => this.remove(event.editor)));
110
+ this._register(this.editorService.onDidCloseEditor(event => this.onDidCloseEditor(event)));
111
+ this._register(this.editorService.onDidMostRecentlyActiveEditorsChange(() => this.handleEditorEventInRecentEditorsStack()));
112
+ this._register(this.editorGroupService.onDidRemoveGroup(e => this.onDidRemoveGroup(e)));
113
+ this._register(this.fileService.onDidFilesChange(event => this.onDidFilesChange(event)));
114
+ this._register(this.fileService.onDidRunOperation(event => this.onDidFilesChange(event)));
115
+ this._register(this.storageService.onWillSaveState(() => this.saveState()));
116
+ this.registerEditorNavigationScopeChangeListener();
117
+ this._register(this.onDidChangeEditorNavigationStack(() => this.updateContextKeys()));
118
+ this._register(this.editorGroupService.onDidChangeActiveGroup(() => this.updateContextKeys()));
119
+ }
120
+ onDidCloseEditor(e) {
121
+ this.handleEditorCloseEventInHistory(e);
122
+ this.handleEditorCloseEventInReopen(e);
123
+ }
124
+ registerMouseNavigationListener() {
125
+ const mouseBackForwardSupportListener = this._register(( (new DisposableStore())));
126
+ const handleMouseBackForwardSupport = () => {
127
+ mouseBackForwardSupportListener.clear();
128
+ if (this.configurationService.getValue(HistoryService.MOUSE_NAVIGATION_SETTING)) {
129
+ mouseBackForwardSupportListener.add(addDisposableListener(this.layoutService.container, EventType.MOUSE_DOWN, e => this.onMouseDownOrUp(e, true)));
130
+ mouseBackForwardSupportListener.add(addDisposableListener(this.layoutService.container, EventType.MOUSE_UP, e => this.onMouseDownOrUp(e, false)));
131
+ }
132
+ };
133
+ this._register(this.configurationService.onDidChangeConfiguration(event => {
134
+ if (event.affectsConfiguration(HistoryService.MOUSE_NAVIGATION_SETTING)) {
135
+ handleMouseBackForwardSupport();
136
+ }
137
+ }));
138
+ handleMouseBackForwardSupport();
139
+ }
140
+ onMouseDownOrUp(event, isMouseDown) {
141
+ switch (event.button) {
142
+ case 3:
143
+ EventHelper.stop(event);
144
+ if (isMouseDown) {
145
+ this.goBack();
146
+ }
147
+ break;
148
+ case 4:
149
+ EventHelper.stop(event);
150
+ if (isMouseDown) {
151
+ this.goForward();
152
+ }
153
+ break;
154
+ }
155
+ }
156
+ onDidRemoveGroup(group) {
157
+ this.handleEditorGroupRemoveInNavigationStacks(group);
158
+ }
159
+ onDidActiveEditorChange() {
160
+ const activeEditorGroup = this.editorGroupService.activeGroup;
161
+ const activeEditorPane = activeEditorGroup.activeEditorPane;
162
+ if (this.lastActiveEditor && this.editorHelper.matchesEditorIdentifier(this.lastActiveEditor, activeEditorPane)) {
163
+ return;
164
+ }
165
+ this.lastActiveEditor = activeEditorPane?.input && activeEditorPane.group ? { editor: activeEditorPane.input, groupId: activeEditorPane.group.id } : undefined;
166
+ this.activeEditorListeners.clear();
167
+ this.handleActiveEditorChange(activeEditorGroup, activeEditorPane);
168
+ if (isEditorPaneWithSelection(activeEditorPane)) {
169
+ this.activeEditorListeners.add(activeEditorPane.onDidChangeSelection(e => this.handleActiveEditorSelectionChangeEvent(activeEditorGroup, activeEditorPane, e)));
170
+ }
171
+ this.updateContextKeys();
172
+ }
173
+ onDidFilesChange(event) {
174
+ if (event instanceof FileChangesEvent) {
175
+ if (event.gotDeleted()) {
176
+ this.remove(event);
177
+ }
178
+ }
179
+ else {
180
+ if (event.isOperation(1 )) {
181
+ this.remove(event);
182
+ }
183
+ else if (event.isOperation(2 ) && event.target.isFile) {
184
+ this.move(event);
185
+ }
186
+ }
187
+ }
188
+ handleActiveEditorChange(group, editorPane) {
189
+ this.handleActiveEditorChangeInHistory(editorPane);
190
+ this.handleActiveEditorChangeInNavigationStacks(group, editorPane);
191
+ }
192
+ handleActiveEditorSelectionChangeEvent(group, editorPane, event) {
193
+ this.handleActiveEditorSelectionChangeInNavigationStacks(group, editorPane, event);
194
+ }
195
+ move(event) {
196
+ this.moveInHistory(event);
197
+ this.moveInEditorNavigationStacks(event);
198
+ }
199
+ remove(arg1) {
200
+ this.removeFromHistory(arg1);
201
+ this.removeFromEditorNavigationStacks(arg1);
202
+ this.removeFromRecentlyClosedEditors(arg1);
203
+ this.removeFromRecentlyOpened(arg1);
204
+ }
205
+ removeFromRecentlyOpened(arg1) {
206
+ let resource = undefined;
207
+ if (isEditorInput(arg1)) {
208
+ resource = EditorResourceAccessor.getOriginalUri(arg1);
209
+ }
210
+ else if (arg1 instanceof FileChangesEvent) ;
211
+ else {
212
+ resource = arg1.resource;
213
+ }
214
+ if (resource) {
215
+ this.workspacesService.removeRecentlyOpened([resource]);
216
+ }
217
+ }
218
+ clear() {
219
+ this.clearRecentlyOpened();
220
+ this.clearEditorNavigationStacks();
221
+ this.recentlyClosedEditors = [];
222
+ this.updateContextKeys();
223
+ }
224
+ updateContextKeys() {
225
+ this.contextKeyService.bufferChangeEvents(() => {
226
+ const activeStack = this.getStack();
227
+ this.canNavigateBackContextKey.set(activeStack.canGoBack(0 ));
228
+ this.canNavigateForwardContextKey.set(activeStack.canGoForward(0 ));
229
+ this.canNavigateBackInNavigationsContextKey.set(activeStack.canGoBack(2 ));
230
+ this.canNavigateForwardInNavigationsContextKey.set(activeStack.canGoForward(2 ));
231
+ this.canNavigateToLastNavigationLocationContextKey.set(activeStack.canGoLast(2 ));
232
+ this.canNavigateBackInEditsContextKey.set(activeStack.canGoBack(1 ));
233
+ this.canNavigateForwardInEditsContextKey.set(activeStack.canGoForward(1 ));
234
+ this.canNavigateToLastEditLocationContextKey.set(activeStack.canGoLast(1 ));
235
+ this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length > 0);
236
+ });
237
+ }
238
+ registerEditorNavigationScopeChangeListener() {
239
+ const handleEditorNavigationScopeChange = () => {
240
+ this.disposeEditorNavigationStacks();
241
+ const configuredScope = this.configurationService.getValue(HistoryService.NAVIGATION_SCOPE_SETTING);
242
+ if (configuredScope === 'editorGroup') {
243
+ this.editorNavigationScope = 1 ;
244
+ }
245
+ else if (configuredScope === 'editor') {
246
+ this.editorNavigationScope = 2 ;
247
+ }
248
+ else {
249
+ this.editorNavigationScope = 0 ;
250
+ }
251
+ };
252
+ this._register(this.configurationService.onDidChangeConfiguration(event => {
253
+ if (event.affectsConfiguration(HistoryService.NAVIGATION_SCOPE_SETTING)) {
254
+ handleEditorNavigationScopeChange();
255
+ }
256
+ }));
257
+ handleEditorNavigationScopeChange();
258
+ }
259
+ getStack(group = this.editorGroupService.activeGroup, editor = group.activeEditor) {
260
+ switch (this.editorNavigationScope) {
261
+ case 2 : {
262
+ if (!editor) {
263
+ return (
264
+ (new NoOpEditorNavigationStacks())
265
+ );
266
+ }
267
+ let stacksForGroup = this.editorScopedNavigationStacks.get(group.id);
268
+ if (!stacksForGroup) {
269
+ stacksForGroup = ( (new Map()));
270
+ this.editorScopedNavigationStacks.set(group.id, stacksForGroup);
271
+ }
272
+ let stack = stacksForGroup.get(editor)?.stack;
273
+ if (!stack) {
274
+ const disposable = ( (new DisposableStore()));
275
+ stack = disposable.add(this.instantiationService.createInstance(EditorNavigationStacks, 2 ));
276
+ disposable.add(stack.onDidChange(() => this._onDidChangeEditorNavigationStack.fire()));
277
+ stacksForGroup.set(editor, { stack, disposable });
278
+ }
279
+ return stack;
280
+ }
281
+ case 1 : {
282
+ let stack = this.editorGroupScopedNavigationStacks.get(group.id)?.stack;
283
+ if (!stack) {
284
+ const disposable = ( (new DisposableStore()));
285
+ stack = disposable.add(this.instantiationService.createInstance(EditorNavigationStacks, 1 ));
286
+ disposable.add(stack.onDidChange(() => this._onDidChangeEditorNavigationStack.fire()));
287
+ this.editorGroupScopedNavigationStacks.set(group.id, { stack, disposable });
288
+ }
289
+ return stack;
290
+ }
291
+ case 0 : {
292
+ if (!this.defaultScopedEditorNavigationStack) {
293
+ this.defaultScopedEditorNavigationStack = this._register(this.instantiationService.createInstance(EditorNavigationStacks, 0 ));
294
+ this._register(this.defaultScopedEditorNavigationStack.onDidChange(() => this._onDidChangeEditorNavigationStack.fire()));
295
+ }
296
+ return this.defaultScopedEditorNavigationStack;
297
+ }
298
+ }
299
+ }
300
+ goForward(filter) {
301
+ return this.getStack().goForward(filter);
302
+ }
303
+ goBack(filter) {
304
+ return this.getStack().goBack(filter);
305
+ }
306
+ goPrevious(filter) {
307
+ return this.getStack().goPrevious(filter);
308
+ }
309
+ goLast(filter) {
310
+ return this.getStack().goLast(filter);
311
+ }
312
+ handleActiveEditorChangeInNavigationStacks(group, editorPane) {
313
+ this.getStack(group, editorPane?.input).handleActiveEditorChange(editorPane);
314
+ }
315
+ handleActiveEditorSelectionChangeInNavigationStacks(group, editorPane, event) {
316
+ this.getStack(group, editorPane.input).handleActiveEditorSelectionChange(editorPane, event);
317
+ }
318
+ handleEditorCloseEventInHistory(e) {
319
+ const editors = this.editorScopedNavigationStacks.get(e.groupId);
320
+ if (editors) {
321
+ const editorStack = editors.get(e.editor);
322
+ if (editorStack) {
323
+ editorStack.disposable.dispose();
324
+ editors.delete(e.editor);
325
+ }
326
+ if (editors.size === 0) {
327
+ this.editorScopedNavigationStacks.delete(e.groupId);
328
+ }
329
+ }
330
+ }
331
+ handleEditorGroupRemoveInNavigationStacks(group) {
332
+ this.defaultScopedEditorNavigationStack?.remove(group.id);
333
+ const editorGroupStack = this.editorGroupScopedNavigationStacks.get(group.id);
334
+ if (editorGroupStack) {
335
+ editorGroupStack.disposable.dispose();
336
+ this.editorGroupScopedNavigationStacks.delete(group.id);
337
+ }
338
+ }
339
+ clearEditorNavigationStacks() {
340
+ this.withEachEditorNavigationStack(stack => stack.clear());
341
+ }
342
+ removeFromEditorNavigationStacks(arg1) {
343
+ this.withEachEditorNavigationStack(stack => stack.remove(arg1));
344
+ }
345
+ moveInEditorNavigationStacks(event) {
346
+ this.withEachEditorNavigationStack(stack => stack.move(event));
347
+ }
348
+ withEachEditorNavigationStack(fn) {
349
+ if (this.defaultScopedEditorNavigationStack) {
350
+ fn(this.defaultScopedEditorNavigationStack);
351
+ }
352
+ for (const [, entry] of this.editorGroupScopedNavigationStacks) {
353
+ fn(entry.stack);
354
+ }
355
+ for (const [, entries] of this.editorScopedNavigationStacks) {
356
+ for (const [, entry] of entries) {
357
+ fn(entry.stack);
358
+ }
359
+ }
360
+ }
361
+ disposeEditorNavigationStacks() {
362
+ this.defaultScopedEditorNavigationStack?.dispose();
363
+ this.defaultScopedEditorNavigationStack = undefined;
364
+ for (const [, stack] of this.editorGroupScopedNavigationStacks) {
365
+ stack.disposable.dispose();
366
+ }
367
+ this.editorGroupScopedNavigationStacks.clear();
368
+ for (const [, stacks] of this.editorScopedNavigationStacks) {
369
+ for (const [, stack] of stacks) {
370
+ stack.disposable.dispose();
371
+ }
372
+ }
373
+ this.editorScopedNavigationStacks.clear();
374
+ }
375
+ openNextRecentlyUsedEditor(groupId) {
376
+ const [stack, index] = this.ensureRecentlyUsedStack(index => index - 1, groupId);
377
+ return this.doNavigateInRecentlyUsedEditorsStack(stack[index], groupId);
378
+ }
379
+ openPreviouslyUsedEditor(groupId) {
380
+ const [stack, index] = this.ensureRecentlyUsedStack(index => index + 1, groupId);
381
+ return this.doNavigateInRecentlyUsedEditorsStack(stack[index], groupId);
382
+ }
383
+ async doNavigateInRecentlyUsedEditorsStack(editorIdentifier, groupId) {
384
+ if (editorIdentifier) {
385
+ const acrossGroups = typeof groupId !== 'number' || !this.editorGroupService.getGroup(groupId);
386
+ if (acrossGroups) {
387
+ this.navigatingInRecentlyUsedEditorsStack = true;
388
+ }
389
+ else {
390
+ this.navigatingInRecentlyUsedEditorsInGroupStack = true;
391
+ }
392
+ const group = this.editorGroupService.getGroup(editorIdentifier.groupId) ?? this.editorGroupService.activeGroup;
393
+ try {
394
+ await group.openEditor(editorIdentifier.editor);
395
+ }
396
+ finally {
397
+ if (acrossGroups) {
398
+ this.navigatingInRecentlyUsedEditorsStack = false;
399
+ }
400
+ else {
401
+ this.navigatingInRecentlyUsedEditorsInGroupStack = false;
402
+ }
403
+ }
404
+ }
405
+ }
406
+ ensureRecentlyUsedStack(indexModifier, groupId) {
407
+ let editors;
408
+ let index;
409
+ const group = typeof groupId === 'number' ? this.editorGroupService.getGroup(groupId) : undefined;
410
+ if (!group) {
411
+ editors = this.recentlyUsedEditorsStack || this.editorService.getEditors(0 );
412
+ index = this.recentlyUsedEditorsStackIndex;
413
+ }
414
+ else {
415
+ editors = this.recentlyUsedEditorsInGroupStack || ( (group.getEditors(0 ).map(editor => ({ groupId: group.id, editor }))));
416
+ index = this.recentlyUsedEditorsInGroupStackIndex;
417
+ }
418
+ let newIndex = indexModifier(index);
419
+ if (newIndex < 0) {
420
+ newIndex = 0;
421
+ }
422
+ else if (newIndex > editors.length - 1) {
423
+ newIndex = editors.length - 1;
424
+ }
425
+ if (!group) {
426
+ this.recentlyUsedEditorsStack = editors;
427
+ this.recentlyUsedEditorsStackIndex = newIndex;
428
+ }
429
+ else {
430
+ this.recentlyUsedEditorsInGroupStack = editors;
431
+ this.recentlyUsedEditorsInGroupStackIndex = newIndex;
432
+ }
433
+ return [editors, newIndex];
434
+ }
435
+ handleEditorEventInRecentEditorsStack() {
436
+ if (!this.navigatingInRecentlyUsedEditorsStack) {
437
+ this.recentlyUsedEditorsStack = undefined;
438
+ this.recentlyUsedEditorsStackIndex = 0;
439
+ }
440
+ if (!this.navigatingInRecentlyUsedEditorsInGroupStack) {
441
+ this.recentlyUsedEditorsInGroupStack = undefined;
442
+ this.recentlyUsedEditorsInGroupStackIndex = 0;
443
+ }
444
+ }
445
+ handleEditorCloseEventInReopen(event) {
446
+ if (this.ignoreEditorCloseEvent) {
447
+ return;
448
+ }
449
+ const { editor, context } = event;
450
+ if (context === EditorCloseContext.REPLACE || context === EditorCloseContext.MOVE) {
451
+ return;
452
+ }
453
+ const untypedEditor = editor.toUntyped();
454
+ if (!untypedEditor) {
455
+ return;
456
+ }
457
+ const associatedResources = [];
458
+ const editorResource = EditorResourceAccessor.getOriginalUri(editor, { supportSideBySide: SideBySideEditor.BOTH });
459
+ if (URI.isUri(editorResource)) {
460
+ associatedResources.push(editorResource);
461
+ }
462
+ else if (editorResource) {
463
+ associatedResources.push(...coalesce([editorResource.primary, editorResource.secondary]));
464
+ }
465
+ this.removeFromRecentlyClosedEditors(editor);
466
+ this.recentlyClosedEditors.push({
467
+ editorId: editor.editorId,
468
+ editor: untypedEditor,
469
+ resource: EditorResourceAccessor.getOriginalUri(editor),
470
+ associatedResources,
471
+ index: event.index,
472
+ sticky: event.sticky
473
+ });
474
+ if (this.recentlyClosedEditors.length > HistoryService.MAX_RECENTLY_CLOSED_EDITORS) {
475
+ this.recentlyClosedEditors.shift();
476
+ }
477
+ this.canReopenClosedEditorContextKey.set(true);
478
+ }
479
+ async reopenLastClosedEditor() {
480
+ const lastClosedEditor = this.recentlyClosedEditors.pop();
481
+ let reopenClosedEditorPromise = undefined;
482
+ if (lastClosedEditor) {
483
+ reopenClosedEditorPromise = this.doReopenLastClosedEditor(lastClosedEditor);
484
+ }
485
+ this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length > 0);
486
+ return reopenClosedEditorPromise;
487
+ }
488
+ async doReopenLastClosedEditor(lastClosedEditor) {
489
+ const options = { pinned: true, sticky: lastClosedEditor.sticky, index: lastClosedEditor.index, ignoreError: true };
490
+ if ((lastClosedEditor.sticky && !this.editorGroupService.activeGroup.isSticky(lastClosedEditor.index)) ||
491
+ (!lastClosedEditor.sticky && this.editorGroupService.activeGroup.isSticky(lastClosedEditor.index))) {
492
+ options.index = undefined;
493
+ }
494
+ let editorPane = undefined;
495
+ if (!this.editorGroupService.activeGroup.contains(lastClosedEditor.editor)) {
496
+ this.ignoreEditorCloseEvent = true;
497
+ try {
498
+ editorPane = await this.editorService.openEditor({
499
+ ...lastClosedEditor.editor,
500
+ options: {
501
+ ...lastClosedEditor.editor.options,
502
+ ...options
503
+ }
504
+ });
505
+ }
506
+ finally {
507
+ this.ignoreEditorCloseEvent = false;
508
+ }
509
+ }
510
+ if (!editorPane) {
511
+ remove(this.recentlyClosedEditors, lastClosedEditor);
512
+ this.reopenLastClosedEditor();
513
+ }
514
+ }
515
+ removeFromRecentlyClosedEditors(arg1) {
516
+ this.recentlyClosedEditors = this.recentlyClosedEditors.filter(recentlyClosedEditor => {
517
+ if (isEditorInput(arg1) && recentlyClosedEditor.editorId !== arg1.editorId) {
518
+ return true;
519
+ }
520
+ if (recentlyClosedEditor.resource && this.editorHelper.matchesFile(recentlyClosedEditor.resource, arg1)) {
521
+ return false;
522
+ }
523
+ if (( (recentlyClosedEditor.associatedResources.some(
524
+ associatedResource => this.editorHelper.matchesFile(associatedResource, arg1)
525
+ )))) {
526
+ return false;
527
+ }
528
+ return true;
529
+ });
530
+ this.canReopenClosedEditorContextKey.set(this.recentlyClosedEditors.length > 0);
531
+ }
532
+ handleActiveEditorChangeInHistory(editorPane) {
533
+ const editor = editorPane?.input;
534
+ if (!editor || editor.isDisposed() || !this.includeInHistory(editor)) {
535
+ return;
536
+ }
537
+ this.removeFromHistory(editor);
538
+ this.addToHistory(editor);
539
+ }
540
+ addToHistory(editor, insertFirst = true) {
541
+ this.ensureHistoryLoaded(this.history);
542
+ const historyInput = this.editorHelper.preferResourceEditorInput(editor);
543
+ if (!historyInput) {
544
+ return;
545
+ }
546
+ if (insertFirst) {
547
+ this.history.unshift(historyInput);
548
+ }
549
+ else {
550
+ this.history.push(historyInput);
551
+ }
552
+ if (this.history.length > HistoryService.MAX_HISTORY_ITEMS) {
553
+ this.editorHelper.clearOnEditorDispose(this.history.pop(), this.editorHistoryListeners);
554
+ }
555
+ if (isEditorInput(historyInput)) {
556
+ this.editorHelper.onEditorDispose(historyInput, () => this.updateHistoryOnEditorDispose(historyInput), this.editorHistoryListeners);
557
+ }
558
+ }
559
+ updateHistoryOnEditorDispose(editor) {
560
+ if (!isSideBySideEditorInput(editor)) {
561
+ this.removeFromHistory(editor);
562
+ }
563
+ else {
564
+ const resourceInputs = [];
565
+ const sideInputs = editor.primary.matches(editor.secondary) ? [editor.primary] : [editor.primary, editor.secondary];
566
+ for (const sideInput of sideInputs) {
567
+ const candidateResourceInput = this.editorHelper.preferResourceEditorInput(sideInput);
568
+ if (isResourceEditorInput(candidateResourceInput)) {
569
+ resourceInputs.push(candidateResourceInput);
570
+ }
571
+ }
572
+ this.replaceInHistory(editor, ...resourceInputs);
573
+ }
574
+ }
575
+ includeInHistory(editor) {
576
+ if (isEditorInput(editor)) {
577
+ return true;
578
+ }
579
+ return !this.resourceExcludeMatcher.value.matches(editor.resource);
580
+ }
581
+ removeExcludedFromHistory() {
582
+ this.ensureHistoryLoaded(this.history);
583
+ this.history = this.history.filter(entry => {
584
+ const include = this.includeInHistory(entry);
585
+ if (!include) {
586
+ this.editorHelper.clearOnEditorDispose(entry, this.editorHistoryListeners);
587
+ }
588
+ return include;
589
+ });
590
+ }
591
+ moveInHistory(event) {
592
+ if (event.isOperation(2 )) {
593
+ const removed = this.removeFromHistory(event);
594
+ if (removed) {
595
+ this.addToHistory({ resource: event.target.resource });
596
+ }
597
+ }
598
+ }
599
+ removeFromHistory(arg1) {
600
+ let removed = false;
601
+ this.ensureHistoryLoaded(this.history);
602
+ this.history = this.history.filter(entry => {
603
+ const matches = this.editorHelper.matchesEditor(arg1, entry);
604
+ if (matches) {
605
+ this.editorHelper.clearOnEditorDispose(arg1, this.editorHistoryListeners);
606
+ removed = true;
607
+ }
608
+ return !matches;
609
+ });
610
+ return removed;
611
+ }
612
+ replaceInHistory(editor, ...replacements) {
613
+ this.ensureHistoryLoaded(this.history);
614
+ let replaced = false;
615
+ const newHistory = [];
616
+ for (const entry of this.history) {
617
+ if (this.editorHelper.matchesEditor(editor, entry)) {
618
+ this.editorHelper.clearOnEditorDispose(editor, this.editorHistoryListeners);
619
+ if (!replaced) {
620
+ newHistory.push(...replacements);
621
+ replaced = true;
622
+ }
623
+ }
624
+ else if (!( (replacements.some(replacement => this.editorHelper.matchesEditor(replacement, entry))))) {
625
+ newHistory.push(entry);
626
+ }
627
+ }
628
+ if (!replaced) {
629
+ newHistory.push(...replacements);
630
+ }
631
+ this.history = newHistory;
632
+ }
633
+ clearRecentlyOpened() {
634
+ this.history = [];
635
+ for (const [, disposable] of this.editorHistoryListeners) {
636
+ dispose(disposable);
637
+ }
638
+ this.editorHistoryListeners.clear();
639
+ }
640
+ getHistory() {
641
+ this.ensureHistoryLoaded(this.history);
642
+ return this.history;
643
+ }
644
+ ensureHistoryLoaded(history) {
645
+ if (!this.history) {
646
+ this.history = [];
647
+ if (this.editorGroupService.isReady) {
648
+ this.loadHistory();
649
+ }
650
+ else {
651
+ (async () => {
652
+ await this.editorGroupService.whenReady;
653
+ this.loadHistory();
654
+ })();
655
+ }
656
+ }
657
+ }
658
+ loadHistory() {
659
+ this.history = [];
660
+ const storedEditorHistory = this.loadHistoryFromStorage();
661
+ const openedEditorsLru = [...this.editorService.getEditors(0 )].reverse();
662
+ const handledEditors = ( (new Set()));
663
+ for (const { editor } of openedEditorsLru) {
664
+ if (!this.includeInHistory(editor)) {
665
+ continue;
666
+ }
667
+ this.addToHistory(editor);
668
+ if (editor.resource) {
669
+ handledEditors.add(`${( ( editor.resource.toString()))}/${editor.editorId}`);
670
+ }
671
+ }
672
+ for (const editor of storedEditorHistory) {
673
+ if (!( (handledEditors.has(`${( ( editor.resource.toString()))}/${editor.options?.override}`)))) {
674
+ this.addToHistory(editor, false );
675
+ }
676
+ }
677
+ }
678
+ loadHistoryFromStorage() {
679
+ const entries = [];
680
+ const entriesRaw = this.storageService.get(HistoryService.HISTORY_STORAGE_KEY, 1 );
681
+ if (entriesRaw) {
682
+ try {
683
+ const entriesParsed = JSON.parse(entriesRaw);
684
+ for (const entryParsed of entriesParsed) {
685
+ if (!entryParsed.editor || !entryParsed.editor.resource) {
686
+ continue;
687
+ }
688
+ try {
689
+ entries.push({
690
+ ...entryParsed.editor,
691
+ resource: typeof entryParsed.editor.resource === 'string' ?
692
+ (
693
+ (URI.parse(entryParsed.editor.resource))) :
694
+ ( (URI.from(entryParsed.editor.resource)))
695
+ });
696
+ }
697
+ catch (error) {
698
+ onUnexpectedError(error);
699
+ }
700
+ }
701
+ }
702
+ catch (error) {
703
+ onUnexpectedError(error);
704
+ }
705
+ }
706
+ return entries;
707
+ }
708
+ saveState() {
709
+ if (!this.history) {
710
+ return;
711
+ }
712
+ const entries = [];
713
+ for (const editor of this.history) {
714
+ if (isEditorInput(editor) || !isResourceEditorInput(editor)) {
715
+ continue;
716
+ }
717
+ entries.push({
718
+ editor: {
719
+ ...editor,
720
+ resource: ( (editor.resource.toString()))
721
+ }
722
+ });
723
+ }
724
+ this.storageService.store(HistoryService.HISTORY_STORAGE_KEY, JSON.stringify(entries), 1 , 1 );
725
+ }
726
+ getLastActiveWorkspaceRoot(schemeFilter) {
727
+ const folders = this.contextService.getWorkspace().folders;
728
+ if (folders.length === 0) {
729
+ return undefined;
730
+ }
731
+ if (folders.length === 1) {
732
+ const resource = folders[0].uri;
733
+ if (!schemeFilter || resource.scheme === schemeFilter) {
734
+ return resource;
735
+ }
736
+ return undefined;
737
+ }
738
+ for (const input of this.getHistory()) {
739
+ if (isEditorInput(input)) {
740
+ continue;
741
+ }
742
+ if (schemeFilter && input.resource.scheme !== schemeFilter) {
743
+ continue;
744
+ }
745
+ const resourceWorkspace = this.contextService.getWorkspaceFolder(input.resource);
746
+ if (resourceWorkspace) {
747
+ return resourceWorkspace.uri;
748
+ }
749
+ }
750
+ for (const folder of folders) {
751
+ const resource = folder.uri;
752
+ if (!schemeFilter || resource.scheme === schemeFilter) {
753
+ return resource;
754
+ }
755
+ }
756
+ return undefined;
757
+ }
758
+ getLastActiveFile(filterByScheme) {
759
+ for (const input of this.getHistory()) {
760
+ let resource;
761
+ if (isEditorInput(input)) {
762
+ resource = EditorResourceAccessor.getOriginalUri(input, { filterByScheme });
763
+ }
764
+ else {
765
+ resource = input.resource;
766
+ }
767
+ if (resource?.scheme === filterByScheme) {
768
+ return resource;
769
+ }
770
+ }
771
+ return undefined;
772
+ }
773
+ };
774
+ HistoryService.MOUSE_NAVIGATION_SETTING = 'workbench.editor.mouseBackForwardToNavigate';
775
+ HistoryService.NAVIGATION_SCOPE_SETTING = 'workbench.editor.navigationScope';
776
+ HistoryService.MAX_RECENTLY_CLOSED_EDITORS = 20;
777
+ HistoryService.MAX_HISTORY_ITEMS = 200;
778
+ HistoryService.HISTORY_STORAGE_KEY = 'history.entries';
779
+ HistoryService = ( (__decorate([
780
+ ( (__param(0, IEditorService))),
781
+ ( (__param(1, IEditorGroupsService))),
782
+ ( (__param(2, IWorkspaceContextService))),
783
+ ( (__param(3, IStorageService))),
784
+ ( (__param(4, IConfigurationService))),
785
+ ( (__param(5, IFileService))),
786
+ ( (__param(6, IWorkspacesService))),
787
+ ( (__param(7, IInstantiationService))),
788
+ ( (__param(8, IWorkbenchLayoutService))),
789
+ ( (__param(9, IContextKeyService)))
790
+ ], HistoryService)));
791
+ class EditorSelectionState {
792
+ constructor(editorIdentifier, selection, reason) {
793
+ this.editorIdentifier = editorIdentifier;
794
+ this.selection = selection;
795
+ this.reason = reason;
796
+ }
797
+ justifiesNewNavigationEntry(other) {
798
+ if (this.editorIdentifier.groupId !== other.editorIdentifier.groupId) {
799
+ return true;
800
+ }
801
+ if (!this.editorIdentifier.editor.matches(other.editorIdentifier.editor)) {
802
+ return true;
803
+ }
804
+ if (!this.selection || !other.selection) {
805
+ return true;
806
+ }
807
+ const result = this.selection.compare(other.selection);
808
+ if (result === 2 && ((other.reason === 4 || other.reason === 5) )) {
809
+ return true;
810
+ }
811
+ return result === 3 ;
812
+ }
813
+ }
814
+ let EditorNavigationStacks = class EditorNavigationStacks extends Disposable {
815
+ constructor(scope, instantiationService) {
816
+ super();
817
+ this.scope = scope;
818
+ this.instantiationService = instantiationService;
819
+ this.selectionsStack = this._register(this.instantiationService.createInstance(EditorNavigationStack, 0 , this.scope));
820
+ this.editsStack = this._register(this.instantiationService.createInstance(EditorNavigationStack, 1 , this.scope));
821
+ this.navigationsStack = this._register(this.instantiationService.createInstance(EditorNavigationStack, 2 , this.scope));
822
+ this.stacks = [
823
+ this.selectionsStack,
824
+ this.editsStack,
825
+ this.navigationsStack
826
+ ];
827
+ this.onDidChange = Event.any(this.selectionsStack.onDidChange, this.editsStack.onDidChange, this.navigationsStack.onDidChange);
828
+ }
829
+ canGoForward(filter) {
830
+ return this.getStack(filter).canGoForward();
831
+ }
832
+ goForward(filter) {
833
+ return this.getStack(filter).goForward();
834
+ }
835
+ canGoBack(filter) {
836
+ return this.getStack(filter).canGoBack();
837
+ }
838
+ goBack(filter) {
839
+ return this.getStack(filter).goBack();
840
+ }
841
+ goPrevious(filter) {
842
+ return this.getStack(filter).goPrevious();
843
+ }
844
+ canGoLast(filter) {
845
+ return this.getStack(filter).canGoLast();
846
+ }
847
+ goLast(filter) {
848
+ return this.getStack(filter).goLast();
849
+ }
850
+ getStack(filter = 0 ) {
851
+ switch (filter) {
852
+ case 0 : return this.selectionsStack;
853
+ case 1 : return this.editsStack;
854
+ case 2 : return this.navigationsStack;
855
+ }
856
+ }
857
+ handleActiveEditorChange(editorPane) {
858
+ this.selectionsStack.notifyNavigation(editorPane);
859
+ }
860
+ handleActiveEditorSelectionChange(editorPane, event) {
861
+ const previous = this.selectionsStack.current;
862
+ this.selectionsStack.notifyNavigation(editorPane, event);
863
+ if (event.reason === 3 ) {
864
+ this.editsStack.notifyNavigation(editorPane, event);
865
+ }
866
+ else if (((event.reason === 4 || event.reason === 5) ) &&
867
+ !this.selectionsStack.isNavigating()) {
868
+ if (event.reason === 5 && !this.navigationsStack.isNavigating()) {
869
+ if (previous) {
870
+ this.navigationsStack.addOrReplace(previous.groupId, previous.editor, previous.selection);
871
+ }
872
+ }
873
+ this.navigationsStack.notifyNavigation(editorPane, event);
874
+ }
875
+ }
876
+ clear() {
877
+ for (const stack of this.stacks) {
878
+ stack.clear();
879
+ }
880
+ }
881
+ remove(arg1) {
882
+ for (const stack of this.stacks) {
883
+ stack.remove(arg1);
884
+ }
885
+ }
886
+ move(event) {
887
+ for (const stack of this.stacks) {
888
+ stack.move(event);
889
+ }
890
+ }
891
+ };
892
+ EditorNavigationStacks = ( (__decorate([
893
+ ( (__param(1, IInstantiationService)))
894
+ ], EditorNavigationStacks)));
895
+ class NoOpEditorNavigationStacks {
896
+ constructor() {
897
+ this.onDidChange = Event.None;
898
+ }
899
+ canGoForward() { return false; }
900
+ async goForward() { }
901
+ canGoBack() { return false; }
902
+ async goBack() { }
903
+ async goPrevious() { }
904
+ canGoLast() { return false; }
905
+ async goLast() { }
906
+ handleActiveEditorChange() { }
907
+ handleActiveEditorSelectionChange() { }
908
+ clear() { }
909
+ remove() { }
910
+ move() { }
911
+ dispose() { }
912
+ }
913
+ let EditorNavigationStack = class EditorNavigationStack extends Disposable {
914
+ get current() {
915
+ return this.stack[this.index];
916
+ }
917
+ set current(entry) {
918
+ if (entry) {
919
+ this.stack[this.index] = entry;
920
+ }
921
+ }
922
+ constructor(filter, scope, instantiationService, editorService, editorGroupService, logService) {
923
+ super();
924
+ this.filter = filter;
925
+ this.scope = scope;
926
+ this.instantiationService = instantiationService;
927
+ this.editorService = editorService;
928
+ this.editorGroupService = editorGroupService;
929
+ this.logService = logService;
930
+ this._onDidChange = this._register(( (new Emitter())));
931
+ this.onDidChange = this._onDidChange.event;
932
+ this.mapEditorToDisposable = ( (new Map()));
933
+ this.mapGroupToDisposable = ( (new Map()));
934
+ this.editorHelper = this.instantiationService.createInstance(EditorHelper);
935
+ this.stack = [];
936
+ this.index = -1;
937
+ this.previousIndex = -1;
938
+ this.navigating = false;
939
+ this.currentSelectionState = undefined;
940
+ this.registerListeners();
941
+ }
942
+ registerListeners() {
943
+ this._register(this.onDidChange(() => this.traceStack()));
944
+ this._register(this.logService.onDidChangeLogLevel(() => this.traceStack()));
945
+ }
946
+ traceStack() {
947
+ if (this.logService.getLevel() !== LogLevel.Trace) {
948
+ return;
949
+ }
950
+ const entryLabels = [];
951
+ for (const entry of this.stack) {
952
+ if (typeof entry.selection?.log === 'function') {
953
+ entryLabels.push(`- group: ${entry.groupId}, editor: ${entry.editor.resource?.toString()}, selection: ${entry.selection.log()}`);
954
+ }
955
+ else {
956
+ entryLabels.push(`- group: ${entry.groupId}, editor: ${entry.editor.resource?.toString()}, selection: <none>`);
957
+ }
958
+ }
959
+ if (entryLabels.length === 0) {
960
+ this.trace(`index: ${this.index}, navigating: ${this.isNavigating()}: <empty>`);
961
+ }
962
+ else {
963
+ this.trace(`index: ${this.index}, navigating: ${this.isNavigating()}
964
+ ${entryLabels.join('\n')}
965
+ `);
966
+ }
967
+ }
968
+ trace(msg, editor = null, event) {
969
+ if (this.logService.getLevel() !== LogLevel.Trace) {
970
+ return;
971
+ }
972
+ let filterLabel;
973
+ switch (this.filter) {
974
+ case 0 :
975
+ filterLabel = 'global';
976
+ break;
977
+ case 1 :
978
+ filterLabel = 'edits';
979
+ break;
980
+ case 2 :
981
+ filterLabel = 'navigation';
982
+ break;
983
+ }
984
+ let scopeLabel;
985
+ switch (this.scope) {
986
+ case 0 :
987
+ scopeLabel = 'default';
988
+ break;
989
+ case 1 :
990
+ scopeLabel = 'editorGroup';
991
+ break;
992
+ case 2 :
993
+ scopeLabel = 'editor';
994
+ break;
995
+ }
996
+ if (editor !== null) {
997
+ this.logService.trace(`[History stack ${filterLabel}-${scopeLabel}]: ${msg} (editor: ${editor?.resource?.toString()}, event: ${this.traceEvent(event)})`);
998
+ }
999
+ else {
1000
+ this.logService.trace(`[History stack ${filterLabel}-${scopeLabel}]: ${msg}`);
1001
+ }
1002
+ }
1003
+ traceEvent(event) {
1004
+ if (!event) {
1005
+ return '<none>';
1006
+ }
1007
+ switch (event.reason) {
1008
+ case 3 : return 'edit';
1009
+ case 4 : return 'navigation';
1010
+ case 5 : return 'jump';
1011
+ case 1 : return 'programmatic';
1012
+ case 2 : return 'user';
1013
+ }
1014
+ }
1015
+ registerGroupListeners(groupId) {
1016
+ if (!( (this.mapGroupToDisposable.has(groupId)))) {
1017
+ const group = this.editorGroupService.getGroup(groupId);
1018
+ if (group) {
1019
+ this.mapGroupToDisposable.set(groupId, group.onWillMoveEditor(e => this.onWillMoveEditor(e)));
1020
+ }
1021
+ }
1022
+ }
1023
+ onWillMoveEditor(e) {
1024
+ this.trace('onWillMoveEditor()', e.editor);
1025
+ if (this.scope === 1 ) {
1026
+ return;
1027
+ }
1028
+ for (const entry of this.stack) {
1029
+ if (entry.groupId !== e.groupId) {
1030
+ continue;
1031
+ }
1032
+ if (!this.editorHelper.matchesEditor(e.editor, entry.editor)) {
1033
+ continue;
1034
+ }
1035
+ entry.groupId = e.target;
1036
+ }
1037
+ }
1038
+ notifyNavigation(editorPane, event) {
1039
+ this.trace('notifyNavigation()', editorPane?.input, event);
1040
+ const isSelectionAwareEditorPane = isEditorPaneWithSelection(editorPane);
1041
+ const hasValidEditor = editorPane?.group && editorPane.input && !editorPane.input.isDisposed();
1042
+ if (this.navigating) {
1043
+ this.trace(`notifyNavigation() ignoring (navigating)`, editorPane?.input, event);
1044
+ if (isSelectionAwareEditorPane && hasValidEditor) {
1045
+ this.trace('notifyNavigation() updating current selection state', editorPane?.input, event);
1046
+ this.currentSelectionState = ( (new EditorSelectionState(
1047
+ { groupId: editorPane.group.id, editor: editorPane.input },
1048
+ editorPane.getSelection(),
1049
+ event?.reason
1050
+ )));
1051
+ }
1052
+ else {
1053
+ this.trace('notifyNavigation() dropping current selection state', editorPane?.input, event);
1054
+ this.currentSelectionState = undefined;
1055
+ }
1056
+ }
1057
+ else {
1058
+ this.trace(`notifyNavigation() not ignoring`, editorPane?.input, event);
1059
+ if (isSelectionAwareEditorPane && hasValidEditor) {
1060
+ this.onSelectionAwareEditorNavigation(editorPane.group.id, editorPane.input, editorPane.getSelection(), event);
1061
+ }
1062
+ else {
1063
+ this.currentSelectionState = undefined;
1064
+ if (hasValidEditor) {
1065
+ this.onNonSelectionAwareEditorNavigation(editorPane.group.id, editorPane.input);
1066
+ }
1067
+ }
1068
+ }
1069
+ }
1070
+ onSelectionAwareEditorNavigation(groupId, editor, selection, event) {
1071
+ if (this.current?.groupId === groupId && !selection && this.editorHelper.matchesEditor(this.current.editor, editor)) {
1072
+ return;
1073
+ }
1074
+ this.trace('onSelectionAwareEditorNavigation()', editor, event);
1075
+ const stateCandidate = ( (new EditorSelectionState({ groupId, editor }, selection, event?.reason)));
1076
+ if (!this.currentSelectionState || this.currentSelectionState.justifiesNewNavigationEntry(stateCandidate)) {
1077
+ this.doAdd(groupId, editor, stateCandidate.selection);
1078
+ }
1079
+ else {
1080
+ this.doReplace(groupId, editor, stateCandidate.selection);
1081
+ }
1082
+ this.currentSelectionState = stateCandidate;
1083
+ }
1084
+ onNonSelectionAwareEditorNavigation(groupId, editor) {
1085
+ if (this.current?.groupId === groupId && this.editorHelper.matchesEditor(this.current.editor, editor)) {
1086
+ return;
1087
+ }
1088
+ this.trace('onNonSelectionAwareEditorNavigation()', editor);
1089
+ this.doAdd(groupId, editor);
1090
+ }
1091
+ doAdd(groupId, editor, selection) {
1092
+ if (!this.navigating) {
1093
+ this.addOrReplace(groupId, editor, selection);
1094
+ }
1095
+ }
1096
+ doReplace(groupId, editor, selection) {
1097
+ if (!this.navigating) {
1098
+ this.addOrReplace(groupId, editor, selection, true );
1099
+ }
1100
+ }
1101
+ addOrReplace(groupId, editorCandidate, selection, forceReplace) {
1102
+ this.registerGroupListeners(groupId);
1103
+ let replace = false;
1104
+ if (this.current) {
1105
+ if (forceReplace) {
1106
+ replace = true;
1107
+ }
1108
+ else if (this.shouldReplaceStackEntry(this.current, { groupId, editor: editorCandidate, selection })) {
1109
+ replace = true;
1110
+ }
1111
+ }
1112
+ const editor = this.editorHelper.preferResourceEditorInput(editorCandidate);
1113
+ if (!editor) {
1114
+ return;
1115
+ }
1116
+ if (replace) {
1117
+ this.trace('replace()', editor);
1118
+ }
1119
+ else {
1120
+ this.trace('add()', editor);
1121
+ }
1122
+ const newStackEntry = { groupId, editor, selection };
1123
+ const removedEntries = [];
1124
+ if (replace) {
1125
+ if (this.current) {
1126
+ removedEntries.push(this.current);
1127
+ }
1128
+ this.current = newStackEntry;
1129
+ }
1130
+ else {
1131
+ if (this.stack.length > this.index + 1) {
1132
+ for (let i = this.index + 1; i < this.stack.length; i++) {
1133
+ removedEntries.push(this.stack[i]);
1134
+ }
1135
+ this.stack = this.stack.slice(0, this.index + 1);
1136
+ }
1137
+ this.stack.splice(this.index + 1, 0, newStackEntry);
1138
+ if (this.stack.length > EditorNavigationStack.MAX_STACK_SIZE) {
1139
+ removedEntries.push(this.stack.shift());
1140
+ if (this.previousIndex >= 0) {
1141
+ this.previousIndex--;
1142
+ }
1143
+ }
1144
+ else {
1145
+ this.setIndex(this.index + 1, true );
1146
+ }
1147
+ }
1148
+ for (const removedEntry of removedEntries) {
1149
+ this.editorHelper.clearOnEditorDispose(removedEntry.editor, this.mapEditorToDisposable);
1150
+ }
1151
+ if (isEditorInput(editor)) {
1152
+ this.editorHelper.onEditorDispose(editor, () => this.remove(editor), this.mapEditorToDisposable);
1153
+ }
1154
+ this._onDidChange.fire();
1155
+ }
1156
+ shouldReplaceStackEntry(entry, candidate) {
1157
+ if (entry.groupId !== candidate.groupId) {
1158
+ return false;
1159
+ }
1160
+ if (!this.editorHelper.matchesEditor(entry.editor, candidate.editor)) {
1161
+ return false;
1162
+ }
1163
+ if (!entry.selection) {
1164
+ return true;
1165
+ }
1166
+ if (!candidate.selection) {
1167
+ return false;
1168
+ }
1169
+ return entry.selection.compare(candidate.selection) === 1 ;
1170
+ }
1171
+ move(event) {
1172
+ if (event.isOperation(2 )) {
1173
+ for (const entry of this.stack) {
1174
+ if (this.editorHelper.matchesEditor(event, entry.editor)) {
1175
+ entry.editor = { resource: event.target.resource };
1176
+ }
1177
+ }
1178
+ }
1179
+ }
1180
+ remove(arg1) {
1181
+ this.stack = this.stack.filter(entry => {
1182
+ const matches = typeof arg1 === 'number' ? entry.groupId === arg1 : this.editorHelper.matchesEditor(arg1, entry.editor);
1183
+ if (matches) {
1184
+ this.editorHelper.clearOnEditorDispose(entry.editor, this.mapEditorToDisposable);
1185
+ }
1186
+ return !matches;
1187
+ });
1188
+ this.flatten();
1189
+ this.index = this.stack.length - 1;
1190
+ this.previousIndex = -1;
1191
+ if (typeof arg1 === 'number') {
1192
+ this.mapGroupToDisposable.get(arg1)?.dispose();
1193
+ this.mapGroupToDisposable.delete(arg1);
1194
+ }
1195
+ this._onDidChange.fire();
1196
+ }
1197
+ flatten() {
1198
+ const flattenedStack = [];
1199
+ let previousEntry = undefined;
1200
+ for (const entry of this.stack) {
1201
+ if (previousEntry && this.shouldReplaceStackEntry(entry, previousEntry)) {
1202
+ continue;
1203
+ }
1204
+ previousEntry = entry;
1205
+ flattenedStack.push(entry);
1206
+ }
1207
+ this.stack = flattenedStack;
1208
+ }
1209
+ clear() {
1210
+ this.index = -1;
1211
+ this.previousIndex = -1;
1212
+ this.stack.splice(0);
1213
+ for (const [, disposable] of this.mapEditorToDisposable) {
1214
+ dispose(disposable);
1215
+ }
1216
+ this.mapEditorToDisposable.clear();
1217
+ for (const [, disposable] of this.mapGroupToDisposable) {
1218
+ dispose(disposable);
1219
+ }
1220
+ this.mapGroupToDisposable.clear();
1221
+ }
1222
+ dispose() {
1223
+ super.dispose();
1224
+ this.clear();
1225
+ }
1226
+ canGoForward() {
1227
+ return this.stack.length > this.index + 1;
1228
+ }
1229
+ async goForward() {
1230
+ const navigated = await this.maybeGoCurrent();
1231
+ if (navigated) {
1232
+ return;
1233
+ }
1234
+ if (!this.canGoForward()) {
1235
+ return;
1236
+ }
1237
+ this.setIndex(this.index + 1);
1238
+ return this.navigate();
1239
+ }
1240
+ canGoBack() {
1241
+ return this.index > 0;
1242
+ }
1243
+ async goBack() {
1244
+ const navigated = await this.maybeGoCurrent();
1245
+ if (navigated) {
1246
+ return;
1247
+ }
1248
+ if (!this.canGoBack()) {
1249
+ return;
1250
+ }
1251
+ this.setIndex(this.index - 1);
1252
+ return this.navigate();
1253
+ }
1254
+ async goPrevious() {
1255
+ const navigated = await this.maybeGoCurrent();
1256
+ if (navigated) {
1257
+ return;
1258
+ }
1259
+ if (this.previousIndex === -1) {
1260
+ return this.goBack();
1261
+ }
1262
+ this.setIndex(this.previousIndex);
1263
+ return this.navigate();
1264
+ }
1265
+ canGoLast() {
1266
+ return this.stack.length > 0;
1267
+ }
1268
+ async goLast() {
1269
+ if (!this.canGoLast()) {
1270
+ return;
1271
+ }
1272
+ this.setIndex(this.stack.length - 1);
1273
+ return this.navigate();
1274
+ }
1275
+ async maybeGoCurrent() {
1276
+ if (this.filter === 0 ) {
1277
+ return false;
1278
+ }
1279
+ if (this.isCurrentSelectionActive()) {
1280
+ return false;
1281
+ }
1282
+ await this.navigate();
1283
+ return true;
1284
+ }
1285
+ isCurrentSelectionActive() {
1286
+ if (!this.current?.selection) {
1287
+ return false;
1288
+ }
1289
+ const pane = this.editorService.activeEditorPane;
1290
+ if (!isEditorPaneWithSelection(pane)) {
1291
+ return false;
1292
+ }
1293
+ if (pane.group?.id !== this.current.groupId) {
1294
+ return false;
1295
+ }
1296
+ if (!pane.input || !this.editorHelper.matchesEditor(pane.input, this.current.editor)) {
1297
+ return false;
1298
+ }
1299
+ const paneSelection = pane.getSelection();
1300
+ if (!paneSelection) {
1301
+ return false;
1302
+ }
1303
+ return paneSelection.compare(this.current.selection) === 1 ;
1304
+ }
1305
+ setIndex(newIndex, skipEvent) {
1306
+ this.previousIndex = this.index;
1307
+ this.index = newIndex;
1308
+ if (!skipEvent) {
1309
+ this._onDidChange.fire();
1310
+ }
1311
+ }
1312
+ async navigate() {
1313
+ this.navigating = true;
1314
+ try {
1315
+ if (this.current) {
1316
+ await this.doNavigate(this.current);
1317
+ }
1318
+ }
1319
+ finally {
1320
+ this.navigating = false;
1321
+ }
1322
+ }
1323
+ doNavigate(location) {
1324
+ let options = Object.create(null);
1325
+ if (location.selection) {
1326
+ options = location.selection.restore(options);
1327
+ }
1328
+ if (isEditorInput(location.editor)) {
1329
+ return this.editorService.openEditor(location.editor, options, location.groupId);
1330
+ }
1331
+ return this.editorService.openEditor({
1332
+ ...location.editor,
1333
+ options: {
1334
+ ...location.editor.options,
1335
+ ...options
1336
+ }
1337
+ }, location.groupId);
1338
+ }
1339
+ isNavigating() {
1340
+ return this.navigating;
1341
+ }
1342
+ };
1343
+ EditorNavigationStack.MAX_STACK_SIZE = 50;
1344
+ EditorNavigationStack = ( (__decorate([
1345
+ ( (__param(2, IInstantiationService))),
1346
+ ( (__param(3, IEditorService))),
1347
+ ( (__param(4, IEditorGroupsService))),
1348
+ ( (__param(5, ILogService)))
1349
+ ], EditorNavigationStack)));
1350
+ let EditorHelper = class EditorHelper {
1351
+ constructor(uriIdentityService, lifecycleService, fileService, pathService) {
1352
+ this.uriIdentityService = uriIdentityService;
1353
+ this.lifecycleService = lifecycleService;
1354
+ this.fileService = fileService;
1355
+ this.pathService = pathService;
1356
+ }
1357
+ preferResourceEditorInput(editor) {
1358
+ const resource = EditorResourceAccessor.getOriginalUri(editor);
1359
+ const hasValidResourceEditorInputScheme = resource?.scheme === Schemas.file ||
1360
+ resource?.scheme === Schemas.vscodeRemote ||
1361
+ resource?.scheme === Schemas.vscodeUserData ||
1362
+ resource?.scheme === this.pathService.defaultUriScheme;
1363
+ if (hasValidResourceEditorInputScheme) {
1364
+ if (isEditorInput(editor)) {
1365
+ const untypedInput = editor.toUntyped();
1366
+ if (isResourceEditorInput(untypedInput)) {
1367
+ return untypedInput;
1368
+ }
1369
+ }
1370
+ return editor;
1371
+ }
1372
+ else {
1373
+ return isEditorInput(editor) ? editor : undefined;
1374
+ }
1375
+ }
1376
+ matchesEditor(arg1, inputB) {
1377
+ if (arg1 instanceof FileChangesEvent || arg1 instanceof FileOperationEvent) {
1378
+ if (isEditorInput(inputB)) {
1379
+ return false;
1380
+ }
1381
+ if (arg1 instanceof FileChangesEvent) {
1382
+ return arg1.contains(inputB.resource, 2 );
1383
+ }
1384
+ return this.matchesFile(inputB.resource, arg1);
1385
+ }
1386
+ if (isEditorInput(arg1)) {
1387
+ if (isEditorInput(inputB)) {
1388
+ return arg1.matches(inputB);
1389
+ }
1390
+ return this.matchesFile(inputB.resource, arg1);
1391
+ }
1392
+ if (isEditorInput(inputB)) {
1393
+ return this.matchesFile(arg1.resource, inputB);
1394
+ }
1395
+ return arg1 && inputB && this.uriIdentityService.extUri.isEqual(arg1.resource, inputB.resource);
1396
+ }
1397
+ matchesFile(resource, arg2) {
1398
+ if (arg2 instanceof FileChangesEvent) {
1399
+ return arg2.contains(resource, 2 );
1400
+ }
1401
+ if (arg2 instanceof FileOperationEvent) {
1402
+ return this.uriIdentityService.extUri.isEqualOrParent(resource, arg2.resource);
1403
+ }
1404
+ if (isEditorInput(arg2)) {
1405
+ const inputResource = arg2.resource;
1406
+ if (!inputResource) {
1407
+ return false;
1408
+ }
1409
+ if (this.lifecycleService.phase >= 3 && !this.fileService.hasProvider(inputResource)) {
1410
+ return false;
1411
+ }
1412
+ return this.uriIdentityService.extUri.isEqual(inputResource, resource);
1413
+ }
1414
+ return this.uriIdentityService.extUri.isEqual(arg2?.resource, resource);
1415
+ }
1416
+ matchesEditorIdentifier(identifier, editorPane) {
1417
+ if (!editorPane?.group) {
1418
+ return false;
1419
+ }
1420
+ if (identifier.groupId !== editorPane.group.id) {
1421
+ return false;
1422
+ }
1423
+ return editorPane.input ? identifier.editor.matches(editorPane.input) : false;
1424
+ }
1425
+ onEditorDispose(editor, listener, mapEditorToDispose) {
1426
+ const toDispose = Event.once(editor.onWillDispose)(() => listener());
1427
+ let disposables = mapEditorToDispose.get(editor);
1428
+ if (!disposables) {
1429
+ disposables = ( (new DisposableStore()));
1430
+ mapEditorToDispose.set(editor, disposables);
1431
+ }
1432
+ disposables.add(toDispose);
1433
+ }
1434
+ clearOnEditorDispose(editor, mapEditorToDispose) {
1435
+ if (!isEditorInput(editor)) {
1436
+ return;
1437
+ }
1438
+ const disposables = mapEditorToDispose.get(editor);
1439
+ if (disposables) {
1440
+ dispose(disposables);
1441
+ mapEditorToDispose.delete(editor);
1442
+ }
1443
+ }
1444
+ };
1445
+ EditorHelper = ( (__decorate([
1446
+ ( (__param(0, IUriIdentityService))),
1447
+ ( (__param(1, ILifecycleService))),
1448
+ ( (__param(2, IFileService))),
1449
+ ( (__param(3, IPathService)))
1450
+ ], EditorHelper)));
1451
+ export { EditorNavigationStack, HistoryService };