@volar/language-service 1.4.0 → 1.4.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.
@@ -54,7 +54,7 @@ function register(context) {
54
54
  }, (inlayHints, map) => inlayHints.map((_inlayHint) => {
55
55
  if (!map)
56
56
  return _inlayHint;
57
- const position = map.toSourcePosition(_inlayHint.position);
57
+ const position = map.toSourcePosition(_inlayHint.position, data => !!data.semanticTokens /* todo */);
58
58
  const edits = _inlayHint.textEdits
59
59
  ?.map(textEdit => transformer.asTextEdit(textEdit, range => map.toSourceRange(range), map.virtualFileDocument))
60
60
  .filter(common_1.notEmpty);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volar/language-service",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "main": "out/index.js",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -13,8 +13,8 @@
13
13
  "directory": "packages/language-service"
14
14
  },
15
15
  "dependencies": {
16
- "@volar/language-core": "1.4.0",
17
- "@volar/source-map": "1.4.0",
16
+ "@volar/language-core": "1.4.1",
17
+ "@volar/source-map": "1.4.1",
18
18
  "typescript-auto-import-cache": "^0.2.1",
19
19
  "vscode-html-languageservice": "^5.0.4",
20
20
  "vscode-json-languageservice": "^5.2.0",
@@ -22,5 +22,5 @@
22
22
  "vscode-languageserver-textdocument": "^1.0.8",
23
23
  "vscode-uri": "^3.0.7"
24
24
  },
25
- "gitHead": "9bf14ef0d08c53f9ae32cf538d9748fa91cc4ab7"
25
+ "gitHead": "2c8a783542ace3292649a04490919b515e387b9e"
26
26
  }
@@ -1,3 +0,0 @@
1
- import * as vscode from 'vscode-languageserver-protocol';
2
- import type { LanguageServicePluginContext } from '../types';
3
- export declare function register(context: LanguageServicePluginContext): (item: vscode.CodeLens, token?: vscode.CancellationToken) => Promise<vscode.CodeLens>;
@@ -1,31 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.register = void 0;
4
- const vscode = require("vscode-languageserver-protocol");
5
- const references = require("./references");
6
- function register(context) {
7
- const findReferences = references.register(context);
8
- return async (item, token = vscode.CancellationToken.None) => {
9
- const data = item.data;
10
- if (data?.kind === 'normal') {
11
- const plugin = context.plugins[data.pluginId];
12
- if (!plugin.resolveCodeLens)
13
- return item;
14
- Object.assign(item, data.original);
15
- item = await plugin.resolveCodeLens(item, token);
16
- // item.range already transformed in codeLens request
17
- }
18
- if (data?.kind === 'references') {
19
- let references = await findReferences(data.uri, item.range.start, token) ?? [];
20
- const plugin = context.plugins[data.pluginId];
21
- const document = context.getTextDocument(data.uri);
22
- if (document && plugin.resolveReferencesCodeLensLocations) {
23
- references = await plugin.resolveReferencesCodeLensLocations(document, data.range, references, token);
24
- }
25
- item.command = context.commands.createShowReferencesCommand(data.uri, data.range.start, references);
26
- }
27
- return item;
28
- };
29
- }
30
- exports.register = register;
31
- //# sourceMappingURL=codeLensResolve%20copy.js.map
@@ -1,3 +0,0 @@
1
- import * as vscode from 'vscode-languageserver-protocol';
2
- import type { LanguageServicePluginContext } from '../types';
3
- export declare function register(context: LanguageServicePluginContext): (item: vscode.CodeLens, token?: vscode.CancellationToken) => Promise<vscode.CodeLens>;
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.register = void 0;
4
- const vscode = require("vscode-languageserver-protocol");
5
- function register(context) {
6
- return async (item, token = vscode.CancellationToken.None) => {
7
- const data = item.data;
8
- if (data) {
9
- const plugin = context.plugins[data.pluginId];
10
- if (!plugin.resolveDocumentLink)
11
- return item;
12
- Object.assign(item, data.original);
13
- item = await plugin.resolveDocumentLink(item, token);
14
- }
15
- return item;
16
- };
17
- }
18
- exports.register = register;
19
- //# sourceMappingURL=documentLinkResolve%20copy.js.map
@@ -1,8 +0,0 @@
1
- import * as vscode from 'vscode-languageserver-protocol';
2
- import type { LanguageServicePluginContext } from '../types';
3
- export interface DocumentLinkData {
4
- uri: string;
5
- original: Pick<vscode.DocumentLink, 'data'>;
6
- pluginId: string;
7
- }
8
- export declare function register(context: LanguageServicePluginContext): (uri: string, token?: vscode.CancellationToken) => Promise<vscode.DocumentLink[]>;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.register = void 0;
4
- const vscode = require("vscode-languageserver-protocol");
5
- const featureWorkers_1 = require("../utils/featureWorkers");
6
- const common_1 = require("../utils/common");
7
- function register(context) {
8
- return async (uri, token = vscode.CancellationToken.None) => {
9
- const pluginLinks = await (0, featureWorkers_1.documentFeatureWorker)(context, uri, file => !!file.capabilities.documentSymbol, async (plugin, document) => {
10
- if (token.isCancellationRequested)
11
- return;
12
- const links = await plugin.provideDocumentLinks?.(document, token);
13
- links?.forEach(link => {
14
- link.data = {
15
- uri,
16
- original: {
17
- data: link.data,
18
- },
19
- pluginId: Object.keys(context.plugins).find(key => context.plugins[key] === plugin),
20
- };
21
- });
22
- return links;
23
- }, (links, map) => links.map(link => {
24
- if (!map)
25
- return link;
26
- const range = map.toSourceRange(link.range);
27
- if (range) {
28
- return {
29
- ...link,
30
- range,
31
- };
32
- }
33
- }).filter(common_1.notEmpty), arr => arr.flat()) ?? [];
34
- const maps = context.documents.getMapsBySourceFileUri(uri);
35
- const fictitiousLinks = maps ? getFictitiousLinks(context.documents.getDocumentByUri(maps.snapshot, uri), maps.maps) : [];
36
- return [
37
- ...pluginLinks,
38
- ...fictitiousLinks,
39
- ];
40
- function getFictitiousLinks(document, maps) {
41
- const result = [];
42
- for (const [_, map] of maps) {
43
- for (const mapped of map.map.mappings) {
44
- if (!mapped.data.displayWithLink)
45
- continue;
46
- if (mapped.sourceRange[0] === mapped.sourceRange[1])
47
- continue;
48
- result.push({
49
- range: {
50
- start: document.positionAt(mapped.sourceRange[0]),
51
- end: document.positionAt(mapped.sourceRange[1]),
52
- },
53
- target: uri, // TODO
54
- });
55
- }
56
- }
57
- return result;
58
- }
59
- };
60
- }
61
- exports.register = register;
62
- //# sourceMappingURL=documentLinks%20copy.js.map