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