@codingame/monaco-vscode-api 1.83.8 → 1.83.9

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 (294) hide show
  1. package/extensions.js +5 -5
  2. package/lifecycle.js +21 -1
  3. package/missing-services.js +187 -24
  4. package/monaco-editor-treemending.patch +955 -955
  5. package/package.json +12 -6
  6. package/services.d.ts +2 -4
  7. package/services.js +28 -27
  8. package/vscode/src/vs/base/common/uriIpc.js +22 -1
  9. package/vscode/src/vs/base/parts/request/common/request.js +7 -1
  10. package/vscode/src/vs/platform/extensionManagement/common/extensionManagement.js +116 -1
  11. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementUtil.js +117 -2
  12. package/vscode/src/vs/platform/extensionRecommendations/common/extensionRecommendations.js +10 -0
  13. package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +42 -0
  14. package/vscode/src/vs/platform/extensionResourceLoader/common/extensionResourceLoader.js +12 -1
  15. package/vscode/src/vs/platform/extensions/common/extensionValidator.js +306 -1
  16. package/vscode/src/vs/platform/log/common/log.d.ts +27 -2
  17. package/vscode/src/vs/platform/remote/common/remoteAgentConnection.d.ts +9 -1
  18. package/vscode/src/vs/platform/remote/common/remoteExtensionsScanner.js +2 -1
  19. package/vscode/src/vs/platform/request/common/request.js +38 -1
  20. package/vscode/src/vs/platform/telemetry/common/telemetryUtils.js +2 -1
  21. package/vscode/src/vs/platform/tunnel/common/tunnel.d.ts +50 -1
  22. package/vscode/src/vs/platform/userDataProfile/common/userDataProfileIpc.js +63 -0
  23. package/vscode/src/vs/platform/userDataSync/common/ignoredExtensions.js +65 -0
  24. package/vscode/src/vs/platform/userDataSync/common/userDataSync.js +2 -1
  25. package/vscode/src/vs/platform/userDataSync/common/userDataSyncAccount.js +3 -0
  26. package/vscode/src/vs/platform/workspace/common/workspace.d.ts +16 -1
  27. package/vscode/src/vs/platform/workspaces/common/workspaces.d.ts +6 -2
  28. package/vscode/src/vs/workbench/api/worker/extensionHostWorker.js +1 -1
  29. package/vscode/src/vs/workbench/common/theme.js +3 -3
  30. package/vscode/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.css.js +4 -0
  31. package/vscode/src/vs/workbench/contrib/codeEditor/browser/suggestEnabledInput/suggestEnabledInput.js +248 -0
  32. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsActions.js +3291 -0
  33. package/vscode/src/vs/workbench/contrib/extensions/browser/extensionsIcons.js +16 -16
  34. package/vscode/src/vs/workbench/contrib/extensions/browser/media/extensionActions.css.js +4 -0
  35. package/vscode/src/vs/workbench/contrib/extensions/common/extensions.js +45 -1
  36. package/vscode/src/vs/workbench/contrib/extensions/common/extensionsFileTemplate.js +67 -0
  37. package/vscode/src/vs/workbench/services/extensionManagement/browser/extensionBisect.js +396 -0
  38. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagement.d.ts +23 -3
  39. package/vscode/src/vs/workbench/services/extensionManagement/common/extensionManagement.js +4 -1
  40. package/vscode/src/vs/workbench/services/extensionRecommendations/common/extensionRecommendations.js +4 -0
  41. package/vscode/src/vs/workbench/services/extensionRecommendations/common/workspaceExtensionsConfig.js +255 -0
  42. package/vscode/src/vs/workbench/services/extensions/browser/extensionService.d.ts +44 -0
  43. package/vscode/src/vs/workbench/services/extensions/common/extensionDescriptionRegistry.d.ts +1 -1
  44. package/vscode/src/vs/workbench/services/extensions/common/extensionHostProtocol.d.ts +1 -1
  45. package/vscode/src/vs/workbench/services/extensions/common/extensions.js +2 -1
  46. package/vscode/src/vs/workbench/services/localization/common/locale.js +4 -0
  47. package/vscode/src/vs/workbench/services/log/common/logConstants.js +2 -1
  48. package/vscode/src/vs/workbench/services/remote/common/remoteExplorerService.d.ts +68 -0
  49. package/vscode/src/vs/workbench/services/remote/common/tunnelModel.d.ts +172 -1
  50. package/vscode/src/vs/workbench/services/userDataProfile/common/remoteUserDataProfiles.js +150 -0
  51. package/vscode/src/vs/workbench/services/userDataSync/common/userDataSync.js +3 -1
  52. package/vscode.proposed.d.ts +4787 -0
  53. package/workbench.js +0 -1
  54. package/service-override/bulkEdit.js +0 -9
  55. package/service-override/environment.js +0 -21
  56. package/service-override/extensions.js +0 -465
  57. package/service-override/files.js +0 -471
  58. package/service-override/keybindings.js +0 -99
  59. package/service-override/layout.js +0 -229
  60. package/service-override/output.js +0 -23
  61. package/service-override/quickaccess.js +0 -98
  62. package/vscode/src/vs/base/common/console.js +0 -58
  63. package/vscode/src/vs/base/common/keybindingParser.js +0 -87
  64. package/vscode/src/vs/base/common/prefixTree.js +0 -130
  65. package/vscode/src/vs/base/common/tfIdf.js +0 -137
  66. package/vscode/src/vs/editor/contrib/quickAccess/browser/commandsQuickAccess.js +0 -23
  67. package/vscode/src/vs/platform/files/browser/indexedDBFileSystemProvider.js +0 -404
  68. package/vscode/src/vs/platform/files/common/fileService.js +0 -957
  69. package/vscode/src/vs/platform/files/common/files.js +0 -81
  70. package/vscode/src/vs/platform/files/common/inMemoryFilesystemProvider.js +0 -220
  71. package/vscode/src/vs/platform/files/common/io.js +0 -75
  72. package/vscode/src/vs/platform/files/common/watcher.js +0 -69
  73. package/vscode/src/vs/platform/keyboardLayout/common/keyboardConfig.js +0 -48
  74. package/vscode/src/vs/platform/keyboardLayout/common/keyboardMapper.js +0 -23
  75. package/vscode/src/vs/platform/lifecycle/common/lifecycle.js +0 -25
  76. package/vscode/src/vs/platform/log/common/fileLog.js +0 -105
  77. package/vscode/src/vs/platform/quickinput/browser/commandsQuickAccess.js +0 -331
  78. package/vscode/src/vs/platform/quickinput/browser/helpQuickAccess.js +0 -65
  79. package/vscode/src/vs/platform/remote/common/managedSocket.js +0 -96
  80. package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +0 -29
  81. package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +0 -33
  82. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +0 -328
  83. package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +0 -66
  84. package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +0 -172
  85. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents.js +0 -50
  86. package/vscode/src/vs/workbench/api/browser/mainThreadChatProvider.js +0 -59
  87. package/vscode/src/vs/workbench/api/browser/mainThreadChatSlashCommands.js +0 -47
  88. package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +0 -29
  89. package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +0 -22
  90. package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +0 -105
  91. package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +0 -92
  92. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +0 -539
  93. package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +0 -78
  94. package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +0 -33
  95. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +0 -576
  96. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +0 -385
  97. package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +0 -100
  98. package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +0 -67
  99. package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +0 -66
  100. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +0 -73
  101. package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +0 -247
  102. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +0 -368
  103. package/vscode/src/vs/workbench/api/browser/mainThreadDownloadService.js +0 -20
  104. package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +0 -39
  105. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +0 -409
  106. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +0 -473
  107. package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +0 -225
  108. package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +0 -22
  109. package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +0 -315
  110. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +0 -278
  111. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +0 -281
  112. package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +0 -66
  113. package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +0 -26
  114. package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +0 -31
  115. package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +0 -25
  116. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +0 -945
  117. package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +0 -76
  118. package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +0 -33
  119. package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +0 -76
  120. package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +0 -91
  121. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +0 -116
  122. package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +0 -156
  123. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +0 -121
  124. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +0 -186
  125. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +0 -127
  126. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +0 -129
  127. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +0 -339
  128. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +0 -23
  129. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +0 -46
  130. package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +0 -74
  131. package/vscode/src/vs/workbench/api/browser/mainThreadProfilContentHandlers.js +0 -36
  132. package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +0 -66
  133. package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +0 -47
  134. package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +0 -183
  135. package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +0 -28
  136. package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +0 -461
  137. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +0 -47
  138. package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +0 -146
  139. package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +0 -68
  140. package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +0 -48
  141. package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +0 -51
  142. package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +0 -70
  143. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +0 -729
  144. package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +0 -51
  145. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +0 -410
  146. package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +0 -180
  147. package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +0 -22
  148. package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +0 -53
  149. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +0 -311
  150. package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +0 -221
  151. package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +0 -108
  152. package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +0 -59
  153. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +0 -27
  154. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +0 -281
  155. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +0 -98
  156. package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +0 -133
  157. package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +0 -55
  158. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +0 -271
  159. package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +0 -33
  160. package/vscode/src/vs/workbench/browser/actions/quickAccessActions.js +0 -230
  161. package/vscode/src/vs/workbench/browser/contextkeys.js +0 -249
  162. package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.js +0 -358
  163. package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkFileEdits.js +0 -362
  164. package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.js +0 -265
  165. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +0 -2
  166. package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +0 -215
  167. package/vscode/src/vs/workbench/contrib/codeEditor/browser/quickaccess/gotoLineQuickAccess.js +0 -86
  168. package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +0 -55
  169. package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +0 -49
  170. package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +0 -90
  171. package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +0 -646
  172. package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +0 -295
  173. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +0 -60
  174. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +0 -247
  175. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +0 -107
  176. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +0 -107
  177. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +0 -329
  178. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +0 -378
  179. package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +0 -3
  180. package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +0 -1194
  181. package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +0 -17
  182. package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +0 -332
  183. package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +0 -541
  184. package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +0 -176
  185. package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +0 -4
  186. package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +0 -4
  187. package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +0 -99
  188. package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +0 -55
  189. package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +0 -143
  190. package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +0 -2
  191. package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +0 -71
  192. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +0 -81
  193. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +0 -177
  194. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +0 -3
  195. package/vscode/src/vs/workbench/contrib/keybindings/browser/keybindings.contribution.js +0 -28
  196. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +0 -142
  197. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +0 -480
  198. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +0 -5
  199. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +0 -83
  200. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +0 -54
  201. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +0 -108
  202. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +0 -258
  203. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +0 -614
  204. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +0 -307
  205. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +0 -36
  206. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +0 -165
  207. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +0 -78
  208. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +0 -68
  209. package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +0 -2
  210. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +0 -106
  211. package/vscode/src/vs/workbench/contrib/output/browser/output.contribution.js +0 -487
  212. package/vscode/src/vs/workbench/contrib/output/browser/outputLinkProvider.js +0 -76
  213. package/vscode/src/vs/workbench/contrib/output/browser/outputServices.js +0 -166
  214. package/vscode/src/vs/workbench/contrib/output/browser/outputView.js +0 -234
  215. package/vscode/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +0 -287
  216. package/vscode/src/vs/workbench/contrib/quickaccess/browser/quickAccess.contribution.js +0 -167
  217. package/vscode/src/vs/workbench/contrib/quickaccess/browser/viewQuickAccess.js +0 -263
  218. package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +0 -504
  219. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +0 -130
  220. package/vscode/src/vs/workbench/contrib/testing/common/getComputedState.js +0 -101
  221. package/vscode/src/vs/workbench/contrib/testing/common/observableValue.js +0 -26
  222. package/vscode/src/vs/workbench/contrib/testing/common/testCoverage.js +0 -23
  223. package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +0 -334
  224. package/vscode/src/vs/workbench/contrib/testing/common/testingStates.js +0 -45
  225. package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.js +0 -1286
  226. package/vscode/src/vs/workbench/services/commands/common/commandService.js +0 -77
  227. package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +0 -141
  228. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +0 -271
  229. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +0 -50
  230. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +0 -1091
  231. package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +0 -40
  232. package/vscode/src/vs/workbench/services/extensions/common/extensionDevOptions.js +0 -23
  233. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +0 -641
  234. package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +0 -272
  235. package/vscode/src/vs/workbench/services/extensions/common/extensionStorageMigration.js +0 -56
  236. package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +0 -78
  237. package/vscode/src/vs/workbench/services/extensions/common/remoteConsoleUtil.js +0 -47
  238. package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +0 -218
  239. package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +0 -917
  240. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayoutService.js +0 -498
  241. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/_.contribution.js +0 -13
  242. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/cz.win.js +0 -162
  243. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de-swiss.win.js +0 -162
  244. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.darwin.js +0 -125
  245. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.linux.js +0 -180
  246. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/de.win.js +0 -162
  247. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/dk.win.js +0 -162
  248. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/dvorak.darwin.js +0 -125
  249. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-belgian.win.js +0 -162
  250. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-ext.darwin.js +0 -125
  251. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-in.win.js +0 -162
  252. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-intl.darwin.js +0 -125
  253. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-intl.win.js +0 -162
  254. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-uk.darwin.js +0 -125
  255. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en-uk.win.js +0 -162
  256. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.darwin.js +0 -133
  257. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.linux.js +0 -182
  258. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/en.win.js +0 -167
  259. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es-latin.win.js +0 -162
  260. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.darwin.js +0 -125
  261. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.linux.js +0 -180
  262. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/es.win.js +0 -162
  263. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.darwin.js +0 -125
  264. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.linux.js +0 -180
  265. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/fr.win.js +0 -162
  266. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/hu.win.js +0 -162
  267. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/it.darwin.js +0 -125
  268. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/it.win.js +0 -162
  269. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/jp-roman.darwin.js +0 -125
  270. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/jp.darwin.js +0 -125
  271. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ko.darwin.js +0 -125
  272. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.darwin.js +0 -17
  273. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.linux.js +0 -6
  274. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/layout.contribution.win.js +0 -23
  275. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/no.win.js +0 -162
  276. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pl.darwin.js +0 -125
  277. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pl.win.js +0 -162
  278. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt-br.win.js +0 -162
  279. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt.darwin.js +0 -125
  280. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/pt.win.js +0 -162
  281. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.darwin.js +0 -125
  282. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.linux.js +0 -180
  283. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/ru.win.js +0 -162
  284. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/sv.win.js +0 -164
  285. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/thai.win.js +0 -162
  286. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/tr.win.js +0 -162
  287. package/vscode/src/vs/workbench/services/keybinding/browser/keyboardLayouts/zh-hans.darwin.js +0 -125
  288. package/vscode/src/vs/workbench/services/keybinding/common/keybindingIO.js +0 -72
  289. package/vscode/src/vs/workbench/services/keybinding/common/keymapInfo.js +0 -108
  290. package/vscode/src/vs/workbench/services/keybinding/common/macLinuxKeyboardMapper.js +0 -886
  291. package/vscode/src/vs/workbench/services/keybinding/common/windowsKeyboardMapper.js +0 -350
  292. package/vscode/src/vs/workbench/services/quickinput/browser/quickInputService.js +0 -67
  293. package/vscode/src/vs/workbench/services/themes/common/iconExtensionPoint.js +0 -4
  294. package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +0 -77
@@ -1,1194 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
- import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
3
- import { coalesce } from 'monaco-editor/esm/vs/base/common/arrays.js';
4
- import { findFirstIdxMonotonousOrArrLen } from 'monaco-editor/esm/vs/base/common/arraysFind.js';
5
- import { createCancelablePromise, Delayer } from 'monaco-editor/esm/vs/base/common/async.js';
6
- import { onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
7
- import { DisposableStore, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
8
- import './media/review.css.js';
9
- import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
10
- import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
11
- import { EditorType } from 'monaco-editor/esm/vs/editor/common/editorCommon.js';
12
- import { ModelDecorationOptions } from 'monaco-editor/esm/vs/editor/common/model/textModel.js';
13
- import * as languages from 'monaco-editor/esm/vs/editor/common/languages.js';
14
- import * as nls from 'monaco-editor/esm/vs/nls.js';
15
- import { IContextMenuService } from 'monaco-editor/esm/vs/platform/contextview/browser/contextView.js';
16
- import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
17
- import { IQuickInputService } from 'monaco-editor/esm/vs/platform/quickinput/common/quickInput.js';
18
- import { CommentGlyphWidget } from './commentGlyphWidget.js';
19
- import { ICommentService } from './commentService.js';
20
- import { ReviewZoneWidget, parseMouseDownInfoFromEvent, isMouseUpEventDragFromMouseDown } from './commentThreadZoneWidget.js';
21
- import { IEditorService } from '../../../services/editor/common/editorService.js';
22
- import { EmbeddedCodeEditorWidget } from 'monaco-editor/esm/vs/editor/browser/widget/embeddedCodeEditorWidget.js';
23
- import { IViewsService } from '../../../common/views.js';
24
- import { COMMENTS_VIEW_ID } from './commentsTreeViewer.js';
25
- import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
26
- import { COMMENTS_SECTION } from '../common/commentsConfiguration.js';
27
- import { COMMENTEDITOR_DECORATION_KEY } from './commentReply.js';
28
- import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
29
- import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
30
- import { CommentThreadRangeDecorator } from './commentThreadRangeDecorator.js';
31
- import { status } from 'monaco-editor/esm/vs/base/browser/ui/aria/aria.js';
32
- import { CommentContextKeys } from '../common/commentContextKeys.js';
33
- import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
34
- import { IAccessibilityService } from 'monaco-editor/esm/vs/platform/accessibility/common/accessibility.js';
35
- const ID = 'editor.contrib.review';
36
- class CommentingRangeDecoration {
37
- get id() {
38
- return this._decorationId;
39
- }
40
- set id(id) {
41
- this._decorationId = id;
42
- }
43
- get range() {
44
- return {
45
- startLineNumber: this._startLineNumber, startColumn: 1,
46
- endLineNumber: this._endLineNumber, endColumn: 1
47
- };
48
- }
49
- constructor(_editor, _ownerId, _extensionId, _label, _range, options, commentingRangesInfo, isHover = false) {
50
- this._editor = _editor;
51
- this._ownerId = _ownerId;
52
- this._extensionId = _extensionId;
53
- this._label = _label;
54
- this._range = _range;
55
- this.options = options;
56
- this.commentingRangesInfo = commentingRangesInfo;
57
- this.isHover = isHover;
58
- this._startLineNumber = _range.startLineNumber;
59
- this._endLineNumber = _range.endLineNumber;
60
- }
61
- getCommentAction() {
62
- return {
63
- extensionId: this._extensionId,
64
- label: this._label,
65
- ownerId: this._ownerId,
66
- commentingRangesInfo: this.commentingRangesInfo
67
- };
68
- }
69
- getOriginalRange() {
70
- return this._range;
71
- }
72
- getActiveRange() {
73
- return this.id ? this._editor.getModel().getDecorationRange(this.id) : undefined;
74
- }
75
- }
76
- class CommentingRangeDecorator {
77
- static { this.description = 'commenting-range-decorator'; }
78
- constructor() {
79
- this.commentingRangeDecorations = [];
80
- this.decorationIds = [];
81
- this._lastHover = -1;
82
- this._onDidChangeDecorationsCount = ( new Emitter());
83
- this.onDidChangeDecorationsCount = this._onDidChangeDecorationsCount.event;
84
- const decorationOptions = {
85
- description: CommentingRangeDecorator.description,
86
- isWholeLine: true,
87
- linesDecorationsClassName: 'comment-range-glyph comment-diff-added'
88
- };
89
- this.decorationOptions = ModelDecorationOptions.createDynamic(decorationOptions);
90
- const hoverDecorationOptions = {
91
- description: CommentingRangeDecorator.description,
92
- isWholeLine: true,
93
- linesDecorationsClassName: `comment-range-glyph line-hover`
94
- };
95
- this.hoverDecorationOptions = ModelDecorationOptions.createDynamic(hoverDecorationOptions);
96
- const multilineDecorationOptions = {
97
- description: CommentingRangeDecorator.description,
98
- isWholeLine: true,
99
- linesDecorationsClassName: `comment-range-glyph multiline-add`
100
- };
101
- this.multilineDecorationOptions = ModelDecorationOptions.createDynamic(multilineDecorationOptions);
102
- }
103
- updateHover(hoverLine) {
104
- if (this._editor && this._infos && (hoverLine !== this._lastHover)) {
105
- this._doUpdate(this._editor, this._infos, hoverLine);
106
- }
107
- this._lastHover = hoverLine ?? -1;
108
- }
109
- updateSelection(cursorLine, range = ( new Range(0, 0, 0, 0))) {
110
- this._lastSelection = range.isEmpty() ? undefined : range;
111
- this._lastSelectionCursor = range.isEmpty() ? undefined : cursorLine;
112
- if (this._editor && this._infos) {
113
- this._doUpdate(this._editor, this._infos, cursorLine, range);
114
- }
115
- }
116
- update(editor, commentInfos, cursorLine, range) {
117
- if (editor) {
118
- this._editor = editor;
119
- this._infos = commentInfos;
120
- this._doUpdate(editor, commentInfos, cursorLine, range);
121
- }
122
- }
123
- _lineHasThread(editor, lineRange) {
124
- return editor.getDecorationsInRange(lineRange)?.find(decoration => decoration.options.description === CommentGlyphWidget.description);
125
- }
126
- _doUpdate(editor, commentInfos, emphasisLine = -1, selectionRange = this._lastSelection) {
127
- const model = editor.getModel();
128
- if (!model) {
129
- return;
130
- }
131
- emphasisLine = this._lastSelectionCursor ?? emphasisLine;
132
- const commentingRangeDecorations = [];
133
- for (const info of commentInfos) {
134
- info.commentingRanges.ranges.forEach(range => {
135
- const rangeObject = ( new Range(
136
- range.startLineNumber,
137
- range.startColumn,
138
- range.endLineNumber,
139
- range.endColumn
140
- ));
141
- let intersectingSelectionRange = selectionRange ? rangeObject.intersectRanges(selectionRange) : undefined;
142
- if ((selectionRange && (emphasisLine >= 0) && intersectingSelectionRange)
143
- && !((intersectingSelectionRange.startLineNumber === intersectingSelectionRange.endLineNumber)
144
- && (emphasisLine === intersectingSelectionRange.startLineNumber))) {
145
- let intersectingEmphasisRange;
146
- if (emphasisLine <= intersectingSelectionRange.startLineNumber) {
147
- intersectingEmphasisRange = intersectingSelectionRange.collapseToStart();
148
- intersectingSelectionRange = ( new Range(
149
- intersectingSelectionRange.startLineNumber + 1,
150
- 1,
151
- intersectingSelectionRange.endLineNumber,
152
- 1
153
- ));
154
- }
155
- else {
156
- intersectingEmphasisRange = ( new Range(
157
- intersectingSelectionRange.endLineNumber,
158
- 1,
159
- intersectingSelectionRange.endLineNumber,
160
- 1
161
- ));
162
- intersectingSelectionRange = ( new Range(
163
- intersectingSelectionRange.startLineNumber,
164
- 1,
165
- intersectingSelectionRange.endLineNumber - 1,
166
- 1
167
- ));
168
- }
169
- commentingRangeDecorations.push(( new CommentingRangeDecoration(
170
- editor,
171
- info.owner,
172
- info.extensionId,
173
- info.label,
174
- intersectingSelectionRange,
175
- this.multilineDecorationOptions,
176
- info.commentingRanges,
177
- true
178
- )));
179
- if (!this._lineHasThread(editor, intersectingEmphasisRange)) {
180
- commentingRangeDecorations.push(( new CommentingRangeDecoration(
181
- editor,
182
- info.owner,
183
- info.extensionId,
184
- info.label,
185
- intersectingEmphasisRange,
186
- this.hoverDecorationOptions,
187
- info.commentingRanges,
188
- true
189
- )));
190
- }
191
- const beforeRangeEndLine = Math.min(intersectingEmphasisRange.startLineNumber, intersectingSelectionRange.startLineNumber) - 1;
192
- const hasBeforeRange = rangeObject.startLineNumber <= beforeRangeEndLine;
193
- const afterRangeStartLine = Math.max(intersectingEmphasisRange.endLineNumber, intersectingSelectionRange.endLineNumber) + 1;
194
- const hasAfterRange = rangeObject.endLineNumber >= afterRangeStartLine;
195
- if (hasBeforeRange) {
196
- const beforeRange = ( new Range(range.startLineNumber, 1, beforeRangeEndLine, 1));
197
- commentingRangeDecorations.push(( new CommentingRangeDecoration(
198
- editor,
199
- info.owner,
200
- info.extensionId,
201
- info.label,
202
- beforeRange,
203
- this.decorationOptions,
204
- info.commentingRanges,
205
- true
206
- )));
207
- }
208
- if (hasAfterRange) {
209
- const afterRange = ( new Range(afterRangeStartLine, 1, range.endLineNumber, 1));
210
- commentingRangeDecorations.push(( new CommentingRangeDecoration(
211
- editor,
212
- info.owner,
213
- info.extensionId,
214
- info.label,
215
- afterRange,
216
- this.decorationOptions,
217
- info.commentingRanges,
218
- true
219
- )));
220
- }
221
- }
222
- else if ((rangeObject.startLineNumber <= emphasisLine) && (emphasisLine <= rangeObject.endLineNumber)) {
223
- if (rangeObject.startLineNumber < emphasisLine) {
224
- const beforeRange = ( new Range(range.startLineNumber, 1, emphasisLine - 1, 1));
225
- commentingRangeDecorations.push(( new CommentingRangeDecoration(
226
- editor,
227
- info.owner,
228
- info.extensionId,
229
- info.label,
230
- beforeRange,
231
- this.decorationOptions,
232
- info.commentingRanges,
233
- true
234
- )));
235
- }
236
- const emphasisRange = ( new Range(emphasisLine, 1, emphasisLine, 1));
237
- if (!this._lineHasThread(editor, emphasisRange)) {
238
- commentingRangeDecorations.push(( new CommentingRangeDecoration(
239
- editor,
240
- info.owner,
241
- info.extensionId,
242
- info.label,
243
- emphasisRange,
244
- this.hoverDecorationOptions,
245
- info.commentingRanges,
246
- true
247
- )));
248
- }
249
- if (emphasisLine < rangeObject.endLineNumber) {
250
- const afterRange = ( new Range(emphasisLine + 1, 1, range.endLineNumber, 1));
251
- commentingRangeDecorations.push(( new CommentingRangeDecoration(
252
- editor,
253
- info.owner,
254
- info.extensionId,
255
- info.label,
256
- afterRange,
257
- this.decorationOptions,
258
- info.commentingRanges,
259
- true
260
- )));
261
- }
262
- }
263
- else {
264
- commentingRangeDecorations.push(( new CommentingRangeDecoration(
265
- editor,
266
- info.owner,
267
- info.extensionId,
268
- info.label,
269
- range,
270
- this.decorationOptions,
271
- info.commentingRanges
272
- )));
273
- }
274
- });
275
- }
276
- editor.changeDecorations((accessor) => {
277
- this.decorationIds = accessor.deltaDecorations(this.decorationIds, commentingRangeDecorations);
278
- commentingRangeDecorations.forEach((decoration, index) => decoration.id = this.decorationIds[index]);
279
- });
280
- const rangesDifference = this.commentingRangeDecorations.length - commentingRangeDecorations.length;
281
- this.commentingRangeDecorations = commentingRangeDecorations;
282
- if (rangesDifference) {
283
- this._onDidChangeDecorationsCount.fire(this.commentingRangeDecorations.length);
284
- }
285
- }
286
- areRangesIntersectingOrTouchingByLine(a, b) {
287
- if (a.endLineNumber < (b.startLineNumber - 1)) {
288
- return false;
289
- }
290
- if ((b.endLineNumber + 1) < a.startLineNumber) {
291
- return false;
292
- }
293
- return true;
294
- }
295
- getMatchedCommentAction(commentRange) {
296
- if (commentRange === undefined) {
297
- const foundInfos = this._infos?.filter(info => info.commentingRanges.fileComments);
298
- if (foundInfos) {
299
- return ( foundInfos.map(foundInfo => {
300
- return {
301
- ownerId: foundInfo.owner,
302
- extensionId: foundInfo.extensionId,
303
- label: foundInfo.label,
304
- commentingRangesInfo: foundInfo.commentingRanges
305
- };
306
- }));
307
- }
308
- return [];
309
- }
310
- const foundHoverActions = ( new Map());
311
- for (const decoration of this.commentingRangeDecorations) {
312
- const range = decoration.getActiveRange();
313
- if (range && this.areRangesIntersectingOrTouchingByLine(range, commentRange)) {
314
- const action = decoration.getCommentAction();
315
- const alreadyFoundInfo = foundHoverActions.get(action.ownerId);
316
- if (alreadyFoundInfo?.action.commentingRangesInfo === action.commentingRangesInfo) {
317
- const newRange = ( new Range(
318
- range.startLineNumber < alreadyFoundInfo.range.startLineNumber ? range.startLineNumber : alreadyFoundInfo.range.startLineNumber,
319
- range.startColumn < alreadyFoundInfo.range.startColumn ? range.startColumn : alreadyFoundInfo.range.startColumn,
320
- range.endLineNumber > alreadyFoundInfo.range.endLineNumber ? range.endLineNumber : alreadyFoundInfo.range.endLineNumber,
321
- range.endColumn > alreadyFoundInfo.range.endColumn ? range.endColumn : alreadyFoundInfo.range.endColumn
322
- ));
323
- foundHoverActions.set(action.ownerId, { range: newRange, action });
324
- }
325
- else {
326
- foundHoverActions.set(action.ownerId, { range, action });
327
- }
328
- }
329
- }
330
- return ( Array.from(( foundHoverActions.values())).filter(action => {
331
- return (action.range.startLineNumber <= commentRange.startLineNumber) && (commentRange.endLineNumber <= action.range.endLineNumber);
332
- }).map(actions => actions.action));
333
- }
334
- getNearestCommentingRange(findPosition, reverse) {
335
- let findPositionContainedWithin;
336
- let decorations;
337
- if (reverse) {
338
- decorations = [];
339
- for (let i = this.commentingRangeDecorations.length - 1; i >= 0; i--) {
340
- decorations.push(this.commentingRangeDecorations[i]);
341
- }
342
- }
343
- else {
344
- decorations = this.commentingRangeDecorations;
345
- }
346
- for (const decoration of decorations) {
347
- const range = decoration.getActiveRange();
348
- if (!range) {
349
- continue;
350
- }
351
- if (findPositionContainedWithin && this.areRangesIntersectingOrTouchingByLine(range, findPositionContainedWithin)) {
352
- findPositionContainedWithin = Range.plusRange(findPositionContainedWithin, range);
353
- continue;
354
- }
355
- if (range.startLineNumber <= findPosition.lineNumber && findPosition.lineNumber <= range.endLineNumber) {
356
- findPositionContainedWithin = ( new Range(
357
- range.startLineNumber,
358
- range.startColumn,
359
- range.endLineNumber,
360
- range.endColumn
361
- ));
362
- continue;
363
- }
364
- if (!reverse && range.endLineNumber < findPosition.lineNumber) {
365
- continue;
366
- }
367
- if (reverse && range.startLineNumber > findPosition.lineNumber) {
368
- continue;
369
- }
370
- return range;
371
- }
372
- return (decorations.length > 0 ? (decorations[0].getActiveRange() ?? undefined) : undefined);
373
- }
374
- dispose() {
375
- this.commentingRangeDecorations = [];
376
- }
377
- }
378
- let CommentController = class CommentController {
379
- constructor(editor, commentService, instantiationService, codeEditorService, contextMenuService, quickInputService, viewsService, configurationService, contextKeyService, editorService, keybindingService, accessibilityService) {
380
- this.commentService = commentService;
381
- this.instantiationService = instantiationService;
382
- this.codeEditorService = codeEditorService;
383
- this.contextMenuService = contextMenuService;
384
- this.quickInputService = quickInputService;
385
- this.viewsService = viewsService;
386
- this.configurationService = configurationService;
387
- this.editorService = editorService;
388
- this.keybindingService = keybindingService;
389
- this.accessibilityService = accessibilityService;
390
- this.globalToDispose = ( new DisposableStore());
391
- this.localToDispose = ( new DisposableStore());
392
- this.mouseDownInfo = null;
393
- this._commentingRangeSpaceReserved = false;
394
- this._emptyThreadsToAddQueue = [];
395
- this._editorDisposables = [];
396
- this._hasRespondedToEditorChange = false;
397
- this._commentInfos = [];
398
- this._commentWidgets = [];
399
- this._pendingNewCommentCache = {};
400
- this._pendingEditsCache = {};
401
- this._computePromise = null;
402
- this._activeCursorHasCommentingRange = CommentContextKeys.activeCursorHasCommentingRange.bindTo(contextKeyService);
403
- this._activeEditorHasCommentingRange = CommentContextKeys.activeEditorHasCommentingRange.bindTo(contextKeyService);
404
- if (editor instanceof EmbeddedCodeEditorWidget) {
405
- return;
406
- }
407
- this.editor = editor;
408
- this._commentingRangeDecorator = ( new CommentingRangeDecorator());
409
- this.globalToDispose.add(this._commentingRangeDecorator.onDidChangeDecorationsCount(count => {
410
- if (count === 0) {
411
- this.clearEditorListeners();
412
- }
413
- else if (this._editorDisposables.length === 0) {
414
- this.registerEditorListeners();
415
- }
416
- }));
417
- this.globalToDispose.add(this._commentThreadRangeDecorator = ( new CommentThreadRangeDecorator(this.commentService)));
418
- this.globalToDispose.add(this.commentService.onDidDeleteDataProvider(ownerId => {
419
- if (ownerId) {
420
- delete this._pendingNewCommentCache[ownerId];
421
- delete this._pendingEditsCache[ownerId];
422
- }
423
- else {
424
- this._pendingNewCommentCache = {};
425
- this._pendingEditsCache = {};
426
- }
427
- this.beginCompute();
428
- }));
429
- this.globalToDispose.add(this.commentService.onDidSetDataProvider(_ => this.beginComputeAndHandleEditorChange()));
430
- this.globalToDispose.add(this.commentService.onDidUpdateCommentingRanges(_ => this.beginComputeAndHandleEditorChange()));
431
- this.globalToDispose.add(this.commentService.onDidSetResourceCommentInfos(e => {
432
- const editorURI = this.editor && this.editor.hasModel() && this.editor.getModel().uri;
433
- if (editorURI && ( editorURI.toString()) === ( e.resource.toString())) {
434
- this.setComments(e.commentInfos.filter(commentInfo => commentInfo !== null));
435
- }
436
- }));
437
- this.globalToDispose.add(this.commentService.onDidChangeCommentingEnabled(e => {
438
- if (e) {
439
- this.registerEditorListeners();
440
- this.beginCompute();
441
- }
442
- else {
443
- this.tryUpdateReservedSpace();
444
- this.clearEditorListeners();
445
- this._commentingRangeDecorator.update(this.editor, []);
446
- this._commentThreadRangeDecorator.update(this.editor, []);
447
- dispose(this._commentWidgets);
448
- this._commentWidgets = [];
449
- }
450
- }));
451
- this.globalToDispose.add(this.editor.onDidChangeModel(_ => this.onModelChanged()));
452
- this.globalToDispose.add(this.configurationService.onDidChangeConfiguration(e => {
453
- if (e.affectsConfiguration('diffEditor.renderSideBySide')) {
454
- this.beginCompute();
455
- }
456
- }));
457
- this.onModelChanged();
458
- this.codeEditorService.registerDecorationType('comment-controller', COMMENTEDITOR_DECORATION_KEY, {});
459
- this.commentService.registerContinueOnCommentProvider({
460
- provideContinueOnComments: () => {
461
- const pendingComments = [];
462
- if (this._commentWidgets) {
463
- for (const zone of this._commentWidgets) {
464
- const zonePendingComments = zone.getPendingComments();
465
- const pendingNewComment = zonePendingComments.newComment;
466
- if (!pendingNewComment || !zone.commentThread.range) {
467
- continue;
468
- }
469
- let lastCommentBody;
470
- if (zone.commentThread.comments && zone.commentThread.comments.length) {
471
- const lastComment = zone.commentThread.comments[zone.commentThread.comments.length - 1];
472
- if (typeof lastComment.body === 'string') {
473
- lastCommentBody = lastComment.body;
474
- }
475
- else {
476
- lastCommentBody = lastComment.body.value;
477
- }
478
- }
479
- if (pendingNewComment !== lastCommentBody) {
480
- pendingComments.push({
481
- owner: zone.owner,
482
- uri: zone.editor.getModel().uri,
483
- range: zone.commentThread.range,
484
- body: pendingNewComment
485
- });
486
- }
487
- }
488
- }
489
- return pendingComments;
490
- }
491
- });
492
- }
493
- registerEditorListeners() {
494
- this._editorDisposables = [];
495
- if (!this.editor) {
496
- return;
497
- }
498
- this._editorDisposables.push(this.editor.onMouseMove(e => this.onEditorMouseMove(e)));
499
- this._editorDisposables.push(this.editor.onDidChangeCursorPosition(e => this.onEditorChangeCursorPosition(e.position)));
500
- this._editorDisposables.push(this.editor.onDidFocusEditorWidget(() => this.onEditorChangeCursorPosition(this.editor?.getPosition() ?? null)));
501
- this._editorDisposables.push(this.editor.onDidChangeCursorSelection(e => this.onEditorChangeCursorSelection(e)));
502
- this._editorDisposables.push(this.editor.onDidBlurEditorWidget(() => this.onEditorChangeCursorSelection()));
503
- }
504
- clearEditorListeners() {
505
- dispose(this._editorDisposables);
506
- this._editorDisposables = [];
507
- }
508
- onEditorMouseMove(e) {
509
- const position = e.target.position?.lineNumber;
510
- if (e.event.leftButton.valueOf() && position && this.mouseDownInfo) {
511
- this._commentingRangeDecorator.updateSelection(position, ( new Range(this.mouseDownInfo.lineNumber, 1, position, 1)));
512
- }
513
- else {
514
- this._commentingRangeDecorator.updateHover(position);
515
- }
516
- }
517
- onEditorChangeCursorSelection(e) {
518
- const position = this.editor?.getPosition()?.lineNumber;
519
- if (position) {
520
- this._commentingRangeDecorator.updateSelection(position, e?.selection);
521
- }
522
- }
523
- onEditorChangeCursorPosition(e) {
524
- const decorations = e ? this.editor?.getDecorationsInRange(Range.fromPositions(e, { column: -1, lineNumber: e.lineNumber })) : undefined;
525
- let hasCommentingRange = false;
526
- if (decorations) {
527
- for (const decoration of decorations) {
528
- if (decoration.options.description === CommentGlyphWidget.description) {
529
- hasCommentingRange = false;
530
- break;
531
- }
532
- else if (decoration.options.description === CommentingRangeDecorator.description) {
533
- hasCommentingRange = true;
534
- }
535
- }
536
- }
537
- this._activeCursorHasCommentingRange.set(hasCommentingRange);
538
- }
539
- isEditorInlineOriginal(testEditor) {
540
- if (this.configurationService.getValue('diffEditor.renderSideBySide')) {
541
- return false;
542
- }
543
- const foundEditor = this.editorService.visibleTextEditorControls.find(editor => {
544
- if (editor.getEditorType() === EditorType.IDiffEditor) {
545
- const diffEditor = editor;
546
- return diffEditor.getOriginalEditor() === testEditor;
547
- }
548
- return false;
549
- });
550
- return !!foundEditor;
551
- }
552
- beginCompute() {
553
- this._computePromise = createCancelablePromise(token => {
554
- const editorURI = this.editor && this.editor.hasModel() && this.editor.getModel().uri;
555
- if (editorURI) {
556
- return this.commentService.getDocumentComments(editorURI);
557
- }
558
- return Promise.resolve([]);
559
- });
560
- return this._computePromise.then(commentInfos => {
561
- this.setComments(coalesce(commentInfos));
562
- this._computePromise = null;
563
- }, error => console.log(error));
564
- }
565
- beginComputeCommentingRanges() {
566
- if (this._computeCommentingRangeScheduler) {
567
- if (this._computeCommentingRangePromise) {
568
- this._computeCommentingRangePromise.cancel();
569
- this._computeCommentingRangePromise = null;
570
- }
571
- this._computeCommentingRangeScheduler.trigger(() => {
572
- const editorURI = this.editor && this.editor.hasModel() && this.editor.getModel().uri;
573
- if (editorURI) {
574
- return this.commentService.getDocumentComments(editorURI);
575
- }
576
- return Promise.resolve([]);
577
- }).then(commentInfos => {
578
- if (this.commentService.isCommentingEnabled) {
579
- const meaningfulCommentInfos = coalesce(commentInfos);
580
- this._commentingRangeDecorator.update(this.editor, meaningfulCommentInfos, this.editor?.getPosition()?.lineNumber, this.editor?.getSelection() ?? undefined);
581
- }
582
- }, (err) => {
583
- onUnexpectedError(err);
584
- return null;
585
- });
586
- }
587
- }
588
- static get(editor) {
589
- return editor.getContribution(ID);
590
- }
591
- revealCommentThread(threadId, commentUniqueId, fetchOnceIfNotExist, focus) {
592
- const commentThreadWidget = this._commentWidgets.filter(widget => widget.commentThread.threadId === threadId);
593
- if (commentThreadWidget.length === 1) {
594
- commentThreadWidget[0].reveal(commentUniqueId, focus);
595
- }
596
- else if (fetchOnceIfNotExist) {
597
- if (this._computePromise) {
598
- this._computePromise.then(_ => {
599
- this.revealCommentThread(threadId, commentUniqueId, false, focus);
600
- });
601
- }
602
- else {
603
- this.beginCompute().then(_ => {
604
- this.revealCommentThread(threadId, commentUniqueId, false, focus);
605
- });
606
- }
607
- }
608
- }
609
- collapseAll() {
610
- for (const widget of this._commentWidgets) {
611
- widget.collapse();
612
- }
613
- }
614
- expandAll() {
615
- for (const widget of this._commentWidgets) {
616
- widget.expand();
617
- }
618
- }
619
- expandUnresolved() {
620
- for (const widget of this._commentWidgets) {
621
- if (widget.commentThread.state === languages.CommentThreadState.Unresolved) {
622
- widget.expand();
623
- }
624
- }
625
- }
626
- nextCommentThread() {
627
- this._findNearestCommentThread();
628
- }
629
- _findNearestCommentThread(reverse) {
630
- if (!this._commentWidgets.length || !this.editor?.hasModel()) {
631
- return;
632
- }
633
- const after = this.editor.getSelection().getEndPosition();
634
- const sortedWidgets = this._commentWidgets.sort((a, b) => {
635
- if (reverse) {
636
- const temp = a;
637
- a = b;
638
- b = temp;
639
- }
640
- if (a.commentThread.range === undefined) {
641
- return -1;
642
- }
643
- if (b.commentThread.range === undefined) {
644
- return 1;
645
- }
646
- if (a.commentThread.range.startLineNumber < b.commentThread.range.startLineNumber) {
647
- return -1;
648
- }
649
- if (a.commentThread.range.startLineNumber > b.commentThread.range.startLineNumber) {
650
- return 1;
651
- }
652
- if (a.commentThread.range.startColumn < b.commentThread.range.startColumn) {
653
- return -1;
654
- }
655
- if (a.commentThread.range.startColumn > b.commentThread.range.startColumn) {
656
- return 1;
657
- }
658
- return 0;
659
- });
660
- const idx = findFirstIdxMonotonousOrArrLen(sortedWidgets, widget => {
661
- const lineValueOne = reverse ? after.lineNumber : (widget.commentThread.range?.startLineNumber ?? 0);
662
- const lineValueTwo = reverse ? (widget.commentThread.range?.startLineNumber ?? 0) : after.lineNumber;
663
- const columnValueOne = reverse ? after.column : (widget.commentThread.range?.startColumn ?? 0);
664
- const columnValueTwo = reverse ? (widget.commentThread.range?.startColumn ?? 0) : after.column;
665
- if (lineValueOne > lineValueTwo) {
666
- return true;
667
- }
668
- if (lineValueOne < lineValueTwo) {
669
- return false;
670
- }
671
- if (columnValueOne > columnValueTwo) {
672
- return true;
673
- }
674
- return false;
675
- });
676
- let nextWidget;
677
- if (idx === this._commentWidgets.length) {
678
- nextWidget = this._commentWidgets[0];
679
- }
680
- else {
681
- nextWidget = sortedWidgets[idx];
682
- }
683
- this.editor.setSelection(nextWidget.commentThread.range ?? ( new Range(1, 1, 1, 1)));
684
- nextWidget.reveal(undefined, true);
685
- }
686
- previousCommentThread() {
687
- this._findNearestCommentThread(true);
688
- }
689
- _findNearestCommentingRange(reverse) {
690
- if (!this.editor?.hasModel()) {
691
- return;
692
- }
693
- const after = this.editor.getSelection().getEndPosition();
694
- const range = this._commentingRangeDecorator.getNearestCommentingRange(after, reverse);
695
- if (range) {
696
- const position = reverse ? range.getEndPosition() : range.getStartPosition();
697
- this.editor.setPosition(position);
698
- this.editor.revealLineInCenterIfOutsideViewport(position.lineNumber);
699
- }
700
- if (this.accessibilityService.isScreenReaderOptimized()) {
701
- const commentRangeStart = range?.getStartPosition().lineNumber;
702
- const commentRangeEnd = range?.getEndPosition().lineNumber;
703
- if (commentRangeStart && commentRangeEnd) {
704
- const oneLine = commentRangeStart === commentRangeEnd;
705
- oneLine ? status(( nls.localizeWithPath(
706
- 'vs/workbench/contrib/comments/browser/commentsController',
707
- 'commentRange',
708
- "Line {0}",
709
- commentRangeStart
710
- ))) : status(( nls.localizeWithPath(
711
- 'vs/workbench/contrib/comments/browser/commentsController',
712
- 'commentRangeStart',
713
- "Lines {0} to {1}",
714
- commentRangeStart,
715
- commentRangeEnd
716
- )));
717
- }
718
- }
719
- }
720
- nextCommentingRange() {
721
- this._findNearestCommentingRange();
722
- }
723
- previousCommentingRange() {
724
- this._findNearestCommentingRange(true);
725
- }
726
- dispose() {
727
- this.globalToDispose.dispose();
728
- this.localToDispose.dispose();
729
- dispose(this._editorDisposables);
730
- dispose(this._commentWidgets);
731
- this.editor = null;
732
- }
733
- onModelChanged() {
734
- this.localToDispose.clear();
735
- this.removeCommentWidgetsAndStoreCache();
736
- if (!this.editor) {
737
- return;
738
- }
739
- this._hasRespondedToEditorChange = false;
740
- this.localToDispose.add(this.editor.onMouseDown(e => this.onEditorMouseDown(e)));
741
- this.localToDispose.add(this.editor.onMouseUp(e => this.onEditorMouseUp(e)));
742
- if (this._editorDisposables.length) {
743
- this.clearEditorListeners();
744
- this.registerEditorListeners();
745
- }
746
- this._computeCommentingRangeScheduler = ( new Delayer(200));
747
- this.localToDispose.add({
748
- dispose: () => {
749
- this._computeCommentingRangeScheduler?.cancel();
750
- this._computeCommentingRangeScheduler = null;
751
- }
752
- });
753
- this.localToDispose.add(this.editor.onDidChangeModelContent(async () => {
754
- this.beginComputeCommentingRanges();
755
- }));
756
- this.localToDispose.add(this.commentService.onDidUpdateCommentThreads(async (e) => {
757
- const editorURI = this.editor && this.editor.hasModel() && this.editor.getModel().uri;
758
- if (!editorURI || !this.commentService.isCommentingEnabled) {
759
- return;
760
- }
761
- if (this._computePromise) {
762
- await this._computePromise;
763
- }
764
- const commentInfo = this._commentInfos.filter(info => info.owner === e.owner);
765
- if (!commentInfo || !commentInfo.length) {
766
- return;
767
- }
768
- const added = e.added.filter(thread => thread.resource && thread.resource === ( editorURI.toString()));
769
- const removed = e.removed.filter(thread => thread.resource && thread.resource === ( editorURI.toString()));
770
- const changed = e.changed.filter(thread => thread.resource && thread.resource === ( editorURI.toString()));
771
- const pending = e.pending.filter(pending => ( pending.uri.toString()) === ( editorURI.toString()));
772
- removed.forEach(thread => {
773
- const matchedZones = this._commentWidgets.filter(zoneWidget => zoneWidget.owner === e.owner && zoneWidget.commentThread.threadId === thread.threadId && zoneWidget.commentThread.threadId !== '');
774
- if (matchedZones.length) {
775
- const matchedZone = matchedZones[0];
776
- const index = this._commentWidgets.indexOf(matchedZone);
777
- this._commentWidgets.splice(index, 1);
778
- matchedZone.dispose();
779
- }
780
- const infosThreads = this._commentInfos.filter(info => info.owner === e.owner)[0].threads;
781
- for (let i = 0; i < infosThreads.length; i++) {
782
- if (infosThreads[i] === thread) {
783
- infosThreads.splice(i, 1);
784
- i--;
785
- }
786
- }
787
- });
788
- changed.forEach(thread => {
789
- const matchedZones = this._commentWidgets.filter(zoneWidget => zoneWidget.owner === e.owner && zoneWidget.commentThread.threadId === thread.threadId);
790
- if (matchedZones.length) {
791
- const matchedZone = matchedZones[0];
792
- matchedZone.update(thread);
793
- this.openCommentsView(thread);
794
- }
795
- });
796
- added.forEach(thread => {
797
- const matchedZones = this._commentWidgets.filter(zoneWidget => zoneWidget.owner === e.owner && zoneWidget.commentThread.threadId === thread.threadId);
798
- if (matchedZones.length) {
799
- return;
800
- }
801
- const matchedNewCommentThreadZones = this._commentWidgets.filter(zoneWidget => zoneWidget.owner === e.owner && zoneWidget.commentThread.commentThreadHandle === -1 && Range.equalsRange(zoneWidget.commentThread.range, thread.range));
802
- if (matchedNewCommentThreadZones.length) {
803
- matchedNewCommentThreadZones[0].update(thread);
804
- return;
805
- }
806
- const continueOnCommentText = (thread.range ? this.commentService.removeContinueOnComment({ owner: e.owner, uri: editorURI, range: thread.range })?.body : undefined);
807
- const pendingCommentText = (this._pendingNewCommentCache[e.owner] && this._pendingNewCommentCache[e.owner][thread.threadId])
808
- ?? continueOnCommentText;
809
- const pendingEdits = this._pendingEditsCache[e.owner] && this._pendingEditsCache[e.owner][thread.threadId];
810
- this.displayCommentThread(e.owner, thread, pendingCommentText, pendingEdits);
811
- this._commentInfos.filter(info => info.owner === e.owner)[0].threads.push(thread);
812
- this.tryUpdateReservedSpace();
813
- });
814
- pending.forEach(thread => {
815
- this.commentService.createCommentThreadTemplate(thread.owner, thread.uri, Range.lift(thread.range));
816
- });
817
- this._commentThreadRangeDecorator.update(this.editor, commentInfo);
818
- }));
819
- this.beginComputeAndHandleEditorChange();
820
- }
821
- beginComputeAndHandleEditorChange() {
822
- this.beginCompute().then(() => {
823
- if (!this._hasRespondedToEditorChange) {
824
- if (( this._commentInfos.some(
825
- commentInfo => commentInfo.commentingRanges.ranges.length > 0 || commentInfo.commentingRanges.fileComments
826
- ))) {
827
- this._hasRespondedToEditorChange = true;
828
- const verbose = this.configurationService.getValue("accessibility.verbosity.comments" );
829
- if (verbose) {
830
- const keybinding = this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp" )?.getAriaLabel();
831
- if (keybinding) {
832
- status(( nls.localizeWithPath(
833
- 'vs/workbench/contrib/comments/browser/commentsController',
834
- 'hasCommentRangesKb',
835
- "Editor has commenting ranges, run the command Open Accessibility Help ({0}), for more information.",
836
- keybinding
837
- )));
838
- }
839
- else {
840
- status(( nls.localizeWithPath(
841
- 'vs/workbench/contrib/comments/browser/commentsController',
842
- 'hasCommentRangesNoKb',
843
- "Editor has commenting ranges, run the command Open Accessibility Help, which is currently not triggerable via keybinding, for more information."
844
- )));
845
- }
846
- }
847
- else {
848
- status(( nls.localizeWithPath(
849
- 'vs/workbench/contrib/comments/browser/commentsController',
850
- 'hasCommentRanges',
851
- "Editor has commenting ranges."
852
- )));
853
- }
854
- }
855
- }
856
- });
857
- }
858
- async openCommentsView(thread) {
859
- if (thread.comments && (thread.comments.length > 0)) {
860
- const openViewState = this.configurationService.getValue(COMMENTS_SECTION).openView;
861
- if (openViewState === 'file') {
862
- return this.viewsService.openView(COMMENTS_VIEW_ID);
863
- }
864
- else if (openViewState === 'firstFile' || (openViewState === 'firstFileUnresolved' && thread.state === languages.CommentThreadState.Unresolved)) {
865
- const hasShownView = this.viewsService.getViewWithId(COMMENTS_VIEW_ID)?.hasRendered;
866
- if (!hasShownView) {
867
- return this.viewsService.openView(COMMENTS_VIEW_ID);
868
- }
869
- }
870
- }
871
- return undefined;
872
- }
873
- displayCommentThread(owner, thread, pendingComment, pendingEdits) {
874
- if (!this.editor?.getModel()) {
875
- return;
876
- }
877
- if (this.isEditorInlineOriginal(this.editor)) {
878
- return;
879
- }
880
- const zoneWidget = this.instantiationService.createInstance(ReviewZoneWidget, this.editor, owner, thread, pendingComment, pendingEdits);
881
- zoneWidget.display(thread.range);
882
- this._commentWidgets.push(zoneWidget);
883
- this.openCommentsView(thread);
884
- }
885
- onEditorMouseDown(e) {
886
- this.mouseDownInfo = parseMouseDownInfoFromEvent(e);
887
- }
888
- onEditorMouseUp(e) {
889
- const matchedLineNumber = isMouseUpEventDragFromMouseDown(this.mouseDownInfo, e);
890
- this.mouseDownInfo = null;
891
- if (!this.editor || matchedLineNumber === null || !e.target.element) {
892
- return;
893
- }
894
- const mouseUpIsOnDecorator = (e.target.element.className.indexOf('comment-range-glyph') >= 0);
895
- const lineNumber = e.target.position.lineNumber;
896
- let range;
897
- let selection;
898
- if ((matchedLineNumber !== lineNumber)) {
899
- if (matchedLineNumber > lineNumber) {
900
- selection = ( new Range(
901
- matchedLineNumber,
902
- this.editor.getModel().getLineLength(matchedLineNumber) + 1,
903
- lineNumber,
904
- 1
905
- ));
906
- }
907
- else {
908
- selection = ( new Range(
909
- matchedLineNumber,
910
- 1,
911
- lineNumber,
912
- this.editor.getModel().getLineLength(lineNumber) + 1
913
- ));
914
- }
915
- }
916
- else if (mouseUpIsOnDecorator) {
917
- selection = this.editor.getSelection();
918
- }
919
- if (selection && (selection.startLineNumber <= lineNumber) && (lineNumber <= selection.endLineNumber)) {
920
- range = selection;
921
- this.editor.setSelection(( new Range(selection.endLineNumber, 1, selection.endLineNumber, 1)));
922
- }
923
- else if (mouseUpIsOnDecorator) {
924
- range = ( new Range(lineNumber, 1, lineNumber, 1));
925
- }
926
- if (range) {
927
- this.addOrToggleCommentAtLine(range, e);
928
- }
929
- }
930
- async addOrToggleCommentAtLine(commentRange, e) {
931
- if (!this._addInProgress) {
932
- this._addInProgress = true;
933
- const existingCommentsAtLine = this._commentWidgets.filter(widget => widget.getGlyphPosition() === (commentRange ? commentRange.endLineNumber : 0));
934
- if (existingCommentsAtLine.length) {
935
- const allExpanded = existingCommentsAtLine.every(widget => widget.expanded);
936
- existingCommentsAtLine.forEach(allExpanded ? widget => widget.collapse() : widget => widget.expand());
937
- this.processNextThreadToAdd();
938
- return;
939
- }
940
- else {
941
- this.addCommentAtLine(commentRange, e);
942
- }
943
- }
944
- else {
945
- this._emptyThreadsToAddQueue.push([commentRange, e]);
946
- }
947
- }
948
- processNextThreadToAdd() {
949
- this._addInProgress = false;
950
- const info = this._emptyThreadsToAddQueue.shift();
951
- if (info) {
952
- this.addOrToggleCommentAtLine(info[0], info[1]);
953
- }
954
- }
955
- addCommentAtLine(range, e) {
956
- const newCommentInfos = this._commentingRangeDecorator.getMatchedCommentAction(range);
957
- if (!newCommentInfos.length || !this.editor?.hasModel()) {
958
- this._addInProgress = false;
959
- if (!newCommentInfos.length) {
960
- throw new Error('There are no commenting ranges at the current position.');
961
- }
962
- return Promise.resolve();
963
- }
964
- if (newCommentInfos.length > 1) {
965
- if (e && range) {
966
- this.contextMenuService.showContextMenu({
967
- getAnchor: () => e.event,
968
- getActions: () => this.getContextMenuActions(newCommentInfos, range),
969
- getActionsContext: () => newCommentInfos.length ? newCommentInfos[0] : undefined,
970
- onHide: () => { this._addInProgress = false; }
971
- });
972
- return Promise.resolve();
973
- }
974
- else {
975
- const picks = this.getCommentProvidersQuickPicks(newCommentInfos);
976
- return this.quickInputService.pick(picks, { placeHolder: ( nls.localizeWithPath(
977
- 'vs/workbench/contrib/comments/browser/commentsController',
978
- 'pickCommentService',
979
- "Select Comment Provider"
980
- )), matchOnDescription: true }).then(pick => {
981
- if (!pick) {
982
- return;
983
- }
984
- const commentInfos = newCommentInfos.filter(info => info.ownerId === pick.id);
985
- if (commentInfos.length) {
986
- const { ownerId } = commentInfos[0];
987
- this.addCommentAtLine2(range, ownerId);
988
- }
989
- }).then(() => {
990
- this._addInProgress = false;
991
- });
992
- }
993
- }
994
- else {
995
- const { ownerId } = newCommentInfos[0];
996
- this.addCommentAtLine2(range, ownerId);
997
- }
998
- return Promise.resolve();
999
- }
1000
- getCommentProvidersQuickPicks(commentInfos) {
1001
- const picks = ( commentInfos.map((commentInfo) => {
1002
- const { ownerId, extensionId, label } = commentInfo;
1003
- return {
1004
- label: label || extensionId,
1005
- id: ownerId
1006
- };
1007
- }));
1008
- return picks;
1009
- }
1010
- getContextMenuActions(commentInfos, commentRange) {
1011
- const actions = [];
1012
- commentInfos.forEach(commentInfo => {
1013
- const { ownerId, extensionId, label } = commentInfo;
1014
- actions.push(( new Action('addCommentThread', `${label || extensionId}`, undefined, true, () => {
1015
- this.addCommentAtLine2(commentRange, ownerId);
1016
- return Promise.resolve();
1017
- })));
1018
- });
1019
- return actions;
1020
- }
1021
- addCommentAtLine2(range, ownerId) {
1022
- if (!this.editor) {
1023
- return;
1024
- }
1025
- this.commentService.createCommentThreadTemplate(ownerId, this.editor.getModel().uri, range);
1026
- this.processNextThreadToAdd();
1027
- return;
1028
- }
1029
- getExistingCommentEditorOptions(editor) {
1030
- const lineDecorationsWidth = editor.getOption(65 );
1031
- let extraEditorClassName = [];
1032
- const configuredExtraClassName = editor.getRawOptions().extraEditorClassName;
1033
- if (configuredExtraClassName) {
1034
- extraEditorClassName = configuredExtraClassName.split(' ');
1035
- }
1036
- return { lineDecorationsWidth, extraEditorClassName };
1037
- }
1038
- getWithoutCommentsEditorOptions(editor, extraEditorClassName, startingLineDecorationsWidth) {
1039
- let lineDecorationsWidth = startingLineDecorationsWidth;
1040
- const inlineCommentPos = extraEditorClassName.findIndex(name => name === 'inline-comment');
1041
- if (inlineCommentPos >= 0) {
1042
- extraEditorClassName.splice(inlineCommentPos, 1);
1043
- }
1044
- const options = editor.getOptions();
1045
- if (options.get(43 ) && options.get(109 ) !== 'never') {
1046
- lineDecorationsWidth += 11;
1047
- }
1048
- lineDecorationsWidth -= 24;
1049
- return { extraEditorClassName, lineDecorationsWidth };
1050
- }
1051
- getWithCommentsEditorOptions(editor, extraEditorClassName, startingLineDecorationsWidth) {
1052
- let lineDecorationsWidth = startingLineDecorationsWidth;
1053
- const options = editor.getOptions();
1054
- if (options.get(43 ) && options.get(109 ) !== 'never') {
1055
- lineDecorationsWidth -= 11;
1056
- }
1057
- lineDecorationsWidth += 24;
1058
- extraEditorClassName.push('inline-comment');
1059
- return { lineDecorationsWidth, extraEditorClassName };
1060
- }
1061
- updateEditorLayoutOptions(editor, extraEditorClassName, lineDecorationsWidth) {
1062
- editor.updateOptions({
1063
- extraEditorClassName: extraEditorClassName.join(' '),
1064
- lineDecorationsWidth: lineDecorationsWidth
1065
- });
1066
- }
1067
- tryUpdateReservedSpace() {
1068
- if (!this.editor) {
1069
- return;
1070
- }
1071
- const hasCommentsOrRanges = ( this._commentInfos.some(info => {
1072
- const hasRanges = Boolean(info.commentingRanges && (Array.isArray(info.commentingRanges) ? info.commentingRanges : info.commentingRanges.ranges).length);
1073
- return hasRanges || (info.threads.length > 0);
1074
- }));
1075
- if (hasCommentsOrRanges && !this._commentingRangeSpaceReserved && this.commentService.isCommentingEnabled) {
1076
- this._commentingRangeSpaceReserved = true;
1077
- const { lineDecorationsWidth, extraEditorClassName } = this.getExistingCommentEditorOptions(this.editor);
1078
- const newOptions = this.getWithCommentsEditorOptions(this.editor, extraEditorClassName, lineDecorationsWidth);
1079
- this.updateEditorLayoutOptions(this.editor, newOptions.extraEditorClassName, newOptions.lineDecorationsWidth);
1080
- }
1081
- else if ((!hasCommentsOrRanges || !this.commentService.isCommentingEnabled) && this._commentingRangeSpaceReserved) {
1082
- this._commentingRangeSpaceReserved = false;
1083
- const { lineDecorationsWidth, extraEditorClassName } = this.getExistingCommentEditorOptions(this.editor);
1084
- const newOptions = this.getWithoutCommentsEditorOptions(this.editor, extraEditorClassName, lineDecorationsWidth);
1085
- this.updateEditorLayoutOptions(this.editor, newOptions.extraEditorClassName, newOptions.lineDecorationsWidth);
1086
- }
1087
- }
1088
- setComments(commentInfos) {
1089
- if (!this.editor || !this.commentService.isCommentingEnabled) {
1090
- return;
1091
- }
1092
- this._commentInfos = commentInfos;
1093
- this.tryUpdateReservedSpace();
1094
- this.removeCommentWidgetsAndStoreCache();
1095
- let hasCommentingRanges = false;
1096
- this._commentInfos.forEach(info => {
1097
- if (!hasCommentingRanges && (info.commentingRanges.ranges.length > 0 || info.commentingRanges.fileComments)) {
1098
- hasCommentingRanges = true;
1099
- }
1100
- const providerCacheStore = this._pendingNewCommentCache[info.owner];
1101
- const providerEditsCacheStore = this._pendingEditsCache[info.owner];
1102
- info.threads = info.threads.filter(thread => !thread.isDisposed);
1103
- info.threads.forEach(thread => {
1104
- let pendingComment = undefined;
1105
- if (providerCacheStore) {
1106
- pendingComment = providerCacheStore[thread.threadId];
1107
- }
1108
- let pendingEdits = undefined;
1109
- if (providerEditsCacheStore) {
1110
- pendingEdits = providerEditsCacheStore[thread.threadId];
1111
- }
1112
- if (pendingComment || pendingEdits) {
1113
- thread.collapsibleState = languages.CommentThreadCollapsibleState.Expanded;
1114
- }
1115
- this.displayCommentThread(info.owner, thread, pendingComment, pendingEdits);
1116
- });
1117
- info.pendingCommentThreads?.forEach(thread => {
1118
- this.commentService.createCommentThreadTemplate(thread.owner, thread.uri, Range.lift(thread.range));
1119
- });
1120
- });
1121
- this._commentingRangeDecorator.update(this.editor, this._commentInfos);
1122
- this._commentThreadRangeDecorator.update(this.editor, this._commentInfos);
1123
- if (hasCommentingRanges) {
1124
- this._activeEditorHasCommentingRange.set(true);
1125
- }
1126
- else {
1127
- this._activeEditorHasCommentingRange.set(false);
1128
- }
1129
- }
1130
- closeWidget() {
1131
- this._commentWidgets?.forEach(widget => widget.hide());
1132
- if (this.editor) {
1133
- this.editor.focus();
1134
- this.editor.revealRangeInCenter(this.editor.getSelection());
1135
- }
1136
- }
1137
- removeCommentWidgetsAndStoreCache() {
1138
- if (this._commentWidgets) {
1139
- this._commentWidgets.forEach(zone => {
1140
- const pendingComments = zone.getPendingComments();
1141
- const pendingNewComment = pendingComments.newComment;
1142
- const providerNewCommentCacheStore = this._pendingNewCommentCache[zone.owner];
1143
- let lastCommentBody;
1144
- if (zone.commentThread.comments && zone.commentThread.comments.length) {
1145
- const lastComment = zone.commentThread.comments[zone.commentThread.comments.length - 1];
1146
- if (typeof lastComment.body === 'string') {
1147
- lastCommentBody = lastComment.body;
1148
- }
1149
- else {
1150
- lastCommentBody = lastComment.body.value;
1151
- }
1152
- }
1153
- if (pendingNewComment && (pendingNewComment !== lastCommentBody)) {
1154
- if (!providerNewCommentCacheStore) {
1155
- this._pendingNewCommentCache[zone.owner] = {};
1156
- }
1157
- this._pendingNewCommentCache[zone.owner][zone.commentThread.threadId] = pendingNewComment;
1158
- }
1159
- else {
1160
- if (providerNewCommentCacheStore) {
1161
- delete providerNewCommentCacheStore[zone.commentThread.threadId];
1162
- }
1163
- }
1164
- const pendingEdits = pendingComments.edits;
1165
- const providerEditsCacheStore = this._pendingEditsCache[zone.owner];
1166
- if (( Object.keys(pendingEdits)).length > 0) {
1167
- if (!providerEditsCacheStore) {
1168
- this._pendingEditsCache[zone.owner] = {};
1169
- }
1170
- this._pendingEditsCache[zone.owner][zone.commentThread.threadId] = pendingEdits;
1171
- }
1172
- else if (providerEditsCacheStore) {
1173
- delete providerEditsCacheStore[zone.commentThread.threadId];
1174
- }
1175
- zone.dispose();
1176
- });
1177
- }
1178
- this._commentWidgets = [];
1179
- }
1180
- };
1181
- CommentController = ( __decorate([
1182
- ( __param(1, ICommentService)),
1183
- ( __param(2, IInstantiationService)),
1184
- ( __param(3, ICodeEditorService)),
1185
- ( __param(4, IContextMenuService)),
1186
- ( __param(5, IQuickInputService)),
1187
- ( __param(6, IViewsService)),
1188
- ( __param(7, IConfigurationService)),
1189
- ( __param(8, IContextKeyService)),
1190
- ( __param(9, IEditorService)),
1191
- ( __param(10, IKeybindingService)),
1192
- ( __param(11, IAccessibilityService))
1193
- ], CommentController));
1194
- export { CommentController, ID };