@volar/language-service 1.2.0-alpha.1 → 1.2.0-alpha.10

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 (53) hide show
  1. package/out/baseLanguageService.d.ts +3 -5
  2. package/out/baseLanguageService.js +11 -14
  3. package/out/documentFeatures/colorPresentations.d.ts +2 -2
  4. package/out/documentFeatures/documentColors.d.ts +2 -2
  5. package/out/documentFeatures/documentSymbols.d.ts +2 -2
  6. package/out/documentFeatures/foldingRanges.d.ts +2 -2
  7. package/out/documentFeatures/format.d.ts +2 -4
  8. package/out/documentFeatures/format.js +26 -123
  9. package/out/documentFeatures/linkedEditingRanges.d.ts +2 -2
  10. package/out/documentFeatures/selectionRanges.d.ts +2 -2
  11. package/out/index.d.ts +1 -1
  12. package/out/index.js +3 -3
  13. package/out/languageFeatures/autoInsert.d.ts +2 -2
  14. package/out/languageFeatures/callHierarchy.d.ts +3 -3
  15. package/out/languageFeatures/callHierarchy.js +5 -3
  16. package/out/languageFeatures/codeActionResolve.d.ts +2 -2
  17. package/out/languageFeatures/codeActionResolve.js +28 -15
  18. package/out/languageFeatures/codeActions.d.ts +15 -6
  19. package/out/languageFeatures/codeActions.js +94 -22
  20. package/out/languageFeatures/codeLens.d.ts +11 -4
  21. package/out/languageFeatures/codeLens.js +25 -15
  22. package/out/languageFeatures/codeLensResolve.d.ts +4 -2
  23. package/out/languageFeatures/codeLensResolve.js +20 -12
  24. package/out/languageFeatures/complete.d.ts +3 -3
  25. package/out/languageFeatures/complete.js +20 -4
  26. package/out/languageFeatures/completeResolve.d.ts +2 -2
  27. package/out/languageFeatures/completeResolve.js +3 -14
  28. package/out/languageFeatures/definition.d.ts +2 -2
  29. package/out/languageFeatures/documentHighlights.d.ts +2 -2
  30. package/out/languageFeatures/documentLinks.d.ts +2 -2
  31. package/out/languageFeatures/documentSemanticTokens.d.ts +2 -2
  32. package/out/languageFeatures/fileReferences.d.ts +2 -2
  33. package/out/languageFeatures/fileRename.d.ts +2 -2
  34. package/out/languageFeatures/fileRename.js +1 -1
  35. package/out/languageFeatures/hover.d.ts +2 -2
  36. package/out/languageFeatures/inlayHints.d.ts +2 -2
  37. package/out/languageFeatures/references.d.ts +2 -2
  38. package/out/languageFeatures/rename.d.ts +3 -3
  39. package/out/languageFeatures/rename.js +64 -44
  40. package/out/languageFeatures/renamePrepare.d.ts +2 -2
  41. package/out/languageFeatures/signatureHelp.d.ts +2 -2
  42. package/out/languageFeatures/validation.d.ts +7 -3
  43. package/out/languageFeatures/validation.js +68 -15
  44. package/out/languageFeatures/workspaceSymbols.d.ts +2 -2
  45. package/out/transformer/foldingRanges.js +6 -6
  46. package/out/types.d.ts +93 -40
  47. package/out/utils/featureWorkers.d.ts +4 -4
  48. package/out/utils/featureWorkers.js +44 -11
  49. package/package.json +9 -9
  50. package/out/languageFeatures/executeCommand.d.ts +0 -11
  51. package/out/languageFeatures/executeCommand.js +0 -32
  52. package/out/languageFeatures/validation copy.d.ts +0 -7
  53. package/out/languageFeatures/validation copy.js +0 -234
@@ -18,14 +18,15 @@ const featureWorkers_1 = require("../utils/featureWorkers");
18
18
  const rename_1 = require("./rename");
19
19
  function register(context) {
20
20
  return (uri, range, codeActionContext) => __awaiter(this, void 0, void 0, function* () {
21
- const document = context.getTextDocument(uri);
22
- if (!document)
21
+ var _a, _b, _c, _d, _e;
22
+ const sourceDocument = context.getTextDocument(uri);
23
+ if (!sourceDocument)
23
24
  return;
24
25
  const offsetRange = {
25
- start: document.offsetAt(range.start),
26
- end: document.offsetAt(range.end),
26
+ start: sourceDocument.offsetAt(range.start),
27
+ end: sourceDocument.offsetAt(range.end),
27
28
  };
28
- let codeActions = yield (0, featureWorkers_1.languageFeatureWorker)(context, uri, { range, codeActionContext }, (_arg, map, file) => {
29
+ const pluginActions = yield (0, featureWorkers_1.languageFeatureWorker)(context, uri, { range, codeActionContext }, (_arg, map, file) => {
29
30
  var _a, _b;
30
31
  if (!file.capabilities.codeAction)
31
32
  return [];
@@ -53,32 +54,39 @@ function register(context) {
53
54
  }];
54
55
  }
55
56
  return [];
56
- }, (plugin, document, { range, codeActionContext }, map) => __awaiter(this, void 0, void 0, function* () {
57
- var _a, _b;
57
+ }, (plugin, document, { range, codeActionContext }) => __awaiter(this, void 0, void 0, function* () {
58
+ var _f, _g;
58
59
  const pluginId = Object.keys(context.plugins).find(key => context.plugins[key] === plugin);
59
60
  const diagnostics = codeActionContext.diagnostics.filter(diagnostic => {
60
61
  const data = diagnostic.data;
62
+ if (data && data.version !== sourceDocument.version) {
63
+ console.warn('[volar/plugin-api] diagnostic version mismatch', data.version, sourceDocument.version);
64
+ return false;
65
+ }
61
66
  return (data === null || data === void 0 ? void 0 : data.type) === 'plugin' && (data === null || data === void 0 ? void 0 : data.pluginOrRuleId) === pluginId;
62
67
  }).map(diagnostic => {
63
68
  const data = diagnostic.data;
64
- return Object.assign(Object.assign({}, diagnostic), { data: data.originalData });
69
+ return Object.assign(Object.assign({}, diagnostic), data.original);
65
70
  });
66
- const codeActions = yield ((_b = (_a = plugin.codeAction) === null || _a === void 0 ? void 0 : _a.on) === null || _b === void 0 ? void 0 : _b.call(_a, document, range, Object.assign(Object.assign({}, codeActionContext), { diagnostics })));
67
- return codeActions === null || codeActions === void 0 ? void 0 : codeActions.map(_codeAction => {
68
- return Object.assign(Object.assign({}, _codeAction), { data: {
69
- uri,
70
- originalData: _codeAction.data,
71
- pluginId: Object.keys(context.plugins).find(key => context.plugins[key] === plugin),
72
- map: map ? {
73
- embeddedDocumentUri: map.virtualFileDocument.uri,
74
- } : undefined,
75
- } });
71
+ const codeActions = yield ((_g = (_f = plugin.codeAction) === null || _f === void 0 ? void 0 : _f.on) === null || _g === void 0 ? void 0 : _g.call(_f, document, range, Object.assign(Object.assign({}, codeActionContext), { diagnostics })));
72
+ codeActions === null || codeActions === void 0 ? void 0 : codeActions.forEach(codeAction => {
73
+ codeAction.data = {
74
+ uri,
75
+ version: document.version,
76
+ type: 'plugin',
77
+ original: {
78
+ data: codeAction.data,
79
+ edit: codeAction.edit,
80
+ },
81
+ pluginId: Object.keys(context.plugins).find(key => context.plugins[key] === plugin),
82
+ };
76
83
  });
84
+ return codeActions;
77
85
  }), (_codeActions, sourceMap) => _codeActions.map(_codeAction => {
78
86
  if (!sourceMap)
79
87
  return _codeAction;
80
88
  if (_codeAction.edit) {
81
- const edit = (0, rename_1.embeddedEditToSourceEdit)(_codeAction.edit, context.documents);
89
+ const edit = (0, rename_1.embeddedEditToSourceEdit)(_codeAction.edit, context.documents, 'codeAction');
82
90
  if (edit) {
83
91
  _codeAction.edit = edit;
84
92
  return _codeAction;
@@ -87,11 +95,75 @@ function register(context) {
87
95
  else {
88
96
  return _codeAction;
89
97
  }
90
- }).filter(shared.notEmpty), arr => arr.flat());
91
- if (codeActions) {
92
- return dedupe.withCodeAction(codeActions);
98
+ }).filter(shared.notEmpty), arr => dedupe.withCodeAction(arr.flat()));
99
+ const ruleActions = [];
100
+ for (const diagnostic of codeActionContext.diagnostics) {
101
+ const data = diagnostic.data;
102
+ if (data && data.version !== sourceDocument.version) {
103
+ console.warn('[volar/rules-api] diagnostic version mismatch', data.version, sourceDocument.version);
104
+ continue;
105
+ }
106
+ if ((data === null || data === void 0 ? void 0 : data.type) === 'rule') {
107
+ const fixes = (_c = (_b = (_a = context.ruleFixes) === null || _a === void 0 ? void 0 : _a[data.documentUri]) === null || _b === void 0 ? void 0 : _b[data.pluginOrRuleId]) === null || _c === void 0 ? void 0 : _c[data.ruleFixIndex];
108
+ if (fixes) {
109
+ for (let i = 0; i < fixes[1].length; i++) {
110
+ const fix = fixes[1][i];
111
+ const matchKinds = [];
112
+ if (!codeActionContext.only) {
113
+ matchKinds.push(undefined);
114
+ }
115
+ else {
116
+ for (const kind of (_d = fix.kinds) !== null && _d !== void 0 ? _d : ['quickfix']) {
117
+ const matchOnly = matchOnlyKind(codeActionContext.only, kind);
118
+ if (matchOnly) {
119
+ matchKinds.push(matchOnly);
120
+ }
121
+ }
122
+ }
123
+ for (const matchKind of matchKinds) {
124
+ const action = {
125
+ title: (_e = fix.title) !== null && _e !== void 0 ? _e : `Fix: ${diagnostic.message}`,
126
+ kind: matchKind,
127
+ diagnostics: [diagnostic],
128
+ data: {
129
+ uri,
130
+ type: 'rule',
131
+ version: data.version,
132
+ isFormat: data.isFormat,
133
+ ruleId: data.pluginOrRuleId,
134
+ documentUri: data.documentUri,
135
+ ruleFixIndex: data.ruleFixIndex,
136
+ index: i,
137
+ },
138
+ };
139
+ ruleActions.push(action);
140
+ }
141
+ }
142
+ }
143
+ }
93
144
  }
145
+ return [
146
+ ...pluginActions !== null && pluginActions !== void 0 ? pluginActions : [],
147
+ ...ruleActions,
148
+ ];
94
149
  });
95
150
  }
96
151
  exports.register = register;
152
+ function matchOnlyKind(only, kind) {
153
+ const b = kind.split('.');
154
+ for (const onlyKind of only) {
155
+ const a = onlyKind.split('.');
156
+ if (a.length <= b.length) {
157
+ let matchNum = 0;
158
+ for (let i = 0; i < a.length; i++) {
159
+ if (a[i] == b[i]) {
160
+ matchNum++;
161
+ }
162
+ }
163
+ if (matchNum === a.length) {
164
+ return onlyKind;
165
+ }
166
+ }
167
+ }
168
+ }
97
169
  //# sourceMappingURL=codeActions.js.map
@@ -1,8 +1,15 @@
1
- import type { LanguageServiceRuntimeContext } from '../types';
2
- import type * as _ from 'vscode-languageserver-protocol';
1
+ import type { LanguageServicePluginContext } from '../types';
2
+ import * as vscode from 'vscode-languageserver-protocol';
3
3
  export interface PluginCodeLensData {
4
+ kind: 'normal';
4
5
  uri: string;
5
- originalData: any;
6
+ original: Pick<vscode.CodeLens, 'data'>;
6
7
  pluginId: string;
7
8
  }
8
- export declare function register(context: LanguageServiceRuntimeContext): (uri: string) => Promise<_.CodeLens[]>;
9
+ export interface PluginReferencesCodeLensData {
10
+ kind: 'references';
11
+ uri: string;
12
+ location: vscode.Location;
13
+ pluginId: string;
14
+ }
15
+ export declare function register(context: LanguageServicePluginContext): (uri: string) => Promise<vscode.CodeLens[]>;
@@ -11,28 +11,38 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.register = void 0;
12
12
  const shared = require("@volar/shared");
13
13
  const featureWorkers_1 = require("../utils/featureWorkers");
14
- const executeCommand_1 = require("./executeCommand");
14
+ const vscode = require("vscode-languageserver-protocol");
15
15
  function register(context) {
16
16
  return (uri) => __awaiter(this, void 0, void 0, function* () {
17
- var _a;
18
- return (_a = yield (0, featureWorkers_1.languageFeatureWorker)(context, uri, undefined, (arg) => [arg], (plugin, document) => __awaiter(this, void 0, void 0, function* () {
19
- var _b, _c;
20
- const codeLens = yield ((_c = (_b = plugin.codeLens) === null || _b === void 0 ? void 0 : _b.on) === null || _c === void 0 ? void 0 : _c.call(_b, document));
17
+ var _a, _b, _c;
18
+ const referencesCodeLendsEnabled = (_b = yield ((_a = context.env.configurationHost) === null || _a === void 0 ? void 0 : _a.getConfiguration('volar.codeLens.references'))) !== null && _b !== void 0 ? _b : true;
19
+ return (_c = yield (0, featureWorkers_1.languageFeatureWorker)(context, uri, undefined, (arg) => [arg], (plugin, document) => __awaiter(this, void 0, void 0, function* () {
20
+ var _d, _e, _f, _g;
21
+ let codeLens = yield ((_e = (_d = plugin.codeLens) === null || _d === void 0 ? void 0 : _d.on) === null || _e === void 0 ? void 0 : _e.call(_d, document));
22
+ const pluginId = Object.keys(context.plugins).find(key => context.plugins[key] === plugin);
21
23
  codeLens === null || codeLens === void 0 ? void 0 : codeLens.forEach(codeLens => {
22
- const pluginId = Object.keys(context.plugins).find(key => context.plugins[key] === plugin);
23
- if (codeLens.command) {
24
- codeLens.command = {
25
- title: codeLens.command.title,
26
- command: executeCommand_1.executePluginCommand,
27
- arguments: [uri, pluginId, codeLens.command],
28
- };
29
- }
30
24
  codeLens.data = {
25
+ kind: 'normal',
31
26
  uri,
32
- originalData: codeLens.data,
27
+ original: {
28
+ data: codeLens.data,
29
+ },
33
30
  pluginId,
34
31
  };
35
32
  });
33
+ if (referencesCodeLendsEnabled) {
34
+ const referencesCodeLensLocs = yield ((_g = (_f = plugin.referencesCodeLens) === null || _f === void 0 ? void 0 : _f.on) === null || _g === void 0 ? void 0 : _g.call(_f, document));
35
+ const referencesCodeLens = referencesCodeLensLocs === null || referencesCodeLensLocs === void 0 ? void 0 : referencesCodeLensLocs.map(loc => vscode.CodeLens.create(loc.range, {
36
+ kind: 'references',
37
+ uri,
38
+ location: loc,
39
+ pluginId,
40
+ }));
41
+ codeLens = [
42
+ ...codeLens !== null && codeLens !== void 0 ? codeLens : [],
43
+ ...referencesCodeLens !== null && referencesCodeLens !== void 0 ? referencesCodeLens : [],
44
+ ];
45
+ }
36
46
  return codeLens;
37
47
  }), (data, map) => data.map(codeLens => {
38
48
  if (!map)
@@ -41,7 +51,7 @@ function register(context) {
41
51
  if (range) {
42
52
  return Object.assign(Object.assign({}, codeLens), { range });
43
53
  }
44
- }).filter(shared.notEmpty), arr => arr.flat())) !== null && _a !== void 0 ? _a : [];
54
+ }).filter(shared.notEmpty), arr => arr.flat())) !== null && _c !== void 0 ? _c : [];
45
55
  });
46
56
  }
47
57
  exports.register = register;
@@ -1,3 +1,5 @@
1
1
  import * as vscode from 'vscode-languageserver-protocol';
2
- import type { LanguageServiceRuntimeContext } from '../types';
3
- export declare function register(context: LanguageServiceRuntimeContext): (item: vscode.CodeLens) => Promise<vscode.CodeLens>;
2
+ import type { LanguageServicePluginContext } from '../types';
3
+ export declare const showReferencesCommand: string;
4
+ export type ShowReferencesCommandData = [string, vscode.Position, vscode.Location[]];
5
+ export declare function register(context: LanguageServicePluginContext): (item: vscode.CodeLens) => Promise<vscode.CodeLens>;
@@ -8,27 +8,35 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
- exports.register = void 0;
12
- const executeCommand_1 = require("./executeCommand");
11
+ exports.register = exports.showReferencesCommand = void 0;
12
+ const references = require("./references");
13
+ exports.showReferencesCommand = `volar.${Math.random().toString(36).slice(2)}.show-references`;
13
14
  function register(context) {
15
+ const findReferences = references.register(context);
14
16
  return (item) => __awaiter(this, void 0, void 0, function* () {
15
- var _a;
17
+ var _a, _b, _c;
16
18
  const data = item.data;
17
- if (data) {
19
+ if ((data === null || data === void 0 ? void 0 : data.kind) === 'normal') {
18
20
  const plugin = context.plugins[data.pluginId];
19
21
  if (!((_a = plugin.codeLens) === null || _a === void 0 ? void 0 : _a.resolve))
20
22
  return item;
21
- item.data = data.originalData;
23
+ Object.assign(item, data.original);
22
24
  item = yield plugin.codeLens.resolve(item);
23
- if (item.command) {
24
- item.command = {
25
- title: item.command.title,
26
- command: executeCommand_1.executePluginCommand,
27
- arguments: [data.uri, data.pluginId, item.command],
28
- };
29
- }
30
25
  // item.range already transformed in codeLens request
31
26
  }
27
+ if ((data === null || data === void 0 ? void 0 : data.kind) === 'references') {
28
+ let references = (_b = yield findReferences(data.uri, item.range.start)) !== null && _b !== void 0 ? _b : [];
29
+ const plugin = context.plugins[data.pluginId];
30
+ const document = context.getTextDocument(data.uri);
31
+ if (document && ((_c = plugin.referencesCodeLens) === null || _c === void 0 ? void 0 : _c.resolve)) {
32
+ references = yield plugin.referencesCodeLens.resolve(document, data.location, references);
33
+ }
34
+ item.command = {
35
+ title: references.length === 1 ? '1 reference' : `${references.length} references`,
36
+ command: exports.showReferencesCommand,
37
+ arguments: [data.uri, data.location.range.start, references],
38
+ };
39
+ }
32
40
  return item;
33
41
  });
34
42
  }
@@ -1,11 +1,11 @@
1
1
  import * as vscode from 'vscode-languageserver-protocol';
2
- import type { LanguageServiceRuntimeContext } from '../types';
2
+ import type { LanguageServicePluginContext } from '../types';
3
3
  export interface PluginCompletionData {
4
4
  uri: string;
5
- originalData: any;
5
+ original: Pick<vscode.CompletionItem, 'additionalTextEdits' | 'textEdit' | 'data'>;
6
6
  pluginId: string;
7
7
  map: {
8
8
  embeddedDocumentUri: string;
9
9
  } | undefined;
10
10
  }
11
- export declare function register(context: LanguageServiceRuntimeContext): (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext) => Promise<vscode.CompletionList>;
11
+ export declare function register(context: LanguageServicePluginContext): (uri: string, position: vscode.Position, completionContext?: vscode.CompletionContext) => Promise<vscode.CompletionList>;
@@ -34,7 +34,11 @@ function register(context) {
34
34
  }
35
35
  cacheData.list = transformer.asCompletionList(embeddedCompletionList, range => map.toSourceRange(range), map.virtualFileDocument, (newItem, oldItem) => newItem.data = {
36
36
  uri,
37
- originalData: oldItem.data,
37
+ original: {
38
+ additionalTextEdits: oldItem.additionalTextEdits,
39
+ textEdit: oldItem.textEdit,
40
+ data: oldItem.data,
41
+ },
38
42
  pluginId: Object.keys(context.plugins).find(key => context.plugins[key] === cacheData.plugin),
39
43
  map: {
40
44
  embeddedDocumentUri: map.virtualFileDocument.uri,
@@ -54,7 +58,11 @@ function register(context) {
54
58
  completionList.items.forEach(item => {
55
59
  item.data = {
56
60
  uri,
57
- originalData: item.data,
61
+ original: {
62
+ additionalTextEdits: item.additionalTextEdits,
63
+ textEdit: item.textEdit,
64
+ data: item.data,
65
+ },
58
66
  pluginId: Object.keys(context.plugins).find(key => context.plugins[key] === cacheData.plugin),
59
67
  map: undefined,
60
68
  };
@@ -104,7 +112,11 @@ function register(context) {
104
112
  }
105
113
  const completionList = transformer.asCompletionList(embeddedCompletionList, range => map.toSourceRange(range), map.virtualFileDocument, (newItem, oldItem) => newItem.data = {
106
114
  uri,
107
- originalData: oldItem.data,
115
+ original: {
116
+ additionalTextEdits: oldItem.additionalTextEdits,
117
+ textEdit: oldItem.textEdit,
118
+ data: oldItem.data,
119
+ },
108
120
  pluginId: Object.keys(context.plugins).find(key => context.plugins[key] === plugin),
109
121
  map: {
110
122
  embeddedDocumentUri: map.virtualFileDocument.uri,
@@ -146,7 +158,11 @@ function register(context) {
146
158
  completionList.items.forEach(item => {
147
159
  item.data = {
148
160
  uri,
149
- originalData: item.data,
161
+ original: {
162
+ additionalTextEdits: item.additionalTextEdits,
163
+ textEdit: item.textEdit,
164
+ data: item.data,
165
+ },
150
166
  pluginId: Object.keys(context.plugins).find(key => context.plugins[key] === plugin),
151
167
  map: undefined,
152
168
  };
@@ -1,3 +1,3 @@
1
1
  import * as vscode from 'vscode-languageserver-protocol';
2
- import type { LanguageServiceRuntimeContext } from '../types';
3
- export declare function register(context: LanguageServiceRuntimeContext): (item: vscode.CompletionItem) => Promise<vscode.CompletionItem>;
2
+ import type { LanguageServicePluginContext } from '../types';
3
+ export declare function register(context: LanguageServicePluginContext): (item: vscode.CompletionItem) => Promise<vscode.CompletionItem>;
@@ -18,22 +18,11 @@ function register(context) {
18
18
  const plugin = context.plugins[data.pluginId];
19
19
  if (!((_a = plugin.complete) === null || _a === void 0 ? void 0 : _a.resolve))
20
20
  return item;
21
- item.data = data.originalData;
21
+ item = Object.assign(item, data.original);
22
22
  if (data.map) {
23
23
  for (const [_, map] of context.documents.getMapsByVirtualFileUri(data.map.embeddedDocumentUri)) {
24
- const resolvedItem = yield plugin.complete.resolve(item);
25
- // fix https://github.com/johnsoncodehk/volar/issues/916
26
- if (resolvedItem.additionalTextEdits) {
27
- for (const edit of resolvedItem.additionalTextEdits) {
28
- if (edit.range.start.line === 0
29
- && edit.range.start.character === 0
30
- && edit.range.end.line === 0
31
- && edit.range.end.character === 0) {
32
- edit.newText = '\n' + edit.newText;
33
- }
34
- }
35
- }
36
- item = transformer.asCompletionItem(resolvedItem, embeddedRange => {
24
+ item = yield plugin.complete.resolve(item);
25
+ item = transformer.asCompletionItem(item, embeddedRange => {
37
26
  var _a;
38
27
  let range = (_a = plugin.resolveEmbeddedRange) === null || _a === void 0 ? void 0 : _a.call(plugin, embeddedRange);
39
28
  if (range)
@@ -1,4 +1,4 @@
1
1
  import * as vscode from 'vscode-languageserver-protocol';
2
- import type { LanguageServiceRuntimeContext } from '../types';
2
+ import type { LanguageServicePluginContext } from '../types';
3
3
  import { FileRangeCapabilities, MirrorBehaviorCapabilities } from '@volar/language-core';
4
- export declare function register(context: LanguageServiceRuntimeContext, api: 'findDefinition' | 'findTypeDefinition' | 'findImplementations', isValidMapping: (data: FileRangeCapabilities) => boolean, isValidMirrorPosition: (mirrorData: MirrorBehaviorCapabilities) => boolean): (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
4
+ export declare function register(context: LanguageServicePluginContext, api: 'findDefinition' | 'findTypeDefinition' | 'findImplementations', isValidMapping: (data: FileRangeCapabilities) => boolean, isValidMirrorPosition: (mirrorData: MirrorBehaviorCapabilities) => boolean): (uri: string, position: vscode.Position) => Promise<vscode.LocationLink[] | undefined>;
@@ -1,3 +1,3 @@
1
1
  import * as vscode from 'vscode-languageserver-protocol';
2
- import type { LanguageServiceRuntimeContext } from '../types';
3
- export declare function register(context: LanguageServiceRuntimeContext): (uri: string, position: vscode.Position) => Promise<vscode.DocumentHighlight[] | undefined>;
2
+ import type { LanguageServicePluginContext } from '../types';
3
+ export declare function register(context: LanguageServicePluginContext): (uri: string, position: vscode.Position) => Promise<vscode.DocumentHighlight[] | undefined>;
@@ -1,3 +1,3 @@
1
1
  import * as vscode from 'vscode-languageserver-protocol';
2
- import type { LanguageServiceRuntimeContext } from '../types';
3
- export declare function register(context: LanguageServiceRuntimeContext): (uri: string) => Promise<vscode.DocumentLink[]>;
2
+ import type { LanguageServicePluginContext } from '../types';
3
+ export declare function register(context: LanguageServicePluginContext): (uri: string) => Promise<vscode.DocumentLink[]>;
@@ -1,4 +1,4 @@
1
1
  import * as vscode from 'vscode-languageserver-protocol';
2
2
  import { SemanticToken } from '@volar/language-service';
3
- import type { LanguageServiceRuntimeContext } from '../types';
4
- export declare function register(context: LanguageServiceRuntimeContext): (uri: string, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, cancelToken: vscode.CancellationToken, reportProgress?: ((tokens: SemanticToken[]) => void) | undefined) => Promise<SemanticToken[] | undefined> | undefined;
3
+ import type { LanguageServicePluginContext } from '../types';
4
+ export declare function register(context: LanguageServicePluginContext): (uri: string, range: vscode.Range | undefined, legend: vscode.SemanticTokensLegend, cancelToken: vscode.CancellationToken, reportProgress?: ((tokens: SemanticToken[]) => void) | undefined) => Promise<SemanticToken[] | undefined> | undefined;
@@ -1,4 +1,4 @@
1
- import type { LanguageServiceRuntimeContext } from '../types';
1
+ import type { LanguageServicePluginContext } from '../types';
2
2
  import * as vscode from 'vscode-languageserver-protocol';
3
3
  import { NullableResult } from '@volar/language-service';
4
- export declare function register(context: LanguageServiceRuntimeContext): (uri: string) => NullableResult<vscode.Location[]>;
4
+ export declare function register(context: LanguageServicePluginContext): (uri: string) => NullableResult<vscode.Location[]>;
@@ -1,3 +1,3 @@
1
- import type { LanguageServiceRuntimeContext } from '../types';
1
+ import type { LanguageServicePluginContext } from '../types';
2
2
  import type * as _ from 'vscode-languageserver-protocol';
3
- export declare function register(context: LanguageServiceRuntimeContext): (oldUri: string, newUri: string) => Promise<_.WorkspaceEdit | undefined>;
3
+ export declare function register(context: LanguageServicePluginContext): (oldUri: string, newUri: string) => Promise<_.WorkspaceEdit | undefined>;
@@ -34,7 +34,7 @@ function register(context) {
34
34
  continue;
35
35
  const workspaceEdit = yield plugin.doFileRename(oldUri, newUri);
36
36
  if (workspaceEdit) {
37
- const result = (0, rename_1.embeddedEditToSourceEdit)(workspaceEdit, context.documents);
37
+ const result = (0, rename_1.embeddedEditToSourceEdit)(workspaceEdit, context.documents, 'fileName');
38
38
  if (result === null || result === void 0 ? void 0 : result.documentChanges) {
39
39
  result.documentChanges = dedupe.withDocumentChanges(result.documentChanges);
40
40
  }
@@ -1,3 +1,3 @@
1
1
  import * as vscode from 'vscode-languageserver-protocol';
2
- import type { LanguageServiceRuntimeContext } from '../types';
3
- export declare function register(context: LanguageServiceRuntimeContext): (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>;
2
+ import type { LanguageServicePluginContext } from '../types';
3
+ export declare function register(context: LanguageServicePluginContext): (uri: string, position: vscode.Position) => Promise<vscode.Hover | undefined>;
@@ -1,3 +1,3 @@
1
1
  import * as vscode from 'vscode-languageserver-protocol';
2
- import type { LanguageServiceRuntimeContext } from '../types';
3
- export declare function register(context: LanguageServiceRuntimeContext): (uri: string, range: vscode.Range) => Promise<vscode.InlayHint[] | undefined>;
2
+ import type { LanguageServicePluginContext } from '../types';
3
+ export declare function register(context: LanguageServicePluginContext): (uri: string, range: vscode.Range) => Promise<vscode.InlayHint[] | undefined>;
@@ -1,3 +1,3 @@
1
1
  import * as vscode from 'vscode-languageserver-protocol';
2
- import type { LanguageServiceRuntimeContext } from '../types';
3
- export declare function register(context: LanguageServiceRuntimeContext): (uri: string, position: vscode.Position) => Promise<vscode.Location[] | undefined>;
2
+ import type { LanguageServicePluginContext } from '../types';
3
+ export declare function register(context: LanguageServicePluginContext): (uri: string, position: vscode.Position) => Promise<vscode.Location[] | undefined>;
@@ -1,6 +1,6 @@
1
1
  import * as vscode from 'vscode-languageserver-protocol';
2
- import type { LanguageServiceRuntimeContext } from '../types';
2
+ import type { LanguageServicePluginContext } from '../types';
3
3
  import { DocumentsAndSourceMaps } from '../documents';
4
- export declare function register(context: LanguageServiceRuntimeContext): (uri: string, position: vscode.Position, newName: string) => Promise<vscode.WorkspaceEdit | undefined>;
4
+ export declare function register(context: LanguageServicePluginContext): (uri: string, position: vscode.Position, newName: string) => Promise<vscode.WorkspaceEdit | undefined>;
5
5
  export declare function mergeWorkspaceEdits(original: vscode.WorkspaceEdit, ...others: vscode.WorkspaceEdit[]): void;
6
- export declare function embeddedEditToSourceEdit(tsResult: vscode.WorkspaceEdit, vueDocuments: DocumentsAndSourceMaps): vscode.WorkspaceEdit | undefined;
6
+ export declare function embeddedEditToSourceEdit(tsResult: vscode.WorkspaceEdit, documents: DocumentsAndSourceMaps, mode: 'fileName' | 'rename' | 'codeAction' | 'format', versions?: Record<string, number>): vscode.WorkspaceEdit | undefined;