@volar/language-service 1.5.0 → 1.5.2

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 (45) hide show
  1. package/out/baseLanguageService.d.ts +2 -2
  2. package/out/baseLanguageService.js +7 -7
  3. package/out/documentFeatures/colorPresentations.js +2 -2
  4. package/out/documentFeatures/documentColors.js +2 -2
  5. package/out/documentFeatures/documentSymbols.js +2 -2
  6. package/out/documentFeatures/foldingRanges.js +2 -2
  7. package/out/documentFeatures/format.js +9 -9
  8. package/out/documentFeatures/linkedEditingRanges.js +2 -2
  9. package/out/documentFeatures/selectionRanges.js +2 -2
  10. package/out/languageFeatures/autoInsert.js +2 -2
  11. package/out/languageFeatures/callHierarchy.d.ts +1 -1
  12. package/out/languageFeatures/callHierarchy.js +11 -11
  13. package/out/languageFeatures/codeActionResolve.js +4 -4
  14. package/out/languageFeatures/codeActions.d.ts +3 -3
  15. package/out/languageFeatures/codeActions.js +8 -9
  16. package/out/languageFeatures/codeLens.d.ts +4 -4
  17. package/out/languageFeatures/codeLens.js +6 -6
  18. package/out/languageFeatures/codeLensResolve.js +6 -6
  19. package/out/languageFeatures/complete.d.ts +2 -2
  20. package/out/languageFeatures/complete.js +28 -28
  21. package/out/languageFeatures/completeResolve.js +5 -5
  22. package/out/languageFeatures/definition.js +2 -2
  23. package/out/languageFeatures/documentHighlights.js +3 -3
  24. package/out/languageFeatures/documentLinkResolve.js +3 -3
  25. package/out/languageFeatures/documentLinks.d.ts +1 -1
  26. package/out/languageFeatures/documentLinks.js +3 -3
  27. package/out/languageFeatures/documentSemanticTokens.js +2 -2
  28. package/out/languageFeatures/fileReferences.js +2 -2
  29. package/out/languageFeatures/fileRename.js +3 -3
  30. package/out/languageFeatures/hover.js +2 -2
  31. package/out/languageFeatures/inlayHintResolve.js +3 -3
  32. package/out/languageFeatures/inlayHints.d.ts +1 -1
  33. package/out/languageFeatures/inlayHints.js +3 -3
  34. package/out/languageFeatures/references.js +3 -3
  35. package/out/languageFeatures/rename.js +18 -7
  36. package/out/languageFeatures/renamePrepare.js +2 -2
  37. package/out/languageFeatures/signatureHelp.js +4 -4
  38. package/out/languageFeatures/validation.d.ts +4 -4
  39. package/out/languageFeatures/validation.js +28 -27
  40. package/out/languageFeatures/workspaceSymbols.js +3 -3
  41. package/out/types.d.ts +23 -18
  42. package/out/types.js +8 -0
  43. package/out/utils/featureWorkers.d.ts +2 -2
  44. package/out/utils/featureWorkers.js +48 -49
  45. package/package.json +4 -4
@@ -20,7 +20,7 @@ export declare function createLanguageService(modules: {
20
20
  findDocumentSymbols: (uri: string, token?: vscode.CancellationToken) => Promise<vscode.DocumentSymbol[] | undefined>;
21
21
  findDocumentColors: (uri: string, token?: vscode.CancellationToken) => Promise<vscode.ColorInformation[] | undefined>;
22
22
  getColorPresentations: (uri: string, color: vscode.Color, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.ColorPresentation[] | undefined>;
23
- doValidation: (uri: string, mode: "semantic" | "all" | "syntactic", token?: vscode.CancellationToken, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
23
+ doValidation: (uri: string, mode: "all" | "semantic" | "syntactic", token?: vscode.CancellationToken, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
24
24
  findReferences: (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Location[] | undefined>;
25
25
  findFileReferences: (uri: string, token?: vscode.CancellationToken) => import("./types").NullableResult<vscode.Location[]>;
26
26
  findDefinition: (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
@@ -68,7 +68,7 @@ declare function createLanguageServiceBase(context: ServiceContext): {
68
68
  findDocumentSymbols: (uri: string, token?: vscode.CancellationToken) => Promise<vscode.DocumentSymbol[] | undefined>;
69
69
  findDocumentColors: (uri: string, token?: vscode.CancellationToken) => Promise<vscode.ColorInformation[] | undefined>;
70
70
  getColorPresentations: (uri: string, color: vscode.Color, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.ColorPresentation[] | undefined>;
71
- doValidation: (uri: string, mode: "semantic" | "all" | "syntactic", token?: vscode.CancellationToken, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
71
+ doValidation: (uri: string, mode: "all" | "semantic" | "syntactic", token?: vscode.CancellationToken, response?: ((result: vscode.Diagnostic[]) => void) | undefined) => Promise<vscode.Diagnostic[]>;
72
72
  findReferences: (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Location[] | undefined>;
73
73
  findFileReferences: (uri: string, token?: vscode.CancellationToken) => import("./types").NullableResult<vscode.Location[]>;
74
74
  findDefinition: (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
@@ -83,8 +83,8 @@ function createLanguageServicePluginContext(modules, env, config, host, language
83
83
  config,
84
84
  host,
85
85
  core: languageContext,
86
- plugins: {},
87
- typescript: ts && tsLs ? {
86
+ services: {},
87
+ typescript: tsLs ? {
88
88
  languageServiceHost: languageContext.typescript.languageServiceHost,
89
89
  languageService: tsLs,
90
90
  } : undefined,
@@ -149,7 +149,7 @@ function createLanguageServicePluginContext(modules, env, config, host, language
149
149
  for (const serviceId in config.services ?? {}) {
150
150
  const service = config.services?.[serviceId];
151
151
  if (service) {
152
- context.plugins[serviceId] = service(context, modules);
152
+ context.services[serviceId] = service(context, modules);
153
153
  }
154
154
  }
155
155
  return context;
@@ -187,10 +187,10 @@ function createLanguageServicePluginContext(modules, env, config, host, language
187
187
  }
188
188
  function createLanguageServiceBase(context) {
189
189
  return {
190
- triggerCharacters: Object.values(context.plugins).map(plugin => plugin?.triggerCharacters ?? []).flat(),
191
- autoFormatTriggerCharacters: Object.values(context.plugins).map(plugin => plugin?.autoFormatTriggerCharacters ?? []).flat(),
192
- signatureHelpTriggerCharacters: Object.values(context.plugins).map(plugin => plugin?.signatureHelpTriggerCharacters ?? []).flat(),
193
- signatureHelpRetriggerCharacters: Object.values(context.plugins).map(plugin => plugin?.signatureHelpRetriggerCharacters ?? []).flat(),
190
+ triggerCharacters: Object.values(context.services).map(service => service?.triggerCharacters ?? []).flat(),
191
+ autoFormatTriggerCharacters: Object.values(context.services).map(service => service?.autoFormatTriggerCharacters ?? []).flat(),
192
+ signatureHelpTriggerCharacters: Object.values(context.services).map(service => service?.signatureHelpTriggerCharacters ?? []).flat(),
193
+ signatureHelpRetriggerCharacters: Object.values(context.services).map(service => service?.signatureHelpRetriggerCharacters ?? []).flat(),
194
194
  format: format.register(context),
195
195
  getFoldingRanges: foldingRanges.register(context),
196
196
  getSelectionRanges: selectionRanges.register(context),
@@ -10,10 +10,10 @@ function register(context) {
10
10
  if (file.capabilities.documentSymbol) // TODO: add color capability setting
11
11
  return map.toGeneratedRanges(range);
12
12
  return [];
13
- }, (plugin, document, range) => {
13
+ }, (service, document, range) => {
14
14
  if (token.isCancellationRequested)
15
15
  return;
16
- return plugin.provideColorPresentations?.(document, color, range, token);
16
+ return service.provideColorPresentations?.(document, color, range, token);
17
17
  }, (data, map) => map ? data.map(cp => {
18
18
  if (cp.textEdit) {
19
19
  const range = map.toSourceRange(cp.textEdit.range);
@@ -7,10 +7,10 @@ const common_1 = require("../utils/common");
7
7
  function register(context) {
8
8
  return (uri, token = vscode.CancellationToken.None) => {
9
9
  return (0, featureWorkers_1.documentFeatureWorker)(context, uri, file => !!file.capabilities.documentSymbol, // TODO: add color capability setting
10
- (plugin, document) => {
10
+ (service, document) => {
11
11
  if (token.isCancellationRequested)
12
12
  return;
13
- return plugin.provideDocumentColors?.(document, token);
13
+ return service.provideDocumentColors?.(document, token);
14
14
  }, (data, map) => map ? data.map(color => {
15
15
  const range = map.toSourceRange(color.range);
16
16
  if (range) {
@@ -7,10 +7,10 @@ const vscode = require("vscode-languageserver-protocol");
7
7
  const common_1 = require("../utils/common");
8
8
  function register(context) {
9
9
  return (uri, token = vscode.CancellationToken.None) => {
10
- return (0, featureWorkers_1.documentFeatureWorker)(context, uri, file => !!file.capabilities.documentSymbol, async (plugin, document) => {
10
+ return (0, featureWorkers_1.documentFeatureWorker)(context, uri, file => !!file.capabilities.documentSymbol, async (service, document) => {
11
11
  if (token.isCancellationRequested)
12
12
  return;
13
- return plugin.provideDocumentSymbols?.(document, token);
13
+ return service.provideDocumentSymbols?.(document, token);
14
14
  }, (data, map) => map
15
15
  ? data
16
16
  .map(symbol => transformer.asDocumentSymbol(symbol, range => map.toSourceRange(range)))
@@ -6,10 +6,10 @@ const transformer = require("../transformer");
6
6
  const vscode = require("vscode-languageserver-protocol");
7
7
  function register(context) {
8
8
  return (uri, token = vscode.CancellationToken.None) => {
9
- return (0, featureWorkers_1.documentFeatureWorker)(context, uri, file => !!file.capabilities.foldingRange, (plugin, document) => {
9
+ return (0, featureWorkers_1.documentFeatureWorker)(context, uri, file => !!file.capabilities.foldingRange, (service, document) => {
10
10
  if (token.isCancellationRequested)
11
11
  return;
12
- return plugin.provideFoldingRanges?.(document, token);
12
+ return service.provideFoldingRanges?.(document, token);
13
13
  }, (data, map) => map ? transformer.asFoldingRanges(data, range => map.toSourceRange(range)) : data, arr => arr.flat());
14
14
  };
15
15
  }
@@ -56,7 +56,7 @@ function register(context) {
56
56
  toPatchIndentUris.push({
57
57
  uri: map.virtualFileDocument.uri,
58
58
  isCodeBlock,
59
- service: embeddedCodeResult.plugin,
59
+ service: embeddedCodeResult.service,
60
60
  });
61
61
  for (const textEdit of embeddedCodeResult.edits) {
62
62
  const range = map.toSourceRange(textEdit.range);
@@ -88,11 +88,11 @@ function register(context) {
88
88
  for (const toPatchIndentUri of toPatchIndentUris) {
89
89
  for (const [_, map] of context.documents.getMapsByVirtualFileUri(toPatchIndentUri.uri)) {
90
90
  const indentSensitiveLines = new Set();
91
- for (const plugin of toPatchIndentUri.service.provideFormattingIndentSensitiveLines ? [toPatchIndentUri.service] : Object.values(context.plugins)) {
91
+ for (const service of toPatchIndentUri.service.provideFormattingIndentSensitiveLines ? [toPatchIndentUri.service] : Object.values(context.services)) {
92
92
  if (token.isCancellationRequested)
93
93
  break;
94
- if (plugin.provideFormattingIndentSensitiveLines) {
95
- const lines = await plugin.provideFormattingIndentSensitiveLines(map.virtualFileDocument, token);
94
+ if (service.provideFormattingIndentSensitiveLines) {
95
+ const lines = await service.provideFormattingIndentSensitiveLines(map.virtualFileDocument, token);
96
96
  if (lines) {
97
97
  for (const line of lines) {
98
98
  const sourceLine = map.toSourcePosition({ line: line, character: 0 })?.line;
@@ -151,18 +151,18 @@ function register(context) {
151
151
  }
152
152
  async function tryFormat(document, range, ch) {
153
153
  let formatRange = range;
154
- for (const plugin of Object.values(context.plugins)) {
154
+ for (const service of Object.values(context.services)) {
155
155
  if (token.isCancellationRequested)
156
156
  break;
157
157
  let edits;
158
158
  try {
159
159
  if (ch !== undefined && vscode.Position.is(formatRange)) {
160
- if (plugin.autoFormatTriggerCharacters?.includes(ch)) {
161
- edits = await plugin.provideOnTypeFormattingEdits?.(document, formatRange, ch, options, token);
160
+ if (service.autoFormatTriggerCharacters?.includes(ch)) {
161
+ edits = await service.provideOnTypeFormattingEdits?.(document, formatRange, ch, options, token);
162
162
  }
163
163
  }
164
164
  else if (ch === undefined && vscode.Range.is(formatRange)) {
165
- edits = await plugin.provideDocumentFormattingEdits?.(document, formatRange, options, token);
165
+ edits = await service.provideDocumentFormattingEdits?.(document, formatRange, options, token);
166
166
  }
167
167
  }
168
168
  catch (err) {
@@ -171,7 +171,7 @@ function register(context) {
171
171
  if (!edits)
172
172
  continue;
173
173
  return {
174
- plugin,
174
+ service,
175
175
  edits,
176
176
  };
177
177
  }
@@ -6,10 +6,10 @@ const vscode = require("vscode-languageserver-protocol");
6
6
  const common_1 = require("../utils/common");
7
7
  function register(context) {
8
8
  return (uri, position, token = vscode.CancellationToken.None) => {
9
- return (0, featureWorkers_1.languageFeatureWorker)(context, uri, position, (position, map) => map.toGeneratedPositions(position, data => !!data.completion), (plugin, document, position) => {
9
+ return (0, featureWorkers_1.languageFeatureWorker)(context, uri, position, (position, map) => map.toGeneratedPositions(position, data => !!data.completion), (service, document, position) => {
10
10
  if (token.isCancellationRequested)
11
11
  return;
12
- return plugin.provideLinkedEditingRanges?.(document, position, token);
12
+ return service.provideLinkedEditingRanges?.(document, position, token);
13
13
  }, (data, map) => map ? ({
14
14
  wordPattern: data.wordPattern,
15
15
  ranges: data.ranges.map(range => map.toSourceRange(range)).filter(common_1.notEmpty),
@@ -17,10 +17,10 @@ function register(context) {
17
17
  }
18
18
  }
19
19
  return [];
20
- }, (plugin, document, positions) => {
20
+ }, (service, document, positions) => {
21
21
  if (token.isCancellationRequested)
22
22
  return;
23
- return plugin.provideSelectionRanges?.(document, positions, token);
23
+ return service.provideSelectionRanges?.(document, positions, token);
24
24
  }, (item, map) => map ? transformer.asSelectionRanges(item, range => map.toSourceRange(range)) : item, results => {
25
25
  const result = [];
26
26
  for (let i = 0; i < positions.length; i++) {
@@ -23,10 +23,10 @@ function register(context) {
23
23
  break;
24
24
  }
25
25
  }
26
- }, (plugin, document, arg) => {
26
+ }, (service, document, arg) => {
27
27
  if (token.isCancellationRequested)
28
28
  return;
29
- return plugin.provideAutoInsertionEdit?.(document, arg.position, arg.autoInsertContext, token);
29
+ return service.provideAutoInsertionEdit?.(document, arg.position, arg.autoInsertContext, token);
30
30
  }, (item, map) => {
31
31
  if (!map || typeof item === 'string')
32
32
  return item;
@@ -3,7 +3,7 @@ import type { ServiceContext } from '../types';
3
3
  export interface PluginCallHierarchyData {
4
4
  uri: string;
5
5
  original: Pick<vscode.CallHierarchyItem, 'data'>;
6
- pluginId: string;
6
+ serviceId: string;
7
7
  virtualDocumentUri: string | undefined;
8
8
  }
9
9
  export declare function register(context: ServiceContext): {
@@ -9,17 +9,17 @@ const featureWorkers_1 = require("../utils/featureWorkers");
9
9
  function register(context) {
10
10
  return {
11
11
  doPrepare(uri, position, token = vscode.CancellationToken.None) {
12
- return (0, featureWorkers_1.languageFeatureWorker)(context, uri, position, (position, map) => map.toGeneratedPositions(position, data => !!data.references), async (plugin, document, position, map) => {
12
+ return (0, featureWorkers_1.languageFeatureWorker)(context, uri, position, (position, map) => map.toGeneratedPositions(position, data => !!data.references), async (service, document, position, map) => {
13
13
  if (token.isCancellationRequested)
14
14
  return;
15
- const items = await plugin.provideCallHierarchyItems?.(document, position, token);
15
+ const items = await service.provideCallHierarchyItems?.(document, position, token);
16
16
  items?.forEach(item => {
17
17
  item.data = {
18
18
  uri,
19
19
  original: {
20
20
  data: item.data,
21
21
  },
22
- pluginId: Object.keys(context.plugins).find(key => context.plugins[key] === plugin),
22
+ serviceId: Object.keys(context.services).find(key => context.services[key] === service),
23
23
  virtualDocumentUri: map?.virtualFileDocument.uri,
24
24
  };
25
25
  });
@@ -32,13 +32,13 @@ function register(context) {
32
32
  const data = item.data;
33
33
  let incomingItems = [];
34
34
  if (data) {
35
- const plugin = context.plugins[data.pluginId];
36
- if (!plugin.provideCallHierarchyIncomingCalls)
35
+ const service = context.services[data.serviceId];
36
+ if (!service.provideCallHierarchyIncomingCalls)
37
37
  return incomingItems;
38
38
  Object.assign(item, data.original);
39
39
  if (data.virtualDocumentUri) {
40
40
  if (context.documents.isVirtualFileUri(data.virtualDocumentUri)) {
41
- const _calls = await plugin.provideCallHierarchyIncomingCalls(item, token);
41
+ const _calls = await service.provideCallHierarchyIncomingCalls(item, token);
42
42
  for (const _call of _calls) {
43
43
  const calls = transformCallHierarchyItem(_call.from, _call.fromRanges);
44
44
  if (!calls)
@@ -51,7 +51,7 @@ function register(context) {
51
51
  }
52
52
  }
53
53
  else {
54
- const _calls = await plugin.provideCallHierarchyIncomingCalls(item, token);
54
+ const _calls = await service.provideCallHierarchyIncomingCalls(item, token);
55
55
  for (const _call of _calls) {
56
56
  const calls = transformCallHierarchyItem(_call.from, _call.fromRanges);
57
57
  if (!calls)
@@ -69,13 +69,13 @@ function register(context) {
69
69
  const data = item.data;
70
70
  let items = [];
71
71
  if (data) {
72
- const plugin = context.plugins[data.pluginId];
73
- if (!plugin.provideCallHierarchyOutgoingCalls)
72
+ const service = context.services[data.serviceId];
73
+ if (!service.provideCallHierarchyOutgoingCalls)
74
74
  return items;
75
75
  Object.assign(item, data.original);
76
76
  if (data.virtualDocumentUri) {
77
77
  if (context.documents.isVirtualFileUri(data.virtualDocumentUri)) {
78
- const _calls = await plugin.provideCallHierarchyOutgoingCalls(item, token);
78
+ const _calls = await service.provideCallHierarchyOutgoingCalls(item, token);
79
79
  for (const call of _calls) {
80
80
  const calls = transformCallHierarchyItem(call.to, call.fromRanges);
81
81
  if (!calls)
@@ -88,7 +88,7 @@ function register(context) {
88
88
  }
89
89
  }
90
90
  else {
91
- const _calls = await plugin.provideCallHierarchyOutgoingCalls(item, token);
91
+ const _calls = await service.provideCallHierarchyOutgoingCalls(item, token);
92
92
  for (const call of _calls) {
93
93
  const calls = transformCallHierarchyItem(call.to, call.fromRanges);
94
94
  if (!calls)
@@ -6,12 +6,12 @@ const rename_1 = require("./rename");
6
6
  function register(context) {
7
7
  return async (item, token = vscode.CancellationToken.None) => {
8
8
  const data = item.data;
9
- if (data?.type === 'plugin') {
10
- const plugin = context.plugins[data.pluginId];
11
- if (!plugin.resolveCodeAction)
9
+ if (data?.type === 'service') {
10
+ const service = context.services[data.serviceId];
11
+ if (!service.resolveCodeAction)
12
12
  return item;
13
13
  Object.assign(item, data.original);
14
- item = await plugin.resolveCodeAction(item, token);
14
+ item = await service.resolveCodeAction(item, token);
15
15
  if (item.edit) {
16
16
  item.edit = (0, rename_1.embeddedEditToSourceEdit)(item.edit, context.documents, 'codeAction', { [data.uri]: data.version });
17
17
  }
@@ -1,11 +1,11 @@
1
1
  import * as vscode from 'vscode-languageserver-protocol';
2
2
  import type { ServiceContext } from '../types';
3
- export interface PluginCodeActionData {
3
+ export interface ServiceCodeActionData {
4
4
  uri: string;
5
5
  version: number;
6
- type: 'plugin';
6
+ type: 'service';
7
7
  original: Pick<vscode.CodeAction, 'data' | 'edit'>;
8
- pluginId: string;
8
+ serviceId: string;
9
9
  }
10
10
  export interface RuleCodeActionData {
11
11
  uri: string;
@@ -43,17 +43,16 @@ function register(context) {
43
43
  }];
44
44
  }
45
45
  return [];
46
- }, async (plugin, document, { range, codeActionContext }) => {
46
+ }, async (service, document, { range, codeActionContext }) => {
47
47
  if (token.isCancellationRequested)
48
48
  return;
49
- const pluginId = Object.keys(context.plugins).find(key => context.plugins[key] === plugin);
49
+ const serviceId = Object.keys(context.services).find(key => context.services[key] === service);
50
50
  const diagnostics = codeActionContext.diagnostics.filter(diagnostic => {
51
51
  const data = diagnostic.data;
52
52
  if (data && data.version !== sourceDocument.version) {
53
- // console.warn('[volar/plugin-api] diagnostic version mismatch', data.version, sourceDocument.version);
54
53
  return false;
55
54
  }
56
- return data?.type === 'plugin' && data?.pluginOrRuleId === pluginId;
55
+ return data?.type === 'service' && data?.serviceOrRuleId === serviceId;
57
56
  }).map(diagnostic => {
58
57
  const data = diagnostic.data;
59
58
  return {
@@ -61,7 +60,7 @@ function register(context) {
61
60
  ...data.original,
62
61
  };
63
62
  });
64
- const codeActions = await plugin.provideCodeActions?.(document, range, {
63
+ const codeActions = await service.provideCodeActions?.(document, range, {
65
64
  ...codeActionContext,
66
65
  diagnostics,
67
66
  }, token);
@@ -69,12 +68,12 @@ function register(context) {
69
68
  codeAction.data = {
70
69
  uri,
71
70
  version: sourceDocument.version,
72
- type: 'plugin',
71
+ type: 'service',
73
72
  original: {
74
73
  data: codeAction.data,
75
74
  edit: codeAction.edit,
76
75
  },
77
- pluginId: Object.keys(context.plugins).find(key => context.plugins[key] === plugin),
76
+ serviceId: Object.keys(context.services).find(key => context.services[key] === service),
78
77
  };
79
78
  });
80
79
  return codeActions;
@@ -98,7 +97,7 @@ function register(context) {
98
97
  continue;
99
98
  }
100
99
  if (data?.type === 'rule') {
101
- const fixes = context.ruleFixes?.[data.documentUri]?.[data.pluginOrRuleId]?.[data.ruleFixIndex];
100
+ const fixes = context.ruleFixes?.[data.documentUri]?.[data.serviceOrRuleId]?.[data.ruleFixIndex];
102
101
  if (fixes) {
103
102
  for (let i = 0; i < fixes[1].length; i++) {
104
103
  const fix = fixes[1][i];
@@ -124,7 +123,7 @@ function register(context) {
124
123
  type: 'rule',
125
124
  version: data.version,
126
125
  isFormat: data.isFormat,
127
- ruleId: data.pluginOrRuleId,
126
+ ruleId: data.serviceOrRuleId,
128
127
  documentUri: data.documentUri,
129
128
  ruleFixIndex: data.ruleFixIndex,
130
129
  index: i,
@@ -1,15 +1,15 @@
1
1
  import type { ServiceContext } from '../types';
2
2
  import * as vscode from 'vscode-languageserver-protocol';
3
- export interface PluginCodeLensData {
3
+ export interface ServiceCodeLensData {
4
4
  kind: 'normal';
5
5
  uri: string;
6
6
  original: Pick<vscode.CodeLens, 'data'>;
7
- pluginId: string;
7
+ serviceId: string;
8
8
  }
9
- export interface PluginReferencesCodeLensData {
9
+ export interface ServiceReferencesCodeLensData {
10
10
  kind: 'references';
11
11
  uri: string;
12
12
  range: vscode.Range;
13
- pluginId: string;
13
+ serviceId: string;
14
14
  }
15
15
  export declare function register(context: ServiceContext): (uri: string, token?: vscode.CancellationToken) => Promise<vscode.CodeLens[]>;
@@ -6,11 +6,11 @@ const vscode = require("vscode-languageserver-protocol");
6
6
  const common_1 = require("../utils/common");
7
7
  function register(context) {
8
8
  return async (uri, token = vscode.CancellationToken.None) => {
9
- return await (0, featureWorkers_1.languageFeatureWorker)(context, uri, undefined, (arg) => [arg], async (plugin, document) => {
9
+ return await (0, featureWorkers_1.languageFeatureWorker)(context, uri, undefined, (arg) => [arg], async (service, document) => {
10
10
  if (token.isCancellationRequested)
11
11
  return;
12
- let codeLens = await plugin.provideCodeLenses?.(document, token);
13
- const pluginId = Object.keys(context.plugins).find(key => context.plugins[key] === plugin);
12
+ let codeLens = await service.provideCodeLenses?.(document, token);
13
+ const serviceId = Object.keys(context.services).find(key => context.services[key] === service);
14
14
  codeLens?.forEach(codeLens => {
15
15
  codeLens.data = {
16
16
  kind: 'normal',
@@ -18,15 +18,15 @@ function register(context) {
18
18
  original: {
19
19
  data: codeLens.data,
20
20
  },
21
- pluginId,
21
+ serviceId: serviceId,
22
22
  };
23
23
  });
24
- const ranges = await plugin.provideReferencesCodeLensRanges?.(document, token);
24
+ const ranges = await service.provideReferencesCodeLensRanges?.(document, token);
25
25
  const referencesCodeLens = ranges?.map(range => vscode.CodeLens.create(range, {
26
26
  kind: 'references',
27
27
  uri,
28
28
  range,
29
- pluginId,
29
+ serviceId: serviceId,
30
30
  }));
31
31
  codeLens = [
32
32
  ...codeLens ?? [],
@@ -8,19 +8,19 @@ function register(context) {
8
8
  return async (item, token = vscode.CancellationToken.None) => {
9
9
  const data = item.data;
10
10
  if (data?.kind === 'normal') {
11
- const plugin = context.plugins[data.pluginId];
12
- if (!plugin.resolveCodeLens)
11
+ const service = context.services[data.serviceId];
12
+ if (!service.resolveCodeLens)
13
13
  return item;
14
14
  Object.assign(item, data.original);
15
- item = await plugin.resolveCodeLens(item, token);
15
+ item = await service.resolveCodeLens(item, token);
16
16
  // item.range already transformed in codeLens request
17
17
  }
18
18
  if (data?.kind === 'references') {
19
19
  let references = await findReferences(data.uri, item.range.start, token) ?? [];
20
- const plugin = context.plugins[data.pluginId];
20
+ const service = context.services[data.serviceId];
21
21
  const document = context.getTextDocument(data.uri);
22
- if (document && plugin.resolveReferencesCodeLensLocations) {
23
- references = await plugin.resolveReferencesCodeLensLocations(document, data.range, references, token);
22
+ if (document && service.resolveReferencesCodeLensLocations) {
23
+ references = await service.resolveReferencesCodeLensLocations(document, data.range, references, token);
24
24
  }
25
25
  item.command = context.commands.showReferences.create(data.uri, data.range.start, references);
26
26
  }
@@ -1,9 +1,9 @@
1
1
  import * as vscode from 'vscode-languageserver-protocol';
2
2
  import type { ServiceContext } from '../types';
3
- export interface PluginCompletionData {
3
+ export interface ServiceCompletionData {
4
4
  uri: string;
5
5
  original: Pick<vscode.CompletionItem, 'additionalTextEdits' | 'textEdit' | 'data'>;
6
- pluginId: string;
6
+ serviceId: string;
7
7
  virtualDocumentUri: string | undefined;
8
8
  }
9
9
  export declare function register(context: ServiceContext): (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext, token?: vscode.CancellationToken) => Promise<vscode.CompletionList>;