@codingame/monaco-vscode-api 1.82.6 → 1.83.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (199) hide show
  1. package/api.js +5 -5
  2. package/assets/index-no-csp.html +2 -1
  3. package/assets/index.html +3 -2
  4. package/extensions.js +17 -14
  5. package/external/xterm/typings/xterm.d.ts +171 -109
  6. package/missing-services.js +33 -22
  7. package/monaco-editor-treemending.patch +1371 -1254
  8. package/monaco-treemending.js +2 -2
  9. package/monaco.js +2 -2
  10. package/package.json +2 -2
  11. package/service-override/extensions.js +10 -11
  12. package/services.d.ts +1 -1
  13. package/vscode/src/vs/base/browser/ui/menu/menubar.js +1 -1
  14. package/vscode/src/vs/base/common/event.d.ts +13 -17
  15. package/vscode/src/vs/base/common/keyCodes.d.ts +18 -18
  16. package/vscode/src/vs/base/common/lifecycle.d.ts +9 -0
  17. package/vscode/src/vs/base/common/observableInternal/base.d.ts +2 -0
  18. package/vscode/src/vs/base/common/product.d.ts +1 -0
  19. package/vscode/src/vs/base/parts/ipc/common/ipc.js +6 -2
  20. package/vscode/src/vs/base/parts/storage/common/storage.d.ts +1 -0
  21. package/vscode/src/vs/editor/common/config/editorOptions.d.ts +12 -3
  22. package/vscode/src/vs/editor/common/core/lineRange.d.ts +0 -5
  23. package/vscode/src/vs/editor/common/core/offsetRange.d.ts +9 -2
  24. package/vscode/src/vs/editor/common/diff/documentDiffProvider.d.ts +6 -20
  25. package/vscode/src/vs/editor/common/diff/legacyLinesDiffComputer.d.ts +2 -2
  26. package/vscode/src/vs/editor/common/diff/linesDiffComputer.d.ts +5 -55
  27. package/vscode/src/vs/editor/common/diff/rangeMapping.d.ts +55 -0
  28. package/vscode/src/vs/editor/common/languages.d.ts +7 -10
  29. package/vscode/src/vs/editor/common/model.d.ts +1 -1
  30. package/vscode/src/vs/platform/actions/common/actions.d.ts +1 -0
  31. package/vscode/src/vs/platform/extensionManagement/common/extensionNls.js +5 -5
  32. package/vscode/src/vs/platform/files/common/fileService.js +46 -40
  33. package/vscode/src/vs/platform/files/common/files.d.ts +46 -1
  34. package/vscode/src/vs/platform/files/common/inMemoryFilesystemProvider.js +45 -0
  35. package/vscode/src/vs/platform/storage/common/storage.d.ts +5 -0
  36. package/vscode/src/vs/platform/storage/common/storage.js +4 -0
  37. package/vscode/src/vs/platform/telemetry/common/telemetryUtils.js +4 -1
  38. package/vscode/src/vs/platform/terminal/common/terminal.js +1 -3
  39. package/vscode/src/vs/platform/tunnel/common/tunnel.d.ts +1 -1
  40. package/vscode/src/vs/platform/userDataProfile/common/userDataProfile.d.ts +1 -0
  41. package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +11 -0
  42. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents.js +50 -0
  43. package/vscode/src/vs/workbench/api/browser/mainThreadChatSlashCommands.js +3 -2
  44. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +16 -11
  45. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +20 -6
  46. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +2 -2
  47. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +1 -1
  48. package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +8 -8
  49. package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +3 -2
  50. package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +93 -0
  51. package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +3 -166
  52. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +3 -0
  53. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +18 -11
  54. package/vscode/src/vs/workbench/api/common/extHost.api.impl.js +14 -9
  55. package/vscode/src/vs/workbench/api/common/extHost.protocol.js +2 -1
  56. package/vscode/src/vs/workbench/api/common/extHostApiCommands.js +11 -2
  57. package/vscode/src/vs/workbench/api/common/extHostChat.js +10 -1
  58. package/vscode/src/vs/workbench/api/common/extHostChatAgents.js +62 -0
  59. package/vscode/src/vs/workbench/api/common/extHostChatSlashCommand.js +13 -4
  60. package/vscode/src/vs/workbench/api/common/extHostCommands.js +4 -4
  61. package/vscode/src/vs/workbench/api/common/extHostComments.js +1 -1
  62. package/vscode/src/vs/workbench/api/common/extHostExtensionService.js +36 -4
  63. package/vscode/src/vs/workbench/api/common/extHostInlineChat.js +6 -29
  64. package/vscode/src/vs/workbench/api/common/extHostLanguageFeatures.js +24 -12
  65. package/vscode/src/vs/workbench/api/common/extHostNotebookKernels.js +0 -2
  66. package/vscode/src/vs/workbench/api/common/extHostRequireInterceptor.js +0 -63
  67. package/vscode/src/vs/workbench/api/common/extHostSCM.js +80 -0
  68. package/vscode/src/vs/workbench/api/common/extHostTerminalService.js +24 -0
  69. package/vscode/src/vs/workbench/api/common/extHostTesting.js +14 -10
  70. package/vscode/src/vs/workbench/api/common/extHostTextEditor.js +4 -4
  71. package/vscode/src/vs/workbench/api/common/extHostTreeViews.js +11 -7
  72. package/vscode/src/vs/workbench/api/common/extHostTypeConverters.js +34 -16
  73. package/vscode/src/vs/workbench/api/common/extHostTypes.js +31 -13
  74. package/vscode/src/vs/workbench/api/common/extHostWebview.js +14 -2
  75. package/vscode/src/vs/workbench/api/common/extHostWebviewPanels.js +11 -5
  76. package/vscode/src/vs/workbench/api/common/extensionHostMain.js +1 -1
  77. package/vscode/src/vs/workbench/browser/actions/layoutActions.js +32 -9
  78. package/vscode/src/vs/workbench/browser/actions/quickAccessActions.js +3 -1
  79. package/vscode/src/vs/workbench/browser/codeeditor.js +1 -1
  80. package/vscode/src/vs/workbench/browser/dnd.js +7 -6
  81. package/vscode/src/vs/workbench/browser/media/part.css.js +1 -1
  82. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +7 -10
  83. package/vscode/src/vs/workbench/browser/parts/editor/editor.js +7 -1
  84. package/vscode/src/vs/workbench/browser/parts/editor/editorActions.js +9 -3
  85. package/vscode/src/vs/workbench/browser/parts/editor/editorAutoSave.js +1 -1
  86. package/vscode/src/vs/workbench/browser/parts/editor/editorCommands.js +9 -2
  87. package/vscode/src/vs/workbench/browser/parts/editor/editorStatus.js +44 -14
  88. package/vscode/src/vs/workbench/browser/parts/editor/media/editorplaceholder.css.js +1 -1
  89. package/vscode/src/vs/workbench/browser/parts/editor/textDiffEditor.js +3 -19
  90. package/vscode/src/vs/workbench/browser/parts/editor/textResourceEditor.js +1 -1
  91. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCommands.js +9 -3
  92. package/vscode/src/vs/workbench/browser/parts/statusbar/statusbarPart.d.ts +1 -1
  93. package/vscode/src/vs/workbench/browser/parts/titlebar/menubarControl.js +10 -9
  94. package/vscode/src/vs/workbench/browser/parts/views/viewFilter.js +2 -0
  95. package/vscode/src/vs/workbench/browser/parts/views/viewPane.js +2 -2
  96. package/vscode/src/vs/workbench/browser/parts/views/viewPaneContainer.js +6 -5
  97. package/vscode/src/vs/workbench/browser/web.api.d.ts +0 -6
  98. package/vscode/src/vs/workbench/browser/workbench.contribution.js +34 -3
  99. package/vscode/src/vs/workbench/common/contextkeys.js +2 -1
  100. package/vscode/src/vs/workbench/common/editor/editorGroupModel.js +4 -4
  101. package/vscode/src/vs/workbench/common/editor/editorInput.d.ts +0 -1
  102. package/vscode/src/vs/workbench/common/editor/editorInput.js +2 -4
  103. package/vscode/src/vs/workbench/common/editor/editorModel.d.ts +0 -1
  104. package/vscode/src/vs/workbench/common/editor/editorModel.js +1 -3
  105. package/vscode/src/vs/workbench/common/editor.d.ts +2 -0
  106. package/vscode/src/vs/workbench/common/theme.js +21 -1
  107. package/vscode/src/vs/workbench/common/views.d.ts +1 -1
  108. package/vscode/src/vs/workbench/common/views.js +1 -2
  109. package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration.js +12 -4
  110. package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibilityContributions.js +335 -0
  111. package/vscode/src/vs/workbench/contrib/accessibility/browser/accessibleView.js +81 -27
  112. package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkEditService.js +1 -1
  113. package/vscode/src/vs/workbench/contrib/bulkEdit/browser/bulkTextEdits.js +22 -14
  114. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatActions.js +2 -0
  115. package/vscode/src/vs/workbench/contrib/chat/common/chatAgents.js +136 -0
  116. package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +14 -3
  117. package/vscode/src/vs/workbench/contrib/chat/common/chatSlashCommands.js +78 -1
  118. package/vscode/src/vs/workbench/contrib/codeActions/browser/codeActionsContribution.js +43 -17
  119. package/vscode/src/vs/workbench/contrib/codeEditor/browser/diffEditorHelper.js +30 -26
  120. package/vscode/src/vs/workbench/contrib/codeEditor/browser/largeFileOptimizations.js +1 -1
  121. package/vscode/src/vs/workbench/contrib/codeEditor/browser/saveParticipants.js +23 -18
  122. package/vscode/src/vs/workbench/contrib/codeEditor/browser/toggleWordWrap.js +8 -8
  123. package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +55 -20
  124. package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +26 -10
  125. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +7 -6
  126. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +58 -9
  127. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +9 -6
  128. package/vscode/src/vs/workbench/contrib/comments/browser/comments.contribution.js +171 -0
  129. package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +204 -33
  130. package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +3 -7
  131. package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +2 -2
  132. package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +1 -1
  133. package/vscode/src/vs/workbench/contrib/comments/browser/simpleCommentEditor.js +21 -4
  134. package/vscode/src/vs/workbench/contrib/comments/common/commentContextKeys.js +22 -0
  135. package/vscode/src/vs/workbench/contrib/debug/common/debug.d.ts +5 -2
  136. package/vscode/src/vs/workbench/contrib/debug/common/debugUtils.js +2 -1
  137. package/vscode/src/vs/workbench/contrib/files/browser/explorerViewlet.js +1 -1
  138. package/vscode/src/vs/workbench/contrib/files/browser/fileImportExport.js +2 -2
  139. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +4 -4
  140. package/vscode/src/vs/workbench/contrib/files/browser/views/emptyView.js +1 -1
  141. package/vscode/src/vs/workbench/contrib/files/browser/views/explorerViewer.js +7 -4
  142. package/vscode/src/vs/workbench/contrib/files/browser/views/openEditorsView.js +2 -1
  143. package/vscode/src/vs/workbench/contrib/files/common/files.js +7 -5
  144. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +2 -2
  145. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +2 -2
  146. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +2 -1
  147. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +17 -17
  148. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +2 -2
  149. package/vscode/src/vs/workbench/contrib/notebook/common/notebookCommon.js +4 -1
  150. package/vscode/src/vs/workbench/contrib/output/browser/output.contribution.js +22 -19
  151. package/vscode/src/vs/workbench/contrib/output/browser/outputServices.js +2 -38
  152. package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +14 -1
  153. package/vscode/src/vs/workbench/contrib/quickaccess/browser/commandsQuickAccess.js +3 -8
  154. package/vscode/src/vs/workbench/contrib/scm/browser/dirtydiffDecorator.js +10 -12
  155. package/vscode/src/vs/workbench/contrib/snippets/browser/tabCompletion.js +2 -2
  156. package/vscode/src/vs/workbench/contrib/terminal/browser/xterm/xtermTerminal.d.ts +2 -2
  157. package/vscode/src/vs/workbench/contrib/terminal/common/terminalContextKey.js +0 -16
  158. package/vscode/src/vs/workbench/contrib/testing/common/observableValue.js +2 -1
  159. package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +8 -6
  160. package/vscode/src/vs/workbench/services/actions/common/menusExtensionPoint.js +2 -4
  161. package/vscode/src/vs/workbench/services/authentication/browser/authenticationService.js +2 -4
  162. package/vscode/src/vs/workbench/services/decorations/browser/decorationsService.js +7 -3
  163. package/vscode/src/vs/workbench/services/editor/common/editorGroupsService.d.ts +2 -6
  164. package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +18 -20
  165. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +9 -13
  166. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.d.ts +2 -1
  167. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +47 -15
  168. package/vscode/src/vs/workbench/services/extensions/common/extensionDescriptionRegistry.d.ts +14 -4
  169. package/vscode/src/vs/workbench/services/extensions/common/extensionDescriptionRegistry.js +22 -3
  170. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.d.ts +1 -1
  171. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +15 -14
  172. package/vscode/src/vs/workbench/services/extensions/common/extensionHostProtocol.d.ts +12 -7
  173. package/vscode/src/vs/workbench/services/extensions/common/extensions.d.ts +10 -6
  174. package/vscode/src/vs/workbench/services/extensions/common/extensions.js +27 -11
  175. package/vscode/src/vs/workbench/services/extensions/common/extensionsApiProposals.js +2 -5
  176. package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +7 -11
  177. package/vscode/src/vs/workbench/services/extensions/common/rpcProtocol.js +20 -4
  178. package/vscode/src/vs/workbench/services/keybinding/browser/keybindingService.js +24 -16
  179. package/vscode/src/vs/workbench/services/output/common/output.js +1 -2
  180. package/vscode/src/vs/workbench/services/preferences/common/preferences.d.ts +6 -6
  181. package/vscode/src/vs/workbench/services/preferences/common/preferences.js +4 -3
  182. package/vscode/src/vs/workbench/services/preferences/common/preferencesModels.d.ts +0 -1
  183. package/vscode/src/vs/workbench/services/search/common/fileSearchManager.js +3 -1
  184. package/vscode/src/vs/workbench/services/search/common/search.js +2 -1
  185. package/vscode/src/vs/workbench/services/search/common/textSearchManager.js +1 -2
  186. package/vscode/src/vs/workbench/services/textfile/common/textFileEditorModel.js +2 -2
  187. package/vscode/src/vs/workbench/services/userDataProfile/common/userDataProfileService.js +3 -8
  188. package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +3 -4
  189. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopySaveParticipant.js +1 -0
  190. package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyBackupService.js +2 -1
  191. package/vscode/src/vs/workbench/services/workingCopy/common/workingCopyService.js +4 -2
  192. package/vscode/src/vs/editor/browser/widget/diffEditorWidget2/diffEditorWidget2.contribution.js +0 -180
  193. package/vscode/src/vs/platform/credentials/common/credentials.d.ts +0 -13
  194. package/vscode/src/vs/platform/credentials/common/credentials.js +0 -3
  195. package/vscode/src/vs/workbench/api/browser/mainThreadKeytar.js +0 -31
  196. package/vscode/src/vs/workbench/browser/iframe.js +0 -16
  197. package/vscode/src/vs/workbench/browser/parts/editor/accessibilityStatus.js +0 -90
  198. package/vscode/src/vs/workbench/browser/parts/editor/tabFocus.js +0 -77
  199. package/vscode/src/vs/workbench/contrib/output/browser/logViewer.js +0 -67
@@ -0,0 +1,171 @@
1
+ import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
+ import * as nls from 'monaco-editor/esm/vs/nls.js';
3
+ import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
4
+ import { Extensions } from 'monaco-editor/esm/vs/platform/configuration/common/configurationRegistry.js';
5
+ import { ctxCommentEditorFocused } from './simpleCommentEditor.js';
6
+ import * as strings from 'monaco-editor/esm/vs/base/common/strings.js';
7
+ import { IAccessibleViewService } from '../../accessibility/browser/accessibleView.js';
8
+ import { AccessibilityHelpAction } from '../../accessibility/browser/accessibleViewActions.js';
9
+ import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
10
+ import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
11
+ import { Disposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
12
+ import { ContextKeyExpr } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
13
+ import { CommentContextKeys } from '../common/commentContextKeys.js';
14
+ import { ToggleTabFocusModeAction } from 'monaco-editor/esm/vs/editor/contrib/toggleTabFocusMode/browser/toggleTabFocusMode.js';
15
+ ( Registry.as(Extensions.Configuration)).registerConfiguration({
16
+ id: 'comments',
17
+ order: 20,
18
+ title: ( nls.localize('commentsConfigurationTitle', "Comments")),
19
+ type: 'object',
20
+ properties: {
21
+ 'comments.openPanel': {
22
+ enum: ['neverOpen', 'openOnSessionStart', 'openOnSessionStartWithComments'],
23
+ default: 'openOnSessionStartWithComments',
24
+ description: ( nls.localize('openComments', "Controls when the comments panel should open.")),
25
+ restricted: false,
26
+ markdownDeprecationMessage: ( nls.localize(
27
+ 'comments.openPanel.deprecated',
28
+ "This setting is deprecated in favor of `comments.openView`."
29
+ ))
30
+ },
31
+ 'comments.openView': {
32
+ enum: ['never', 'file', 'firstFile', 'firstFileUnresolved'],
33
+ enumDescriptions: [( nls.localize('comments.openView.never', "The comments view will never be opened.")), ( nls.localize(
34
+ 'comments.openView.file',
35
+ "The comments view will open when a file with comments is active."
36
+ )), ( nls.localize(
37
+ 'comments.openView.firstFile',
38
+ "If the comments view has not been opened yet during this session it will open the first time during a session that a file with comments is active."
39
+ )), ( nls.localize(
40
+ 'comments.openView.firstFileUnresolved',
41
+ "If the comments view has not been opened yet during this session and the comment is not resolved, it will open the first time during a session that a file with comments is active."
42
+ ))],
43
+ default: 'firstFile',
44
+ description: ( nls.localize('comments.openView', "Controls when the comments view should open.")),
45
+ restricted: false
46
+ },
47
+ 'comments.useRelativeTime': {
48
+ type: 'boolean',
49
+ default: true,
50
+ description: ( nls.localize(
51
+ 'useRelativeTime',
52
+ "Determines if relative time will be used in comment timestamps (ex. '1 day ago')."
53
+ ))
54
+ },
55
+ 'comments.visible': {
56
+ type: 'boolean',
57
+ default: true,
58
+ description: ( nls.localize(
59
+ 'comments.visible',
60
+ "Controls the visibility of the comments bar and comment threads in editors that have commenting ranges and comments. Comments are still accessible via the Comments view and will cause commenting to be toggled on in the same way running the command \"Comments: Toggle Editor Commenting\" toggles comments."
61
+ ))
62
+ },
63
+ 'comments.maxHeight': {
64
+ type: 'boolean',
65
+ default: true,
66
+ description: ( nls.localize(
67
+ 'comments.maxHeight',
68
+ "Controls whether the comments widget scrolls or expands."
69
+ ))
70
+ },
71
+ 'comments.collapseOnResolve': {
72
+ type: 'boolean',
73
+ default: true,
74
+ description: ( nls.localize(
75
+ 'collapseOnResolve',
76
+ "Controls whether the comment thread should collapse when the thread is resolved."
77
+ ))
78
+ }
79
+ }
80
+ });
81
+ var CommentAccessibilityHelpNLS;
82
+ ( (function(CommentAccessibilityHelpNLS) {
83
+ CommentAccessibilityHelpNLS.intro = ( nls.localize(
84
+ 'intro',
85
+ "The editor contains commentable range(s). Some useful commands include:"
86
+ ));
87
+ CommentAccessibilityHelpNLS.introWidget = ( nls.localize(
88
+ 'introWidget',
89
+ "This widget contains a text area, for composition of new comments, and actions, that can be tabbed to once tab moves focus mode has been enabled ({0})."
90
+ ));
91
+ CommentAccessibilityHelpNLS.introWidgetNoKb = ( nls.localize(
92
+ 'introWidgetNoKb',
93
+ "This widget contains a text area, for composition of new comments, and actions, that can be tabbed to once tab moves focus mode has been enabled with the command Toggle Tab Key Moves Focus, which is currently not triggerable via keybinding."
94
+ ));
95
+ CommentAccessibilityHelpNLS.commentCommands = ( nls.localize('commentCommands', "Some useful comment commands include:"));
96
+ CommentAccessibilityHelpNLS.escape = ( nls.localize('escape', "- Dismiss Comment (Escape)"));
97
+ CommentAccessibilityHelpNLS.nextRange = ( nls.localize('next', "- Go to Next Commenting Range ({0})"));
98
+ CommentAccessibilityHelpNLS.nextRangeNoKb = ( nls.localize(
99
+ 'nextNoKb',
100
+ "- Go to Next Commenting Range, which is currently not triggerable via keybinding."
101
+ ));
102
+ CommentAccessibilityHelpNLS.previousRange = ( nls.localize('previous', "- Go to Previous Commenting Range ({0})"));
103
+ CommentAccessibilityHelpNLS.previousRangeNoKb = ( nls.localize(
104
+ 'previousNoKb',
105
+ "- Go to Previous Commenting Range, which is currently not triggerable via keybinding."
106
+ ));
107
+ CommentAccessibilityHelpNLS.nextCommentThreadKb = ( nls.localize('nextCommentThreadKb', "- Go to Next Comment Thread ({0})"));
108
+ CommentAccessibilityHelpNLS.nextCommentThreadNoKb = ( nls.localize(
109
+ 'nextCommentThreadNoKb',
110
+ "- Go to Next Comment Thread, which is currently not triggerable via keybinding."
111
+ ));
112
+ CommentAccessibilityHelpNLS.previousCommentThreadKb = ( nls.localize('previousCommentThreadKb', "- Go to Previous Comment Thread ({0})"));
113
+ CommentAccessibilityHelpNLS.previousCommentThreadNoKb = ( nls.localize(
114
+ 'previousCommentThreadNoKb',
115
+ "- Go to Previous Comment Thread, which is currently not triggerable via keybinding."
116
+ ));
117
+ CommentAccessibilityHelpNLS.addComment = ( nls.localize('addComment', "- Add Comment ({0})"));
118
+ CommentAccessibilityHelpNLS.addCommentNoKb = ( nls.localize(
119
+ 'addCommentNoKb',
120
+ "- Add Comment on Current Selection, which is currently not triggerable via keybinding."
121
+ ));
122
+ CommentAccessibilityHelpNLS.submitComment = ( nls.localize('submitComment', "- Submit Comment ({0})"));
123
+ CommentAccessibilityHelpNLS.submitCommentNoKb = ( nls.localize(
124
+ 'submitCommentNoKb',
125
+ "- Submit Comment, accessible via tabbing, as it's currently not triggerable with a keybinding."
126
+ ));
127
+ })(CommentAccessibilityHelpNLS || (CommentAccessibilityHelpNLS = {})));
128
+ class CommentsAccessibilityHelpContribution extends Disposable {
129
+ constructor() {
130
+ super();
131
+ this._register(AccessibilityHelpAction.addImplementation(110, 'comments', accessor => {
132
+ const instantiationService = accessor.get(IInstantiationService);
133
+ const accessibleViewService = accessor.get(IAccessibleViewService);
134
+ accessibleViewService.show(instantiationService.createInstance(CommentsAccessibilityHelpProvider));
135
+ return true;
136
+ }, ( ContextKeyExpr.or(ctxCommentEditorFocused, CommentContextKeys.commentFocused))));
137
+ }
138
+ }
139
+ let CommentsAccessibilityHelpProvider = class CommentsAccessibilityHelpProvider {
140
+ constructor(_keybindingService) {
141
+ this._keybindingService = _keybindingService;
142
+ this.verbositySettingKey = "accessibility.verbosity.comments" ;
143
+ this.options = { type: "help" };
144
+ }
145
+ _descriptionForCommand(commandId, msg, noKbMsg) {
146
+ const kb = this._keybindingService.lookupKeybinding(commandId);
147
+ if (kb) {
148
+ return strings.format(msg, kb.getAriaLabel());
149
+ }
150
+ return strings.format(noKbMsg, commandId);
151
+ }
152
+ provideContent() {
153
+ this._element = document.activeElement;
154
+ const content = [];
155
+ content.push(this._descriptionForCommand(ToggleTabFocusModeAction.ID, CommentAccessibilityHelpNLS.introWidget, CommentAccessibilityHelpNLS.introWidgetNoKb) + '\n');
156
+ content.push(CommentAccessibilityHelpNLS.commentCommands);
157
+ content.push(CommentAccessibilityHelpNLS.escape);
158
+ content.push(this._descriptionForCommand("workbench.action.addComment" , CommentAccessibilityHelpNLS.addComment, CommentAccessibilityHelpNLS.addCommentNoKb));
159
+ content.push(this._descriptionForCommand("editor.action.submitComment" , CommentAccessibilityHelpNLS.submitComment, CommentAccessibilityHelpNLS.submitCommentNoKb));
160
+ content.push(this._descriptionForCommand("editor.action.nextCommentingRange" , CommentAccessibilityHelpNLS.nextRange, CommentAccessibilityHelpNLS.nextRangeNoKb));
161
+ content.push(this._descriptionForCommand("editor.action.previousCommentingRange" , CommentAccessibilityHelpNLS.previousRange, CommentAccessibilityHelpNLS.previousRangeNoKb));
162
+ return content.join('\n');
163
+ }
164
+ onClose() {
165
+ this._element?.focus();
166
+ }
167
+ };
168
+ CommentsAccessibilityHelpProvider = ( __decorate([
169
+ ( __param(0, IKeybindingService))
170
+ ], CommentsAccessibilityHelpProvider));
171
+ export { CommentAccessibilityHelpNLS, CommentsAccessibilityHelpContribution, CommentsAccessibilityHelpProvider };
@@ -1,6 +1,7 @@
1
1
  import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
2
2
  import { Action } from 'monaco-editor/esm/vs/base/common/actions.js';
3
- import { coalesce, findFirstInSorted } from 'monaco-editor/esm/vs/base/common/arrays.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';
4
5
  import { createCancelablePromise, Delayer } from 'monaco-editor/esm/vs/base/common/async.js';
5
6
  import { onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
6
7
  import { DisposableStore, dispose } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
@@ -25,8 +26,12 @@ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configurati
25
26
  import { COMMENTS_SECTION } from '../common/commentsConfiguration.js';
26
27
  import { COMMENTEDITOR_DECORATION_KEY } from './commentReply.js';
27
28
  import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
28
- import { IContextKeyService, RawContextKey } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
29
+ import { IContextKeyService } from 'monaco-editor/esm/vs/platform/contextkey/common/contextkey.js';
29
30
  import { CommentThreadRangeDecorator } from './commentThreadRangeDecorator.js';
31
+ import { status } from 'monaco-editor/esm/vs/base/browser/ui/aria/aria.js';
32
+ import { CommentContextKeys } from '../common/commentContextKeys.js';
33
+ import { IKeybindingService } from 'monaco-editor/esm/vs/platform/keybinding/common/keybinding.js';
34
+ import { IAccessibilityService } from 'monaco-editor/esm/vs/platform/accessibility/common/accessibility.js';
30
35
  const ID = 'editor.contrib.review';
31
36
  class CommentingRangeDecoration {
32
37
  get id() {
@@ -278,6 +283,15 @@ class CommentingRangeDecorator {
278
283
  this._onDidChangeDecorationsCount.fire(this.commentingRangeDecorations.length);
279
284
  }
280
285
  }
286
+ areRangesIntersectingOrTouchingByLine(a, b) {
287
+ if (a.endLineNumber < (b.startLineNumber - 1)) {
288
+ return false;
289
+ }
290
+ if ((b.endLineNumber + 1) < a.startLineNumber) {
291
+ return false;
292
+ }
293
+ return true;
294
+ }
281
295
  getMatchedCommentAction(commentRange) {
282
296
  if (commentRange === undefined) {
283
297
  const foundInfos = this._infos?.filter(info => info.commentingRanges.fileComments);
@@ -296,7 +310,7 @@ class CommentingRangeDecorator {
296
310
  const foundHoverActions = ( new Map());
297
311
  for (const decoration of this.commentingRangeDecorations) {
298
312
  const range = decoration.getActiveRange();
299
- if (range && ((range.startLineNumber <= commentRange.startLineNumber) || (commentRange.endLineNumber <= range.endLineNumber))) {
313
+ if (range && this.areRangesIntersectingOrTouchingByLine(range, commentRange)) {
300
314
  const action = decoration.getCommentAction();
301
315
  const alreadyFoundInfo = foundHoverActions.get(action.ownerId);
302
316
  if (alreadyFoundInfo?.action.commentingRangesInfo === action.commentingRangesInfo) {
@@ -317,19 +331,52 @@ class CommentingRangeDecorator {
317
331
  return (action.range.startLineNumber <= commentRange.startLineNumber) && (commentRange.endLineNumber <= action.range.endLineNumber);
318
332
  }).map(actions => actions.action));
319
333
  }
334
+ getNearestCommentingRange(findPosition, reverse) {
335
+ let findPositionContainedWithin;
336
+ let decorations;
337
+ if (reverse) {
338
+ decorations = [];
339
+ for (let i = this.commentingRangeDecorations.length - 1; i >= 0; i--) {
340
+ decorations.push(this.commentingRangeDecorations[i]);
341
+ }
342
+ }
343
+ else {
344
+ decorations = this.commentingRangeDecorations;
345
+ }
346
+ for (const decoration of decorations) {
347
+ const range = decoration.getActiveRange();
348
+ if (!range) {
349
+ continue;
350
+ }
351
+ if (findPositionContainedWithin && this.areRangesIntersectingOrTouchingByLine(range, findPositionContainedWithin)) {
352
+ findPositionContainedWithin = Range.plusRange(findPositionContainedWithin, range);
353
+ continue;
354
+ }
355
+ if (range.startLineNumber <= findPosition.lineNumber && findPosition.lineNumber <= range.endLineNumber) {
356
+ findPositionContainedWithin = ( new Range(
357
+ range.startLineNumber,
358
+ range.startColumn,
359
+ range.endLineNumber,
360
+ range.endColumn
361
+ ));
362
+ continue;
363
+ }
364
+ if (!reverse && range.endLineNumber < findPosition.lineNumber) {
365
+ continue;
366
+ }
367
+ if (reverse && range.startLineNumber > findPosition.lineNumber) {
368
+ continue;
369
+ }
370
+ return range;
371
+ }
372
+ return (decorations.length > 0 ? (decorations[0].getActiveRange() ?? undefined) : undefined);
373
+ }
320
374
  dispose() {
321
375
  this.commentingRangeDecorations = [];
322
376
  }
323
377
  }
324
- const ActiveCursorHasCommentingRange = ( new RawContextKey('activeCursorHasCommentingRange', false, {
325
- description: ( nls.localize(
326
- 'hasCommentingRange',
327
- "Whether the position at the active cursor has a commenting range"
328
- )),
329
- type: 'boolean'
330
- }));
331
378
  let CommentController = class CommentController {
332
- constructor(editor, commentService, instantiationService, codeEditorService, contextMenuService, quickInputService, viewsService, configurationService, contextKeyService, editorService) {
379
+ constructor(editor, commentService, instantiationService, codeEditorService, contextMenuService, quickInputService, viewsService, configurationService, contextKeyService, editorService, keybindingService, accessibilityService) {
333
380
  this.commentService = commentService;
334
381
  this.instantiationService = instantiationService;
335
382
  this.codeEditorService = codeEditorService;
@@ -338,18 +385,22 @@ let CommentController = class CommentController {
338
385
  this.viewsService = viewsService;
339
386
  this.configurationService = configurationService;
340
387
  this.editorService = editorService;
388
+ this.keybindingService = keybindingService;
389
+ this.accessibilityService = accessibilityService;
341
390
  this.globalToDispose = ( new DisposableStore());
342
391
  this.localToDispose = ( new DisposableStore());
343
392
  this.mouseDownInfo = null;
344
393
  this._commentingRangeSpaceReserved = false;
345
394
  this._emptyThreadsToAddQueue = [];
346
395
  this._editorDisposables = [];
396
+ this._hasRespondedToEditorChange = false;
347
397
  this._commentInfos = [];
348
398
  this._commentWidgets = [];
349
399
  this._pendingNewCommentCache = {};
350
400
  this._pendingEditsCache = {};
351
401
  this._computePromise = null;
352
- this._activeCursorHasCommentingRange = ActiveCursorHasCommentingRange.bindTo(contextKeyService);
402
+ this._activeCursorHasCommentingRange = CommentContextKeys.activeCursorHasCommentingRange.bindTo(contextKeyService);
403
+ this._activeEditorHasCommentingRange = CommentContextKeys.activeEditorHasCommentingRange.bindTo(contextKeyService);
353
404
  if (editor instanceof EmbeddedCodeEditorWidget) {
354
405
  return;
355
406
  }
@@ -375,8 +426,8 @@ let CommentController = class CommentController {
375
426
  }
376
427
  this.beginCompute();
377
428
  }));
378
- this.globalToDispose.add(this.commentService.onDidSetDataProvider(_ => this.beginCompute()));
379
- this.globalToDispose.add(this.commentService.onDidUpdateCommentingRanges(_ => this.beginCompute()));
429
+ this.globalToDispose.add(this.commentService.onDidSetDataProvider(_ => this.beginComputeAndHandleEditorChange()));
430
+ this.globalToDispose.add(this.commentService.onDidUpdateCommentingRanges(_ => this.beginComputeAndHandleEditorChange()));
380
431
  this.globalToDispose.add(this.commentService.onDidSetResourceCommentInfos(e => {
381
432
  const editorURI = this.editor && this.editor.hasModel() && this.editor.getModel().uri;
382
433
  if (editorURI && ( editorURI.toString()) === ( e.resource.toString())) {
@@ -405,7 +456,39 @@ let CommentController = class CommentController {
405
456
  }));
406
457
  this.onModelChanged();
407
458
  this.codeEditorService.registerDecorationType('comment-controller', COMMENTEDITOR_DECORATION_KEY, {});
408
- this.beginCompute();
459
+ this.commentService.registerContinueOnCommentProvider({
460
+ provideContinueOnComments: () => {
461
+ const pendingComments = [];
462
+ if (this._commentWidgets) {
463
+ for (const zone of this._commentWidgets) {
464
+ const zonePendingComments = zone.getPendingComments();
465
+ const pendingNewComment = zonePendingComments.newComment;
466
+ if (!pendingNewComment || !zone.commentThread.range) {
467
+ continue;
468
+ }
469
+ let lastCommentBody;
470
+ if (zone.commentThread.comments && zone.commentThread.comments.length) {
471
+ const lastComment = zone.commentThread.comments[zone.commentThread.comments.length - 1];
472
+ if (typeof lastComment.body === 'string') {
473
+ lastCommentBody = lastComment.body;
474
+ }
475
+ else {
476
+ lastCommentBody = lastComment.body.value;
477
+ }
478
+ }
479
+ if (pendingNewComment !== lastCommentBody) {
480
+ pendingComments.push({
481
+ owner: zone.owner,
482
+ uri: zone.editor.getModel().uri,
483
+ range: zone.commentThread.range,
484
+ body: pendingNewComment
485
+ });
486
+ }
487
+ }
488
+ }
489
+ return pendingComments;
490
+ }
491
+ });
409
492
  }
410
493
  registerEditorListeners() {
411
494
  this._editorDisposables = [];
@@ -505,20 +588,20 @@ let CommentController = class CommentController {
505
588
  static get(editor) {
506
589
  return editor.getContribution(ID);
507
590
  }
508
- revealCommentThread(threadId, commentUniqueId, fetchOnceIfNotExist) {
591
+ revealCommentThread(threadId, commentUniqueId, fetchOnceIfNotExist, focus) {
509
592
  const commentThreadWidget = this._commentWidgets.filter(widget => widget.commentThread.threadId === threadId);
510
593
  if (commentThreadWidget.length === 1) {
511
- commentThreadWidget[0].reveal(commentUniqueId);
594
+ commentThreadWidget[0].reveal(commentUniqueId, focus);
512
595
  }
513
596
  else if (fetchOnceIfNotExist) {
514
597
  if (this._computePromise) {
515
598
  this._computePromise.then(_ => {
516
- this.revealCommentThread(threadId, commentUniqueId, false);
599
+ this.revealCommentThread(threadId, commentUniqueId, false, focus);
517
600
  });
518
601
  }
519
602
  else {
520
603
  this.beginCompute().then(_ => {
521
- this.revealCommentThread(threadId, commentUniqueId, false);
604
+ this.revealCommentThread(threadId, commentUniqueId, false, focus);
522
605
  });
523
606
  }
524
607
  }
@@ -574,7 +657,7 @@ let CommentController = class CommentController {
574
657
  }
575
658
  return 0;
576
659
  });
577
- const idx = findFirstInSorted(sortedWidgets, widget => {
660
+ const idx = findFirstIdxMonotonousOrArrLen(sortedWidgets, widget => {
578
661
  const lineValueOne = reverse ? after.lineNumber : (widget.commentThread.range?.startLineNumber ?? 0);
579
662
  const lineValueTwo = reverse ? (widget.commentThread.range?.startLineNumber ?? 0) : after.lineNumber;
580
663
  const columnValueOne = reverse ? after.column : (widget.commentThread.range?.startColumn ?? 0);
@@ -603,6 +686,37 @@ let CommentController = class CommentController {
603
686
  previousCommentThread() {
604
687
  this._findNearestCommentThread(true);
605
688
  }
689
+ _findNearestCommentingRange(reverse) {
690
+ if (!this.editor?.hasModel()) {
691
+ return;
692
+ }
693
+ const after = this.editor.getSelection().getEndPosition();
694
+ const range = this._commentingRangeDecorator.getNearestCommentingRange(after, reverse);
695
+ if (range) {
696
+ const position = reverse ? range.getEndPosition() : range.getStartPosition();
697
+ this.editor.setPosition(position);
698
+ this.editor.revealLineInCenterIfOutsideViewport(position.lineNumber);
699
+ }
700
+ if (this.accessibilityService.isScreenReaderOptimized()) {
701
+ const commentRangeStart = range?.getStartPosition().lineNumber;
702
+ const commentRangeEnd = range?.getEndPosition().lineNumber;
703
+ if (commentRangeStart && commentRangeEnd) {
704
+ const oneLine = commentRangeStart === commentRangeEnd;
705
+ oneLine ? status(( nls.localize('commentRange', "Line {0}", commentRangeStart))) : status(( nls.localize(
706
+ 'commentRangeStart',
707
+ "Lines {0} to {1}",
708
+ commentRangeStart,
709
+ commentRangeEnd
710
+ )));
711
+ }
712
+ }
713
+ }
714
+ nextCommentingRange() {
715
+ this._findNearestCommentingRange();
716
+ }
717
+ previousCommentingRange() {
718
+ this._findNearestCommentingRange(true);
719
+ }
606
720
  dispose() {
607
721
  this.globalToDispose.dispose();
608
722
  this.localToDispose.dispose();
@@ -616,6 +730,7 @@ let CommentController = class CommentController {
616
730
  if (!this.editor) {
617
731
  return;
618
732
  }
733
+ this._hasRespondedToEditorChange = false;
619
734
  this.localToDispose.add(this.editor.onMouseDown(e => this.onEditorMouseDown(e)));
620
735
  this.localToDispose.add(this.editor.onMouseUp(e => this.onEditorMouseUp(e)));
621
736
  if (this._editorDisposables.length) {
@@ -644,9 +759,10 @@ let CommentController = class CommentController {
644
759
  if (!commentInfo || !commentInfo.length) {
645
760
  return;
646
761
  }
647
- const added = e.added.filter(thread => thread.resource && ( thread.resource.toString()) === ( editorURI.toString()));
648
- const removed = e.removed.filter(thread => thread.resource && ( thread.resource.toString()) === ( editorURI.toString()));
649
- const changed = e.changed.filter(thread => thread.resource && ( thread.resource.toString()) === ( editorURI.toString()));
762
+ const added = e.added.filter(thread => thread.resource && thread.resource === ( editorURI.toString()));
763
+ const removed = e.removed.filter(thread => thread.resource && thread.resource === ( editorURI.toString()));
764
+ const changed = e.changed.filter(thread => thread.resource && thread.resource === ( editorURI.toString()));
765
+ const pending = e.pending.filter(pending => ( pending.uri.toString()) === ( editorURI.toString()));
650
766
  removed.forEach(thread => {
651
767
  const matchedZones = this._commentWidgets.filter(zoneWidget => zoneWidget.owner === e.owner && zoneWidget.commentThread.threadId === thread.threadId && zoneWidget.commentThread.threadId !== '');
652
768
  if (matchedZones.length) {
@@ -681,22 +797,59 @@ let CommentController = class CommentController {
681
797
  matchedNewCommentThreadZones[0].update(thread);
682
798
  return;
683
799
  }
684
- const pendingCommentText = this._pendingNewCommentCache[e.owner] && this._pendingNewCommentCache[e.owner][thread.threadId];
800
+ const continueOnCommentText = (thread.range ? this.commentService.removeContinueOnComment({ owner: e.owner, uri: editorURI, range: thread.range })?.body : undefined);
801
+ const pendingCommentText = (this._pendingNewCommentCache[e.owner] && this._pendingNewCommentCache[e.owner][thread.threadId])
802
+ ?? continueOnCommentText;
685
803
  const pendingEdits = this._pendingEditsCache[e.owner] && this._pendingEditsCache[e.owner][thread.threadId];
686
804
  this.displayCommentThread(e.owner, thread, pendingCommentText, pendingEdits);
687
805
  this._commentInfos.filter(info => info.owner === e.owner)[0].threads.push(thread);
688
806
  this.tryUpdateReservedSpace();
689
807
  });
808
+ pending.forEach(thread => {
809
+ this.commentService.createCommentThreadTemplate(thread.owner, thread.uri, Range.lift(thread.range));
810
+ });
690
811
  this._commentThreadRangeDecorator.update(this.editor, commentInfo);
691
812
  }));
692
- this.beginCompute();
813
+ this.beginComputeAndHandleEditorChange();
814
+ }
815
+ beginComputeAndHandleEditorChange() {
816
+ this.beginCompute().then(() => {
817
+ if (!this._hasRespondedToEditorChange) {
818
+ if (( this._commentInfos.some(
819
+ commentInfo => commentInfo.commentingRanges.ranges.length > 0 || commentInfo.commentingRanges.fileComments
820
+ ))) {
821
+ this._hasRespondedToEditorChange = true;
822
+ const verbose = this.configurationService.getValue("accessibility.verbosity.comments" );
823
+ if (verbose) {
824
+ const keybinding = this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp" )?.getAriaLabel();
825
+ if (keybinding) {
826
+ status(( nls.localize(
827
+ 'hasCommentRangesKb',
828
+ "Editor has commenting ranges, run the command Open Accessibility Help ({0}), for more information.",
829
+ keybinding
830
+ )));
831
+ }
832
+ else {
833
+ status(( nls.localize(
834
+ 'hasCommentRangesNoKb',
835
+ "Editor has commenting ranges, run the command Open Accessibility Help, which is currently not triggerable via keybinding, for more information."
836
+ )));
837
+ }
838
+ }
839
+ else {
840
+ status(( nls.localize('hasCommentRanges', "Editor has commenting ranges.")));
841
+ }
842
+ }
843
+ }
844
+ });
693
845
  }
694
846
  async openCommentsView(thread) {
695
847
  if (thread.comments && (thread.comments.length > 0)) {
696
- if (this.configurationService.getValue(COMMENTS_SECTION).openView === 'file') {
848
+ const openViewState = this.configurationService.getValue(COMMENTS_SECTION).openView;
849
+ if (openViewState === 'file') {
697
850
  return this.viewsService.openView(COMMENTS_VIEW_ID);
698
851
  }
699
- else if (this.configurationService.getValue(COMMENTS_SECTION).openView === 'firstFile') {
852
+ else if (openViewState === 'firstFile' || (openViewState === 'firstFileUnresolved' && thread.state === languages.CommentThreadState.Unresolved)) {
700
853
  const hasShownView = this.viewsService.getViewWithId(COMMENTS_VIEW_ID)?.hasRendered;
701
854
  if (!hasShownView) {
702
855
  return this.viewsService.openView(COMMENTS_VIEW_ID);
@@ -706,7 +859,7 @@ let CommentController = class CommentController {
706
859
  return undefined;
707
860
  }
708
861
  displayCommentThread(owner, thread, pendingComment, pendingEdits) {
709
- if (!this.editor) {
862
+ if (!this.editor?.getModel()) {
710
863
  return;
711
864
  }
712
865
  if (this.isEditorInlineOriginal(this.editor)) {
@@ -791,6 +944,9 @@ let CommentController = class CommentController {
791
944
  const newCommentInfos = this._commentingRangeDecorator.getMatchedCommentAction(range);
792
945
  if (!newCommentInfos.length || !this.editor?.hasModel()) {
793
946
  this._addInProgress = false;
947
+ if (!newCommentInfos.length) {
948
+ throw new Error('There are no commenting ranges at the current position.');
949
+ }
794
950
  return Promise.resolve();
795
951
  }
796
952
  if (newCommentInfos.length > 1) {
@@ -855,7 +1011,7 @@ let CommentController = class CommentController {
855
1011
  return;
856
1012
  }
857
1013
  getExistingCommentEditorOptions(editor) {
858
- const lineDecorationsWidth = editor.getOption(64 );
1014
+ const lineDecorationsWidth = editor.getOption(65 );
859
1015
  let extraEditorClassName = [];
860
1016
  const configuredExtraClassName = editor.getRawOptions().extraEditorClassName;
861
1017
  if (configuredExtraClassName) {
@@ -870,7 +1026,7 @@ let CommentController = class CommentController {
870
1026
  extraEditorClassName.splice(inlineCommentPos, 1);
871
1027
  }
872
1028
  const options = editor.getOptions();
873
- if (options.get(42 ) && options.get(108 ) !== 'never') {
1029
+ if (options.get(43 ) && options.get(109 ) !== 'never') {
874
1030
  lineDecorationsWidth += 11;
875
1031
  }
876
1032
  lineDecorationsWidth -= 24;
@@ -879,7 +1035,7 @@ let CommentController = class CommentController {
879
1035
  getWithCommentsEditorOptions(editor, extraEditorClassName, startingLineDecorationsWidth) {
880
1036
  let lineDecorationsWidth = startingLineDecorationsWidth;
881
1037
  const options = editor.getOptions();
882
- if (options.get(42 ) && options.get(108 ) !== 'never') {
1038
+ if (options.get(43 ) && options.get(109 ) !== 'never') {
883
1039
  lineDecorationsWidth -= 11;
884
1040
  }
885
1041
  lineDecorationsWidth += 24;
@@ -920,7 +1076,11 @@ let CommentController = class CommentController {
920
1076
  this._commentInfos = commentInfos;
921
1077
  this.tryUpdateReservedSpace();
922
1078
  this.removeCommentWidgetsAndStoreCache();
1079
+ let hasCommentingRanges = false;
923
1080
  this._commentInfos.forEach(info => {
1081
+ if (!hasCommentingRanges && (info.commentingRanges.ranges.length > 0 || info.commentingRanges.fileComments)) {
1082
+ hasCommentingRanges = true;
1083
+ }
924
1084
  const providerCacheStore = this._pendingNewCommentCache[info.owner];
925
1085
  const providerEditsCacheStore = this._pendingEditsCache[info.owner];
926
1086
  info.threads = info.threads.filter(thread => !thread.isDisposed);
@@ -938,9 +1098,18 @@ let CommentController = class CommentController {
938
1098
  }
939
1099
  this.displayCommentThread(info.owner, thread, pendingComment, pendingEdits);
940
1100
  });
1101
+ info.pendingCommentThreads?.forEach(thread => {
1102
+ this.commentService.createCommentThreadTemplate(thread.owner, thread.uri, Range.lift(thread.range));
1103
+ });
941
1104
  });
942
1105
  this._commentingRangeDecorator.update(this.editor, this._commentInfos);
943
1106
  this._commentThreadRangeDecorator.update(this.editor, this._commentInfos);
1107
+ if (hasCommentingRanges) {
1108
+ this._activeEditorHasCommentingRange.set(true);
1109
+ }
1110
+ else {
1111
+ this._activeEditorHasCommentingRange.set(false);
1112
+ }
944
1113
  }
945
1114
  closeWidget() {
946
1115
  this._commentWidgets?.forEach(widget => widget.hide());
@@ -1002,6 +1171,8 @@ CommentController = ( __decorate([
1002
1171
  ( __param(6, IViewsService)),
1003
1172
  ( __param(7, IConfigurationService)),
1004
1173
  ( __param(8, IContextKeyService)),
1005
- ( __param(9, IEditorService))
1174
+ ( __param(9, IEditorService)),
1175
+ ( __param(10, IKeybindingService)),
1176
+ ( __param(11, IAccessibilityService))
1006
1177
  ], CommentController));
1007
- export { ActiveCursorHasCommentingRange, CommentController, ID };
1178
+ export { CommentController, ID };
@@ -20,6 +20,7 @@ import { basename } from 'monaco-editor/esm/vs/base/common/resources.js';
20
20
  import { openLinkFromMarkdown } from 'monaco-editor/esm/vs/editor/contrib/markdownRenderer/browser/markdownRenderer.js';
21
21
  const COMMENTS_VIEW_ID = 'workbench.panel.comments';
22
22
  const COMMENTS_VIEW_STORAGE_ID = 'Comments';
23
+ const COMMENTS_VIEW_ORIGINAL_TITLE = 'Comments';
23
24
  const COMMENTS_VIEW_TITLE = ( (nls.localize('comments.view.title', "Comments")));
24
25
  class CommentsModelVirualDelegate {
25
26
  static { this.RESOURCE_ID = 'resource-with-comments'; }
@@ -269,12 +270,7 @@ let CommentsList = class CommentsList extends WorkbenchObjectTree {
269
270
  return '';
270
271
  }
271
272
  },
272
- expandOnlyOnTwistieClick: (element) => {
273
- if (element instanceof CommentsModel || element instanceof ResourceWithCommentThreads) {
274
- return false;
275
- }
276
- return true;
277
- },
273
+ expandOnlyOnTwistieClick: true,
278
274
  collapseByDefault: false,
279
275
  overrideStyles: options.overrideStyles,
280
276
  filter: options.filter,
@@ -304,4 +300,4 @@ CommentsList = ( (__decorate([
304
300
  ( (__param(6, IInstantiationService))),
305
301
  ( (__param(7, IConfigurationService)))
306
302
  ], CommentsList)));
307
- export { COMMENTS_VIEW_ID, COMMENTS_VIEW_STORAGE_ID, COMMENTS_VIEW_TITLE, CommentNodeRenderer, CommentsList, Filter, ResourceWithCommentsRenderer };
303
+ export { COMMENTS_VIEW_ID, COMMENTS_VIEW_ORIGINAL_TITLE, COMMENTS_VIEW_STORAGE_ID, COMMENTS_VIEW_TITLE, CommentNodeRenderer, CommentsList, Filter, ResourceWithCommentsRenderer };
@@ -332,7 +332,7 @@ let CommentsPanel = class CommentsPanel extends FilterViewPane {
332
332
  const commentToReveal = element instanceof ResourceWithCommentThreads ? element.commentThreads[0].comment.uniqueIdInThread : element.comment.uniqueIdInThread;
333
333
  if (threadToReveal && isCodeEditor(editor)) {
334
334
  const controller = CommentController.get(editor);
335
- controller?.revealCommentThread(threadToReveal, commentToReveal, true);
335
+ controller?.revealCommentThread(threadToReveal, commentToReveal, true, !preserveFocus);
336
336
  }
337
337
  return true;
338
338
  }
@@ -351,7 +351,7 @@ let CommentsPanel = class CommentsPanel extends FilterViewPane {
351
351
  const control = editor.getControl();
352
352
  if (threadToReveal && isCodeEditor(control)) {
353
353
  const controller = CommentController.get(control);
354
- controller?.revealCommentThread(threadToReveal, commentToReveal.uniqueIdInThread, true);
354
+ controller?.revealCommentThread(threadToReveal, commentToReveal.uniqueIdInThread, true, !preserveFocus);
355
355
  }
356
356
  }
357
357
  });