@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,1842 @@
1
+ import { __decorate, __param } from '../../../../../../node_modules/tslib/tslib.es6.js';
2
+ import * as arrays from 'monaco-editor/esm/vs/base/common/arrays.js';
3
+ import { RunOnceScheduler } from 'monaco-editor/esm/vs/base/common/async.js';
4
+ import { CancellationToken, CancellationTokenSource } from 'monaco-editor/esm/vs/base/common/cancellation.js';
5
+ import { comparePaths, compareFileNames, compareFileExtensions } from 'monaco-editor/esm/vs/base/common/comparers.js';
6
+ import { memoize } from 'monaco-editor/esm/vs/base/common/decorators.js';
7
+ import * as errors from 'monaco-editor/esm/vs/base/common/errors.js';
8
+ import { Emitter, PauseableEmitter, Event } from 'monaco-editor/esm/vs/base/common/event.js';
9
+ import { Lazy } from 'monaco-editor/esm/vs/base/common/lazy.js';
10
+ import { Disposable, DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
11
+ import { ResourceMap, ResourceSet } from 'monaco-editor/esm/vs/base/common/map.js';
12
+ import { Schemas } from 'monaco-editor/esm/vs/base/common/network.js';
13
+ import { lcut } from 'monaco-editor/esm/vs/base/common/strings.js';
14
+ import { TernarySearchTree } from 'monaco-editor/esm/vs/base/common/ternarySearchTree.js';
15
+ import { isNumber } from 'monaco-editor/esm/vs/base/common/types.js';
16
+ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
17
+ import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
18
+ import { OverviewRulerLane, MinimapPosition, FindMatch } from 'monaco-editor/esm/vs/editor/common/model.js';
19
+ import { ModelDecorationOptions } from 'monaco-editor/esm/vs/editor/common/model/textModel.js';
20
+ import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
21
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
22
+ import { createDecorator, IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
23
+ import { ILabelService } from 'monaco-editor/esm/vs/platform/label/common/label.js';
24
+ import { ITelemetryService } from 'monaco-editor/esm/vs/platform/telemetry/common/telemetry.js';
25
+ import { overviewRulerFindMatchForeground, minimapFindMatch } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
26
+ import { themeColorFromId } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
27
+ import { IUriIdentityService } from 'monaco-editor/esm/vs/platform/uriIdentity/common/uriIdentity.js';
28
+ import { FindMatchDecorationModel } from '../../../../../../override/vs/workbench/contrib/notebook/browser/contrib/find/findMatchDecorationModel.js';
29
+ import { CellEditState } from '../../notebook/browser/notebookBrowser.js';
30
+ import { NotebookEditorWidget } from '../../../../../../override/vs/workbench/contrib/notebook/browser/notebookEditorWidget.js';
31
+ import { INotebookEditorService } from '../../notebook/browser/services/notebookEditorService.js';
32
+ import { NotebookCellsChangeType } from '../../notebook/common/notebookCommon.js';
33
+ import { IReplaceService } from './replace.js';
34
+ import { isIFileMatchWithCells, contentMatchesToTextSearchMatches, webviewMatchesToTextSearchMatches } from './searchNotebookHelpers.js';
35
+ import { ReplacePattern } from '../../../services/search/common/replace.js';
36
+ import { resultIsMatch, OneLineRange, ISearchService } from '../../../services/search/common/search.js';
37
+ import { editorMatchesToTextSearchResults, addContextToEditorMatches } from '../../../services/search/common/searchHelpers.js';
38
+ class Match {
39
+ constructor(_parent, _fullPreviewLines, _fullPreviewRange, _documentRange) {
40
+ this._parent = _parent;
41
+ this._fullPreviewLines = _fullPreviewLines;
42
+ this._oneLinePreviewText = _fullPreviewLines[_fullPreviewRange.startLineNumber];
43
+ const adjustedEndCol = _fullPreviewRange.startLineNumber === _fullPreviewRange.endLineNumber ?
44
+ _fullPreviewRange.endColumn :
45
+ this._oneLinePreviewText.length;
46
+ this._rangeInPreviewText = ( new OneLineRange(1, _fullPreviewRange.startColumn + 1, adjustedEndCol + 1));
47
+ this._range = ( new Range(
48
+ _documentRange.startLineNumber + 1,
49
+ _documentRange.startColumn + 1,
50
+ _documentRange.endLineNumber + 1,
51
+ _documentRange.endColumn + 1
52
+ ));
53
+ this._fullPreviewRange = _fullPreviewRange;
54
+ this._id = this._parent.id() + '>' + this._range + this.getMatchString();
55
+ }
56
+ id() {
57
+ return this._id;
58
+ }
59
+ parent() {
60
+ return this._parent;
61
+ }
62
+ text() {
63
+ return this._oneLinePreviewText;
64
+ }
65
+ range() {
66
+ return this._range;
67
+ }
68
+ preview() {
69
+ let before = this._oneLinePreviewText.substring(0, this._rangeInPreviewText.startColumn - 1), inside = this.getMatchString(), after = this._oneLinePreviewText.substring(this._rangeInPreviewText.endColumn - 1);
70
+ before = lcut(before, 26);
71
+ before = before.trimLeft();
72
+ let charsRemaining = Match.MAX_PREVIEW_CHARS - before.length;
73
+ inside = inside.substr(0, charsRemaining);
74
+ charsRemaining -= inside.length;
75
+ after = after.substr(0, charsRemaining);
76
+ return {
77
+ before,
78
+ inside,
79
+ after,
80
+ };
81
+ }
82
+ get replaceString() {
83
+ const searchModel = this.parent().parent().searchModel;
84
+ if (!searchModel.replacePattern) {
85
+ throw new Error('searchModel.replacePattern must be set before accessing replaceString');
86
+ }
87
+ const fullMatchText = this.fullMatchText();
88
+ let replaceString = searchModel.replacePattern.getReplaceString(fullMatchText, searchModel.preserveCase);
89
+ if (replaceString !== null) {
90
+ return replaceString;
91
+ }
92
+ const fullMatchTextWithoutCR = fullMatchText.replace(/\r\n/g, '\n');
93
+ if (fullMatchTextWithoutCR !== fullMatchText) {
94
+ replaceString = searchModel.replacePattern.getReplaceString(fullMatchTextWithoutCR, searchModel.preserveCase);
95
+ if (replaceString !== null) {
96
+ return replaceString;
97
+ }
98
+ }
99
+ const contextMatchTextWithSurroundingContent = this.fullMatchText(true);
100
+ replaceString = searchModel.replacePattern.getReplaceString(contextMatchTextWithSurroundingContent, searchModel.preserveCase);
101
+ if (replaceString !== null) {
102
+ return replaceString;
103
+ }
104
+ const contextMatchTextWithoutCR = contextMatchTextWithSurroundingContent.replace(/\r\n/g, '\n');
105
+ if (contextMatchTextWithoutCR !== contextMatchTextWithSurroundingContent) {
106
+ replaceString = searchModel.replacePattern.getReplaceString(contextMatchTextWithoutCR, searchModel.preserveCase);
107
+ if (replaceString !== null) {
108
+ return replaceString;
109
+ }
110
+ }
111
+ return searchModel.replacePattern.pattern;
112
+ }
113
+ fullMatchText(includeSurrounding = false) {
114
+ let thisMatchPreviewLines;
115
+ if (includeSurrounding) {
116
+ thisMatchPreviewLines = this._fullPreviewLines;
117
+ }
118
+ else {
119
+ thisMatchPreviewLines = this._fullPreviewLines.slice(this._fullPreviewRange.startLineNumber, this._fullPreviewRange.endLineNumber + 1);
120
+ thisMatchPreviewLines[thisMatchPreviewLines.length - 1] = thisMatchPreviewLines[thisMatchPreviewLines.length - 1].slice(0, this._fullPreviewRange.endColumn);
121
+ thisMatchPreviewLines[0] = thisMatchPreviewLines[0].slice(this._fullPreviewRange.startColumn);
122
+ }
123
+ return thisMatchPreviewLines.join('\n');
124
+ }
125
+ rangeInPreview() {
126
+ return {
127
+ ...this._fullPreviewRange,
128
+ startColumn: this._fullPreviewRange.startColumn + 1,
129
+ endColumn: this._fullPreviewRange.endColumn + 1
130
+ };
131
+ }
132
+ fullPreviewLines() {
133
+ return this._fullPreviewLines.slice(this._fullPreviewRange.startLineNumber, this._fullPreviewRange.endLineNumber + 1);
134
+ }
135
+ getMatchString() {
136
+ return this._oneLinePreviewText.substring(this._rangeInPreviewText.startColumn - 1, this._rangeInPreviewText.endColumn - 1);
137
+ }
138
+ }
139
+ Match.MAX_PREVIEW_CHARS = 250;
140
+ Match.__decorator = ( __decorate([
141
+ memoize
142
+ ], Match.prototype, "preview", null));
143
+ class CellMatch {
144
+ constructor(_parent, _cell, _cellIndex) {
145
+ this._parent = _parent;
146
+ this._cell = _cell;
147
+ this._cellIndex = _cellIndex;
148
+ this._contentMatches = ( new Map());
149
+ this._webviewMatches = ( new Map());
150
+ this._context = ( new Map());
151
+ }
152
+ get context() {
153
+ return ( new Map(this._context));
154
+ }
155
+ matches() {
156
+ return [...( this._contentMatches.values()), ...( this._webviewMatches.values())];
157
+ }
158
+ get contentMatches() {
159
+ return Array.from(( this._contentMatches.values()));
160
+ }
161
+ get webviewMatches() {
162
+ return Array.from(( this._webviewMatches.values()));
163
+ }
164
+ remove(matches) {
165
+ if (!Array.isArray(matches)) {
166
+ matches = [matches];
167
+ }
168
+ for (const match of matches) {
169
+ this._contentMatches.delete(match.id());
170
+ this._webviewMatches.delete(match.id());
171
+ }
172
+ }
173
+ addContentMatches(textSearchMatches) {
174
+ const contentMatches = textSearchMatchesToNotebookMatches();
175
+ contentMatches.forEach((match) => {
176
+ this._contentMatches.set(match.id(), match);
177
+ });
178
+ this.addContext(textSearchMatches);
179
+ }
180
+ addContext(textSearchMatches) {
181
+ this.cell.resolveTextModel().then((textModel) => {
182
+ const textResultsWithContext = addContextToEditorMatches(textSearchMatches, textModel, this.parent.parent().query);
183
+ const contexts = textResultsWithContext.filter((result => !resultIsMatch(result)));
184
+ ( contexts.map(context => ({ ...context, lineNumber: context.lineNumber + 1 })))
185
+ .forEach((context) => { this._context.set(context.lineNumber, context.text); });
186
+ });
187
+ }
188
+ addWebviewMatches(textSearchMatches) {
189
+ const webviewMatches = textSearchMatchesToNotebookMatches();
190
+ webviewMatches.forEach((match) => {
191
+ this._webviewMatches.set(match.id(), match);
192
+ });
193
+ }
194
+ get parent() {
195
+ return this._parent;
196
+ }
197
+ get id() {
198
+ return this._cell.id;
199
+ }
200
+ get cellIndex() {
201
+ return this._cellIndex;
202
+ }
203
+ get cell() {
204
+ return this._cell;
205
+ }
206
+ }
207
+ class MatchInNotebook extends Match {
208
+ constructor(_cellParent, _fullPreviewLines, _fullPreviewRange, _documentRange, webviewIndex) {
209
+ super(_cellParent.parent, _fullPreviewLines, _fullPreviewRange, _documentRange);
210
+ this._cellParent = _cellParent;
211
+ this._id = this._parent.id() + '>' + this._cellParent.cellIndex + (webviewIndex ? '_' + webviewIndex : '') + '_' + this.notebookMatchTypeString() + this._range + this.getMatchString();
212
+ this._webviewIndex = webviewIndex;
213
+ }
214
+ parent() {
215
+ return this._cellParent.parent;
216
+ }
217
+ get cellParent() {
218
+ return this._cellParent;
219
+ }
220
+ notebookMatchTypeString() {
221
+ return this.isWebviewMatch() ? 'webview' : 'content';
222
+ }
223
+ isWebviewMatch() {
224
+ return this._webviewIndex !== undefined;
225
+ }
226
+ get cellIndex() {
227
+ return this._cellParent.cellIndex;
228
+ }
229
+ get webviewIndex() {
230
+ return this._webviewIndex;
231
+ }
232
+ get cell() {
233
+ return this._cellParent.cell;
234
+ }
235
+ }
236
+ let FileMatch = class FileMatch extends Disposable {
237
+ static getDecorationOption(selected) {
238
+ return (selected ? FileMatch._CURRENT_FIND_MATCH : FileMatch._FIND_MATCH);
239
+ }
240
+ get context() {
241
+ return ( new Map(this._context));
242
+ }
243
+ get cellContext() {
244
+ const cellContext = ( new Map());
245
+ this._cellMatches.forEach(cellMatch => {
246
+ cellContext.set(cellMatch.id, cellMatch.context);
247
+ });
248
+ return cellContext;
249
+ }
250
+ constructor(_query, _previewOptions, _maxResults, _parent, rawMatch, _closestRoot, modelService, replaceService, labelService, notebookEditorService) {
251
+ super();
252
+ this._query = _query;
253
+ this._previewOptions = _previewOptions;
254
+ this._maxResults = _maxResults;
255
+ this._parent = _parent;
256
+ this.rawMatch = rawMatch;
257
+ this._closestRoot = _closestRoot;
258
+ this.modelService = modelService;
259
+ this.replaceService = replaceService;
260
+ this.labelService = labelService;
261
+ this.notebookEditorService = notebookEditorService;
262
+ this._onChange = this._register(( new Emitter()));
263
+ this.onChange = this._onChange.event;
264
+ this._onDispose = this._register(( new Emitter()));
265
+ this.onDispose = this._onDispose.event;
266
+ this._model = null;
267
+ this._modelListener = null;
268
+ this._selectedMatch = null;
269
+ this._modelDecorations = [];
270
+ this._context = ( new Map());
271
+ this._notebookEditorWidget = null;
272
+ this._editorWidgetListener = null;
273
+ this.replaceQ = Promise.resolve();
274
+ this._resource = this.rawMatch.resource;
275
+ this._textMatches = ( new Map());
276
+ this._removedTextMatches = ( new Set());
277
+ this._updateScheduler = ( new RunOnceScheduler(this.updateMatchesForModel.bind(this), 250));
278
+ this._name = ( new Lazy(() => labelService.getUriBasenameLabel(this.resource)));
279
+ this._cellMatches = ( new Map());
280
+ this._notebookUpdateScheduler = ( new RunOnceScheduler(this.updateMatchesForEditorWidget.bind(this), 250));
281
+ this.createMatches();
282
+ }
283
+ addWebviewMatchesToCell(cellID, webviewMatches) {
284
+ const cellMatch = this.getCellMatch(cellID);
285
+ if (cellMatch !== undefined) {
286
+ cellMatch.addWebviewMatches(webviewMatches);
287
+ }
288
+ }
289
+ addContentMatchesToCell(cellID, contentMatches) {
290
+ const cellMatch = this.getCellMatch(cellID);
291
+ if (cellMatch !== undefined) {
292
+ cellMatch.addContentMatches(contentMatches);
293
+ }
294
+ }
295
+ getCellMatch(cellID) {
296
+ return this._cellMatches.get(cellID);
297
+ }
298
+ addCellMatch(rawCell) {
299
+ const cellMatch = ( new CellMatch(this, rawCell.cell, rawCell.index));
300
+ this._cellMatches.set(cellMatch.id, cellMatch);
301
+ this.addWebviewMatchesToCell(rawCell.cell.id, rawCell.webviewResults);
302
+ this.addContentMatchesToCell(rawCell.cell.id, rawCell.contentResults);
303
+ }
304
+ get closestRoot() {
305
+ return this._closestRoot;
306
+ }
307
+ hasWebviewMatches() {
308
+ return ( this.matches().some(m => m instanceof MatchInNotebook && m.isWebviewMatch()));
309
+ }
310
+ createMatches() {
311
+ const model = this.modelService.getModel(this._resource);
312
+ if (model) {
313
+ this.bindModel(model);
314
+ this.updateMatchesForModel();
315
+ }
316
+ else {
317
+ const notebookEditorWidgetBorrow = this.notebookEditorService.retrieveExistingWidgetFromURI(this.resource);
318
+ if (notebookEditorWidgetBorrow?.value) {
319
+ this.bindNotebookEditorWidget(notebookEditorWidgetBorrow.value);
320
+ }
321
+ if (this.rawMatch.results) {
322
+ this.rawMatch.results
323
+ .filter(resultIsMatch)
324
+ .forEach(rawMatch => {
325
+ textSearchResultToMatches(rawMatch, this)
326
+ .forEach(m => this.add(m));
327
+ });
328
+ }
329
+ if (isIFileMatchWithCells(this.rawMatch)) {
330
+ this.rawMatch.cellResults?.forEach(cell => this.addCellMatch(cell));
331
+ this.setNotebookFindMatchDecorationsUsingCellMatches(this.cellMatches());
332
+ this._onChange.fire({ forceUpdateModel: true });
333
+ }
334
+ this.addContext(this.rawMatch.results);
335
+ }
336
+ }
337
+ bindModel(model) {
338
+ this._model = model;
339
+ this._modelListener = this._model.onDidChangeContent(() => {
340
+ this._updateScheduler.schedule();
341
+ });
342
+ this._model.onWillDispose(() => this.onModelWillDispose());
343
+ this.updateHighlights();
344
+ }
345
+ onModelWillDispose() {
346
+ this.updateMatchesForModel();
347
+ this.unbindModel();
348
+ }
349
+ unbindModel() {
350
+ if (this._model) {
351
+ this._updateScheduler.cancel();
352
+ this._model.changeDecorations((accessor) => {
353
+ this._modelDecorations = accessor.deltaDecorations(this._modelDecorations, []);
354
+ });
355
+ this._model = null;
356
+ this._modelListener.dispose();
357
+ }
358
+ }
359
+ updateMatchesForModel() {
360
+ if (!this._model) {
361
+ return;
362
+ }
363
+ this._textMatches = ( new Map());
364
+ const wordSeparators = this._query.isWordMatch && this._query.wordSeparators ? this._query.wordSeparators : null;
365
+ const matches = this._model
366
+ .findMatches(this._query.pattern, this._model.getFullModelRange(), !!this._query.isRegExp, !!this._query.isCaseSensitive, wordSeparators, false, this._maxResults ?? Number.MAX_SAFE_INTEGER);
367
+ this.updateMatches(matches, true, this._model);
368
+ }
369
+ async updatesMatchesForLineAfterReplace(lineNumber, modelChange) {
370
+ if (!this._model) {
371
+ return;
372
+ }
373
+ const range = {
374
+ startLineNumber: lineNumber,
375
+ startColumn: this._model.getLineMinColumn(lineNumber),
376
+ endLineNumber: lineNumber,
377
+ endColumn: this._model.getLineMaxColumn(lineNumber)
378
+ };
379
+ const oldMatches = Array.from(( this._textMatches.values())).filter(match => match.range().startLineNumber === lineNumber);
380
+ oldMatches.forEach(match => this._textMatches.delete(match.id()));
381
+ const wordSeparators = this._query.isWordMatch && this._query.wordSeparators ? this._query.wordSeparators : null;
382
+ const matches = this._model.findMatches(this._query.pattern, range, !!this._query.isRegExp, !!this._query.isCaseSensitive, wordSeparators, false, this._maxResults ?? Number.MAX_SAFE_INTEGER);
383
+ this.updateMatches(matches, modelChange, this._model);
384
+ }
385
+ updateMatches(matches, modelChange, model) {
386
+ const textSearchResults = editorMatchesToTextSearchResults(matches, model, this._previewOptions);
387
+ textSearchResults.forEach(textSearchResult => {
388
+ textSearchResultToMatches(textSearchResult, this).forEach(match => {
389
+ if (!( this._removedTextMatches.has(match.id()))) {
390
+ this.add(match);
391
+ if (this.isMatchSelected(match)) {
392
+ this._selectedMatch = match;
393
+ }
394
+ }
395
+ });
396
+ });
397
+ this.addContext(( addContextToEditorMatches(textSearchResults, model, this.parent().parent().query)
398
+ .filter((result => !resultIsMatch(result)))
399
+ .map(context => ({ ...context, lineNumber: context.lineNumber + 1 }))));
400
+ this._onChange.fire({ forceUpdateModel: modelChange });
401
+ this.updateHighlights();
402
+ }
403
+ updateHighlights() {
404
+ if (!this._model) {
405
+ return;
406
+ }
407
+ this._model.changeDecorations((accessor) => {
408
+ const newDecorations = (this.parent().showHighlights
409
+ ? ( this.matches().map(match => ({
410
+ range: match.range(),
411
+ options: FileMatch.getDecorationOption(this.isMatchSelected(match))
412
+ })))
413
+ : []);
414
+ this._modelDecorations = accessor.deltaDecorations(this._modelDecorations, newDecorations);
415
+ });
416
+ }
417
+ id() {
418
+ return ( this.resource.toString());
419
+ }
420
+ parent() {
421
+ return this._parent;
422
+ }
423
+ matches() {
424
+ const cellMatches = Array.from(( this._cellMatches.values())).flatMap((e) => e.matches());
425
+ return [...( this._textMatches.values()), ...cellMatches];
426
+ }
427
+ textMatches() {
428
+ return Array.from(( this._textMatches.values()));
429
+ }
430
+ cellMatches() {
431
+ return Array.from(( this._cellMatches.values()));
432
+ }
433
+ remove(matches) {
434
+ if (!Array.isArray(matches)) {
435
+ matches = [matches];
436
+ }
437
+ for (const match of matches) {
438
+ this.removeMatch(match);
439
+ this._removedTextMatches.add(match.id());
440
+ }
441
+ this._onChange.fire({ didRemove: true });
442
+ }
443
+ async replace(toReplace) {
444
+ return this.replaceQ = this.replaceQ.finally(async () => {
445
+ await this.replaceService.replace(toReplace);
446
+ await this.updatesMatchesForLineAfterReplace(toReplace.range().startLineNumber, false);
447
+ });
448
+ }
449
+ setSelectedMatch(match) {
450
+ if (match) {
451
+ if (!( this._textMatches.has(match.id()))) {
452
+ return;
453
+ }
454
+ if (this.isMatchSelected(match)) {
455
+ return;
456
+ }
457
+ }
458
+ this._selectedMatch = match;
459
+ this.updateHighlights();
460
+ }
461
+ getSelectedMatch() {
462
+ return this._selectedMatch;
463
+ }
464
+ isMatchSelected(match) {
465
+ return !!this._selectedMatch && this._selectedMatch.id() === match.id();
466
+ }
467
+ count() {
468
+ return this.matches().length;
469
+ }
470
+ get resource() {
471
+ return this._resource;
472
+ }
473
+ name() {
474
+ return this._name.value;
475
+ }
476
+ addContext(results) {
477
+ if (!results) {
478
+ return;
479
+ }
480
+ const contexts = results
481
+ .filter((result => !resultIsMatch(result)));
482
+ return contexts.forEach(context => this._context.set(context.lineNumber, context.text));
483
+ }
484
+ add(match, trigger) {
485
+ this._textMatches.set(match.id(), match);
486
+ if (trigger) {
487
+ this._onChange.fire({ forceUpdateModel: true });
488
+ }
489
+ }
490
+ removeMatch(match) {
491
+ if (match instanceof MatchInNotebook) {
492
+ match.cellParent.remove(match);
493
+ if (match.cellParent.matches().length === 0) {
494
+ this._cellMatches.delete(match.cellParent.id);
495
+ }
496
+ }
497
+ else {
498
+ this._textMatches.delete(match.id());
499
+ }
500
+ if (this.isMatchSelected(match)) {
501
+ this.setSelectedMatch(null);
502
+ this._findMatchDecorationModel?.clearCurrentFindMatchDecoration();
503
+ }
504
+ else {
505
+ this.updateHighlights();
506
+ }
507
+ if (match instanceof MatchInNotebook) {
508
+ this.setNotebookFindMatchDecorationsUsingCellMatches(this.cellMatches());
509
+ }
510
+ }
511
+ async resolveFileStat(fileService) {
512
+ this._fileStat = await fileService.stat(this.resource).catch(() => undefined);
513
+ }
514
+ get fileStat() {
515
+ return this._fileStat;
516
+ }
517
+ set fileStat(stat) {
518
+ this._fileStat = stat;
519
+ }
520
+ dispose() {
521
+ this.setSelectedMatch(null);
522
+ this.unbindModel();
523
+ this.unbindNotebookEditorWidget();
524
+ this._onDispose.fire();
525
+ super.dispose();
526
+ }
527
+ hasOnlyReadOnlyMatches() {
528
+ return this.matches().every(match => (match instanceof MatchInNotebook && match.isWebviewMatch()));
529
+ }
530
+ bindNotebookEditorWidget(widget) {
531
+ if (this._notebookEditorWidget === widget) {
532
+ return;
533
+ }
534
+ this._notebookEditorWidget = widget;
535
+ this._editorWidgetListener = this._notebookEditorWidget.textModel?.onDidChangeContent((e) => {
536
+ if (!( e.rawEvents.some(
537
+ event => event.kind === NotebookCellsChangeType.ChangeCellContent || event.kind === NotebookCellsChangeType.ModelChange
538
+ ))) {
539
+ return;
540
+ }
541
+ this._notebookUpdateScheduler.schedule();
542
+ }) ?? null;
543
+ this._findMatchDecorationModel?.dispose();
544
+ this._findMatchDecorationModel = ( new FindMatchDecorationModel(this._notebookEditorWidget));
545
+ }
546
+ unbindNotebookEditorWidget(widget) {
547
+ if (widget && this._notebookEditorWidget !== widget) {
548
+ return;
549
+ }
550
+ if (this._notebookEditorWidget) {
551
+ this._notebookUpdateScheduler.cancel();
552
+ this._findMatchDecorationModel?.dispose();
553
+ this._findMatchDecorationModel = undefined;
554
+ this._editorWidgetListener?.dispose();
555
+ }
556
+ if (this._findMatchDecorationModel) {
557
+ this._findMatchDecorationModel?.dispose();
558
+ this._findMatchDecorationModel = undefined;
559
+ }
560
+ this._notebookEditorWidget = null;
561
+ }
562
+ updateNotebookMatches(matches, modelChange) {
563
+ if (!this._notebookEditorWidget) {
564
+ return;
565
+ }
566
+ if (this._notebookEditorWidget.getId() !== this._lastEditorWidgetIdForUpdate) {
567
+ this._cellMatches.clear();
568
+ this._lastEditorWidgetIdForUpdate = this._notebookEditorWidget.getId();
569
+ }
570
+ matches.forEach(match => {
571
+ let cell = this._cellMatches.get(match.cell.id);
572
+ if (!cell) {
573
+ cell = ( new CellMatch(this, match.cell, match.index));
574
+ }
575
+ cell.addContentMatches(contentMatchesToTextSearchMatches(match.contentMatches, match.cell));
576
+ cell.addWebviewMatches(webviewMatchesToTextSearchMatches(match.webviewMatches));
577
+ this._cellMatches.set(cell.id, cell);
578
+ });
579
+ this._findMatchDecorationModel?.setAllFindMatchesDecorations(matches);
580
+ this._onChange.fire({ forceUpdateModel: modelChange });
581
+ }
582
+ setNotebookFindMatchDecorationsUsingCellMatches(cells) {
583
+ if (!this._findMatchDecorationModel) {
584
+ return;
585
+ }
586
+ const cellFindMatch = ( cells.map((cell) => {
587
+ const webviewMatches = ( cell.webviewMatches.map(match => {
588
+ return {
589
+ index: match.webviewIndex,
590
+ };
591
+ }));
592
+ const findMatches = ( cell.contentMatches.map(match => {
593
+ return ( new FindMatch(match.range(), [match.text()]));
594
+ }));
595
+ return {
596
+ cell: cell.cell,
597
+ index: cell.cellIndex,
598
+ contentMatches: findMatches,
599
+ webviewMatches: webviewMatches
600
+ };
601
+ }));
602
+ try {
603
+ this._findMatchDecorationModel.setAllFindMatchesDecorations(cellFindMatch);
604
+ }
605
+ catch (e) {
606
+ }
607
+ }
608
+ async updateMatchesForEditorWidget() {
609
+ if (!this._notebookEditorWidget) {
610
+ return;
611
+ }
612
+ this._textMatches = ( new Map());
613
+ const wordSeparators = this._query.isWordMatch && this._query.wordSeparators ? this._query.wordSeparators : null;
614
+ const allMatches = await this._notebookEditorWidget
615
+ .find(this._query.pattern, {
616
+ regex: this._query.isRegExp,
617
+ wholeWord: this._query.isWordMatch,
618
+ caseSensitive: this._query.isCaseSensitive,
619
+ wordSeparators: wordSeparators ?? undefined,
620
+ includeMarkupInput: this._query.notebookInfo?.isInNotebookMarkdownInput,
621
+ includeMarkupPreview: this._query.notebookInfo?.isInNotebookMarkdownPreview,
622
+ includeCodeInput: this._query.notebookInfo?.isInNotebookCellInput,
623
+ includeOutput: this._query.notebookInfo?.isInNotebookCellOutput,
624
+ }, CancellationToken.None, false, true);
625
+ this.updateNotebookMatches(allMatches, true);
626
+ }
627
+ async showMatch(match) {
628
+ const offset = await this.highlightCurrentFindMatchDecoration(match);
629
+ this.setSelectedMatch(match);
630
+ this.revealCellRange(match, offset);
631
+ }
632
+ async highlightCurrentFindMatchDecoration(match) {
633
+ if (!this._findMatchDecorationModel) {
634
+ return null;
635
+ }
636
+ if (match.webviewIndex === undefined) {
637
+ return this._findMatchDecorationModel.highlightCurrentFindMatchDecorationInCell(match.cell, match.range());
638
+ }
639
+ else {
640
+ return this._findMatchDecorationModel.highlightCurrentFindMatchDecorationInWebview(match.cell, match.webviewIndex);
641
+ }
642
+ }
643
+ revealCellRange(match, outputOffset) {
644
+ if (!this._notebookEditorWidget) {
645
+ return;
646
+ }
647
+ if (match.webviewIndex !== undefined) {
648
+ const index = this._notebookEditorWidget.getCellIndex(match.cell);
649
+ if (index !== undefined) {
650
+ this._notebookEditorWidget.revealCellOffsetInCenterAsync(match.cell, outputOffset ?? 0);
651
+ }
652
+ }
653
+ else {
654
+ match.cell.updateEditState(CellEditState.Editing, 'focusNotebookCell');
655
+ this._notebookEditorWidget.setCellEditorSelection(match.cell, match.range());
656
+ this._notebookEditorWidget.revealRangeInCenterIfOutsideViewportAsync(match.cell, match.range());
657
+ }
658
+ }
659
+ };
660
+ FileMatch._CURRENT_FIND_MATCH = ModelDecorationOptions.register({
661
+ description: 'search-current-find-match',
662
+ stickiness: 1 ,
663
+ zIndex: 13,
664
+ className: 'currentFindMatch',
665
+ overviewRuler: {
666
+ color: themeColorFromId(overviewRulerFindMatchForeground),
667
+ position: OverviewRulerLane.Center
668
+ },
669
+ minimap: {
670
+ color: themeColorFromId(minimapFindMatch),
671
+ position: MinimapPosition.Inline
672
+ }
673
+ });
674
+ FileMatch._FIND_MATCH = ModelDecorationOptions.register({
675
+ description: 'search-find-match',
676
+ stickiness: 1 ,
677
+ className: 'findMatch',
678
+ overviewRuler: {
679
+ color: themeColorFromId(overviewRulerFindMatchForeground),
680
+ position: OverviewRulerLane.Center
681
+ },
682
+ minimap: {
683
+ color: themeColorFromId(minimapFindMatch),
684
+ position: MinimapPosition.Inline
685
+ }
686
+ });
687
+ FileMatch = ( __decorate([
688
+ ( __param(6, IModelService)),
689
+ ( __param(7, IReplaceService)),
690
+ ( __param(8, ILabelService)),
691
+ ( __param(9, INotebookEditorService))
692
+ ], FileMatch));
693
+ let FolderMatch = class FolderMatch extends Disposable {
694
+ constructor(_resource, _id, _index, _query, _parent, _searchModel, _closestRoot, replaceService, instantiationService, labelService, uriIdentityService) {
695
+ super();
696
+ this._resource = _resource;
697
+ this._id = _id;
698
+ this._index = _index;
699
+ this._query = _query;
700
+ this._parent = _parent;
701
+ this._searchModel = _searchModel;
702
+ this._closestRoot = _closestRoot;
703
+ this.replaceService = replaceService;
704
+ this.instantiationService = instantiationService;
705
+ this.uriIdentityService = uriIdentityService;
706
+ this._onChange = this._register(( new Emitter()));
707
+ this.onChange = this._onChange.event;
708
+ this._onDispose = this._register(( new Emitter()));
709
+ this.onDispose = this._onDispose.event;
710
+ this._replacingAll = false;
711
+ this._fileMatches = ( new ResourceMap());
712
+ this._folderMatches = ( new ResourceMap());
713
+ this._folderMatchesMap = TernarySearchTree.forUris(key => this.uriIdentityService.extUri.ignorePathCasing(key));
714
+ this._unDisposedFileMatches = ( new ResourceMap());
715
+ this._unDisposedFolderMatches = ( new ResourceMap());
716
+ this._name = ( new Lazy(() => this.resource ? labelService.getUriBasenameLabel(this.resource) : ''));
717
+ }
718
+ get searchModel() {
719
+ return this._searchModel;
720
+ }
721
+ get showHighlights() {
722
+ return this._parent.showHighlights;
723
+ }
724
+ get closestRoot() {
725
+ return this._closestRoot;
726
+ }
727
+ set replacingAll(b) {
728
+ this._replacingAll = b;
729
+ }
730
+ id() {
731
+ return this._id;
732
+ }
733
+ get resource() {
734
+ return this._resource;
735
+ }
736
+ index() {
737
+ return this._index;
738
+ }
739
+ name() {
740
+ return this._name.value;
741
+ }
742
+ parent() {
743
+ return this._parent;
744
+ }
745
+ bindModel(model) {
746
+ const fileMatch = this._fileMatches.get(model.uri);
747
+ if (fileMatch) {
748
+ fileMatch.bindModel(model);
749
+ }
750
+ else {
751
+ const folderMatch = this.getFolderMatch(model.uri);
752
+ const match = folderMatch?.getDownstreamFileMatch(model.uri);
753
+ match?.bindModel(model);
754
+ }
755
+ }
756
+ async bindNotebookEditorWidget(editor, resource) {
757
+ const fileMatch = this._fileMatches.get(resource);
758
+ if (fileMatch) {
759
+ fileMatch.bindNotebookEditorWidget(editor);
760
+ await fileMatch.updateMatchesForEditorWidget();
761
+ }
762
+ else {
763
+ const folderMatches = this.folderMatchesIterator();
764
+ for (const elem of folderMatches) {
765
+ await elem.bindNotebookEditorWidget(editor, resource);
766
+ }
767
+ }
768
+ }
769
+ unbindNotebookEditorWidget(editor, resource) {
770
+ const fileMatch = this._fileMatches.get(resource);
771
+ if (fileMatch) {
772
+ fileMatch.unbindNotebookEditorWidget(editor);
773
+ }
774
+ else {
775
+ const folderMatches = this.folderMatchesIterator();
776
+ for (const elem of folderMatches) {
777
+ elem.unbindNotebookEditorWidget(editor, resource);
778
+ }
779
+ }
780
+ }
781
+ createIntermediateFolderMatch(resource, id, index, query, baseWorkspaceFolder) {
782
+ const folderMatch = this.instantiationService.createInstance(FolderMatchWithResource, resource, id, index, query, this, this._searchModel, baseWorkspaceFolder);
783
+ this.configureIntermediateMatch(folderMatch);
784
+ this.doAddFolder(folderMatch);
785
+ return folderMatch;
786
+ }
787
+ configureIntermediateMatch(folderMatch) {
788
+ const disposable = folderMatch.onChange((event) => this.onFolderChange(folderMatch, event));
789
+ folderMatch.onDispose(() => disposable.dispose());
790
+ }
791
+ clear(clearingAll = false) {
792
+ const changed = this.allDownstreamFileMatches();
793
+ this.disposeMatches();
794
+ this._onChange.fire({ elements: changed, removed: true, added: false, clearingAll });
795
+ }
796
+ remove(matches) {
797
+ if (!Array.isArray(matches)) {
798
+ matches = [matches];
799
+ }
800
+ const allMatches = getFileMatches(matches);
801
+ this.doRemoveFile(allMatches);
802
+ }
803
+ async replace(match) {
804
+ return this.replaceService.replace([match]).then(() => {
805
+ this.doRemoveFile([match], true, true, true);
806
+ });
807
+ }
808
+ replaceAll() {
809
+ const matches = this.matches();
810
+ return this.batchReplace(matches);
811
+ }
812
+ matches() {
813
+ return [...this.fileMatchesIterator(), ...this.folderMatchesIterator()];
814
+ }
815
+ fileMatchesIterator() {
816
+ return ( this._fileMatches.values());
817
+ }
818
+ folderMatchesIterator() {
819
+ return ( this._folderMatches.values());
820
+ }
821
+ isEmpty() {
822
+ return (this.fileCount() + this.folderCount()) === 0;
823
+ }
824
+ getDownstreamFileMatch(uri) {
825
+ const directChildFileMatch = this._fileMatches.get(uri);
826
+ if (directChildFileMatch) {
827
+ return directChildFileMatch;
828
+ }
829
+ const folderMatch = this.getFolderMatch(uri);
830
+ const match = folderMatch?.getDownstreamFileMatch(uri);
831
+ if (match) {
832
+ return match;
833
+ }
834
+ return null;
835
+ }
836
+ allDownstreamFileMatches() {
837
+ let recursiveChildren = [];
838
+ const iterator = this.folderMatchesIterator();
839
+ for (const elem of iterator) {
840
+ recursiveChildren = recursiveChildren.concat(elem.allDownstreamFileMatches());
841
+ }
842
+ return [...this.fileMatchesIterator(), ...recursiveChildren];
843
+ }
844
+ fileCount() {
845
+ return this._fileMatches.size;
846
+ }
847
+ folderCount() {
848
+ return this._folderMatches.size;
849
+ }
850
+ count() {
851
+ return this.fileCount() + this.folderCount();
852
+ }
853
+ recursiveFileCount() {
854
+ return this.allDownstreamFileMatches().length;
855
+ }
856
+ recursiveMatchCount() {
857
+ return this.allDownstreamFileMatches().reduce((prev, match) => prev + match.count(), 0);
858
+ }
859
+ get query() {
860
+ return this._query;
861
+ }
862
+ addFileMatch(raw, silent) {
863
+ const added = [];
864
+ const updated = [];
865
+ raw.forEach(rawFileMatch => {
866
+ const existingFileMatch = this.getDownstreamFileMatch(rawFileMatch.resource);
867
+ if (existingFileMatch) {
868
+ rawFileMatch
869
+ .results
870
+ .filter(resultIsMatch)
871
+ .forEach(m => {
872
+ textSearchResultToMatches(m, existingFileMatch)
873
+ .forEach(m => existingFileMatch.add(m));
874
+ });
875
+ if (isIFileMatchWithCells(rawFileMatch)) {
876
+ rawFileMatch.cellResults?.forEach(rawCellMatch => {
877
+ const existingCellMatch = existingFileMatch.getCellMatch(rawCellMatch.cell.id);
878
+ if (existingCellMatch) {
879
+ existingCellMatch.addContentMatches(rawCellMatch.contentResults);
880
+ existingCellMatch.addContentMatches(rawCellMatch.webviewResults);
881
+ }
882
+ else {
883
+ existingFileMatch.addCellMatch(rawCellMatch);
884
+ }
885
+ });
886
+ }
887
+ updated.push(existingFileMatch);
888
+ existingFileMatch.addContext(rawFileMatch.results);
889
+ }
890
+ else {
891
+ if (this instanceof FolderMatchWorkspaceRoot || this instanceof FolderMatchNoRoot) {
892
+ const fileMatch = this.createAndConfigureFileMatch(rawFileMatch);
893
+ added.push(fileMatch);
894
+ }
895
+ }
896
+ });
897
+ const elements = [...added, ...updated];
898
+ if (!silent && elements.length) {
899
+ this._onChange.fire({ elements, added: !!added.length });
900
+ }
901
+ }
902
+ doAddFile(fileMatch) {
903
+ this._fileMatches.set(fileMatch.resource, fileMatch);
904
+ if (( this._unDisposedFileMatches.has(fileMatch.resource))) {
905
+ this._unDisposedFileMatches.delete(fileMatch.resource);
906
+ }
907
+ }
908
+ hasOnlyReadOnlyMatches() {
909
+ return Array.from(( this._fileMatches.values())).every(fm => fm.hasOnlyReadOnlyMatches());
910
+ }
911
+ uriHasParent(parent, child) {
912
+ return this.uriIdentityService.extUri.isEqualOrParent(child, parent) && !this.uriIdentityService.extUri.isEqual(child, parent);
913
+ }
914
+ isInParentChain(folderMatch) {
915
+ let matchItem = this;
916
+ while (matchItem instanceof FolderMatch) {
917
+ if (matchItem.id() === folderMatch.id()) {
918
+ return true;
919
+ }
920
+ matchItem = matchItem.parent();
921
+ }
922
+ return false;
923
+ }
924
+ getFolderMatch(resource) {
925
+ const folderMatch = this._folderMatchesMap.findSubstr(resource);
926
+ return folderMatch;
927
+ }
928
+ doAddFolder(folderMatch) {
929
+ if (this instanceof FolderMatchWithResource && !this.uriHasParent(this.resource, folderMatch.resource)) {
930
+ throw Error(`${folderMatch.resource} does not belong as a child of ${this.resource}`);
931
+ }
932
+ else if (this.isInParentChain(folderMatch)) {
933
+ throw Error(`${folderMatch.resource} is a parent of ${this.resource}`);
934
+ }
935
+ this._folderMatches.set(folderMatch.resource, folderMatch);
936
+ this._folderMatchesMap.set(folderMatch.resource, folderMatch);
937
+ if (( this._unDisposedFolderMatches.has(folderMatch.resource))) {
938
+ this._unDisposedFolderMatches.delete(folderMatch.resource);
939
+ }
940
+ }
941
+ async batchReplace(matches) {
942
+ const allMatches = getFileMatches(matches);
943
+ await this.replaceService.replace(allMatches);
944
+ this.doRemoveFile(allMatches, true, true, true);
945
+ }
946
+ onFileChange(fileMatch, removed = false) {
947
+ let added = false;
948
+ if (!( this._fileMatches.has(fileMatch.resource))) {
949
+ this.doAddFile(fileMatch);
950
+ added = true;
951
+ }
952
+ if (fileMatch.count() === 0) {
953
+ this.doRemoveFile([fileMatch], false, false);
954
+ added = false;
955
+ removed = true;
956
+ }
957
+ if (!this._replacingAll) {
958
+ this._onChange.fire({ elements: [fileMatch], added: added, removed: removed });
959
+ }
960
+ }
961
+ onFolderChange(folderMatch, event) {
962
+ if (!( this._folderMatches.has(folderMatch.resource))) {
963
+ this.doAddFolder(folderMatch);
964
+ }
965
+ if (folderMatch.isEmpty()) {
966
+ this._folderMatches.delete(folderMatch.resource);
967
+ folderMatch.dispose();
968
+ }
969
+ this._onChange.fire(event);
970
+ }
971
+ doRemoveFile(fileMatches, dispose = true, trigger = true, keepReadonly = false) {
972
+ const removed = [];
973
+ for (const match of fileMatches) {
974
+ if (this._fileMatches.get(match.resource)) {
975
+ if (keepReadonly && match.hasWebviewMatches()) {
976
+ continue;
977
+ }
978
+ this._fileMatches.delete(match.resource);
979
+ if (dispose) {
980
+ match.dispose();
981
+ }
982
+ else {
983
+ this._unDisposedFileMatches.set(match.resource, match);
984
+ }
985
+ removed.push(match);
986
+ }
987
+ else {
988
+ const folder = this.getFolderMatch(match.resource);
989
+ if (folder) {
990
+ folder.doRemoveFile([match], dispose, trigger);
991
+ }
992
+ else {
993
+ throw Error(`FileMatch ${match.resource} is not located within FolderMatch ${this.resource}`);
994
+ }
995
+ }
996
+ }
997
+ if (trigger) {
998
+ this._onChange.fire({ elements: removed, removed: true });
999
+ }
1000
+ }
1001
+ disposeMatches() {
1002
+ [...( this._fileMatches.values())].forEach((fileMatch) => fileMatch.dispose());
1003
+ [...( this._folderMatches.values())].forEach((folderMatch) => folderMatch.disposeMatches());
1004
+ [...( this._unDisposedFileMatches.values())].forEach((fileMatch) => fileMatch.dispose());
1005
+ [...( this._unDisposedFolderMatches.values())].forEach((folderMatch) => folderMatch.disposeMatches());
1006
+ this._fileMatches.clear();
1007
+ this._folderMatches.clear();
1008
+ this._unDisposedFileMatches.clear();
1009
+ this._unDisposedFolderMatches.clear();
1010
+ }
1011
+ dispose() {
1012
+ this.disposeMatches();
1013
+ this._onDispose.fire();
1014
+ super.dispose();
1015
+ }
1016
+ };
1017
+ FolderMatch = ( __decorate([
1018
+ ( __param(7, IReplaceService)),
1019
+ ( __param(8, IInstantiationService)),
1020
+ ( __param(9, ILabelService)),
1021
+ ( __param(10, IUriIdentityService))
1022
+ ], FolderMatch));
1023
+ let FolderMatchWithResource = class FolderMatchWithResource extends FolderMatch {
1024
+ constructor(_resource, _id, _index, _query, _parent, _searchModel, _closestRoot, replaceService, instantiationService, labelService, uriIdentityService) {
1025
+ super(_resource, _id, _index, _query, _parent, _searchModel, _closestRoot, replaceService, instantiationService, labelService, uriIdentityService);
1026
+ }
1027
+ get resource() {
1028
+ return this._resource;
1029
+ }
1030
+ };
1031
+ FolderMatchWithResource = ( __decorate([
1032
+ ( __param(7, IReplaceService)),
1033
+ ( __param(8, IInstantiationService)),
1034
+ ( __param(9, ILabelService)),
1035
+ ( __param(10, IUriIdentityService))
1036
+ ], FolderMatchWithResource));
1037
+ let FolderMatchWorkspaceRoot = class FolderMatchWorkspaceRoot extends FolderMatchWithResource {
1038
+ constructor(_resource, _id, _index, _query, _parent, _searchModel, replaceService, instantiationService, labelService, uriIdentityService) {
1039
+ super(_resource, _id, _index, _query, _parent, _searchModel, null, replaceService, instantiationService, labelService, uriIdentityService);
1040
+ }
1041
+ normalizedUriParent(uri) {
1042
+ return this.uriIdentityService.extUri.normalizePath(this.uriIdentityService.extUri.dirname(uri));
1043
+ }
1044
+ uriEquals(uri1, ur2) {
1045
+ return this.uriIdentityService.extUri.isEqual(uri1, ur2);
1046
+ }
1047
+ createFileMatch(query, previewOptions, maxResults, parent, rawFileMatch, closestRoot) {
1048
+ const fileMatch = this.instantiationService.createInstance(FileMatch, query, previewOptions, maxResults, parent, rawFileMatch, closestRoot);
1049
+ parent.doAddFile(fileMatch);
1050
+ const disposable = fileMatch.onChange(({ didRemove }) => parent.onFileChange(fileMatch, didRemove));
1051
+ fileMatch.onDispose(() => disposable.dispose());
1052
+ return fileMatch;
1053
+ }
1054
+ createAndConfigureFileMatch(rawFileMatch) {
1055
+ if (!this.uriHasParent(this.resource, rawFileMatch.resource)) {
1056
+ throw Error(`${rawFileMatch.resource} is not a descendant of ${this.resource}`);
1057
+ }
1058
+ const fileMatchParentParts = [];
1059
+ const normalizedResource = this.uriIdentityService.extUri.normalizePath(this.resource);
1060
+ let uri = this.normalizedUriParent(rawFileMatch.resource);
1061
+ while (!this.uriEquals(normalizedResource, uri)) {
1062
+ fileMatchParentParts.unshift(uri);
1063
+ const prevUri = uri;
1064
+ uri = this.normalizedUriParent(uri);
1065
+ if (this.uriEquals(prevUri, uri)) {
1066
+ throw Error(`${rawFileMatch.resource} is not correctly configured as a child of ${normalizedResource}`);
1067
+ }
1068
+ }
1069
+ const root = this.closestRoot ?? this;
1070
+ let parent = this;
1071
+ for (let i = 0; i < fileMatchParentParts.length; i++) {
1072
+ let folderMatch = parent.getFolderMatch(fileMatchParentParts[i]);
1073
+ if (!folderMatch) {
1074
+ folderMatch = parent.createIntermediateFolderMatch(fileMatchParentParts[i], ( fileMatchParentParts[i].toString()), -1, this._query, root);
1075
+ }
1076
+ parent = folderMatch;
1077
+ }
1078
+ return this.createFileMatch(this._query.contentPattern, this._query.previewOptions, this._query.maxResults, parent, rawFileMatch, root);
1079
+ }
1080
+ };
1081
+ FolderMatchWorkspaceRoot = ( __decorate([
1082
+ ( __param(6, IReplaceService)),
1083
+ ( __param(7, IInstantiationService)),
1084
+ ( __param(8, ILabelService)),
1085
+ ( __param(9, IUriIdentityService))
1086
+ ], FolderMatchWorkspaceRoot));
1087
+ let FolderMatchNoRoot = class FolderMatchNoRoot extends FolderMatch {
1088
+ constructor(_id, _index, _query, _parent, _searchModel, replaceService, instantiationService, labelService, uriIdentityService) {
1089
+ super(null, _id, _index, _query, _parent, _searchModel, null, replaceService, instantiationService, labelService, uriIdentityService);
1090
+ }
1091
+ createAndConfigureFileMatch(rawFileMatch) {
1092
+ const fileMatch = this.instantiationService.createInstance(FileMatch, this._query.contentPattern, this._query.previewOptions, this._query.maxResults, this, rawFileMatch, null);
1093
+ this.doAddFile(fileMatch);
1094
+ const disposable = fileMatch.onChange(({ didRemove }) => this.onFileChange(fileMatch, didRemove));
1095
+ fileMatch.onDispose(() => disposable.dispose());
1096
+ return fileMatch;
1097
+ }
1098
+ };
1099
+ FolderMatchNoRoot = ( __decorate([
1100
+ ( __param(5, IReplaceService)),
1101
+ ( __param(6, IInstantiationService)),
1102
+ ( __param(7, ILabelService)),
1103
+ ( __param(8, IUriIdentityService))
1104
+ ], FolderMatchNoRoot));
1105
+ let elemAIndex = -1;
1106
+ let elemBIndex = -1;
1107
+ function searchMatchComparer(elementA, elementB, sortOrder = "default" ) {
1108
+ if (elementA instanceof FileMatch && elementB instanceof FolderMatch) {
1109
+ return 1;
1110
+ }
1111
+ if (elementB instanceof FileMatch && elementA instanceof FolderMatch) {
1112
+ return -1;
1113
+ }
1114
+ if (elementA instanceof FolderMatch && elementB instanceof FolderMatch) {
1115
+ elemAIndex = elementA.index();
1116
+ elemBIndex = elementB.index();
1117
+ if (elemAIndex !== -1 && elemBIndex !== -1) {
1118
+ return elemAIndex - elemBIndex;
1119
+ }
1120
+ switch (sortOrder) {
1121
+ case "countDescending" :
1122
+ return elementB.count() - elementA.count();
1123
+ case "countAscending" :
1124
+ return elementA.count() - elementB.count();
1125
+ case "type" :
1126
+ return compareFileExtensions(elementA.name(), elementB.name());
1127
+ case "fileNames" :
1128
+ return compareFileNames(elementA.name(), elementB.name());
1129
+ default:
1130
+ if (!elementA.resource || !elementB.resource) {
1131
+ return 0;
1132
+ }
1133
+ return comparePaths(elementA.resource.fsPath, elementB.resource.fsPath) || compareFileNames(elementA.name(), elementB.name());
1134
+ }
1135
+ }
1136
+ if (elementA instanceof FileMatch && elementB instanceof FileMatch) {
1137
+ switch (sortOrder) {
1138
+ case "countDescending" :
1139
+ return elementB.count() - elementA.count();
1140
+ case "countAscending" :
1141
+ return elementA.count() - elementB.count();
1142
+ case "type" :
1143
+ return compareFileExtensions(elementA.name(), elementB.name());
1144
+ case "fileNames" :
1145
+ return compareFileNames(elementA.name(), elementB.name());
1146
+ case "modified" : {
1147
+ const fileStatA = elementA.fileStat;
1148
+ const fileStatB = elementB.fileStat;
1149
+ if (fileStatA && fileStatB) {
1150
+ return fileStatB.mtime - fileStatA.mtime;
1151
+ }
1152
+ }
1153
+ default:
1154
+ return comparePaths(elementA.resource.fsPath, elementB.resource.fsPath) || compareFileNames(elementA.name(), elementB.name());
1155
+ }
1156
+ }
1157
+ if (elementA instanceof MatchInNotebook && elementB instanceof MatchInNotebook) {
1158
+ return compareNotebookPos(elementA, elementB);
1159
+ }
1160
+ if (elementA instanceof Match && elementB instanceof Match) {
1161
+ return Range.compareRangesUsingStarts(elementA.range(), elementB.range());
1162
+ }
1163
+ return 0;
1164
+ }
1165
+ function compareNotebookPos(match1, match2) {
1166
+ if (match1.cellIndex === match2.cellIndex) {
1167
+ if (match1.webviewIndex !== undefined && match2.webviewIndex !== undefined) {
1168
+ return match1.webviewIndex - match2.webviewIndex;
1169
+ }
1170
+ else if (match1.webviewIndex === undefined && match2.webviewIndex === undefined) {
1171
+ return Range.compareRangesUsingStarts(match1.range(), match2.range());
1172
+ }
1173
+ else {
1174
+ if (match1.webviewIndex !== undefined) {
1175
+ return 1;
1176
+ }
1177
+ else {
1178
+ return -1;
1179
+ }
1180
+ }
1181
+ }
1182
+ else if (match1.cellIndex < match2.cellIndex) {
1183
+ return -1;
1184
+ }
1185
+ else {
1186
+ return 1;
1187
+ }
1188
+ }
1189
+ let SearchResult = class SearchResult extends Disposable {
1190
+ constructor(_searchModel, replaceService, instantiationService, modelService, uriIdentityService, notebookEditorService) {
1191
+ super();
1192
+ this._searchModel = _searchModel;
1193
+ this.replaceService = replaceService;
1194
+ this.instantiationService = instantiationService;
1195
+ this.modelService = modelService;
1196
+ this.uriIdentityService = uriIdentityService;
1197
+ this.notebookEditorService = notebookEditorService;
1198
+ this._onChange = this._register(( new PauseableEmitter({
1199
+ merge: this.mergeEvents
1200
+ })));
1201
+ this.onChange = this._onChange.event;
1202
+ this._folderMatches = [];
1203
+ this._otherFilesMatch = null;
1204
+ this._folderMatchesMap = TernarySearchTree.forUris(key => this.uriIdentityService.extUri.ignorePathCasing(key));
1205
+ this._showHighlights = false;
1206
+ this._query = null;
1207
+ this.disposePastResults = () => { };
1208
+ this._isDirty = false;
1209
+ this._rangeHighlightDecorations = this.instantiationService.createInstance(RangeHighlightDecorations);
1210
+ this._register(this.modelService.onModelAdded(model => this.onModelAdded(model)));
1211
+ this._register(this.notebookEditorService.onDidAddNotebookEditor(widget => {
1212
+ if (widget instanceof NotebookEditorWidget) {
1213
+ this.onDidAddNotebookEditorWidget(widget);
1214
+ }
1215
+ }));
1216
+ this._register(this.onChange(e => {
1217
+ if (e.removed) {
1218
+ this._isDirty = !this.isEmpty();
1219
+ }
1220
+ }));
1221
+ }
1222
+ async batchReplace(elementsToReplace) {
1223
+ try {
1224
+ this._onChange.pause();
1225
+ await Promise.all(( elementsToReplace.map(async (elem) => {
1226
+ const parent = elem.parent();
1227
+ if ((parent instanceof FolderMatch || parent instanceof FileMatch) && arrayContainsElementOrParent(parent, elementsToReplace)) {
1228
+ return;
1229
+ }
1230
+ if (elem instanceof FileMatch) {
1231
+ await elem.parent().replace(elem);
1232
+ }
1233
+ else if (elem instanceof Match) {
1234
+ await elem.parent().replace(elem);
1235
+ }
1236
+ else if (elem instanceof FolderMatch) {
1237
+ await elem.replaceAll();
1238
+ }
1239
+ })));
1240
+ }
1241
+ finally {
1242
+ this._onChange.resume();
1243
+ }
1244
+ }
1245
+ batchRemove(elementsToRemove) {
1246
+ const removedElems = [];
1247
+ try {
1248
+ this._onChange.pause();
1249
+ elementsToRemove.forEach((currentElement) => {
1250
+ if (!arrayContainsElementOrParent(currentElement, removedElems)) {
1251
+ currentElement.parent().remove(currentElement);
1252
+ removedElems.push(currentElement);
1253
+ }
1254
+ });
1255
+ }
1256
+ finally {
1257
+ this._onChange.resume();
1258
+ }
1259
+ }
1260
+ get isDirty() {
1261
+ return this._isDirty;
1262
+ }
1263
+ get query() {
1264
+ return this._query;
1265
+ }
1266
+ set query(query) {
1267
+ const oldFolderMatches = this.folderMatches();
1268
+ ( new Promise(resolve => this.disposePastResults = resolve))
1269
+ .then(() => oldFolderMatches.forEach(match => match.clear()))
1270
+ .then(() => oldFolderMatches.forEach(match => match.dispose()))
1271
+ .then(() => this._isDirty = false);
1272
+ this._rangeHighlightDecorations.removeHighlightRange();
1273
+ this._folderMatchesMap = TernarySearchTree.forUris(key => this.uriIdentityService.extUri.ignorePathCasing(key));
1274
+ if (!query) {
1275
+ return;
1276
+ }
1277
+ this._folderMatches = ( ( (query && query.folderQueries || [])
1278
+ .map(fq => fq.folder))
1279
+ .map((resource, index) => this._createBaseFolderMatch(resource, ( resource.toString()), index, query)));
1280
+ this._folderMatches.forEach(fm => this._folderMatchesMap.set(fm.resource, fm));
1281
+ this._otherFilesMatch = this._createBaseFolderMatch(null, 'otherFiles', this._folderMatches.length + 1, query);
1282
+ this._query = query;
1283
+ }
1284
+ mergeEvents(events) {
1285
+ const retEvent = {
1286
+ elements: [],
1287
+ added: false,
1288
+ removed: false,
1289
+ };
1290
+ events.forEach((e) => {
1291
+ if (e.added) {
1292
+ retEvent.added = true;
1293
+ }
1294
+ if (e.removed) {
1295
+ retEvent.removed = true;
1296
+ }
1297
+ retEvent.elements = retEvent.elements.concat(e.elements);
1298
+ });
1299
+ return retEvent;
1300
+ }
1301
+ onDidAddNotebookEditorWidget(widget) {
1302
+ this._onWillChangeModelListener?.dispose();
1303
+ this._onWillChangeModelListener = widget.onWillChangeModel((model) => {
1304
+ if (model) {
1305
+ this.onNotebookEditorWidgetRemoved(widget, model?.uri);
1306
+ }
1307
+ });
1308
+ this._onDidChangeModelListener?.dispose();
1309
+ this._onDidChangeModelListener = widget.onDidAttachViewModel(() => {
1310
+ if (widget.hasModel()) {
1311
+ this.onNotebookEditorWidgetAdded(widget, widget.textModel.uri);
1312
+ }
1313
+ });
1314
+ }
1315
+ onModelAdded(model) {
1316
+ const folderMatch = this._folderMatchesMap.findSubstr(model.uri);
1317
+ folderMatch?.bindModel(model);
1318
+ }
1319
+ async onNotebookEditorWidgetAdded(editor, resource) {
1320
+ const folderMatch = this._folderMatchesMap.findSubstr(resource);
1321
+ await folderMatch?.bindNotebookEditorWidget(editor, resource);
1322
+ }
1323
+ onNotebookEditorWidgetRemoved(editor, resource) {
1324
+ const folderMatch = this._folderMatchesMap.findSubstr(resource);
1325
+ folderMatch?.unbindNotebookEditorWidget(editor, resource);
1326
+ }
1327
+ _createBaseFolderMatch(resource, id, index, query) {
1328
+ let folderMatch;
1329
+ if (resource) {
1330
+ folderMatch = this.instantiationService.createInstance(FolderMatchWorkspaceRoot, resource, id, index, query, this, this._searchModel);
1331
+ }
1332
+ else {
1333
+ folderMatch = this.instantiationService.createInstance(FolderMatchNoRoot, id, index, query, this, this._searchModel);
1334
+ }
1335
+ const disposable = folderMatch.onChange((event) => this._onChange.fire(event));
1336
+ folderMatch.onDispose(() => disposable.dispose());
1337
+ return folderMatch;
1338
+ }
1339
+ get searchModel() {
1340
+ return this._searchModel;
1341
+ }
1342
+ add(allRaw, silent = false) {
1343
+ const { byFolder, other } = this.groupFilesByFolder(allRaw);
1344
+ byFolder.forEach(raw => {
1345
+ if (!raw.length) {
1346
+ return;
1347
+ }
1348
+ const folderMatch = this.getFolderMatch(raw[0].resource);
1349
+ folderMatch?.addFileMatch(raw, silent);
1350
+ });
1351
+ this._otherFilesMatch?.addFileMatch(other, silent);
1352
+ this.disposePastResults();
1353
+ }
1354
+ clear() {
1355
+ this.folderMatches().forEach((folderMatch) => folderMatch.clear(true));
1356
+ this.disposeMatches();
1357
+ this._folderMatches = [];
1358
+ this._otherFilesMatch = null;
1359
+ }
1360
+ remove(matches) {
1361
+ if (!Array.isArray(matches)) {
1362
+ matches = [matches];
1363
+ }
1364
+ matches.forEach(m => {
1365
+ if (m instanceof FolderMatch) {
1366
+ m.clear();
1367
+ }
1368
+ });
1369
+ const fileMatches = matches.filter(m => m instanceof FileMatch);
1370
+ const { byFolder, other } = this.groupFilesByFolder(fileMatches);
1371
+ byFolder.forEach(matches => {
1372
+ if (!matches.length) {
1373
+ return;
1374
+ }
1375
+ this.getFolderMatch(matches[0].resource).remove(matches);
1376
+ });
1377
+ if (other.length) {
1378
+ this.getFolderMatch(other[0].resource).remove(other);
1379
+ }
1380
+ }
1381
+ replace(match) {
1382
+ return this.getFolderMatch(match.resource).replace(match);
1383
+ }
1384
+ replaceAll(progress) {
1385
+ this.replacingAll = true;
1386
+ const promise = this.replaceService.replace(this.matches(), progress);
1387
+ return promise.then(() => {
1388
+ this.replacingAll = false;
1389
+ this.clear();
1390
+ }, () => {
1391
+ this.replacingAll = false;
1392
+ });
1393
+ }
1394
+ folderMatches() {
1395
+ return this._otherFilesMatch ?
1396
+ [
1397
+ ...this._folderMatches,
1398
+ this._otherFilesMatch
1399
+ ] :
1400
+ [
1401
+ ...this._folderMatches
1402
+ ];
1403
+ }
1404
+ matches() {
1405
+ const matches = [];
1406
+ this.folderMatches().forEach(folderMatch => {
1407
+ matches.push(folderMatch.allDownstreamFileMatches());
1408
+ });
1409
+ return [].concat(...matches);
1410
+ }
1411
+ isEmpty() {
1412
+ return this.folderMatches().every((folderMatch) => folderMatch.isEmpty());
1413
+ }
1414
+ fileCount() {
1415
+ return this.folderMatches().reduce((prev, match) => prev + match.recursiveFileCount(), 0);
1416
+ }
1417
+ count() {
1418
+ return this.matches().reduce((prev, match) => prev + match.count(), 0);
1419
+ }
1420
+ get showHighlights() {
1421
+ return this._showHighlights;
1422
+ }
1423
+ toggleHighlights(value) {
1424
+ if (this._showHighlights === value) {
1425
+ return;
1426
+ }
1427
+ this._showHighlights = value;
1428
+ let selectedMatch = null;
1429
+ this.matches().forEach((fileMatch) => {
1430
+ fileMatch.updateHighlights();
1431
+ if (!selectedMatch) {
1432
+ selectedMatch = fileMatch.getSelectedMatch();
1433
+ }
1434
+ });
1435
+ if (this._showHighlights && selectedMatch) {
1436
+ this._rangeHighlightDecorations.highlightRange(selectedMatch.parent().resource, selectedMatch.range());
1437
+ }
1438
+ else {
1439
+ this._rangeHighlightDecorations.removeHighlightRange();
1440
+ }
1441
+ }
1442
+ get rangeHighlightDecorations() {
1443
+ return this._rangeHighlightDecorations;
1444
+ }
1445
+ getFolderMatch(resource) {
1446
+ const folderMatch = this._folderMatchesMap.findSubstr(resource);
1447
+ return folderMatch ? folderMatch : this._otherFilesMatch;
1448
+ }
1449
+ set replacingAll(running) {
1450
+ this.folderMatches().forEach((folderMatch) => {
1451
+ folderMatch.replacingAll = running;
1452
+ });
1453
+ }
1454
+ groupFilesByFolder(fileMatches) {
1455
+ const rawPerFolder = ( new ResourceMap());
1456
+ const otherFileMatches = [];
1457
+ this._folderMatches.forEach(fm => rawPerFolder.set(fm.resource, []));
1458
+ fileMatches.forEach(rawFileMatch => {
1459
+ const folderMatch = this.getFolderMatch(rawFileMatch.resource);
1460
+ if (!folderMatch) {
1461
+ return;
1462
+ }
1463
+ const resource = folderMatch.resource;
1464
+ if (resource) {
1465
+ rawPerFolder.get(resource).push(rawFileMatch);
1466
+ }
1467
+ else {
1468
+ otherFileMatches.push(rawFileMatch);
1469
+ }
1470
+ });
1471
+ return {
1472
+ byFolder: rawPerFolder,
1473
+ other: otherFileMatches
1474
+ };
1475
+ }
1476
+ disposeMatches() {
1477
+ this.folderMatches().forEach(folderMatch => folderMatch.dispose());
1478
+ this._folderMatches = [];
1479
+ this._folderMatchesMap = TernarySearchTree.forUris(key => this.uriIdentityService.extUri.ignorePathCasing(key));
1480
+ this._rangeHighlightDecorations.removeHighlightRange();
1481
+ }
1482
+ dispose() {
1483
+ this._onWillChangeModelListener?.dispose();
1484
+ this._onDidChangeModelListener?.dispose();
1485
+ this.disposePastResults();
1486
+ this.disposeMatches();
1487
+ this._rangeHighlightDecorations.dispose();
1488
+ super.dispose();
1489
+ }
1490
+ };
1491
+ SearchResult = ( __decorate([
1492
+ ( __param(1, IReplaceService)),
1493
+ ( __param(2, IInstantiationService)),
1494
+ ( __param(3, IModelService)),
1495
+ ( __param(4, IUriIdentityService)),
1496
+ ( __param(5, INotebookEditorService))
1497
+ ], SearchResult));
1498
+ let SearchModel = class SearchModel extends Disposable {
1499
+ constructor(searchService, telemetryService, configurationService, instantiationService, uriIdentityService, notebookEditorService) {
1500
+ super();
1501
+ this.searchService = searchService;
1502
+ this.telemetryService = telemetryService;
1503
+ this.configurationService = configurationService;
1504
+ this.instantiationService = instantiationService;
1505
+ this.uriIdentityService = uriIdentityService;
1506
+ this.notebookEditorService = notebookEditorService;
1507
+ this._searchQuery = null;
1508
+ this._replaceActive = false;
1509
+ this._replaceString = null;
1510
+ this._replacePattern = null;
1511
+ this._preserveCase = false;
1512
+ this._startStreamDelay = Promise.resolve();
1513
+ this._resultQueue = [];
1514
+ this._onReplaceTermChanged = this._register(( new Emitter()));
1515
+ this.onReplaceTermChanged = this._onReplaceTermChanged.event;
1516
+ this.currentCancelTokenSource = null;
1517
+ this.searchCancelledForNewSearch = false;
1518
+ this._searchResult = this.instantiationService.createInstance(SearchResult, this);
1519
+ }
1520
+ isReplaceActive() {
1521
+ return this._replaceActive;
1522
+ }
1523
+ set replaceActive(replaceActive) {
1524
+ this._replaceActive = replaceActive;
1525
+ }
1526
+ get replacePattern() {
1527
+ return this._replacePattern;
1528
+ }
1529
+ get replaceString() {
1530
+ return this._replaceString || '';
1531
+ }
1532
+ set preserveCase(value) {
1533
+ this._preserveCase = value;
1534
+ }
1535
+ get preserveCase() {
1536
+ return this._preserveCase;
1537
+ }
1538
+ set replaceString(replaceString) {
1539
+ this._replaceString = replaceString;
1540
+ if (this._searchQuery) {
1541
+ this._replacePattern = ( new ReplacePattern(replaceString, this._searchQuery.contentPattern));
1542
+ }
1543
+ this._onReplaceTermChanged.fire();
1544
+ }
1545
+ get searchResult() {
1546
+ return this._searchResult;
1547
+ }
1548
+ async getLocalNotebookResults(query, token) {
1549
+ const localResults = ( new ResourceMap(uri => this.uriIdentityService.extUri.getComparisonKey(uri)));
1550
+ let limitHit = false;
1551
+ if (query.type === 2 ) {
1552
+ const notebookWidgets = this.notebookEditorService.retrieveAllExistingWidgets();
1553
+ for (const borrowWidget of notebookWidgets) {
1554
+ const widget = borrowWidget.value;
1555
+ if (!widget || !widget.viewModel) {
1556
+ continue;
1557
+ }
1558
+ const askMax = isNumber(query.maxResults) ? query.maxResults + 1 : Number.MAX_SAFE_INTEGER;
1559
+ let matches = await widget
1560
+ .find(query.contentPattern.pattern, {
1561
+ regex: query.contentPattern.isRegExp,
1562
+ wholeWord: query.contentPattern.isWordMatch,
1563
+ caseSensitive: query.contentPattern.isCaseSensitive,
1564
+ includeMarkupInput: query.contentPattern.notebookInfo?.isInNotebookMarkdownInput,
1565
+ includeMarkupPreview: query.contentPattern.notebookInfo?.isInNotebookMarkdownPreview,
1566
+ includeCodeInput: query.contentPattern.notebookInfo?.isInNotebookCellInput,
1567
+ includeOutput: query.contentPattern.notebookInfo?.isInNotebookCellOutput,
1568
+ }, token, false, true);
1569
+ if (matches.length) {
1570
+ if (askMax && matches.length >= askMax) {
1571
+ limitHit = true;
1572
+ matches = matches.slice(0, askMax - 1);
1573
+ }
1574
+ const cellResults = ( matches.map(match => {
1575
+ const contentResults = contentMatchesToTextSearchMatches(match.contentMatches, match.cell);
1576
+ const webviewResults = webviewMatchesToTextSearchMatches(match.webviewMatches);
1577
+ return {
1578
+ cell: match.cell,
1579
+ index: match.index,
1580
+ contentResults: contentResults,
1581
+ webviewResults: webviewResults,
1582
+ };
1583
+ }));
1584
+ const fileMatch = {
1585
+ resource: widget.viewModel.uri, cellResults: cellResults
1586
+ };
1587
+ localResults.set(widget.viewModel.uri, fileMatch);
1588
+ }
1589
+ else {
1590
+ localResults.set(widget.viewModel.uri, null);
1591
+ }
1592
+ }
1593
+ }
1594
+ return {
1595
+ results: localResults,
1596
+ limitHit
1597
+ };
1598
+ }
1599
+ async notebookSearch(query, token, onProgress) {
1600
+ const localResults = await this.getLocalNotebookResults(query, token);
1601
+ if (onProgress) {
1602
+ arrays.coalesce([...( localResults.results.values())]).forEach(onProgress);
1603
+ }
1604
+ return {
1605
+ completeData: {
1606
+ messages: [],
1607
+ limitHit: localResults.limitHit,
1608
+ results: arrays.coalesce([...( localResults.results.values())]),
1609
+ },
1610
+ scannedFiles: ( new ResourceSet([...( localResults.results.keys())], uri => this.uriIdentityService.extUri.getComparisonKey(uri)))
1611
+ };
1612
+ }
1613
+ async doSearch(query, progressEmitter, searchQuery, onProgress) {
1614
+ const tokenSource = this.currentCancelTokenSource = ( new CancellationTokenSource());
1615
+ const onProgressCall = (p) => {
1616
+ progressEmitter.fire();
1617
+ this.onSearchProgress(p);
1618
+ onProgress?.(p);
1619
+ };
1620
+ const notebookResult = await this.notebookSearch(query, this.currentCancelTokenSource.token, onProgressCall);
1621
+ const currentResult = await this.searchService.textSearch(searchQuery, this.currentCancelTokenSource.token, onProgressCall, notebookResult?.scannedFiles);
1622
+ tokenSource.dispose();
1623
+ return notebookResult ? { ...currentResult, ...notebookResult.completeData } : currentResult;
1624
+ }
1625
+ async search(query, onProgress) {
1626
+ this.cancelSearch(true);
1627
+ this._searchQuery = query;
1628
+ if (!this.searchConfig.searchOnType) {
1629
+ this.searchResult.clear();
1630
+ }
1631
+ this._searchResult.query = this._searchQuery;
1632
+ const progressEmitter = ( new Emitter());
1633
+ this._replacePattern = ( new ReplacePattern(this.replaceString, this._searchQuery.contentPattern));
1634
+ this._startStreamDelay = ( new Promise(resolve => setTimeout(resolve, this.searchConfig.searchOnType ? 150 : 0)));
1635
+ const currentRequest = this.doSearch(query, progressEmitter, this._searchQuery, onProgress);
1636
+ const start = Date.now();
1637
+ Promise.race([currentRequest, Event.toPromise(progressEmitter.event)]).finally(() => {
1638
+ this.telemetryService.publicLog('searchResultsFirstRender', { duration: Date.now() - start });
1639
+ });
1640
+ currentRequest.then(value => this.onSearchCompleted(value, Date.now() - start), e => this.onSearchError(e, Date.now() - start));
1641
+ try {
1642
+ return await currentRequest;
1643
+ }
1644
+ finally {
1645
+ this.telemetryService.publicLog('searchResultsFinished', { duration: Date.now() - start });
1646
+ }
1647
+ }
1648
+ onSearchCompleted(completed, duration) {
1649
+ if (!this._searchQuery) {
1650
+ throw new Error('onSearchCompleted must be called after a search is started');
1651
+ }
1652
+ this._searchResult.add(this._resultQueue);
1653
+ this._resultQueue.length = 0;
1654
+ const options = Object.assign({}, this._searchQuery.contentPattern);
1655
+ delete options.pattern;
1656
+ const stats = completed && completed.stats;
1657
+ const fileSchemeOnly = this._searchQuery.folderQueries.every(fq => fq.folder.scheme === Schemas.file);
1658
+ const otherSchemeOnly = this._searchQuery.folderQueries.every(fq => fq.folder.scheme !== Schemas.file);
1659
+ const scheme = fileSchemeOnly ? Schemas.file :
1660
+ otherSchemeOnly ? 'other' :
1661
+ 'mixed';
1662
+ this.telemetryService.publicLog('searchResultsShown', {
1663
+ count: this._searchResult.count(),
1664
+ fileCount: this._searchResult.fileCount(),
1665
+ options,
1666
+ duration,
1667
+ type: stats && stats.type,
1668
+ scheme,
1669
+ searchOnTypeEnabled: this.searchConfig.searchOnType
1670
+ });
1671
+ return completed;
1672
+ }
1673
+ onSearchError(e, duration) {
1674
+ if (errors.isCancellationError(e)) {
1675
+ this.onSearchCompleted(this.searchCancelledForNewSearch
1676
+ ? { exit: 1 , results: [], messages: [] }
1677
+ : null, duration);
1678
+ this.searchCancelledForNewSearch = false;
1679
+ }
1680
+ }
1681
+ async onSearchProgress(p) {
1682
+ if (p.resource) {
1683
+ this._resultQueue.push(p);
1684
+ await this._startStreamDelay;
1685
+ if (this._resultQueue.length) {
1686
+ this._searchResult.add(this._resultQueue, true);
1687
+ this._resultQueue.length = 0;
1688
+ }
1689
+ }
1690
+ }
1691
+ get searchConfig() {
1692
+ return this.configurationService.getValue('search');
1693
+ }
1694
+ cancelSearch(cancelledForNewSearch = false) {
1695
+ if (this.currentCancelTokenSource) {
1696
+ this.searchCancelledForNewSearch = cancelledForNewSearch;
1697
+ this.currentCancelTokenSource.cancel();
1698
+ return true;
1699
+ }
1700
+ return false;
1701
+ }
1702
+ dispose() {
1703
+ this.cancelSearch();
1704
+ this.searchResult.dispose();
1705
+ super.dispose();
1706
+ }
1707
+ };
1708
+ SearchModel = ( __decorate([
1709
+ ( __param(0, ISearchService)),
1710
+ ( __param(1, ITelemetryService)),
1711
+ ( __param(2, IConfigurationService)),
1712
+ ( __param(3, IInstantiationService)),
1713
+ ( __param(4, IUriIdentityService)),
1714
+ ( __param(5, INotebookEditorService))
1715
+ ], SearchModel));
1716
+ let SearchWorkbenchService = class SearchWorkbenchService {
1717
+ constructor(instantiationService) {
1718
+ this.instantiationService = instantiationService;
1719
+ this._searchModel = null;
1720
+ }
1721
+ get searchModel() {
1722
+ if (!this._searchModel) {
1723
+ this._searchModel = this.instantiationService.createInstance(SearchModel);
1724
+ }
1725
+ return this._searchModel;
1726
+ }
1727
+ };
1728
+ SearchWorkbenchService = ( __decorate([
1729
+ ( __param(0, IInstantiationService))
1730
+ ], SearchWorkbenchService));
1731
+ const ISearchWorkbenchService = ( createDecorator('searchWorkbenchService'));
1732
+ let RangeHighlightDecorations = class RangeHighlightDecorations {
1733
+ constructor(_modelService) {
1734
+ this._modelService = _modelService;
1735
+ this._decorationId = null;
1736
+ this._model = null;
1737
+ this._modelDisposables = ( new DisposableStore());
1738
+ }
1739
+ removeHighlightRange() {
1740
+ if (this._model && this._decorationId) {
1741
+ const decorationId = this._decorationId;
1742
+ this._model.changeDecorations((accessor) => {
1743
+ accessor.removeDecoration(decorationId);
1744
+ });
1745
+ }
1746
+ this._decorationId = null;
1747
+ }
1748
+ highlightRange(resource, range, ownerId = 0) {
1749
+ let model;
1750
+ if (URI.isUri(resource)) {
1751
+ model = this._modelService.getModel(resource);
1752
+ }
1753
+ else {
1754
+ model = resource;
1755
+ }
1756
+ if (model) {
1757
+ this.doHighlightRange(model, range);
1758
+ }
1759
+ }
1760
+ doHighlightRange(model, range) {
1761
+ this.removeHighlightRange();
1762
+ model.changeDecorations((accessor) => {
1763
+ this._decorationId = accessor.addDecoration(range, RangeHighlightDecorations._RANGE_HIGHLIGHT_DECORATION);
1764
+ });
1765
+ this.setModel(model);
1766
+ }
1767
+ setModel(model) {
1768
+ if (this._model !== model) {
1769
+ this.clearModelListeners();
1770
+ this._model = model;
1771
+ this._modelDisposables.add(this._model.onDidChangeDecorations((e) => {
1772
+ this.clearModelListeners();
1773
+ this.removeHighlightRange();
1774
+ this._model = null;
1775
+ }));
1776
+ this._modelDisposables.add(this._model.onWillDispose(() => {
1777
+ this.clearModelListeners();
1778
+ this.removeHighlightRange();
1779
+ this._model = null;
1780
+ }));
1781
+ }
1782
+ }
1783
+ clearModelListeners() {
1784
+ this._modelDisposables.clear();
1785
+ }
1786
+ dispose() {
1787
+ if (this._model) {
1788
+ this.removeHighlightRange();
1789
+ this._modelDisposables.dispose();
1790
+ this._model = null;
1791
+ }
1792
+ }
1793
+ };
1794
+ RangeHighlightDecorations._RANGE_HIGHLIGHT_DECORATION = ModelDecorationOptions.register({
1795
+ description: 'search-range-highlight',
1796
+ stickiness: 1 ,
1797
+ className: 'rangeHighlight',
1798
+ isWholeLine: true
1799
+ });
1800
+ RangeHighlightDecorations = ( __decorate([
1801
+ ( __param(0, IModelService))
1802
+ ], RangeHighlightDecorations));
1803
+ function textSearchResultToMatches(rawMatch, fileMatch) {
1804
+ const previewLines = rawMatch.preview.text.split('\n');
1805
+ if (Array.isArray(rawMatch.ranges)) {
1806
+ return ( rawMatch.ranges.map((r, i) => {
1807
+ const previewRange = rawMatch.preview.matches[i];
1808
+ return ( new Match(fileMatch, previewLines, previewRange, r));
1809
+ }));
1810
+ }
1811
+ else {
1812
+ const previewRange = rawMatch.preview.matches;
1813
+ const match = ( new Match(fileMatch, previewLines, previewRange, rawMatch.ranges));
1814
+ return [match];
1815
+ }
1816
+ }
1817
+ function textSearchMatchesToNotebookMatches(textSearchMatches, cell) {
1818
+ const notebookMatches = [];
1819
+ return notebookMatches;
1820
+ }
1821
+ function arrayContainsElementOrParent(element, testArray) {
1822
+ do {
1823
+ if (testArray.includes(element)) {
1824
+ return true;
1825
+ }
1826
+ } while (!(element.parent() instanceof SearchResult) && (element = element.parent()));
1827
+ return false;
1828
+ }
1829
+ function getFileMatches(matches) {
1830
+ const folderMatches = [];
1831
+ const fileMatches = [];
1832
+ matches.forEach((e) => {
1833
+ if (e instanceof FileMatch) {
1834
+ fileMatches.push(e);
1835
+ }
1836
+ else {
1837
+ folderMatches.push(e);
1838
+ }
1839
+ });
1840
+ return fileMatches.concat(( folderMatches.map(e => e.allDownstreamFileMatches())).flat());
1841
+ }
1842
+ export { CellMatch, FileMatch, FolderMatch, FolderMatchNoRoot, FolderMatchWithResource, FolderMatchWorkspaceRoot, ISearchWorkbenchService, Match, MatchInNotebook, RangeHighlightDecorations, SearchModel, SearchResult, SearchWorkbenchService, arrayContainsElementOrParent, compareNotebookPos, searchMatchComparer, textSearchMatchesToNotebookMatches };