@codingame/monaco-vscode-extensions-service-override 2.2.2 → 3.1.0

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 (21) hide show
  1. package/extensions.js +3 -3
  2. package/package.json +9 -9
  3. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +497 -0
  4. package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +103 -0
  5. package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +0 -7
  6. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +23 -8
  7. package/vscode/src/vs/workbench/api/browser/mainThreadChatProvider.js +147 -10
  8. package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +11 -2
  9. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +9 -6
  10. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +17 -3
  11. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +4 -1
  12. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +2 -2
  13. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +18 -0
  14. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +19 -3
  15. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +2 -2
  16. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +2 -2
  17. package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +25 -20
  18. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +6 -8
  19. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +2 -10
  20. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +40 -0
  21. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +10 -10
@@ -34,7 +34,6 @@ let MainThreadChat = class MainThreadChat extends Disposable {
34
34
  }
35
35
  const unreg = this._chatService.registerProvider({
36
36
  id,
37
- displayName: registration.label,
38
37
  prepareSession: async (token) => {
39
38
  const session = await this._proxy.$prepareChat(handle, token);
40
39
  if (!session) {
@@ -58,12 +57,6 @@ let MainThreadChat = class MainThreadChat extends Disposable {
58
57
  }
59
58
  };
60
59
  },
61
- provideWelcomeMessage: (token) => {
62
- return this._proxy.$provideWelcomeMessage(handle, token);
63
- },
64
- provideSampleQuestions: (token) => {
65
- return this._proxy.$provideSampleQuestions(handle, token);
66
- },
67
60
  });
68
61
  this._providerRegistrations.set(handle, unreg);
69
62
  }
@@ -36,10 +36,10 @@ let MainThreadChatAgents2 = class MainThreadChatAgents2 extends Disposable {
36
36
  for (const [handle, agent] of this._agents) {
37
37
  if (agent.name === e.agentId) {
38
38
  if (e.action.kind === 'vote') {
39
- this._proxy.$acceptFeedback(handle, e.sessionId, e.requestId, e.action.direction);
39
+ this._proxy.$acceptFeedback(handle, e.result ?? {}, e.action.direction);
40
40
  }
41
41
  else {
42
- this._proxy.$acceptAction(handle, e.sessionId, e.requestId, e);
42
+ this._proxy.$acceptAction(handle, e.result || {}, e);
43
43
  }
44
44
  break;
45
45
  }
@@ -50,9 +50,11 @@ let MainThreadChatAgents2 = class MainThreadChatAgents2 extends Disposable {
50
50
  $unregisterAgent(handle) {
51
51
  this._agents.deleteAndDispose(handle);
52
52
  }
53
- $registerAgent(handle, name, metadata) {
53
+ $registerAgent(handle, extension, name, metadata) {
54
+ const lastSlashCommands = ( new WeakMap());
54
55
  const d = this._chatAgentService.registerAgent({
55
56
  id: name,
57
+ extensionId: extension,
56
58
  metadata: revive(metadata),
57
59
  invoke: async (request, progress, history, token) => {
58
60
  this._pendingProgress.set(request.requestId, progress);
@@ -63,17 +65,30 @@ let MainThreadChatAgents2 = class MainThreadChatAgents2 extends Disposable {
63
65
  this._pendingProgress.delete(request.requestId);
64
66
  }
65
67
  },
66
- provideFollowups: async (sessionId, token) => {
68
+ provideFollowups: async (request, result, token) => {
67
69
  if (!this._agents.get(handle)?.hasFollowups) {
68
70
  return [];
69
71
  }
70
- return this._proxy.$provideFollowups(handle, sessionId, token);
72
+ return this._proxy.$provideFollowups(request, handle, result, token);
71
73
  },
72
- provideSlashCommands: async (token) => {
74
+ getLastSlashCommands: (model) => {
75
+ return lastSlashCommands.get(model);
76
+ },
77
+ provideSlashCommands: async (model, history, token) => {
73
78
  if (!this._agents.get(handle)?.hasSlashCommands) {
74
79
  return [];
75
80
  }
76
- return this._proxy.$provideSlashCommands(handle, token);
81
+ const commands = await this._proxy.$provideSlashCommands(handle, { history }, token);
82
+ if (model) {
83
+ lastSlashCommands.set(model, commands);
84
+ }
85
+ return commands;
86
+ },
87
+ provideWelcomeMessage: (token) => {
88
+ return this._proxy.$provideWelcomeMessage(handle, token);
89
+ },
90
+ provideSampleQuestions: (token) => {
91
+ return this._proxy.$provideSampleQuestions(handle, token);
77
92
  }
78
93
  });
79
94
  this._agents.set(handle, {
@@ -111,7 +126,7 @@ let MainThreadChatAgents2 = class MainThreadChatAgents2 extends Disposable {
111
126
  if (query && !( triggerCharacters.some(c => query.startsWith(c)))) {
112
127
  return;
113
128
  }
114
- const parsedRequest = (await this._instantiationService.createInstance(ChatRequestParser).parseChatRequest(widget.viewModel.sessionId, model.getValue())).parts;
129
+ const parsedRequest = this._instantiationService.createInstance(ChatRequestParser).parseChatRequest(widget.viewModel.sessionId, model.getValue()).parts;
115
130
  const agentPart = parsedRequest.find((part) => part instanceof ChatRequestAgentPart);
116
131
  const thisAgentName = this._agents.get(handle)?.name;
117
132
  if (agentPart?.agent.id !== thisAgentName) {
@@ -1,37 +1,66 @@
1
1
  import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
- import { DisposableMap } from 'vscode/vscode/vs/base/common/lifecycle';
2
+ import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
3
+ import { DisposableStore, DisposableMap, Disposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
4
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
5
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
4
6
  import { Progress } from 'vscode/vscode/vs/platform/progress/common/progress';
7
+ import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
5
8
  import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
6
9
  import { IChatProviderService } from 'vscode/vscode/vs/workbench/contrib/chat/common/chatProvider';
10
+ import { IAuthenticationService, INTERNAL_AUTH_PROVIDER_PREFIX } from 'vscode/vscode/vs/workbench/services/authentication/common/authentication';
11
+ import { IExtensionFeaturesManagementService, Extensions } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionFeatures';
7
12
  import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
13
+ import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
8
14
 
9
15
  let MainThreadChatProvider = class MainThreadChatProvider {
10
- constructor(extHostContext, _chatProviderService, _logService) {
16
+ constructor(extHostContext, _chatProviderService, _extensionFeaturesManagementService, _logService, _authenticationService, _extensionService) {
11
17
  this._chatProviderService = _chatProviderService;
18
+ this._extensionFeaturesManagementService = _extensionFeaturesManagementService;
12
19
  this._logService = _logService;
20
+ this._authenticationService = _authenticationService;
21
+ this._extensionService = _extensionService;
22
+ this._store = ( new DisposableStore());
13
23
  this._providerRegistrations = ( new DisposableMap());
14
24
  this._pendingProgress = ( new Map());
15
25
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostChatProvider));
26
+ this._proxy.$updateLanguageModels({ added: _chatProviderService.getProviders() });
27
+ this._store.add(_chatProviderService.onDidChangeProviders(this._proxy.$updateLanguageModels, this._proxy));
16
28
  }
17
29
  dispose() {
18
30
  this._providerRegistrations.dispose();
31
+ this._store.dispose();
19
32
  }
20
33
  $registerProvider(handle, identifier, metadata) {
21
- const registration = this._chatProviderService.registerChatResponseProvider(identifier, {
34
+ const dipsosables = ( new DisposableStore());
35
+ dipsosables.add(this._chatProviderService.registerChatResponseProvider(identifier, {
22
36
  metadata,
23
- provideChatResponse: async (messages, options, progress, token) => {
37
+ provideChatResponse: async (messages, from, options, progress, token) => {
24
38
  const requestId = (Math.random() * 1e6) | 0;
25
39
  this._pendingProgress.set(requestId, progress);
26
40
  try {
27
- await this._proxy.$provideChatResponse(handle, requestId, messages, options, token);
41
+ await this._proxy.$provideLanguageModelResponse(handle, requestId, from, messages, options, token);
28
42
  }
29
43
  finally {
30
44
  this._pendingProgress.delete(requestId);
31
45
  }
32
46
  }
33
- });
34
- this._providerRegistrations.set(handle, registration);
47
+ }));
48
+ if (metadata.auth) {
49
+ dipsosables.add(this._registerAuthenticationProvider(metadata.extension, metadata.auth));
50
+ }
51
+ dipsosables.add(( Registry.as(Extensions.ExtensionFeaturesRegistry)).registerExtensionFeature({
52
+ id: `lm-${identifier}`,
53
+ label: ( localizeWithPath(
54
+ 'vs/workbench/api/browser/mainThreadChatProvider',
55
+ 'languageModels',
56
+ "Language Model ({0})",
57
+ `${identifier}`
58
+ )),
59
+ access: {
60
+ canToggle: false,
61
+ },
62
+ }));
63
+ this._providerRegistrations.set(handle, dipsosables);
35
64
  }
36
65
  async $handleProgressChunk(requestId, chunk) {
37
66
  this._pendingProgress.get(requestId)?.report(chunk);
@@ -39,26 +68,134 @@ let MainThreadChatProvider = class MainThreadChatProvider {
39
68
  $unregisterProvider(handle) {
40
69
  this._providerRegistrations.deleteAndDispose(handle);
41
70
  }
42
- async $prepareChatAccess(providerId) {
71
+ async $prepareChatAccess(extension, providerId, justification) {
72
+ const activate = this._extensionService.activateByEvent(`onLanguageModelAccess:${providerId}`);
73
+ const metadata = this._chatProviderService.lookupChatResponseProvider(providerId);
74
+ if (metadata) {
75
+ return metadata;
76
+ }
77
+ await Promise.race([
78
+ activate,
79
+ Event.toPromise(Event.filter(this._chatProviderService.onDidChangeProviders, e => Boolean(e.added?.includes(providerId))))
80
+ ]);
43
81
  return this._chatProviderService.lookupChatResponseProvider(providerId);
44
82
  }
45
83
  async $fetchResponse(extension, providerId, requestId, messages, options, token) {
84
+ await this._extensionFeaturesManagementService.getAccess(extension, `lm-${providerId}`);
46
85
  this._logService.debug('[CHAT] extension request STARTED', extension.value, requestId);
47
- const task = this._chatProviderService.fetchChatResponse(providerId, messages, options, ( new Progress(value => {
86
+ const task = this._chatProviderService.fetchChatResponse(providerId, extension, messages, options, ( new Progress(value => {
48
87
  this._proxy.$handleResponseFragment(requestId, value);
49
88
  })), token);
50
89
  task.catch(err => {
51
90
  this._logService.error('[CHAT] extension request ERRORED', err, extension.value, requestId);
91
+ throw err;
52
92
  }).finally(() => {
53
93
  this._logService.debug('[CHAT] extension request DONE', extension.value, requestId);
54
94
  });
55
95
  return task;
56
96
  }
97
+ _registerAuthenticationProvider(extension, auth) {
98
+ const authProviderId = INTERNAL_AUTH_PROVIDER_PREFIX + extension.value;
99
+ if (this._authenticationService.getProviderIds().includes(authProviderId)) {
100
+ return Disposable.None;
101
+ }
102
+ const accountLabel = auth.accountLabel ?? ( localizeWithPath(
103
+ 'vs/workbench/api/browser/mainThreadChatProvider',
104
+ 'languageModelsAccountId',
105
+ 'Language Models'
106
+ ));
107
+ const disposables = ( new DisposableStore());
108
+ this._authenticationService.registerAuthenticationProvider(authProviderId, ( new LanguageModelAccessAuthProvider(authProviderId, auth.providerLabel, accountLabel)));
109
+ disposables.add(toDisposable(() => {
110
+ this._authenticationService.unregisterAuthenticationProvider(authProviderId);
111
+ }));
112
+ disposables.add(this._authenticationService.onDidChangeSessions(async (e) => {
113
+ if (e.providerId === authProviderId) {
114
+ if (e.event.removed?.length) {
115
+ const allowedExtensions = this._authenticationService.readAllowedExtensions(authProviderId, accountLabel);
116
+ const extensionsToUpdateAccess = [];
117
+ for (const allowed of allowedExtensions) {
118
+ const from = await this._extensionService.getExtension(allowed.id);
119
+ this._authenticationService.updateAllowedExtension(authProviderId, authProviderId, allowed.id, allowed.name, false);
120
+ if (from) {
121
+ extensionsToUpdateAccess.push({
122
+ from: from.identifier,
123
+ to: extension,
124
+ enabled: false
125
+ });
126
+ }
127
+ }
128
+ this._proxy.$updateModelAccesslist(extensionsToUpdateAccess);
129
+ }
130
+ }
131
+ }));
132
+ disposables.add(this._authenticationService.onDidChangeExtensionSessionAccess(async (e) => {
133
+ const allowedExtensions = this._authenticationService.readAllowedExtensions(authProviderId, accountLabel);
134
+ const accessList = [];
135
+ for (const allowedExtension of allowedExtensions) {
136
+ const from = await this._extensionService.getExtension(allowedExtension.id);
137
+ if (from) {
138
+ accessList.push({
139
+ from: from.identifier,
140
+ to: extension,
141
+ enabled: allowedExtension.allowed ?? true
142
+ });
143
+ }
144
+ }
145
+ this._proxy.$updateModelAccesslist(accessList);
146
+ }));
147
+ return disposables;
148
+ }
57
149
  };
58
150
  MainThreadChatProvider = __decorate([
59
151
  extHostNamedCustomer(MainContext.MainThreadChatProvider),
60
152
  ( __param(1, IChatProviderService)),
61
- ( __param(2, ILogService))
153
+ ( __param(2, IExtensionFeaturesManagementService)),
154
+ ( __param(3, ILogService)),
155
+ ( __param(4, IAuthenticationService)),
156
+ ( __param(5, IExtensionService))
62
157
  ], MainThreadChatProvider);
158
+ class LanguageModelAccessAuthProvider {
159
+ constructor(id, label, _accountLabel) {
160
+ this.id = id;
161
+ this.label = label;
162
+ this._accountLabel = _accountLabel;
163
+ this.supportsMultipleAccounts = false;
164
+ this._onDidChangeSessions = ( new Emitter());
165
+ this.onDidChangeSessions = this._onDidChangeSessions.event;
166
+ }
167
+ async getSessions(scopes) {
168
+ if (scopes === undefined && !this._session) {
169
+ return [];
170
+ }
171
+ if (this._session) {
172
+ return [this._session];
173
+ }
174
+ return [await this.createSession(scopes || [], {})];
175
+ }
176
+ async createSession(scopes, options) {
177
+ this._session = this._createFakeSession(scopes);
178
+ this._onDidChangeSessions.fire({ added: [this._session], changed: [], removed: [] });
179
+ return this._session;
180
+ }
181
+ removeSession(sessionId) {
182
+ if (this._session) {
183
+ this._onDidChangeSessions.fire({ added: [], changed: [], removed: [this._session] });
184
+ this._session = undefined;
185
+ }
186
+ return Promise.resolve();
187
+ }
188
+ _createFakeSession(scopes) {
189
+ return {
190
+ id: 'fake-session',
191
+ account: {
192
+ id: this.id,
193
+ label: this._accountLabel,
194
+ },
195
+ accessToken: 'fake-access-token',
196
+ scopes,
197
+ };
198
+ }
199
+ }
63
200
 
64
201
  export { MainThreadChatProvider };
@@ -9,17 +9,26 @@ let MainThreadChatVariables = class MainThreadChatVariables {
9
9
  constructor(extHostContext, _chatVariablesService) {
10
10
  this._chatVariablesService = _chatVariablesService;
11
11
  this._variables = ( new DisposableMap());
12
+ this._pendingProgress = ( new Map());
12
13
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostChatVariables));
13
14
  }
14
15
  dispose() {
15
16
  this._variables.clearAndDisposeAll();
16
17
  }
17
18
  $registerVariable(handle, data) {
18
- const registration = this._chatVariablesService.registerVariable(data, async (messageText, _arg, _model, token) => {
19
- return revive(await this._proxy.$resolveVariable(handle, messageText, token));
19
+ const registration = this._chatVariablesService.registerVariable(data, async (messageText, _arg, model, progress, token) => {
20
+ const varRequestId = `${model.sessionId}-${handle}`;
21
+ this._pendingProgress.set(varRequestId, progress);
22
+ const result = revive(await this._proxy.$resolveVariable(handle, varRequestId, messageText, token));
23
+ this._pendingProgress.delete(varRequestId);
24
+ return result;
20
25
  });
21
26
  this._variables.set(handle, registration);
22
27
  }
28
+ async $handleProgressChunk(requestId, progress) {
29
+ const revivedProgress = revive(progress);
30
+ this._pendingProgress.get(requestId)?.(revivedProgress);
31
+ }
23
32
  $unregisterVariable(handle) {
24
33
  this._variables.deleteAndDispose(handle);
25
34
  }
@@ -205,6 +205,9 @@ class MainThreadCommentController {
205
205
  this._features = _features;
206
206
  this._threads = ( new Map());
207
207
  }
208
+ async setActiveCommentAndThread(commentInfo) {
209
+ return this._proxy.$setActiveComment(this._handle, commentInfo ? { commentThreadHandle: commentInfo.thread.commentThreadHandle, uniqueIdInThread: commentInfo.comment?.uniqueIdInThread } : undefined);
210
+ }
208
211
  updateFeatures(features) {
209
212
  this._features = features;
210
213
  }
@@ -278,7 +281,7 @@ class MainThreadCommentController {
278
281
  });
279
282
  }
280
283
  updateInput(input) {
281
- const thread = this.activeCommentThread;
284
+ const thread = this.activeEditingCommentThread;
282
285
  if (thread && thread.input) {
283
286
  const commentInput = thread.input;
284
287
  commentInput.value = input;
@@ -384,19 +387,19 @@ let MainThreadComments = class MainThreadComments extends Disposable {
384
387
  this._viewDescriptorService = _viewDescriptorService;
385
388
  this._handlers = ( new Map());
386
389
  this._commentControllers = ( new Map());
387
- this._activeCommentThreadDisposables = this._register(( new DisposableStore()));
390
+ this._activeEditingCommentThreadDisposables = this._register(( new DisposableStore()));
388
391
  this._openViewListener = null;
389
392
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostComments));
390
393
  this._commentService.unregisterCommentController();
391
- this._register(this._commentService.onDidChangeActiveCommentThread(async (thread) => {
394
+ this._register(this._commentService.onDidChangeActiveEditingCommentThread(async (thread) => {
392
395
  const handle = thread.controllerHandle;
393
396
  const controller = this._commentControllers.get(handle);
394
397
  if (!controller) {
395
398
  return;
396
399
  }
397
- this._activeCommentThreadDisposables.clear();
398
- this._activeCommentThread = thread;
399
- controller.activeCommentThread = this._activeCommentThread;
400
+ this._activeEditingCommentThreadDisposables.clear();
401
+ this._activeEditingCommentThread = thread;
402
+ controller.activeEditingCommentThread = this._activeEditingCommentThread;
400
403
  }));
401
404
  }
402
405
  $registerCommentController(handle, id, label, extensionId) {
@@ -18,6 +18,7 @@ let MainThreadDebugService = class MainThreadDebugService {
18
18
  this._toDispose = ( new DisposableStore());
19
19
  this._debugAdaptersHandleCounter = 1;
20
20
  this._visualizerHandles = ( new Map());
21
+ this._visualizerTreeHandles = ( new Map());
21
22
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostDebugService));
22
23
  const sessionListeners = ( new DisposableMap());
23
24
  this._toDispose.add(sessionListeners);
@@ -83,6 +84,18 @@ let MainThreadDebugService = class MainThreadDebugService {
83
84
  }));
84
85
  this.sendBreakpointsAndListen();
85
86
  }
87
+ $registerDebugVisualizerTree(treeId, canEdit) {
88
+ this.visualizerService.registerTree(treeId, {
89
+ disposeItem: id => this._proxy.$disposeVisualizedTree(id),
90
+ getChildren: e => this._proxy.$getVisualizerTreeItemChildren(treeId, e),
91
+ getTreeItem: e => this._proxy.$getVisualizerTreeItem(treeId, e),
92
+ editItem: canEdit ? ((e, v) => this._proxy.$editVisualizerTreeItem(e, v)) : undefined
93
+ });
94
+ }
95
+ $unregisterDebugVisualizerTree(treeId) {
96
+ this._visualizerTreeHandles.get(treeId)?.dispose();
97
+ this._visualizerTreeHandles.delete(treeId);
98
+ }
86
99
  $registerDebugVisualizer(extensionId, id) {
87
100
  const handle = this.visualizerService.register({
88
101
  extensionId: ( new ExtensionIdentifier(extensionId)),
@@ -154,15 +167,16 @@ let MainThreadDebugService = class MainThreadDebugService {
154
167
  column: l.character > 0 ? l.character + 1 : undefined,
155
168
  condition: l.condition,
156
169
  hitCondition: l.hitCondition,
157
- logMessage: l.logMessage
170
+ logMessage: l.logMessage,
171
+ mode: l.mode,
158
172
  })));
159
173
  this.debugService.addBreakpoints(URI.revive(dto.uri), rawbps);
160
174
  }
161
175
  else if (dto.type === 'function') {
162
- this.debugService.addFunctionBreakpoint(dto.functionName, dto.id);
176
+ this.debugService.addFunctionBreakpoint(dto.functionName, dto.id, dto.mode);
163
177
  }
164
178
  else if (dto.type === 'data') {
165
- this.debugService.addDataBreakpoint(dto.label, dto.dataId, dto.canPersist, dto.accessTypes, dto.accessType);
179
+ this.debugService.addDataBreakpoint(dto.label, dto.dataId, dto.canPersist, dto.accessTypes, dto.accessType, dto.mode);
166
180
  }
167
181
  }
168
182
  return Promise.resolve();
@@ -42,7 +42,7 @@ class MainThreadTextEditorProperties {
42
42
  let lineNumbers;
43
43
  if (codeEditor) {
44
44
  const options = codeEditor.getOptions();
45
- const lineNumbersOpts = options.get(67 );
45
+ const lineNumbersOpts = options.get(68 );
46
46
  cursorStyle = options.get(28 );
47
47
  lineNumbers = lineNumbersOpts.renderType;
48
48
  }
@@ -290,6 +290,9 @@ class MainThreadTextEditor {
290
290
  case 2 :
291
291
  lineNumbers = 'relative';
292
292
  break;
293
+ case 3 :
294
+ lineNumbers = 'interval';
295
+ break;
293
296
  default:
294
297
  lineNumbers = 'off';
295
298
  }
@@ -297,7 +297,7 @@ let MainThreadFileSystemEventService = class MainThreadFileSystemEventService {
297
297
  const config = this._configurationService.getValue();
298
298
  if (config.files?.watcherExclude) {
299
299
  for (const key in config.files.watcherExclude) {
300
- if (config.files.watcherExclude[key] === true) {
300
+ if (key && config.files.watcherExclude[key] === true) {
301
301
  opts.excludes.push(key);
302
302
  }
303
303
  }
@@ -307,7 +307,7 @@ let MainThreadFileSystemEventService = class MainThreadFileSystemEventService {
307
307
  const config = this._configurationService.getValue();
308
308
  if (config.files?.watcherExclude) {
309
309
  for (const key in config.files.watcherExclude) {
310
- if (config.files.watcherExclude[key] === true) {
310
+ if (key && config.files.watcherExclude[key] === true) {
311
311
  if (!opts.includes) {
312
312
  opts.includes = [];
313
313
  }
@@ -391,6 +391,13 @@ let MainThreadLanguageFeatures = MainThreadLanguageFeatures_1 = class MainThread
391
391
  : undefined
392
392
  }));
393
393
  }
394
+ $registerNewSymbolNamesProvider(handle, selector) {
395
+ this._registrations.set(handle, this._languageFeaturesService.newSymbolNamesProvider.register(selector, {
396
+ provideNewSymbolNames: (model, range, token) => {
397
+ return this._proxy.$provideNewSymbolNames(handle, model.uri, range, token);
398
+ }
399
+ }));
400
+ }
394
401
  $registerDocumentSemanticTokensProvider(handle, selector, legend, eventHandle) {
395
402
  let event = undefined;
396
403
  if (typeof eventHandle === 'number') {
@@ -500,6 +507,17 @@ let MainThreadLanguageFeatures = MainThreadLanguageFeatures_1 = class MainThread
500
507
  };
501
508
  this._registrations.set(handle, this._languageFeaturesService.inlineCompletionsProvider.register(selector, provider));
502
509
  }
510
+ $registerInlineEditProvider(handle, selector, extensionId) {
511
+ const provider = {
512
+ provideInlineEdit: async (model, context, token) => {
513
+ return this._proxy.$provideInlineEdit(handle, model.uri, context, token);
514
+ },
515
+ freeInlineEdit: (edit) => {
516
+ this._proxy.$freeInlineEdit(handle, edit.pid);
517
+ }
518
+ };
519
+ this._registrations.set(handle, this._languageFeaturesService.inlineEditProvider.register(selector, provider));
520
+ }
503
521
  $registerSignatureHelpProvider(handle, selector, metadata) {
504
522
  this._registrations.set(handle, this._languageFeaturesService.signatureHelpProvider.register(selector, {
505
523
  signatureHelpTriggerCharacters: metadata.triggerCharacters,
@@ -6,12 +6,14 @@ import { extHostNamedCustomer } from '../../services/extensions/common/extHostCu
6
6
  import '../../../../../../override/vs/platform/dialogs/common/dialogs.js';
7
7
  import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
8
8
  import { Event } from 'vscode/vscode/vs/base/common/event';
9
+ import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
9
10
  import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
10
11
  import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs';
11
12
 
12
13
  let MainThreadMessageService = class MainThreadMessageService {
13
- constructor(extHostContext, _notificationService, _dialogService, extensionService) {
14
+ constructor(extHostContext, _notificationService, _commandService, _dialogService, extensionService) {
14
15
  this._notificationService = _notificationService;
16
+ this._commandService = _commandService;
15
17
  this._dialogService = _dialogService;
16
18
  this.extensionsListener = extensionService.onDidChangeExtensions(e => {
17
19
  for (const extension of e.removed) {
@@ -56,6 +58,19 @@ let MainThreadMessageService = class MainThreadMessageService {
56
58
  ));
57
59
  }
58
60
  const secondaryActions = [];
61
+ if (options.source) {
62
+ secondaryActions.push(toAction({
63
+ id: options.source.identifier.value,
64
+ label: ( localizeWithPath(
65
+ 'vs/workbench/api/browser/mainThreadMessageService',
66
+ 'manageExtension',
67
+ "Manage Extension"
68
+ )),
69
+ run: () => {
70
+ return this._commandService.executeCommand('_extensions.manage', options.source.identifier.value);
71
+ }
72
+ }));
73
+ }
59
74
  const messageHandle = this._notificationService.notify({
60
75
  severity,
61
76
  message,
@@ -114,8 +129,9 @@ let MainThreadMessageService = class MainThreadMessageService {
114
129
  MainThreadMessageService = __decorate([
115
130
  extHostNamedCustomer(MainContext.MainThreadMessageService),
116
131
  ( __param(1, INotificationService)),
117
- ( __param(2, IDialogService)),
118
- ( __param(3, IExtensionService))
132
+ ( __param(2, ICommandService)),
133
+ ( __param(3, IDialogService)),
134
+ ( __param(4, IExtensionService))
119
135
  ], MainThreadMessageService);
120
136
 
121
137
  export { MainThreadMessageService };
@@ -11,7 +11,7 @@ class ExtHostNotebookDocumentSaveParticipant {
11
11
  constructor(extHostContext) {
12
12
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostNotebookDocumentSaveParticipant));
13
13
  }
14
- async participate(workingCopy, env, _progress, token) {
14
+ async participate(workingCopy, context, _progress, token) {
15
15
  if (!workingCopy.model || !(workingCopy.model instanceof NotebookFileWorkingCopyModel)) {
16
16
  return undefined;
17
17
  }
@@ -22,7 +22,7 @@ class ExtHostNotebookDocumentSaveParticipant {
22
22
  'timeout.onWillSave',
23
23
  "Aborted onWillSaveNotebookDocument-event after 1750ms"
24
24
  ))))), 1750);
25
- this._proxy.$participateInSave(workingCopy.resource, env.reason, token).then(_ => {
25
+ this._proxy.$participateInSave(workingCopy.resource, context.reason, token).then(_ => {
26
26
  clearTimeout(_warningTimeout);
27
27
  return undefined;
28
28
  }).then(resolve, reject);
@@ -11,7 +11,7 @@ class ExtHostSaveParticipant {
11
11
  constructor(extHostContext) {
12
12
  this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostDocumentSaveParticipant));
13
13
  }
14
- async participate(editorModel, env, _progress, token) {
14
+ async participate(editorModel, context, _progress, token) {
15
15
  if (!editorModel.textEditorModel || !shouldSynchronizeModel(editorModel.textEditorModel)) {
16
16
  return undefined;
17
17
  }
@@ -21,7 +21,7 @@ class ExtHostSaveParticipant {
21
21
  'timeout.onWillSave',
22
22
  "Aborted onWillSaveTextDocument-event after 1750ms"
23
23
  ))))), 1750);
24
- this._proxy.$participateInSave(editorModel.resource, env.reason).then(values => {
24
+ this._proxy.$participateInSave(editorModel.resource, context.reason).then(values => {
25
25
  if (!values.every(success => success)) {
26
26
  return Promise.reject(( new Error('listener failed')));
27
27
  }
@@ -1,6 +1,5 @@
1
1
  import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
- import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
3
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
2
+ import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
4
3
  import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
5
4
  import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
6
5
  import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
@@ -20,38 +19,44 @@ let MainThreadSpeech = class MainThreadSpeech {
20
19
  this.logService.trace('[Speech] extension registered provider', metadata.extension.value);
21
20
  const registration = this.speechService.registerSpeechProvider(identifier, {
22
21
  metadata,
23
- createSpeechToTextSession: token => {
22
+ createSpeechToTextSession: (token, options) => {
23
+ if (token.isCancellationRequested) {
24
+ return {
25
+ onDidChange: Event.None
26
+ };
27
+ }
24
28
  const disposables = ( new DisposableStore());
25
- const cts = ( new CancellationTokenSource(token));
26
29
  const session = Math.random();
27
- this.proxy.$createSpeechToTextSession(handle, session);
28
- disposables.add(token.onCancellationRequested(() => this.proxy.$cancelSpeechToTextSession(session)));
30
+ this.proxy.$createSpeechToTextSession(handle, session, options?.language);
29
31
  const onDidChange = disposables.add(( new Emitter()));
30
32
  this.speechToTextSessions.set(session, { onDidChange });
33
+ disposables.add(token.onCancellationRequested(() => {
34
+ this.proxy.$cancelSpeechToTextSession(session);
35
+ this.speechToTextSessions.delete(session);
36
+ disposables.dispose();
37
+ }));
31
38
  return {
32
- onDidChange: onDidChange.event,
33
- dispose: () => {
34
- cts.dispose(true);
35
- this.speechToTextSessions.delete(session);
36
- disposables.dispose();
37
- }
39
+ onDidChange: onDidChange.event
38
40
  };
39
41
  },
40
42
  createKeywordRecognitionSession: token => {
43
+ if (token.isCancellationRequested) {
44
+ return {
45
+ onDidChange: Event.None
46
+ };
47
+ }
41
48
  const disposables = ( new DisposableStore());
42
- const cts = ( new CancellationTokenSource(token));
43
49
  const session = Math.random();
44
50
  this.proxy.$createKeywordRecognitionSession(handle, session);
45
- disposables.add(token.onCancellationRequested(() => this.proxy.$cancelKeywordRecognitionSession(session)));
46
51
  const onDidChange = disposables.add(( new Emitter()));
47
52
  this.keywordRecognitionSessions.set(session, { onDidChange });
53
+ disposables.add(token.onCancellationRequested(() => {
54
+ this.proxy.$cancelKeywordRecognitionSession(session);
55
+ this.keywordRecognitionSessions.delete(session);
56
+ disposables.dispose();
57
+ }));
48
58
  return {
49
- onDidChange: onDidChange.event,
50
- dispose: () => {
51
- cts.dispose(true);
52
- this.keywordRecognitionSessions.delete(session);
53
- disposables.dispose();
54
- }
59
+ onDidChange: onDidChange.event
55
60
  };
56
61
  }
57
62
  });