@volar/language-service 2.2.4 → 2.3.0-alpha.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.
- package/index.d.ts +1 -2
- package/index.js +2 -41
- package/lib/documents.d.ts +20 -18
- package/lib/documents.js +7 -5
- package/lib/features/provideAutoInsertSnippet.d.ts +8 -0
- package/lib/features/{provideAutoInsertionEdit.js → provideAutoInsertSnippet.js} +6 -15
- package/lib/features/provideCallHierarchyItems.d.ts +5 -4
- package/lib/features/provideCallHierarchyItems.js +18 -17
- package/lib/features/provideCodeActions.d.ts +4 -3
- package/lib/features/provideCodeActions.js +9 -9
- package/lib/features/provideCodeLenses.d.ts +4 -3
- package/lib/features/provideCodeLenses.js +9 -9
- package/lib/features/provideColorPresentations.d.ts +3 -2
- package/lib/features/provideColorPresentations.js +5 -5
- package/lib/features/provideCompletionItems.d.ts +4 -3
- package/lib/features/provideCompletionItems.js +26 -25
- package/lib/features/provideDefinition.d.ts +3 -2
- package/lib/features/provideDefinition.js +6 -5
- package/lib/features/provideDiagnostics.d.ts +4 -3
- package/lib/features/provideDiagnostics.js +13 -11
- package/lib/features/provideDocumentColors.d.ts +3 -2
- package/lib/features/provideDocumentColors.js +2 -2
- package/lib/features/provideDocumentDropEdits.d.ts +3 -2
- package/lib/features/provideDocumentDropEdits.js +3 -3
- package/lib/features/provideDocumentFormattingEdits.d.ts +3 -2
- package/lib/features/provideDocumentFormattingEdits.js +18 -16
- package/lib/features/provideDocumentHighlights.d.ts +3 -2
- package/lib/features/provideDocumentHighlights.js +9 -8
- package/lib/features/provideDocumentLinks.d.ts +4 -3
- package/lib/features/provideDocumentLinks.js +6 -6
- package/lib/features/provideDocumentSemanticTokens.d.ts +3 -2
- package/lib/features/provideDocumentSemanticTokens.js +3 -3
- package/lib/features/provideDocumentSymbols.d.ts +3 -2
- package/lib/features/provideDocumentSymbols.js +5 -5
- package/lib/features/provideFileReferences.d.ts +3 -2
- package/lib/features/provideFileReferences.js +8 -7
- package/lib/features/provideFileRenameEdits.d.ts +3 -2
- package/lib/features/provideFileRenameEdits.js +6 -6
- package/lib/features/provideFoldingRanges.d.ts +3 -2
- package/lib/features/provideFoldingRanges.js +4 -4
- package/lib/features/provideHover.d.ts +3 -2
- package/lib/features/provideHover.js +7 -7
- package/lib/features/provideInlayHints.d.ts +4 -3
- package/lib/features/provideInlayHints.js +6 -6
- package/lib/features/provideLinkedEditingRanges.d.ts +3 -2
- package/lib/features/provideLinkedEditingRanges.js +5 -5
- package/lib/features/provideReferences.d.ts +3 -2
- package/lib/features/provideReferences.js +9 -8
- package/lib/features/provideRenameEdits.d.ts +3 -2
- package/lib/features/provideRenameEdits.js +5 -4
- package/lib/features/provideRenameRange.d.ts +3 -2
- package/lib/features/provideRenameRange.js +4 -4
- package/lib/features/provideSelectionRanges.d.ts +3 -2
- package/lib/features/provideSelectionRanges.js +3 -3
- package/lib/features/provideSignatureHelp.d.ts +3 -2
- package/lib/features/provideSignatureHelp.js +6 -6
- package/lib/features/provideWorkspaceSymbols.d.ts +2 -2
- package/lib/features/provideWorkspaceSymbols.js +6 -5
- package/lib/features/resolveCodeAction.d.ts +2 -2
- package/lib/features/resolveCodeAction.js +4 -4
- package/lib/features/resolveCodeLens.d.ts +2 -2
- package/lib/features/resolveCodeLens.js +6 -5
- package/lib/features/resolveCompletionItem.d.ts +2 -2
- package/lib/features/resolveCompletionItem.js +7 -6
- package/lib/features/resolveDocumentLink.d.ts +2 -2
- package/lib/features/resolveDocumentLink.js +4 -4
- package/lib/features/resolveInlayHint.d.ts +2 -2
- package/lib/features/resolveInlayHint.js +3 -3
- package/lib/languageService.d.ts +37 -32
- package/lib/languageService.js +42 -29
- package/lib/types.d.ts +77 -36
- package/lib/utils/common.js +6 -12
- package/lib/utils/dedupe.d.ts +1 -1
- package/lib/utils/featureWorkers.d.ts +7 -6
- package/lib/utils/featureWorkers.js +25 -18
- package/lib/utils/transform.d.ts +7 -6
- package/lib/utils/transform.js +18 -15
- package/lib/utils/uriMap.d.ts +3 -0
- package/lib/utils/uriMap.js +69 -0
- package/package.json +3 -3
- package/lib/features/provideAutoInsertionEdit.d.ts +0 -7
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
+
const language_core_1 = require("@volar/language-core");
|
|
4
5
|
const SemanticTokensBuilder_1 = require("../utils/SemanticTokensBuilder");
|
|
5
6
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
7
|
const common_1 = require("../utils/common");
|
|
7
8
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
8
|
-
const language_core_1 = require("@volar/language-core");
|
|
9
9
|
function register(context) {
|
|
10
10
|
return async (uri, range, legend, token = cancellation_1.NoneCancellationToken, _reportProgress) => {
|
|
11
11
|
const sourceScript = context.language.scripts.get(uri);
|
|
@@ -27,11 +27,11 @@ function register(context) {
|
|
|
27
27
|
end: map.embeddedDocument.positionAt(mapped.end),
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
}, (
|
|
30
|
+
}, (plugin, document, range) => {
|
|
31
31
|
if (token?.isCancellationRequested) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return plugin[1].provideDocumentSemanticTokens?.(document, range, legend, token);
|
|
35
35
|
}, (tokens, map) => {
|
|
36
36
|
if (!map) {
|
|
37
37
|
return tokens;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { ServiceContext } from '../types';
|
|
2
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
|
-
|
|
2
|
+
import type { URI } from 'vscode-uri';
|
|
3
|
+
import type { LanguageServiceContext } from '../types';
|
|
4
|
+
export declare function register(context: LanguageServiceContext): (uri: URI, token?: vscode.CancellationToken) => Promise<vscode.DocumentSymbol[] | undefined>;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const
|
|
5
|
-
const common_1 = require("../utils/common");
|
|
4
|
+
const language_core_1 = require("@volar/language-core");
|
|
6
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
|
+
const common_1 = require("../utils/common");
|
|
7
|
+
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
7
8
|
const transform_1 = require("../utils/transform");
|
|
8
|
-
const language_core_1 = require("@volar/language-core");
|
|
9
9
|
function register(context) {
|
|
10
10
|
return (uri, token = cancellation_1.NoneCancellationToken) => {
|
|
11
|
-
return (0, featureWorkers_1.documentFeatureWorker)(context, uri, map => map.map.mappings.some(mapping => (0, language_core_1.isSymbolsEnabled)(mapping.data)), async (
|
|
11
|
+
return (0, featureWorkers_1.documentFeatureWorker)(context, uri, map => map.map.mappings.some(mapping => (0, language_core_1.isSymbolsEnabled)(mapping.data)), async (plugin, document) => {
|
|
12
12
|
if (token.isCancellationRequested) {
|
|
13
13
|
return;
|
|
14
14
|
}
|
|
15
|
-
return
|
|
15
|
+
return plugin[1].provideDocumentSymbols?.(document, token);
|
|
16
16
|
}, (data, map) => {
|
|
17
17
|
if (!map) {
|
|
18
18
|
return data;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { NullableProviderResult, ServiceContext } from '../types';
|
|
2
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
|
-
|
|
2
|
+
import { URI } from 'vscode-uri';
|
|
3
|
+
import type { NullableProviderResult, LanguageServiceContext } from '../types';
|
|
4
|
+
export declare function register(context: LanguageServiceContext): (uri: URI, token?: vscode.CancellationToken) => NullableProviderResult<vscode.Location[]>;
|
|
@@ -1,21 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
5
|
-
const dedupe = require("../utils/dedupe");
|
|
6
|
-
const common_1 = require("../utils/common");
|
|
7
|
-
const cancellation_1 = require("../utils/cancellation");
|
|
8
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
6
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
7
|
+
const common_1 = require("../utils/common");
|
|
8
|
+
const dedupe = require("../utils/dedupe");
|
|
9
|
+
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
9
10
|
function register(context) {
|
|
10
11
|
return (uri, token = cancellation_1.NoneCancellationToken) => {
|
|
11
|
-
return (0, featureWorkers_1.documentFeatureWorker)(context, uri, () => true, async (
|
|
12
|
+
return (0, featureWorkers_1.documentFeatureWorker)(context, uri, () => true, async (plugin, document) => {
|
|
12
13
|
if (token.isCancellationRequested) {
|
|
13
14
|
return;
|
|
14
15
|
}
|
|
15
|
-
return await
|
|
16
|
+
return await plugin[1].provideFileReferences?.(document, token) ?? [];
|
|
16
17
|
}, data => data
|
|
17
18
|
.map(reference => {
|
|
18
|
-
const decoded = context.decodeEmbeddedDocumentUri(reference.uri);
|
|
19
|
+
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(reference.uri));
|
|
19
20
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
20
21
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
21
22
|
if (!virtualCode) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { URI } from 'vscode-uri';
|
|
2
|
+
import type { LanguageServiceContext } from '../types';
|
|
2
3
|
import type * as _ from 'vscode-languageserver-protocol';
|
|
3
|
-
export declare function register(context:
|
|
4
|
+
export declare function register(context: LanguageServiceContext): (oldUri: URI, newUri: URI, token?: _.CancellationToken) => Promise<_.WorkspaceEdit | undefined>;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const transform_1 = require("../utils/transform");
|
|
5
|
-
const dedupe = require("../utils/dedupe");
|
|
6
4
|
const cancellation_1 = require("../utils/cancellation");
|
|
5
|
+
const dedupe = require("../utils/dedupe");
|
|
6
|
+
const transform_1 = require("../utils/transform");
|
|
7
7
|
function register(context) {
|
|
8
8
|
return async (oldUri, newUri, token = cancellation_1.NoneCancellationToken) => {
|
|
9
|
-
for (const
|
|
10
|
-
if (context.disabledServicePlugins.has(
|
|
9
|
+
for (const plugin of context.plugins) {
|
|
10
|
+
if (context.disabledServicePlugins.has(plugin[1])) {
|
|
11
11
|
continue;
|
|
12
12
|
}
|
|
13
13
|
if (token.isCancellationRequested) {
|
|
14
14
|
break;
|
|
15
15
|
}
|
|
16
|
-
if (!
|
|
16
|
+
if (!plugin[1].provideFileRenameEdits) {
|
|
17
17
|
continue;
|
|
18
18
|
}
|
|
19
|
-
const workspaceEdit = await
|
|
19
|
+
const workspaceEdit = await plugin[1].provideFileRenameEdits(oldUri, newUri, token);
|
|
20
20
|
if (workspaceEdit) {
|
|
21
21
|
const result = (0, transform_1.transformWorkspaceEdit)(workspaceEdit, context, 'fileName');
|
|
22
22
|
if (result?.documentChanges) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { URI } from 'vscode-uri';
|
|
2
|
+
import type { LanguageServiceContext } from '../types';
|
|
2
3
|
import type * as _ from 'vscode-languageserver-protocol';
|
|
3
|
-
export declare function register(context:
|
|
4
|
+
export declare function register(context: LanguageServiceContext): (uri: URI, token?: _.CancellationToken) => Promise<_.FoldingRange[] | undefined>;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const
|
|
4
|
+
const language_core_1 = require("@volar/language-core");
|
|
5
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
|
+
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
6
7
|
const transform_1 = require("../utils/transform");
|
|
7
|
-
const language_core_1 = require("@volar/language-core");
|
|
8
8
|
function register(context) {
|
|
9
9
|
return (uri, token = cancellation_1.NoneCancellationToken) => {
|
|
10
|
-
return (0, featureWorkers_1.documentFeatureWorker)(context, uri, map => map.map.mappings.some(mapping => (0, language_core_1.isFoldingRangesEnabled)(mapping.data)), (
|
|
10
|
+
return (0, featureWorkers_1.documentFeatureWorker)(context, uri, map => map.map.mappings.some(mapping => (0, language_core_1.isFoldingRangesEnabled)(mapping.data)), (plugin, document) => {
|
|
11
11
|
if (token.isCancellationRequested) {
|
|
12
12
|
return;
|
|
13
13
|
}
|
|
14
|
-
return
|
|
14
|
+
return plugin[1].provideFoldingRanges?.(document, token);
|
|
15
15
|
}, (data, map) => {
|
|
16
16
|
if (!map) {
|
|
17
17
|
return data;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { URI } from 'vscode-uri';
|
|
3
|
+
import type { LanguageServiceContext } from '../types';
|
|
4
|
+
export declare function register(context: LanguageServiceContext): (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Hover | undefined>;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const
|
|
5
|
-
const common_1 = require("../utils/common");
|
|
6
|
-
const provideDiagnostics_1 = require("./provideDiagnostics");
|
|
4
|
+
const language_core_1 = require("@volar/language-core");
|
|
7
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
|
+
const common_1 = require("../utils/common");
|
|
7
|
+
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
8
8
|
const transform_1 = require("../utils/transform");
|
|
9
|
-
const
|
|
9
|
+
const provideDiagnostics_1 = require("./provideDiagnostics");
|
|
10
10
|
function register(context) {
|
|
11
11
|
return async (uri, position, token = cancellation_1.NoneCancellationToken) => {
|
|
12
|
-
let hover = await (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, map => map.getGeneratedPositions(position, language_core_1.isHoverEnabled), (
|
|
12
|
+
let hover = await (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, map => map.getGeneratedPositions(position, language_core_1.isHoverEnabled), (plugin, document, position) => {
|
|
13
13
|
if (token.isCancellationRequested) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return plugin[1].provideHover?.(document, position, token);
|
|
17
17
|
}, (item, map) => {
|
|
18
18
|
if (!map || !item.range) {
|
|
19
19
|
return item;
|
|
@@ -27,7 +27,7 @@ function register(context) {
|
|
|
27
27
|
},
|
|
28
28
|
range: hovers.find(hover => hover.range && (0, common_1.isInsideRange)(hover.range, { start: position, end: position }))?.range ?? hovers[0].range,
|
|
29
29
|
}));
|
|
30
|
-
const markups = provideDiagnostics_1.errorMarkups
|
|
30
|
+
const markups = provideDiagnostics_1.errorMarkups.get(uri);
|
|
31
31
|
if (markups) {
|
|
32
32
|
for (const errorAndMarkup of markups) {
|
|
33
33
|
if ((0, common_1.isInsideRange)(errorAndMarkup.error.range, { start: position, end: position })) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
2
|
+
import type { URI } from 'vscode-uri';
|
|
3
|
+
import type { LanguageServiceContext } from '../types';
|
|
3
4
|
export interface InlayHintData {
|
|
4
5
|
uri: string;
|
|
5
6
|
original: Pick<vscode.CodeAction, 'data' | 'edit'>;
|
|
6
|
-
|
|
7
|
+
pluginIndex: number;
|
|
7
8
|
}
|
|
8
|
-
export declare function register(context:
|
|
9
|
+
export declare function register(context: LanguageServiceContext): (uri: URI, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.InlayHint[] | undefined>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
+
const language_core_1 = require("@volar/language-core");
|
|
5
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
4
6
|
const common_1 = require("../utils/common");
|
|
5
7
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
6
|
-
const cancellation_1 = require("../utils/cancellation");
|
|
7
8
|
const transform_1 = require("../utils/transform");
|
|
8
|
-
const language_core_1 = require("@volar/language-core");
|
|
9
9
|
function register(context) {
|
|
10
10
|
return async (uri, range, token = cancellation_1.NoneCancellationToken) => {
|
|
11
11
|
const sourceScript = context.language.scripts.get(uri);
|
|
@@ -20,18 +20,18 @@ function register(context) {
|
|
|
20
20
|
end: map.embeddedDocument.positionAt(mapped.end),
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
}, async (
|
|
23
|
+
}, async (plugin, document, arg) => {
|
|
24
24
|
if (token.isCancellationRequested) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
27
|
-
const hints = await
|
|
27
|
+
const hints = await plugin[1].provideInlayHints?.(document, arg, token);
|
|
28
28
|
hints?.forEach(link => {
|
|
29
29
|
link.data = {
|
|
30
|
-
uri,
|
|
30
|
+
uri: uri.toString(),
|
|
31
31
|
original: {
|
|
32
32
|
data: link.data,
|
|
33
33
|
},
|
|
34
|
-
|
|
34
|
+
pluginIndex: context.plugins.indexOf(plugin),
|
|
35
35
|
};
|
|
36
36
|
});
|
|
37
37
|
return hints;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import type { ServiceContext } from '../types';
|
|
2
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
|
-
|
|
2
|
+
import type { URI } from 'vscode-uri';
|
|
3
|
+
import type { LanguageServiceContext } from '../types';
|
|
4
|
+
export declare function register(context: LanguageServiceContext): (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LinkedEditingRanges | undefined>;
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
5
|
-
const common_1 = require("../utils/common");
|
|
6
|
-
const cancellation_1 = require("../utils/cancellation");
|
|
7
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
6
|
+
const common_1 = require("../utils/common");
|
|
7
|
+
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
8
8
|
function register(context) {
|
|
9
9
|
return (uri, position, token = cancellation_1.NoneCancellationToken) => {
|
|
10
10
|
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, function* (map) {
|
|
11
11
|
for (const pos of map.getGeneratedPositions(position, language_core_1.isLinkedEditingEnabled)) {
|
|
12
12
|
yield pos;
|
|
13
13
|
}
|
|
14
|
-
}, (
|
|
14
|
+
}, (plugin, document, position) => {
|
|
15
15
|
if (token.isCancellationRequested) {
|
|
16
16
|
return;
|
|
17
17
|
}
|
|
18
|
-
return
|
|
18
|
+
return plugin[1].provideLinkedEditingRanges?.(document, position, token);
|
|
19
19
|
}, (ranges, map) => {
|
|
20
20
|
if (!map) {
|
|
21
21
|
return ranges;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import { URI } from 'vscode-uri';
|
|
3
|
+
import type { LanguageServiceContext } from '../types';
|
|
4
|
+
export declare function register(context: LanguageServiceContext): (uri: URI, position: vscode.Position, referenceContext: vscode.ReferenceContext, token?: vscode.CancellationToken) => Promise<vscode.Location[] | undefined>;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
5
|
-
const dedupe = require("../utils/dedupe");
|
|
6
|
-
const cancellation_1 = require("../utils/cancellation");
|
|
7
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
6
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
7
|
+
const dedupe = require("../utils/dedupe");
|
|
8
|
+
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
8
9
|
function register(context) {
|
|
9
10
|
return (uri, position, referenceContext, token = cancellation_1.NoneCancellationToken) => {
|
|
10
|
-
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, map => map.getGeneratedPositions(position, language_core_1.isReferencesEnabled), async (
|
|
11
|
+
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, map => map.getGeneratedPositions(position, language_core_1.isReferencesEnabled), async (plugin, document, position) => {
|
|
11
12
|
if (token.isCancellationRequested) {
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
@@ -16,18 +17,18 @@ function register(context) {
|
|
|
16
17
|
await withLinkedCode(document, position);
|
|
17
18
|
return result;
|
|
18
19
|
async function withLinkedCode(document, position) {
|
|
19
|
-
if (!
|
|
20
|
+
if (!plugin[1].provideReferences) {
|
|
20
21
|
return;
|
|
21
22
|
}
|
|
22
23
|
if (recursiveChecker.has({ uri: document.uri, range: { start: position, end: position } })) {
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
25
26
|
recursiveChecker.add({ uri: document.uri, range: { start: position, end: position } });
|
|
26
|
-
const references = await
|
|
27
|
+
const references = await plugin[1].provideReferences(document, position, referenceContext, token) ?? [];
|
|
27
28
|
for (const reference of references) {
|
|
28
29
|
let foundMirrorPosition = false;
|
|
29
30
|
recursiveChecker.add({ uri: reference.uri, range: { start: reference.range.start, end: reference.range.start } });
|
|
30
|
-
const decoded = context.decodeEmbeddedDocumentUri(reference.uri);
|
|
31
|
+
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(reference.uri));
|
|
31
32
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
32
33
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
33
34
|
const linkedCodeMap = virtualCode && sourceScript
|
|
@@ -50,7 +51,7 @@ function register(context) {
|
|
|
50
51
|
}, data => {
|
|
51
52
|
const results = [];
|
|
52
53
|
for (const reference of data) {
|
|
53
|
-
const decoded = context.decodeEmbeddedDocumentUri(reference.uri);
|
|
54
|
+
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(reference.uri));
|
|
54
55
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
55
56
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
56
57
|
if (virtualCode) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import { URI } from 'vscode-uri';
|
|
3
|
+
import type { LanguageServiceContext } from '../types';
|
|
4
|
+
export declare function register(context: LanguageServiceContext): (uri: URI, position: vscode.Position, newName: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceEdit | undefined>;
|
|
4
5
|
export declare function mergeWorkspaceEdits(original: vscode.WorkspaceEdit, ...others: vscode.WorkspaceEdit[]): void;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeWorkspaceEdits = exports.register = void 0;
|
|
4
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
5
6
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
7
|
const dedupe = require("../utils/dedupe");
|
|
7
8
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
@@ -20,7 +21,7 @@ function register(context) {
|
|
|
20
21
|
};
|
|
21
22
|
}
|
|
22
23
|
;
|
|
23
|
-
}, async (
|
|
24
|
+
}, async (plugin, document, params) => {
|
|
24
25
|
if (token.isCancellationRequested) {
|
|
25
26
|
return;
|
|
26
27
|
}
|
|
@@ -29,14 +30,14 @@ function register(context) {
|
|
|
29
30
|
await withLinkedCode(document, params.position, params.newName);
|
|
30
31
|
return result;
|
|
31
32
|
async function withLinkedCode(document, position, newName) {
|
|
32
|
-
if (!
|
|
33
|
+
if (!plugin[1].provideRenameEdits) {
|
|
33
34
|
return;
|
|
34
35
|
}
|
|
35
36
|
if (recursiveChecker.has({ uri: document.uri, range: { start: position, end: position } })) {
|
|
36
37
|
return;
|
|
37
38
|
}
|
|
38
39
|
recursiveChecker.add({ uri: document.uri, range: { start: position, end: position } });
|
|
39
|
-
const workspaceEdit = await
|
|
40
|
+
const workspaceEdit = await plugin[1].provideRenameEdits(document, position, newName, token);
|
|
40
41
|
if (!workspaceEdit) {
|
|
41
42
|
return;
|
|
42
43
|
}
|
|
@@ -49,7 +50,7 @@ function register(context) {
|
|
|
49
50
|
for (const textEdit of textEdits) {
|
|
50
51
|
let foundMirrorPosition = false;
|
|
51
52
|
recursiveChecker.add({ uri: editUri, range: { start: textEdit.range.start, end: textEdit.range.start } });
|
|
52
|
-
const decoded = context.decodeEmbeddedDocumentUri(editUri);
|
|
53
|
+
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(editUri));
|
|
53
54
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
54
55
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
55
56
|
const linkedCodeMap = virtualCode && sourceScript
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { URI } from 'vscode-uri';
|
|
3
|
+
import type { LanguageServiceContext } from '../types';
|
|
4
|
+
export declare function register(context: LanguageServiceContext): (uri: URI, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.Range | {
|
|
4
5
|
range: vscode.Range;
|
|
5
6
|
placeholder: string;
|
|
6
7
|
} | {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
5
|
-
const cancellation_1 = require("../utils/cancellation");
|
|
6
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
6
|
+
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
7
7
|
function register(context) {
|
|
8
8
|
return (uri, position, token = cancellation_1.NoneCancellationToken) => {
|
|
9
|
-
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, map => map.getGeneratedPositions(position, language_core_1.isRenameEnabled), (
|
|
9
|
+
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, map => map.getGeneratedPositions(position, language_core_1.isRenameEnabled), (plugin, document, position) => {
|
|
10
10
|
if (token.isCancellationRequested) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
|
-
return
|
|
13
|
+
return plugin[1].provideRenameRange?.(document, position, token);
|
|
14
14
|
}, (item, map) => {
|
|
15
15
|
if (!map) {
|
|
16
16
|
return item;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { URI } from 'vscode-uri';
|
|
3
|
+
import type { LanguageServiceContext } from '../types';
|
|
4
|
+
export declare function register(context: LanguageServiceContext): (uri: URI, positions: vscode.Position[], token?: vscode.CancellationToken) => Promise<vscode.SelectionRange[] | undefined>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
+
const language_core_1 = require("@volar/language-core");
|
|
4
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
5
6
|
const common_1 = require("../utils/common");
|
|
6
7
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
7
8
|
const transform_1 = require("../utils/transform");
|
|
8
|
-
const language_core_1 = require("@volar/language-core");
|
|
9
9
|
function register(context) {
|
|
10
10
|
return (uri, positions, token = cancellation_1.NoneCancellationToken) => {
|
|
11
11
|
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => positions, function* (map) {
|
|
@@ -15,11 +15,11 @@ function register(context) {
|
|
|
15
15
|
if (result.length) {
|
|
16
16
|
yield result;
|
|
17
17
|
}
|
|
18
|
-
}, (
|
|
18
|
+
}, (plugin, document, positions) => {
|
|
19
19
|
if (token.isCancellationRequested) {
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
return
|
|
22
|
+
return plugin[1].provideSelectionRanges?.(document, positions, token);
|
|
23
23
|
}, (data, map) => {
|
|
24
24
|
if (!map) {
|
|
25
25
|
return data;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type { URI } from 'vscode-uri';
|
|
3
|
+
import type { LanguageServiceContext } from '../types';
|
|
4
|
+
export declare function register(context: LanguageServiceContext): (uri: URI, position: vscode.Position, signatureHelpContext?: vscode.SignatureHelpContext, token?: vscode.CancellationToken) => Promise<vscode.SignatureHelp | undefined>;
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
5
|
-
const cancellation_1 = require("../utils/cancellation");
|
|
6
4
|
const language_core_1 = require("@volar/language-core");
|
|
5
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
6
|
+
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
7
7
|
function register(context) {
|
|
8
8
|
return (uri, position, signatureHelpContext = {
|
|
9
9
|
triggerKind: 1,
|
|
10
10
|
isRetrigger: false,
|
|
11
11
|
}, token = cancellation_1.NoneCancellationToken) => {
|
|
12
|
-
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, map => map.getGeneratedPositions(position, language_core_1.isSignatureHelpEnabled), (
|
|
12
|
+
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, () => position, map => map.getGeneratedPositions(position, language_core_1.isSignatureHelpEnabled), (plugin, document, position) => {
|
|
13
13
|
if (token.isCancellationRequested) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
16
|
if (signatureHelpContext?.triggerKind === 2
|
|
17
17
|
&& signatureHelpContext.triggerCharacter
|
|
18
18
|
&& !(signatureHelpContext.isRetrigger
|
|
19
|
-
?
|
|
20
|
-
:
|
|
19
|
+
? plugin[0].capabilities.signatureHelpProvider?.retriggerCharacters
|
|
20
|
+
: plugin[0].capabilities.signatureHelpProvider?.triggerCharacters)?.includes(signatureHelpContext.triggerCharacter)) {
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
|
-
return
|
|
23
|
+
return plugin[1].provideSignatureHelp?.(document, position, signatureHelpContext, token);
|
|
24
24
|
}, data => data);
|
|
25
25
|
};
|
|
26
26
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { LanguageServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: LanguageServiceContext): (query: string, token?: vscode.CancellationToken) => Promise<vscode.WorkspaceSymbol[]>;
|
|
@@ -4,25 +4,26 @@ exports.register = void 0;
|
|
|
4
4
|
const common_1 = require("../utils/common");
|
|
5
5
|
const cancellation_1 = require("../utils/cancellation");
|
|
6
6
|
const transform_1 = require("../utils/transform");
|
|
7
|
+
const vscode_uri_1 = require("vscode-uri");
|
|
7
8
|
function register(context) {
|
|
8
9
|
return async (query, token = cancellation_1.NoneCancellationToken) => {
|
|
9
10
|
const symbolsList = [];
|
|
10
|
-
for (const
|
|
11
|
-
if (context.disabledServicePlugins.has(
|
|
11
|
+
for (const plugin of context.plugins) {
|
|
12
|
+
if (context.disabledServicePlugins.has(plugin[1])) {
|
|
12
13
|
continue;
|
|
13
14
|
}
|
|
14
15
|
if (token.isCancellationRequested) {
|
|
15
16
|
break;
|
|
16
17
|
}
|
|
17
|
-
if (!
|
|
18
|
+
if (!plugin[1].provideWorkspaceSymbols) {
|
|
18
19
|
continue;
|
|
19
20
|
}
|
|
20
|
-
const embeddedSymbols = await
|
|
21
|
+
const embeddedSymbols = await plugin[1].provideWorkspaceSymbols(query, token);
|
|
21
22
|
if (!embeddedSymbols) {
|
|
22
23
|
continue;
|
|
23
24
|
}
|
|
24
25
|
const symbols = embeddedSymbols.map(symbol => (0, transform_1.transformWorkspaceSymbol)(symbol, loc => {
|
|
25
|
-
const decoded = context.decodeEmbeddedDocumentUri(loc.uri);
|
|
26
|
+
const decoded = context.decodeEmbeddedDocumentUri(vscode_uri_1.URI.parse(loc.uri));
|
|
26
27
|
const sourceScript = decoded && context.language.scripts.get(decoded[0]);
|
|
27
28
|
const virtualCode = decoded && sourceScript?.generated?.embeddedCodes.get(decoded[1]);
|
|
28
29
|
if (virtualCode) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { LanguageServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: LanguageServiceContext): (item: vscode.CodeAction, token?: vscode.CancellationToken) => Promise<vscode.CodeAction>;
|
|
@@ -7,13 +7,13 @@ function register(context) {
|
|
|
7
7
|
return async (item, token = cancellation_1.NoneCancellationToken) => {
|
|
8
8
|
const data = item.data;
|
|
9
9
|
if (data) {
|
|
10
|
-
const
|
|
11
|
-
if (!
|
|
10
|
+
const plugin = context.plugins[data.pluginIndex];
|
|
11
|
+
if (!plugin[1].resolveCodeAction) {
|
|
12
12
|
return item;
|
|
13
13
|
}
|
|
14
14
|
Object.assign(item, data.original);
|
|
15
|
-
item = await
|
|
16
|
-
item =
|
|
15
|
+
item = await plugin[1].resolveCodeAction(item, token);
|
|
16
|
+
item = plugin[1].transformCodeAction?.(item)
|
|
17
17
|
?? (item.edit
|
|
18
18
|
? {
|
|
19
19
|
...item,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function register(context:
|
|
2
|
+
import type { LanguageServiceContext } from '../types';
|
|
3
|
+
export declare function register(context: LanguageServiceContext): (item: vscode.CodeLens, token?: vscode.CancellationToken) => Promise<vscode.CodeLens>;
|