@volar/language-service 1.6.4 → 1.6.6
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/out/baseLanguageService.d.ts +1 -1
- package/out/baseLanguageService.js +30 -12
- package/out/documentFeatures/colorPresentations.d.ts +1 -1
- package/out/documentFeatures/colorPresentations.js +2 -2
- package/out/documentFeatures/documentColors.d.ts +1 -1
- package/out/documentFeatures/documentColors.js +6 -3
- package/out/documentFeatures/documentSymbols.d.ts +1 -1
- package/out/documentFeatures/documentSymbols.js +2 -2
- package/out/documentFeatures/foldingRanges.d.ts +2 -2
- package/out/documentFeatures/foldingRanges.js +2 -2
- package/out/documentFeatures/format.d.ts +1 -1
- package/out/documentFeatures/format.js +16 -7
- package/out/documentFeatures/linkedEditingRanges.d.ts +1 -1
- package/out/documentFeatures/linkedEditingRanges.js +2 -2
- package/out/documentFeatures/selectionRanges.d.ts +1 -1
- package/out/documentFeatures/selectionRanges.js +2 -2
- package/out/documents.d.ts +1 -1
- package/out/index.d.ts +1 -1
- package/out/languageFeatures/autoInsert.d.ts +1 -1
- package/out/languageFeatures/autoInsert.js +2 -2
- package/out/languageFeatures/callHierarchy.d.ts +1 -1
- package/out/languageFeatures/callHierarchy.js +2 -2
- package/out/languageFeatures/codeActionResolve.d.ts +1 -1
- package/out/languageFeatures/codeActionResolve.js +2 -2
- package/out/languageFeatures/codeActions.d.ts +1 -1
- package/out/languageFeatures/codeActions.js +6 -3
- package/out/languageFeatures/codeLens.d.ts +1 -1
- package/out/languageFeatures/codeLens.js +9 -6
- package/out/languageFeatures/codeLensResolve.d.ts +1 -1
- package/out/languageFeatures/codeLensResolve.js +2 -2
- package/out/languageFeatures/complete.d.ts +1 -1
- package/out/languageFeatures/complete.js +3 -3
- package/out/languageFeatures/completeResolve.d.ts +1 -1
- package/out/languageFeatures/completeResolve.js +2 -2
- package/out/languageFeatures/definition.d.ts +1 -1
- package/out/languageFeatures/definition.js +10 -4
- package/out/languageFeatures/documentHighlights.d.ts +1 -1
- package/out/languageFeatures/documentHighlights.js +2 -2
- package/out/languageFeatures/documentLinkResolve.d.ts +1 -1
- package/out/languageFeatures/documentLinkResolve.js +2 -2
- package/out/languageFeatures/documentLinks.d.ts +1 -1
- package/out/languageFeatures/documentLinks.js +2 -2
- package/out/languageFeatures/documentSemanticTokens.d.ts +1 -1
- package/out/languageFeatures/documentSemanticTokens.js +6 -3
- package/out/languageFeatures/fileReferences.d.ts +1 -1
- package/out/languageFeatures/fileReferences.js +2 -2
- package/out/languageFeatures/fileRename.js +2 -2
- package/out/languageFeatures/hover.d.ts +1 -1
- package/out/languageFeatures/hover.js +10 -10
- package/out/languageFeatures/inlayHintResolve.d.ts +1 -1
- package/out/languageFeatures/inlayHintResolve.js +2 -2
- package/out/languageFeatures/inlayHints.d.ts +1 -1
- package/out/languageFeatures/inlayHints.js +6 -3
- package/out/languageFeatures/references.d.ts +1 -1
- package/out/languageFeatures/references.js +2 -2
- package/out/languageFeatures/rename.d.ts +1 -1
- package/out/languageFeatures/rename.js +30 -16
- package/out/languageFeatures/renamePrepare.d.ts +1 -1
- package/out/languageFeatures/renamePrepare.js +5 -9
- package/out/languageFeatures/signatureHelp.d.ts +1 -1
- package/out/languageFeatures/signatureHelp.js +4 -4
- package/out/languageFeatures/validation.d.ts +1 -1
- package/out/languageFeatures/validation.js +2 -6
- package/out/languageFeatures/workspaceSymbols.d.ts +1 -1
- package/out/languageFeatures/workspaceSymbols.js +3 -3
- package/out/legend.d.ts +2 -0
- package/out/legend.js +44 -0
- package/out/transformer/completionItem.d.ts +1 -1
- package/out/transformer/completionList.d.ts +1 -1
- package/out/transformer/documentSymbol.d.ts +1 -1
- package/out/transformer/foldingRanges.d.ts +1 -1
- package/out/transformer/hover.d.ts +1 -1
- package/out/transformer/locationLike.d.ts +1 -1
- package/out/transformer/locationsLike.d.ts +1 -1
- package/out/transformer/selectionRange.d.ts +1 -1
- package/out/transformer/selectionRanges.d.ts +1 -1
- package/out/transformer/textEdit.d.ts +1 -1
- package/out/transformer/textEdit.js +2 -3
- package/out/transformer/workspaceSymbol.d.ts +1 -1
- package/out/transformer/workspaceSymbol.js +1 -2
- package/out/types.d.ts +4 -7
- package/out/utils/cancellation.d.ts +2 -0
- package/out/utils/cancellation.js +8 -0
- package/package.json +9 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LanguageServiceHost } from '@volar/language-core';
|
|
2
2
|
import { Config, ServiceContext, ServiceEnvironment } from './types';
|
|
3
3
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
4
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
4
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
5
5
|
export type LanguageService = ReturnType<typeof createLanguageServiceBase>;
|
|
6
6
|
export declare function createLanguageService(modules: {
|
|
7
7
|
typescript?: typeof import('typescript/lib/tsserverlibrary');
|
|
@@ -36,7 +36,6 @@ const foldingRanges = require("./documentFeatures/foldingRanges");
|
|
|
36
36
|
const format = require("./documentFeatures/format");
|
|
37
37
|
const linkedEditingRanges = require("./documentFeatures/linkedEditingRanges");
|
|
38
38
|
const selectionRanges = require("./documentFeatures/selectionRanges");
|
|
39
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
40
39
|
const common_1 = require("./utils/common");
|
|
41
40
|
function createLanguageService(modules, env, config, host, documentRegistry) {
|
|
42
41
|
const languageContext = (0, language_core_1.createLanguageContext)(modules, host, Object.values(config.languages ?? {}).filter(common_1.notEmpty));
|
|
@@ -63,7 +62,7 @@ function createLanguageServicePluginContext(modules, env, config, host, language
|
|
|
63
62
|
if (created.projectUpdated) {
|
|
64
63
|
let scriptFileNames = new Set(host.getScriptFileNames());
|
|
65
64
|
env.onDidChangeWatchedFiles?.((params) => {
|
|
66
|
-
if (params.changes.some(change => change.type !==
|
|
65
|
+
if (params.changes.some(change => change.type !== 2)) {
|
|
67
66
|
scriptFileNames = new Set(host.getScriptFileNames());
|
|
68
67
|
}
|
|
69
68
|
for (const change of params.changes) {
|
|
@@ -95,7 +94,14 @@ function createLanguageServicePluginContext(modules, env, config, host, language
|
|
|
95
94
|
if (!source) {
|
|
96
95
|
return;
|
|
97
96
|
}
|
|
98
|
-
return
|
|
97
|
+
return {
|
|
98
|
+
title: '',
|
|
99
|
+
command: 'editor.action.rename',
|
|
100
|
+
arguments: [
|
|
101
|
+
source.uri,
|
|
102
|
+
source.position,
|
|
103
|
+
],
|
|
104
|
+
};
|
|
99
105
|
},
|
|
100
106
|
is(command) {
|
|
101
107
|
return command.command === 'editor.action.rename';
|
|
@@ -121,7 +127,15 @@ function createLanguageServicePluginContext(modules, env, config, host, language
|
|
|
121
127
|
sourceReferences.push(reference);
|
|
122
128
|
}
|
|
123
129
|
}
|
|
124
|
-
return
|
|
130
|
+
return {
|
|
131
|
+
title: locations.length === 1 ? '1 reference' : `${locations.length} references`,
|
|
132
|
+
command: 'editor.action.showReferences',
|
|
133
|
+
arguments: [
|
|
134
|
+
source.uri,
|
|
135
|
+
source.position,
|
|
136
|
+
sourceReferences,
|
|
137
|
+
],
|
|
138
|
+
};
|
|
125
139
|
},
|
|
126
140
|
is(command) {
|
|
127
141
|
return command.command === 'editor.action.showReferences';
|
|
@@ -129,14 +143,18 @@ function createLanguageServicePluginContext(modules, env, config, host, language
|
|
|
129
143
|
},
|
|
130
144
|
setSelection: {
|
|
131
145
|
create(position) {
|
|
132
|
-
return
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
146
|
+
return {
|
|
147
|
+
title: '',
|
|
148
|
+
command: 'setSelection',
|
|
149
|
+
arguments: [{
|
|
150
|
+
selection: {
|
|
151
|
+
selectionStartLineNumber: position.line + 1,
|
|
152
|
+
positionLineNumber: position.line + 1,
|
|
153
|
+
selectionStartColumn: position.character + 1,
|
|
154
|
+
positionColumn: position.character + 1,
|
|
155
|
+
},
|
|
156
|
+
}],
|
|
157
|
+
};
|
|
140
158
|
},
|
|
141
159
|
is(command) {
|
|
142
160
|
return command.command === 'setSelection';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ServiceContext } from '../types';
|
|
2
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
3
|
export declare function register(context: ServiceContext): (uri: string, color: vscode.Color, range: vscode.Range, token?: vscode.CancellationToken) => Promise<vscode.ColorPresentation[] | undefined>;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
4
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
5
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
6
5
|
const common_1 = require("../utils/common");
|
|
6
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
7
7
|
function register(context) {
|
|
8
|
-
return (uri, color, range, token =
|
|
8
|
+
return (uri, color, range, token = cancellation_1.NoneCancellationToken) => {
|
|
9
9
|
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, range, (range, map, file) => {
|
|
10
10
|
if (file.capabilities.documentSymbol) // TODO: add color capability setting
|
|
11
11
|
return map.toGeneratedRanges(range);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ServiceContext } from '../types';
|
|
2
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
3
|
export declare function register(context: ServiceContext): (uri: string, token?: vscode.CancellationToken) => Promise<vscode.ColorInformation[] | undefined>;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
4
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
5
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
6
5
|
const common_1 = require("../utils/common");
|
|
6
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
7
7
|
function register(context) {
|
|
8
|
-
return (uri, token =
|
|
8
|
+
return (uri, token = cancellation_1.NoneCancellationToken) => {
|
|
9
9
|
return (0, featureWorkers_1.documentFeatureWorker)(context, uri, file => !!file.capabilities.documentSymbol, // TODO: add color capability setting
|
|
10
10
|
(service, document) => {
|
|
11
11
|
if (token.isCancellationRequested)
|
|
@@ -14,7 +14,10 @@ function register(context) {
|
|
|
14
14
|
}, (data, map) => map ? data.map(color => {
|
|
15
15
|
const range = map.toSourceRange(color.range);
|
|
16
16
|
if (range) {
|
|
17
|
-
return
|
|
17
|
+
return {
|
|
18
|
+
range,
|
|
19
|
+
color: color.color,
|
|
20
|
+
};
|
|
18
21
|
}
|
|
19
22
|
}).filter(common_1.notEmpty) : data, arr => arr.flat());
|
|
20
23
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ServiceContext } from '../types';
|
|
2
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
3
|
export declare function register(context: ServiceContext): (uri: string, token?: vscode.CancellationToken) => Promise<vscode.DocumentSymbol[] | undefined>;
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.register = void 0;
|
|
4
4
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
5
5
|
const transformer = require("../transformer");
|
|
6
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
7
6
|
const common_1 = require("../utils/common");
|
|
7
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
8
8
|
function register(context) {
|
|
9
|
-
return (uri, token =
|
|
9
|
+
return (uri, token = cancellation_1.NoneCancellationToken) => {
|
|
10
10
|
return (0, featureWorkers_1.documentFeatureWorker)(context, uri, file => !!file.capabilities.documentSymbol, async (service, document) => {
|
|
11
11
|
if (token.isCancellationRequested)
|
|
12
12
|
return;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ServiceContext } from '../types';
|
|
2
|
-
import * as
|
|
3
|
-
export declare function register(context: ServiceContext): (uri: string, token?:
|
|
2
|
+
import type * as _ from 'vscode-languageserver-protocol';
|
|
3
|
+
export declare function register(context: ServiceContext): (uri: string, token?: _.CancellationToken) => Promise<_.FoldingRange[] | undefined>;
|
|
@@ -3,9 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.register = void 0;
|
|
4
4
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
5
5
|
const transformer = require("../transformer");
|
|
6
|
-
const
|
|
6
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
7
7
|
function register(context) {
|
|
8
|
-
return (uri, token =
|
|
8
|
+
return (uri, token = cancellation_1.NoneCancellationToken) => {
|
|
9
9
|
return (0, featureWorkers_1.documentFeatureWorker)(context, uri, file => !!file.capabilities.foldingRange, (service, document) => {
|
|
10
10
|
if (token.isCancellationRequested)
|
|
11
11
|
return;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
1
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
2
|
import type { ServiceContext } from '../types';
|
|
3
3
|
export declare function register(context: ServiceContext): (uri: string, options: vscode.FormattingOptions, range: vscode.Range | undefined, onTypeParams: {
|
|
4
4
|
ch: string;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
5
4
|
const vscode_languageserver_textdocument_1 = require("vscode-languageserver-textdocument");
|
|
6
5
|
const common_1 = require("../utils/common");
|
|
6
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
7
7
|
function register(context) {
|
|
8
|
-
return async (uri, options, range, onTypeParams, token =
|
|
8
|
+
return async (uri, options, range, onTypeParams, token = cancellation_1.NoneCancellationToken) => {
|
|
9
9
|
let document = context.getTextDocument(uri);
|
|
10
10
|
if (!document)
|
|
11
11
|
return;
|
|
12
|
-
range ??=
|
|
12
|
+
range ??= {
|
|
13
|
+
start: document.positionAt(0),
|
|
14
|
+
end: document.positionAt(document.getText().length),
|
|
15
|
+
};
|
|
13
16
|
const source = context.documents.getSourceByUri(document.uri);
|
|
14
17
|
if (!source) {
|
|
15
18
|
return onTypeParams
|
|
@@ -134,8 +137,14 @@ function register(context) {
|
|
|
134
137
|
}
|
|
135
138
|
if (document.getText() === originalDocument.getText())
|
|
136
139
|
return;
|
|
137
|
-
const editRange =
|
|
138
|
-
|
|
140
|
+
const editRange = {
|
|
141
|
+
start: originalDocument.positionAt(0),
|
|
142
|
+
end: originalDocument.positionAt(originalDocument.getText().length),
|
|
143
|
+
};
|
|
144
|
+
const textEdit = {
|
|
145
|
+
range: editRange,
|
|
146
|
+
newText: document.getText(),
|
|
147
|
+
};
|
|
139
148
|
return [textEdit];
|
|
140
149
|
function getEmbeddedFilesByLevel(rootFile, level) {
|
|
141
150
|
const embeddedFilesByLevel = [[rootFile]];
|
|
@@ -156,12 +165,12 @@ function register(context) {
|
|
|
156
165
|
break;
|
|
157
166
|
let edits;
|
|
158
167
|
try {
|
|
159
|
-
if (ch !== undefined &&
|
|
168
|
+
if (ch !== undefined && 'line' in formatRange && 'character' in formatRange) {
|
|
160
169
|
if (service.autoFormatTriggerCharacters?.includes(ch)) {
|
|
161
170
|
edits = await service.provideOnTypeFormattingEdits?.(document, formatRange, ch, options, token);
|
|
162
171
|
}
|
|
163
172
|
}
|
|
164
|
-
else if (ch === undefined &&
|
|
173
|
+
else if (ch === undefined && 'start' in formatRange && 'end' in formatRange) {
|
|
165
174
|
edits = await service.provideDocumentFormattingEdits?.(document, formatRange, options, token);
|
|
166
175
|
}
|
|
167
176
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ServiceContext } from '../types';
|
|
2
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
3
|
export declare function register(context: ServiceContext): (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LinkedEditingRanges | undefined>;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
4
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
5
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
6
5
|
const common_1 = require("../utils/common");
|
|
6
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
7
7
|
function register(context) {
|
|
8
|
-
return (uri, position, token =
|
|
8
|
+
return (uri, position, token = cancellation_1.NoneCancellationToken) => {
|
|
9
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;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { ServiceContext } from '../types';
|
|
2
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
3
3
|
export declare function register(context: ServiceContext): (uri: string, positions: vscode.Position[], token?: vscode.CancellationToken) => Promise<vscode.SelectionRange[] | undefined>;
|
|
@@ -3,10 +3,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.register = void 0;
|
|
4
4
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
5
5
|
const transformer = require("../transformer");
|
|
6
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
7
6
|
const common_1 = require("../utils/common");
|
|
7
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
8
8
|
function register(context) {
|
|
9
|
-
return (uri, positions, token =
|
|
9
|
+
return (uri, positions, token = cancellation_1.NoneCancellationToken) => {
|
|
10
10
|
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, positions, (positions, map, file) => {
|
|
11
11
|
if (file.capabilities.documentFormatting) {
|
|
12
12
|
const result = positions
|
package/out/documents.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { VirtualFiles, VirtualFile, FileRangeCapabilities, MirrorBehaviorCapabilities, MirrorMap, LanguageServiceHost } from '@volar/language-core';
|
|
2
2
|
import { Mapping, SourceMap } from '@volar/source-map';
|
|
3
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
3
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
4
4
|
import { TextDocument } from 'vscode-languageserver-textdocument';
|
|
5
5
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
6
6
|
import { ServiceEnvironment } from './types';
|
package/out/index.d.ts
CHANGED
|
@@ -4,5 +4,5 @@ export * from './documents';
|
|
|
4
4
|
export { mergeWorkspaceEdits } from './languageFeatures/rename';
|
|
5
5
|
export * from './types';
|
|
6
6
|
export * as transformer from './transformer';
|
|
7
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
7
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
8
8
|
export declare const standardSemanticTokensLegend: vscode.SemanticTokensLegend;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
1
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
2
|
import type { ServiceContext, AutoInsertionContext } from '../types';
|
|
3
3
|
export declare function register(context: ServiceContext): (uri: string, position: vscode.Position, autoInsertContext: AutoInsertionContext, token?: vscode.CancellationToken) => Promise<NonNullable<string | vscode.TextEdit | null | undefined> | undefined>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
5
4
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
5
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
6
6
|
function register(context) {
|
|
7
|
-
return (uri, position, autoInsertContext, token =
|
|
7
|
+
return (uri, position, autoInsertContext, token = cancellation_1.NoneCancellationToken) => {
|
|
8
8
|
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, { position, autoInsertContext }, function* (arg, map) {
|
|
9
9
|
for (const position of map.toGeneratedPositions(arg.position, data => !!data.completion)) {
|
|
10
10
|
const rangeOffset = map.map.toGeneratedOffset(arg.autoInsertContext.lastChange.rangeOffset)?.[0];
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
4
|
const path_1 = require("path");
|
|
5
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
6
5
|
const common_1 = require("../utils/common");
|
|
7
6
|
const dedupe = require("../utils/dedupe");
|
|
8
7
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
8
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
9
9
|
function register(context) {
|
|
10
10
|
return {
|
|
11
|
-
doPrepare(uri, position, token =
|
|
11
|
+
doPrepare(uri, position, token = cancellation_1.NoneCancellationToken) {
|
|
12
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;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
1
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
2
|
import type { ServiceContext } from '../types';
|
|
3
3
|
export declare function register(context: ServiceContext): (item: vscode.CodeAction, token?: vscode.CancellationToken) => Promise<vscode.CodeAction>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
5
4
|
const rename_1 = require("./rename");
|
|
5
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
6
6
|
function register(context) {
|
|
7
|
-
return async (item, token =
|
|
7
|
+
return async (item, token = cancellation_1.NoneCancellationToken) => {
|
|
8
8
|
const data = item.data;
|
|
9
9
|
if (data?.type === 'service') {
|
|
10
10
|
const service = context.services[data.serviceId];
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
4
|
const transformer = require("../transformer");
|
|
5
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
6
5
|
const common_1 = require("../utils/common");
|
|
7
6
|
const dedupe = require("../utils/dedupe");
|
|
8
7
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
9
8
|
const rename_1 = require("./rename");
|
|
9
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
10
10
|
function register(context) {
|
|
11
|
-
return async (uri, range, codeActionContext, token =
|
|
11
|
+
return async (uri, range, codeActionContext, token = cancellation_1.NoneCancellationToken) => {
|
|
12
12
|
const sourceDocument = context.getTextDocument(uri);
|
|
13
13
|
if (!sourceDocument)
|
|
14
14
|
return;
|
|
@@ -38,7 +38,10 @@ function register(context) {
|
|
|
38
38
|
}
|
|
39
39
|
if (minStart !== undefined && maxEnd !== undefined) {
|
|
40
40
|
return [{
|
|
41
|
-
range:
|
|
41
|
+
range: {
|
|
42
|
+
start: map.virtualFileDocument.positionAt(minStart),
|
|
43
|
+
end: map.virtualFileDocument.positionAt(maxEnd),
|
|
44
|
+
},
|
|
42
45
|
codeActionContext: _codeActionContext,
|
|
43
46
|
}];
|
|
44
47
|
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
4
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
5
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
6
5
|
const common_1 = require("../utils/common");
|
|
6
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
7
7
|
function register(context) {
|
|
8
|
-
return async (uri, token =
|
|
8
|
+
return async (uri, token = cancellation_1.NoneCancellationToken) => {
|
|
9
9
|
return await (0, featureWorkers_1.languageFeatureWorker)(context, uri, undefined, (arg) => [arg], async (service, document) => {
|
|
10
10
|
if (token.isCancellationRequested)
|
|
11
11
|
return;
|
|
@@ -22,11 +22,14 @@ function register(context) {
|
|
|
22
22
|
};
|
|
23
23
|
});
|
|
24
24
|
const ranges = await service.provideReferencesCodeLensRanges?.(document, token);
|
|
25
|
-
const referencesCodeLens = ranges?.map(range =>
|
|
26
|
-
kind: 'references',
|
|
27
|
-
uri,
|
|
25
|
+
const referencesCodeLens = ranges?.map(range => ({
|
|
28
26
|
range,
|
|
29
|
-
|
|
27
|
+
data: {
|
|
28
|
+
kind: 'references',
|
|
29
|
+
uri,
|
|
30
|
+
range,
|
|
31
|
+
serviceId: serviceId,
|
|
32
|
+
},
|
|
30
33
|
}));
|
|
31
34
|
codeLens = [
|
|
32
35
|
...codeLens ?? [],
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
1
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
2
|
import type { ServiceContext } from '../types';
|
|
3
3
|
export declare function register(context: ServiceContext): (item: vscode.CodeLens, token?: vscode.CancellationToken) => Promise<vscode.CodeLens>;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
5
4
|
const references = require("./references");
|
|
5
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
6
6
|
function register(context) {
|
|
7
7
|
const findReferences = references.register(context);
|
|
8
|
-
return async (item, token =
|
|
8
|
+
return async (item, token = cancellation_1.NoneCancellationToken) => {
|
|
9
9
|
const data = item.data;
|
|
10
10
|
if (data?.kind === 'normal') {
|
|
11
11
|
const service = context.services[data.serviceId];
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
4
|
const transformer = require("../transformer");
|
|
5
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
6
5
|
const definePlugin_1 = require("../utils/definePlugin");
|
|
6
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
7
7
|
function register(context) {
|
|
8
8
|
let cache;
|
|
9
|
-
return async (uri, position, completionContext = { triggerKind:
|
|
9
|
+
return async (uri, position, completionContext = { triggerKind: 1, }, token = cancellation_1.NoneCancellationToken) => {
|
|
10
10
|
let document;
|
|
11
|
-
if (completionContext?.triggerKind ===
|
|
11
|
+
if (completionContext?.triggerKind === 3
|
|
12
12
|
&& cache?.uri === uri) {
|
|
13
13
|
for (const cacheData of cache.data) {
|
|
14
14
|
if (!cacheData.list.isIncomplete)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
1
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
2
|
import type { ServiceContext } from '../types';
|
|
3
3
|
export declare function register(context: ServiceContext): (item: vscode.CompletionItem, token?: vscode.CancellationToken) => Promise<vscode.CompletionItem>;
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
4
|
const transformer = require("../transformer");
|
|
5
|
-
const
|
|
5
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
6
6
|
function register(context) {
|
|
7
|
-
return async (item, token =
|
|
7
|
+
return async (item, token = cancellation_1.NoneCancellationToken) => {
|
|
8
8
|
const data = item.data;
|
|
9
9
|
if (data) {
|
|
10
10
|
const service = context.services[data.serviceId];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
1
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
2
|
import type { ServiceContext } from '../types';
|
|
3
3
|
import { FileRangeCapabilities, MirrorBehaviorCapabilities } from '@volar/language-core';
|
|
4
4
|
export declare function register(context: ServiceContext, apiName: 'provideDefinition' | 'provideTypeDefinition' | 'provideImplementation', isValidMapping: (data: FileRangeCapabilities) => boolean, isValidMirrorPosition: (mirrorData: MirrorBehaviorCapabilities) => boolean): (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.LocationLink[] | undefined>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
5
4
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
6
5
|
const dedupe = require("../utils/dedupe");
|
|
7
6
|
const common_1 = require("../utils/common");
|
|
7
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
8
8
|
function register(context, apiName, isValidMapping, isValidMirrorPosition) {
|
|
9
|
-
return (uri, position, token =
|
|
9
|
+
return (uri, position, token = cancellation_1.NoneCancellationToken) => {
|
|
10
10
|
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, position, (position, map) => map.toGeneratedPositions(position, isValidMapping), async (service, document, position) => {
|
|
11
11
|
if (token.isCancellationRequested)
|
|
12
12
|
return;
|
|
@@ -74,8 +74,14 @@ function register(context, apiName, isValidMapping, isValidMirrorPosition) {
|
|
|
74
74
|
return {
|
|
75
75
|
...link,
|
|
76
76
|
targetUri: targetMap.sourceFileDocument.uri,
|
|
77
|
-
targetRange:
|
|
78
|
-
|
|
77
|
+
targetRange: {
|
|
78
|
+
start: { line: 0, character: 0 },
|
|
79
|
+
end: { line: 0, character: 0 },
|
|
80
|
+
},
|
|
81
|
+
targetSelectionRange: {
|
|
82
|
+
start: { line: 0, character: 0 },
|
|
83
|
+
end: { line: 0, character: 0 },
|
|
84
|
+
},
|
|
79
85
|
};
|
|
80
86
|
}
|
|
81
87
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
1
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
2
|
import type { ServiceContext } from '../types';
|
|
3
3
|
export declare function register(context: ServiceContext): (uri: string, position: vscode.Position, token?: vscode.CancellationToken) => Promise<vscode.DocumentHighlight[] | undefined>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
5
4
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
6
5
|
const dedupe = require("../utils/dedupe");
|
|
7
6
|
const common_1 = require("../utils/common");
|
|
7
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
8
8
|
function register(context) {
|
|
9
|
-
return (uri, position, token =
|
|
9
|
+
return (uri, position, token = cancellation_1.NoneCancellationToken) => {
|
|
10
10
|
return (0, featureWorkers_1.languageFeatureWorker)(context, uri, position, (position, map) => map.toGeneratedPositions(position,
|
|
11
11
|
// note https://github.com/johnsoncodehk/volar/issues/2009
|
|
12
12
|
data => typeof data.rename === 'object' ? !!data.rename.normalize : !!data.rename), async (service, document, position) => {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import * as vscode from 'vscode-languageserver-protocol';
|
|
1
|
+
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
2
|
import type { ServiceContext } from '../types';
|
|
3
3
|
export declare function register(context: ServiceContext): (item: vscode.CodeLens, token?: vscode.CancellationToken) => Promise<vscode.CodeLens>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const
|
|
4
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
5
5
|
function register(context) {
|
|
6
|
-
return async (item, token =
|
|
6
|
+
return async (item, token = cancellation_1.NoneCancellationToken) => {
|
|
7
7
|
const data = item.data;
|
|
8
8
|
if (data) {
|
|
9
9
|
const service = context.services[data.serviceId];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.register = void 0;
|
|
4
|
-
const vscode = require("vscode-languageserver-protocol");
|
|
5
4
|
const featureWorkers_1 = require("../utils/featureWorkers");
|
|
6
5
|
const common_1 = require("../utils/common");
|
|
6
|
+
const cancellation_1 = require("../utils/cancellation");
|
|
7
7
|
function register(context) {
|
|
8
|
-
return async (uri, token =
|
|
8
|
+
return async (uri, token = cancellation_1.NoneCancellationToken) => {
|
|
9
9
|
const pluginLinks = await (0, featureWorkers_1.documentFeatureWorker)(context, uri, file => !!file.capabilities.documentSymbol, async (service, document) => {
|
|
10
10
|
if (token.isCancellationRequested)
|
|
11
11
|
return;
|