@codingame/monaco-vscode-extensions-service-override 1.83.7 → 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,297 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
3
+ import { MOUSE_CURSOR_TEXT_CSS_CLASS_NAME } from 'monaco-editor/esm/vs/base/browser/ui/mouseCursor/mouseCursor.js';
4
+ import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
5
+ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
6
+ import { generateUuid } from 'monaco-editor/esm/vs/base/common/uuid.js';
7
+ import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
8
+ import { IModelService } from 'monaco-editor/esm/vs/editor/common/services/model.js';
9
+ import * as nls from 'monaco-editor/esm/vs/nls.js';
10
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
11
+ import { resolveColorValue, editorForeground } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
12
+ import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
13
+ import { CommentFormActions } from './commentFormActions.js';
14
+ import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService';
15
+ import { CommentContextKeys } from 'vscode/vscode/vs/workbench/contrib/comments/common/commentContextKeys';
16
+ import { MIN_EDITOR_HEIGHT, SimpleCommentEditor, calculateEditorHeight } from 'vscode/vscode/vs/workbench/contrib/comments/browser/simpleCommentEditor';
17
+
18
+ const COMMENT_SCHEME = 'comment';
19
+ let INMEM_MODEL_ID = 0;
20
+ const COMMENTEDITOR_DECORATION_KEY = 'commenteditordecoration';
21
+ let CommentReply = class CommentReply extends Disposable {
22
+ constructor(owner, container, _parentEditor, _commentThread, _scopedInstatiationService, _contextKeyService, _commentMenus, _commentOptions, _pendingComment, _parentThread, _actionRunDelegate, commentService, languageService, modelService, themeService, configurationService) {
23
+ super();
24
+ this.owner = owner;
25
+ this._parentEditor = _parentEditor;
26
+ this._commentThread = _commentThread;
27
+ this._scopedInstatiationService = _scopedInstatiationService;
28
+ this._contextKeyService = _contextKeyService;
29
+ this._commentMenus = _commentMenus;
30
+ this._commentOptions = _commentOptions;
31
+ this._pendingComment = _pendingComment;
32
+ this._parentThread = _parentThread;
33
+ this._actionRunDelegate = _actionRunDelegate;
34
+ this.commentService = commentService;
35
+ this.languageService = languageService;
36
+ this.modelService = modelService;
37
+ this.themeService = themeService;
38
+ this._commentThreadDisposables = [];
39
+ this._editorHeight = MIN_EDITOR_HEIGHT;
40
+ this.form = dom.append(container, dom.$('.comment-form'));
41
+ this.commentEditor = this._register(this._scopedInstatiationService.createInstance(SimpleCommentEditor, this.form, SimpleCommentEditor.getEditorOptions(configurationService), _contextKeyService, this._parentThread));
42
+ this.commentEditorIsEmpty = CommentContextKeys.commentIsEmpty.bindTo(this._contextKeyService);
43
+ this.commentEditorIsEmpty.set(!this._pendingComment);
44
+ const hasExistingComments = this._commentThread.comments && this._commentThread.comments.length > 0;
45
+ const modeId = generateUuid() + '-' + (hasExistingComments ? this._commentThread.threadId : ++INMEM_MODEL_ID);
46
+ const params = JSON.stringify({
47
+ extensionId: this._commentThread.extensionId,
48
+ commentThreadId: this._commentThread.threadId
49
+ });
50
+ let resource = ( URI.parse(
51
+ `${COMMENT_SCHEME}://${this._commentThread.extensionId}/commentinput-${modeId}.md?${params}`
52
+ ));
53
+ const commentController = this.commentService.getCommentController(owner);
54
+ if (commentController) {
55
+ resource = resource.with({ authority: commentController.id });
56
+ }
57
+ const model = this.modelService.createModel(this._pendingComment || '', this.languageService.createByFilepathOrFirstLine(resource), resource, false);
58
+ this._register(model);
59
+ this.commentEditor.setModel(model);
60
+ this.calculateEditorHeight();
61
+ this._register((model.onDidChangeContent(() => {
62
+ this.setCommentEditorDecorations();
63
+ this.commentEditorIsEmpty?.set(!this.commentEditor.getValue());
64
+ if (this.calculateEditorHeight()) {
65
+ this.commentEditor.layout({ height: this._editorHeight, width: this.commentEditor.getLayoutInfo().width });
66
+ this.commentEditor.render(true);
67
+ }
68
+ })));
69
+ this.createTextModelListener(this.commentEditor, this.form);
70
+ this.setCommentEditorDecorations();
71
+ if (hasExistingComments) {
72
+ this.createReplyButton(this.commentEditor, this.form);
73
+ }
74
+ else if (this._commentThread.comments && this._commentThread.comments.length === 0) {
75
+ this.expandReplyArea();
76
+ }
77
+ this._error = dom.append(this.form, dom.$('.validation-error.hidden'));
78
+ const formActions = dom.append(this.form, dom.$('.form-actions'));
79
+ this._formActions = dom.append(formActions, dom.$('.other-actions'));
80
+ this.createCommentWidgetFormActions(this._formActions, model);
81
+ this._editorActions = dom.append(formActions, dom.$('.editor-actions'));
82
+ this.createCommentWidgetEditorActions(this._editorActions, model);
83
+ }
84
+ calculateEditorHeight() {
85
+ const newEditorHeight = calculateEditorHeight(this._parentEditor, this.commentEditor, this._editorHeight);
86
+ if (newEditorHeight !== this._editorHeight) {
87
+ this._editorHeight = newEditorHeight;
88
+ return true;
89
+ }
90
+ return false;
91
+ }
92
+ updateCommentThread(commentThread) {
93
+ const isReplying = this.commentEditor.hasTextFocus();
94
+ if (!this._reviewThreadReplyButton) {
95
+ this.createReplyButton(this.commentEditor, this.form);
96
+ }
97
+ if (this._commentThread.comments && this._commentThread.comments.length === 0) {
98
+ this.expandReplyArea();
99
+ }
100
+ if (isReplying) {
101
+ this.commentEditor.focus();
102
+ }
103
+ }
104
+ getPendingComment() {
105
+ const model = this.commentEditor.getModel();
106
+ if (model && model.getValueLength() > 0) {
107
+ return model.getValue();
108
+ }
109
+ return undefined;
110
+ }
111
+ layout(widthInPixel) {
112
+ this.commentEditor.layout({ height: this._editorHeight, width: widthInPixel - 54 });
113
+ }
114
+ focusIfNeeded() {
115
+ if (!this._commentThread.comments || !this._commentThread.comments.length) {
116
+ this.commentEditor.focus();
117
+ }
118
+ else if (this.commentEditor.getModel().getValueLength() > 0) {
119
+ this.expandReplyArea();
120
+ }
121
+ }
122
+ focusCommentEditor() {
123
+ this.commentEditor.focus();
124
+ }
125
+ expandReplyAreaAndFocusCommentEditor() {
126
+ this.expandReplyArea();
127
+ this.commentEditor.focus();
128
+ }
129
+ isCommentEditorFocused() {
130
+ return this.commentEditor.hasWidgetFocus();
131
+ }
132
+ getCommentModel() {
133
+ return this.commentEditor.getModel();
134
+ }
135
+ updateCanReply() {
136
+ if (!this._commentThread.canReply) {
137
+ this.form.style.display = 'none';
138
+ }
139
+ else {
140
+ this.form.style.display = 'block';
141
+ }
142
+ }
143
+ async submitComment() {
144
+ await this._commentFormActions?.triggerDefaultAction();
145
+ this._pendingComment = undefined;
146
+ }
147
+ setCommentEditorDecorations() {
148
+ const model = this.commentEditor.getModel();
149
+ if (model) {
150
+ const valueLength = model.getValueLength();
151
+ const hasExistingComments = this._commentThread.comments && this._commentThread.comments.length > 0;
152
+ const placeholder = valueLength > 0
153
+ ? ''
154
+ : hasExistingComments
155
+ ? (this._commentOptions?.placeHolder || ( nls.localizeWithPath('vs/workbench/contrib/comments/browser/commentReply', 'reply', "Reply...")))
156
+ : (this._commentOptions?.placeHolder || ( nls.localizeWithPath(
157
+ 'vs/workbench/contrib/comments/browser/commentReply',
158
+ 'newComment',
159
+ "Type a new comment"
160
+ )));
161
+ const decorations = [{
162
+ range: {
163
+ startLineNumber: 0,
164
+ endLineNumber: 0,
165
+ startColumn: 0,
166
+ endColumn: 1
167
+ },
168
+ renderOptions: {
169
+ after: {
170
+ contentText: placeholder,
171
+ color: `${resolveColorValue(editorForeground, this.themeService.getColorTheme())?.transparent(0.4)}`
172
+ }
173
+ }
174
+ }];
175
+ this.commentEditor.setDecorationsByType('review-zone-widget', COMMENTEDITOR_DECORATION_KEY, decorations);
176
+ }
177
+ }
178
+ createTextModelListener(commentEditor, commentForm) {
179
+ this._commentThreadDisposables.push(commentEditor.onDidFocusEditorWidget(() => {
180
+ this._commentThread.input = {
181
+ uri: commentEditor.getModel().uri,
182
+ value: commentEditor.getValue()
183
+ };
184
+ this.commentService.setActiveCommentThread(this._commentThread);
185
+ }));
186
+ this._commentThreadDisposables.push(commentEditor.getModel().onDidChangeContent(() => {
187
+ const modelContent = commentEditor.getValue();
188
+ if (this._commentThread.input && this._commentThread.input.uri === commentEditor.getModel().uri && this._commentThread.input.value !== modelContent) {
189
+ const newInput = this._commentThread.input;
190
+ newInput.value = modelContent;
191
+ this._commentThread.input = newInput;
192
+ }
193
+ this.commentService.setActiveCommentThread(this._commentThread);
194
+ }));
195
+ this._commentThreadDisposables.push(this._commentThread.onDidChangeInput(input => {
196
+ const thread = this._commentThread;
197
+ const model = commentEditor.getModel();
198
+ if (thread.input && model && (thread.input.uri !== model.uri)) {
199
+ return;
200
+ }
201
+ if (!input) {
202
+ return;
203
+ }
204
+ if (commentEditor.getValue() !== input.value) {
205
+ commentEditor.setValue(input.value);
206
+ if (input.value === '') {
207
+ this._pendingComment = '';
208
+ commentForm.classList.remove('expand');
209
+ commentEditor.getDomNode().style.outline = '';
210
+ this._error.textContent = '';
211
+ this._error.classList.add('hidden');
212
+ }
213
+ }
214
+ }));
215
+ }
216
+ createCommentWidgetFormActions(container, model) {
217
+ const menu = this._commentMenus.getCommentThreadActions(this._contextKeyService);
218
+ this._register(menu);
219
+ this._register(menu.onDidChange(() => {
220
+ this._commentFormActions.setActions(menu);
221
+ }));
222
+ this._commentFormActions = ( new CommentFormActions(container, async (action) => {
223
+ this._actionRunDelegate?.();
224
+ action.run({
225
+ thread: this._commentThread,
226
+ text: this.commentEditor.getValue(),
227
+ $mid: 9
228
+ });
229
+ this.hideReplyArea();
230
+ }));
231
+ this._register(this._commentFormActions);
232
+ this._commentFormActions.setActions(menu);
233
+ }
234
+ createCommentWidgetEditorActions(container, model) {
235
+ const editorMenu = this._commentMenus.getCommentEditorActions(this._contextKeyService);
236
+ this._register(editorMenu);
237
+ this._register(editorMenu.onDidChange(() => {
238
+ this._commentEditorActions.setActions(editorMenu);
239
+ }));
240
+ this._commentEditorActions = ( new CommentFormActions(container, async (action) => {
241
+ this._actionRunDelegate?.();
242
+ action.run({
243
+ thread: this._commentThread,
244
+ text: this.commentEditor.getValue(),
245
+ $mid: 9
246
+ });
247
+ this.focusCommentEditor();
248
+ }));
249
+ this._register(this._commentEditorActions);
250
+ this._commentEditorActions.setActions(editorMenu, true);
251
+ }
252
+ get isReplyExpanded() {
253
+ return this.form.classList.contains('expand');
254
+ }
255
+ expandReplyArea() {
256
+ if (!this.isReplyExpanded) {
257
+ this.form.classList.add('expand');
258
+ this.commentEditor.focus();
259
+ this.commentEditor.layout();
260
+ }
261
+ }
262
+ clearAndExpandReplyArea() {
263
+ if (!this.isReplyExpanded) {
264
+ this.commentEditor.setValue('');
265
+ this.expandReplyArea();
266
+ }
267
+ }
268
+ hideReplyArea() {
269
+ this.commentEditor.getDomNode().style.outline = '';
270
+ this.commentEditor.setValue('');
271
+ this._pendingComment = '';
272
+ this.form.classList.remove('expand');
273
+ this._error.textContent = '';
274
+ this._error.classList.add('hidden');
275
+ }
276
+ createReplyButton(commentEditor, commentForm) {
277
+ this._reviewThreadReplyButton = dom.append(commentForm, dom.$(`button.review-thread-reply-button.${MOUSE_CURSOR_TEXT_CSS_CLASS_NAME}`));
278
+ this._reviewThreadReplyButton.title = this._commentOptions?.prompt || ( nls.localizeWithPath('vs/workbench/contrib/comments/browser/commentReply', 'reply', "Reply..."));
279
+ this._reviewThreadReplyButton.textContent = this._commentOptions?.prompt || ( nls.localizeWithPath('vs/workbench/contrib/comments/browser/commentReply', 'reply', "Reply..."));
280
+ this._register(dom.addDisposableListener(this._reviewThreadReplyButton, 'click', _ => this.clearAndExpandReplyArea()));
281
+ this._register(dom.addDisposableListener(this._reviewThreadReplyButton, 'focus', _ => this.clearAndExpandReplyArea()));
282
+ commentEditor.onDidBlurEditorWidget(() => {
283
+ if (commentEditor.getModel().getValueLength() === 0 && commentForm.classList.contains('expand')) {
284
+ commentForm.classList.remove('expand');
285
+ }
286
+ });
287
+ }
288
+ };
289
+ CommentReply = ( __decorate([
290
+ ( __param(11, ICommentService)),
291
+ ( __param(12, ILanguageService)),
292
+ ( __param(13, IModelService)),
293
+ ( __param(14, IThemeService)),
294
+ ( __param(15, IConfigurationService))
295
+ ], CommentReply));
296
+
297
+ export { COMMENTEDITOR_DECORATION_KEY, CommentReply };
@@ -0,0 +1,62 @@
1
+ import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
2
+ import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
3
+ import { CommentFormActions } from './commentFormActions.js';
4
+
5
+ class CommentThreadAdditionalActions extends Disposable {
6
+ constructor(container, _commentThread, _contextKeyService, _commentMenus, _actionRunDelegate) {
7
+ super();
8
+ this._commentThread = _commentThread;
9
+ this._contextKeyService = _contextKeyService;
10
+ this._commentMenus = _commentMenus;
11
+ this._actionRunDelegate = _actionRunDelegate;
12
+ this._container = dom.append(container, dom.$('.comment-additional-actions'));
13
+ dom.append(this._container, dom.$('.section-separator'));
14
+ this._buttonBar = dom.append(this._container, dom.$('.button-bar'));
15
+ this._createAdditionalActions(this._buttonBar);
16
+ }
17
+ _showMenu() {
18
+ this._container?.classList.remove('hidden');
19
+ }
20
+ _hideMenu() {
21
+ this._container?.classList.add('hidden');
22
+ }
23
+ _enableDisableMenu(menu) {
24
+ const groups = menu.getActions({ shouldForwardArgs: true });
25
+ for (const group of groups) {
26
+ const [, actions] = group;
27
+ for (const action of actions) {
28
+ if (action.enabled) {
29
+ this._showMenu();
30
+ return;
31
+ }
32
+ for (const subAction of action.actions ?? []) {
33
+ if (subAction.enabled) {
34
+ this._showMenu();
35
+ return;
36
+ }
37
+ }
38
+ }
39
+ }
40
+ this._hideMenu();
41
+ }
42
+ _createAdditionalActions(container) {
43
+ const menu = this._commentMenus.getCommentThreadAdditionalActions(this._contextKeyService);
44
+ this._register(menu);
45
+ this._register(menu.onDidChange(() => {
46
+ this._commentFormActions.setActions(menu, true);
47
+ this._enableDisableMenu(menu);
48
+ }));
49
+ this._commentFormActions = ( new CommentFormActions(container, async (action) => {
50
+ this._actionRunDelegate?.();
51
+ action.run({
52
+ thread: this._commentThread,
53
+ $mid: 8
54
+ });
55
+ }, 4));
56
+ this._register(this._commentFormActions);
57
+ this._commentFormActions.setActions(menu, true);
58
+ this._enableDisableMenu(menu);
59
+ }
60
+ }
61
+
62
+ export { CommentThreadAdditionalActions };
@@ -0,0 +1,249 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
3
+ import * as nls from 'monaco-editor/esm/vs/nls.js';
4
+ import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
5
+ import * as languages from 'monaco-editor/esm/vs/editor/common/languages.js';
6
+ import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
7
+ import { ICommentService } from 'vscode/vscode/vs/workbench/contrib/comments/browser/commentService';
8
+ import { StandardKeyboardEvent } from 'monaco-editor/esm/vs/base/browser/keyboardEvent.js';
9
+ import { CommentNode } from './commentNode.js';
10
+ import { MarkdownRenderer } from 'monaco-editor/esm/vs/editor/contrib/markdownRenderer/browser/markdownRenderer.js';
11
+ import { IOpenerService } from 'monaco-editor/esm/vs/platform/opener/common/opener.js';
12
+ import { ILanguageService } from 'monaco-editor/esm/vs/editor/common/languages/language.js';
13
+
14
+ let CommentThreadBody = class CommentThreadBody extends Disposable {
15
+ get length() {
16
+ return this._commentThread.comments ? this._commentThread.comments.length : 0;
17
+ }
18
+ get activeComment() {
19
+ return this._commentElements.filter(node => node.isEditing)[0];
20
+ }
21
+ constructor(_parentEditor, owner, parentResourceUri, container, _options, _commentThread, _pendingEdits, _scopedInstatiationService, _parentCommentThreadWidget, commentService, openerService, languageService) {
22
+ super();
23
+ this._parentEditor = _parentEditor;
24
+ this.owner = owner;
25
+ this.parentResourceUri = parentResourceUri;
26
+ this.container = container;
27
+ this._options = _options;
28
+ this._commentThread = _commentThread;
29
+ this._pendingEdits = _pendingEdits;
30
+ this._scopedInstatiationService = _scopedInstatiationService;
31
+ this._parentCommentThreadWidget = _parentCommentThreadWidget;
32
+ this.commentService = commentService;
33
+ this.openerService = openerService;
34
+ this.languageService = languageService;
35
+ this._commentElements = [];
36
+ this._focusedComment = undefined;
37
+ this._onDidResize = ( new Emitter());
38
+ this.onDidResize = this._onDidResize.event;
39
+ this._commentDisposable = ( new Map());
40
+ this._register(dom.addDisposableListener(container, dom.EventType.FOCUS_IN, e => {
41
+ this.commentService.setActiveCommentThread(this._commentThread);
42
+ }));
43
+ this._markdownRenderer = this._register(( new MarkdownRenderer(this._options, this.languageService, this.openerService)));
44
+ }
45
+ focus() {
46
+ this._commentsElement.focus();
47
+ }
48
+ display() {
49
+ this._commentsElement = dom.append(this.container, dom.$('div.comments-container'));
50
+ this._commentsElement.setAttribute('role', 'presentation');
51
+ this._commentsElement.tabIndex = 0;
52
+ this._updateAriaLabel();
53
+ this._register(dom.addDisposableListener(this._commentsElement, dom.EventType.KEY_DOWN, (e) => {
54
+ const event = ( new StandardKeyboardEvent(e));
55
+ if ((event.equals(16 ) || event.equals(18 )) && (!this._focusedComment || !this._commentElements[this._focusedComment].isEditing)) {
56
+ const moveFocusWithinBounds = (change) => {
57
+ if (this._focusedComment === undefined && change >= 0) {
58
+ return 0;
59
+ }
60
+ if (this._focusedComment === undefined && change < 0) {
61
+ return this._commentElements.length - 1;
62
+ }
63
+ const newIndex = this._focusedComment + change;
64
+ return Math.min(Math.max(0, newIndex), this._commentElements.length - 1);
65
+ };
66
+ this._setFocusedComment(event.equals(16 ) ? moveFocusWithinBounds(-1) : moveFocusWithinBounds(1));
67
+ }
68
+ }));
69
+ this._commentElements = [];
70
+ if (this._commentThread.comments) {
71
+ for (const comment of this._commentThread.comments) {
72
+ const newCommentNode = this.createNewCommentNode(comment);
73
+ this._commentElements.push(newCommentNode);
74
+ this._commentsElement.appendChild(newCommentNode.domNode);
75
+ if (comment.mode === languages.CommentMode.Editing) {
76
+ newCommentNode.switchToEditMode();
77
+ }
78
+ }
79
+ }
80
+ this._resizeObserver = ( new MutationObserver(this._refresh.bind(this)));
81
+ this._resizeObserver.observe(this.container, {
82
+ attributes: true,
83
+ childList: true,
84
+ characterData: true,
85
+ subtree: true
86
+ });
87
+ }
88
+ _refresh() {
89
+ const dimensions = dom.getClientArea(this.container);
90
+ this._onDidResize.fire(dimensions);
91
+ }
92
+ getDimensions() {
93
+ return dom.getClientArea(this.container);
94
+ }
95
+ layout() {
96
+ this._commentElements.forEach(element => {
97
+ element.layout();
98
+ });
99
+ }
100
+ getPendingEdits() {
101
+ const pendingEdits = {};
102
+ this._commentElements.forEach(element => {
103
+ if (element.isEditing) {
104
+ const pendingEdit = element.getPendingEdit();
105
+ if (pendingEdit) {
106
+ pendingEdits[element.comment.uniqueIdInThread] = pendingEdit;
107
+ }
108
+ }
109
+ });
110
+ return pendingEdits;
111
+ }
112
+ getCommentCoords(commentUniqueId) {
113
+ const matchedNode = this._commentElements.filter(commentNode => commentNode.comment.uniqueIdInThread === commentUniqueId);
114
+ if (matchedNode && matchedNode.length) {
115
+ const commentThreadCoords = dom.getDomNodePagePosition(this._commentElements[0].domNode);
116
+ const commentCoords = dom.getDomNodePagePosition(matchedNode[0].domNode);
117
+ return {
118
+ thread: commentThreadCoords,
119
+ comment: commentCoords
120
+ };
121
+ }
122
+ return;
123
+ }
124
+ updateCommentThread(commentThread) {
125
+ const oldCommentsLen = this._commentElements.length;
126
+ const newCommentsLen = commentThread.comments ? commentThread.comments.length : 0;
127
+ const commentElementsToDel = [];
128
+ const commentElementsToDelIndex = [];
129
+ for (let i = 0; i < oldCommentsLen; i++) {
130
+ const comment = this._commentElements[i].comment;
131
+ const newComment = commentThread.comments ? commentThread.comments.filter(c => c.uniqueIdInThread === comment.uniqueIdInThread) : [];
132
+ if (newComment.length) {
133
+ this._commentElements[i].update(newComment[0]);
134
+ }
135
+ else {
136
+ commentElementsToDelIndex.push(i);
137
+ commentElementsToDel.push(this._commentElements[i]);
138
+ }
139
+ }
140
+ for (let i = commentElementsToDel.length - 1; i >= 0; i--) {
141
+ const commentToDelete = commentElementsToDel[i];
142
+ this._commentDisposable.get(commentToDelete)?.dispose();
143
+ this._commentDisposable.delete(commentToDelete);
144
+ this._commentElements.splice(commentElementsToDelIndex[i], 1);
145
+ this._commentsElement.removeChild(commentToDelete.domNode);
146
+ }
147
+ let lastCommentElement = null;
148
+ const newCommentNodeList = [];
149
+ const newCommentsInEditMode = [];
150
+ for (let i = newCommentsLen - 1; i >= 0; i--) {
151
+ const currentComment = commentThread.comments[i];
152
+ const oldCommentNode = this._commentElements.filter(commentNode => commentNode.comment.uniqueIdInThread === currentComment.uniqueIdInThread);
153
+ if (oldCommentNode.length) {
154
+ lastCommentElement = oldCommentNode[0].domNode;
155
+ newCommentNodeList.unshift(oldCommentNode[0]);
156
+ }
157
+ else {
158
+ const newElement = this.createNewCommentNode(currentComment);
159
+ newCommentNodeList.unshift(newElement);
160
+ if (lastCommentElement) {
161
+ this._commentsElement.insertBefore(newElement.domNode, lastCommentElement);
162
+ lastCommentElement = newElement.domNode;
163
+ }
164
+ else {
165
+ this._commentsElement.appendChild(newElement.domNode);
166
+ lastCommentElement = newElement.domNode;
167
+ }
168
+ if (currentComment.mode === languages.CommentMode.Editing) {
169
+ newElement.switchToEditMode();
170
+ newCommentsInEditMode.push(newElement);
171
+ }
172
+ }
173
+ }
174
+ this._commentThread = commentThread;
175
+ this._commentElements = newCommentNodeList;
176
+ if (newCommentsInEditMode.length) {
177
+ const lastIndex = this._commentElements.indexOf(newCommentsInEditMode[newCommentsInEditMode.length - 1]);
178
+ this._focusedComment = lastIndex;
179
+ }
180
+ this._updateAriaLabel();
181
+ this._setFocusedComment(this._focusedComment);
182
+ }
183
+ _updateAriaLabel() {
184
+ if (this._commentThread.isDocumentCommentThread()) {
185
+ if (this._commentThread.range) {
186
+ this._commentsElement.ariaLabel = ( nls.localizeWithPath(
187
+ 'vs/workbench/contrib/comments/browser/commentThreadBody',
188
+ 'commentThreadAria.withRange',
189
+ "Comment thread with {0} comments on lines {1} through {2}. {3}.",
190
+ this._commentThread.comments?.length,
191
+ this._commentThread.range.startLineNumber,
192
+ this._commentThread.range.endLineNumber,
193
+ this._commentThread.label
194
+ ));
195
+ }
196
+ else {
197
+ this._commentsElement.ariaLabel = ( nls.localizeWithPath(
198
+ 'vs/workbench/contrib/comments/browser/commentThreadBody',
199
+ 'commentThreadAria.document',
200
+ "Comment thread with {0} comments on the entire document. {1}.",
201
+ this._commentThread.comments?.length,
202
+ this._commentThread.label
203
+ ));
204
+ }
205
+ }
206
+ else {
207
+ this._commentsElement.ariaLabel = ( nls.localizeWithPath(
208
+ 'vs/workbench/contrib/comments/browser/commentThreadBody',
209
+ 'commentThreadAria',
210
+ "Comment thread with {0} comments. {1}.",
211
+ this._commentThread.comments?.length,
212
+ this._commentThread.label
213
+ ));
214
+ }
215
+ }
216
+ _setFocusedComment(value) {
217
+ if (this._focusedComment !== undefined) {
218
+ this._commentElements[this._focusedComment]?.setFocus(false);
219
+ }
220
+ if (this._commentElements.length === 0 || value === undefined) {
221
+ this._focusedComment = undefined;
222
+ }
223
+ else {
224
+ this._focusedComment = Math.min(value, this._commentElements.length - 1);
225
+ this._commentElements[this._focusedComment].setFocus(true);
226
+ }
227
+ }
228
+ createNewCommentNode(comment) {
229
+ const newCommentNode = this._scopedInstatiationService.createInstance(CommentNode, this._parentEditor, this._commentThread, comment, this._pendingEdits ? this._pendingEdits[comment.uniqueIdInThread] : undefined, this.owner, this.parentResourceUri, this._parentCommentThreadWidget, this._markdownRenderer);
230
+ this._register(newCommentNode);
231
+ this._commentDisposable.set(newCommentNode, newCommentNode.onDidClick(clickedNode => this._setFocusedComment(this._commentElements.findIndex(commentNode => commentNode.comment.uniqueIdInThread === clickedNode.comment.uniqueIdInThread))));
232
+ return newCommentNode;
233
+ }
234
+ dispose() {
235
+ super.dispose();
236
+ if (this._resizeObserver) {
237
+ this._resizeObserver.disconnect();
238
+ this._resizeObserver = null;
239
+ }
240
+ this._commentDisposable.forEach(v => v.dispose());
241
+ }
242
+ };
243
+ CommentThreadBody = ( __decorate([
244
+ ( __param(9, ICommentService)),
245
+ ( __param(10, IOpenerService)),
246
+ ( __param(11, ILanguageService))
247
+ ], CommentThreadBody));
248
+
249
+ export { CommentThreadBody };