@volar/language-service 1.0.22 → 1.1.0-1.2.0-alpha.1.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/out/baseLanguageService.d.ts +3 -11
- package/out/baseLanguageService.js +34 -24
- package/out/documentFeatures/documentSymbols.js +3 -5
- package/out/documentFeatures/foldingRanges.js +2 -2
- package/out/documentFeatures/format.js +7 -7
- package/out/documentFeatures/selectionRanges.js +2 -2
- package/out/documents.d.ts +3 -3
- package/out/documents.js +17 -24
- package/out/index.d.ts +1 -0
- package/out/index.js +2 -1
- package/out/languageFeatures/callHierarchy.d.ts +2 -2
- package/out/languageFeatures/callHierarchy.js +18 -21
- package/out/languageFeatures/codeActionResolve.js +4 -6
- package/out/languageFeatures/codeActions.d.ts +2 -2
- package/out/languageFeatures/codeActions.js +14 -7
- package/out/languageFeatures/codeLens.d.ts +4 -4
- package/out/languageFeatures/codeLens.js +16 -10
- package/out/languageFeatures/codeLensResolve.js +10 -4
- package/out/languageFeatures/complete.d.ts +2 -2
- package/out/languageFeatures/complete.js +34 -35
- package/out/languageFeatures/completeResolve.js +5 -7
- package/out/languageFeatures/definition.js +1 -1
- package/out/languageFeatures/executeCommand.d.ts +1 -1
- package/out/languageFeatures/executeCommand.js +1 -1
- package/out/languageFeatures/fileReferences.js +1 -1
- package/out/languageFeatures/fileRename.js +4 -3
- package/out/languageFeatures/inlayHints.js +2 -2
- package/out/languageFeatures/references.js +1 -1
- package/out/languageFeatures/rename.js +5 -5
- package/out/languageFeatures/renamePrepare.js +1 -6
- package/out/languageFeatures/validation copy.d.ts +7 -0
- package/out/languageFeatures/validation copy.js +234 -0
- package/out/languageFeatures/validation.d.ts +6 -0
- package/out/languageFeatures/validation.js +118 -41
- package/out/languageFeatures/workspaceSymbols.js +4 -4
- package/out/transformer/completionItem.d.ts +2 -0
- package/out/transformer/completionItem.js +12 -0
- package/out/transformer/completionList.d.ts +2 -0
- package/out/transformer/completionList.js +23 -0
- package/out/transformer/foldingRanges.d.ts +2 -0
- package/out/transformer/foldingRanges.js +24 -0
- package/out/transformer/hover.d.ts +2 -0
- package/out/transformer/hover.js +13 -0
- package/out/transformer/index.d.ts +11 -0
- package/out/transformer/index.js +25 -0
- package/out/transformer/locationLike.d.ts +4 -0
- package/out/transformer/locationLike.js +10 -0
- package/out/transformer/locationsLike.d.ts +4 -0
- package/out/transformer/locationsLike.js +11 -0
- package/out/transformer/selectionRange.d.ts +2 -0
- package/out/transformer/selectionRange.js +14 -0
- package/out/transformer/selectionRanges.d.ts +2 -0
- package/out/transformer/selectionRanges.js +11 -0
- package/out/transformer/symbolInformation.d.ts +2 -0
- package/out/transformer/symbolInformation.js +10 -0
- package/out/transformer/symbolInformations.d.ts +2 -0
- package/out/transformer/symbolInformations.js +11 -0
- package/out/transformer/textEdit.d.ts +2 -0
- package/out/transformer/textEdit.js +57 -0
- package/out/types.d.ts +45 -9
- package/out/types.js +0 -1
- package/out/utils/common.d.ts +0 -2
- package/out/utils/common.js +1 -28
- package/out/utils/definePlugin.js +2 -1
- package/out/utils/featureWorkers.d.ts +2 -1
- package/out/utils/featureWorkers.js +89 -6
- package/package.json +7 -8
package/out/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { LanguageContext, LanguageServiceHost } from '@volar/language-core';
|
|
1
|
+
import { LanguageContext, LanguageModule, LanguageServiceHost } from '@volar/language-core';
|
|
2
|
+
import { LanguageService } from '@volar/language-service';
|
|
2
3
|
import type * as ts from 'typescript/lib/tsserverlibrary';
|
|
3
4
|
import type { DocumentContext, FileSystemProvider } from 'vscode-html-languageservice';
|
|
4
5
|
import type { SchemaRequestService } from 'vscode-json-languageservice';
|
|
@@ -6,13 +7,8 @@ import type * as vscode from 'vscode-languageserver-protocol';
|
|
|
6
7
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
7
8
|
import { URI } from 'vscode-uri';
|
|
8
9
|
import { DocumentsAndSourceMaps } from './documents';
|
|
9
|
-
import { LanguageService } from '@volar/language-service';
|
|
10
10
|
export * from 'vscode-languageserver-protocol';
|
|
11
11
|
export interface LanguageServiceRuntimeContext<Host extends LanguageServiceHost = LanguageServiceHost> {
|
|
12
|
-
host: Host;
|
|
13
|
-
core: LanguageContext;
|
|
14
|
-
documents: DocumentsAndSourceMaps;
|
|
15
|
-
plugins: LanguageServicePluginInstance[];
|
|
16
12
|
typescript: {
|
|
17
13
|
module: typeof import('typescript/lib/tsserverlibrary');
|
|
18
14
|
languageServiceHost: ts.LanguageServiceHost;
|
|
@@ -21,10 +17,25 @@ export interface LanguageServiceRuntimeContext<Host extends LanguageServiceHost
|
|
|
21
17
|
env: {
|
|
22
18
|
rootUri: URI;
|
|
23
19
|
configurationHost?: ConfigurationHost;
|
|
24
|
-
documentContext
|
|
20
|
+
documentContext: DocumentContext;
|
|
25
21
|
fileSystemProvider?: FileSystemProvider;
|
|
26
22
|
schemaRequestService?: SchemaRequestService;
|
|
27
23
|
};
|
|
24
|
+
/** @private */
|
|
25
|
+
host: Host;
|
|
26
|
+
/** @private */
|
|
27
|
+
core: LanguageContext;
|
|
28
|
+
/** @private */
|
|
29
|
+
documents: DocumentsAndSourceMaps;
|
|
30
|
+
/** @private */
|
|
31
|
+
plugins: {
|
|
32
|
+
[id: string]: LanguageServicePluginInstance;
|
|
33
|
+
};
|
|
34
|
+
/** @private */
|
|
35
|
+
rules: {
|
|
36
|
+
[id: string]: Rule | undefined;
|
|
37
|
+
};
|
|
38
|
+
/** @private */
|
|
28
39
|
getTextDocument(uri: string): TextDocument | undefined;
|
|
29
40
|
}
|
|
30
41
|
export interface ConfigurationHost {
|
|
@@ -53,10 +64,13 @@ export interface ExecuteCommandContext {
|
|
|
53
64
|
}): Promise<void>;
|
|
54
65
|
applyEdit(paramOrEdit: vscode.ApplyWorkspaceEditParams | vscode.WorkspaceEdit): Promise<vscode.ApplyWorkspaceEditResult>;
|
|
55
66
|
}
|
|
56
|
-
export
|
|
67
|
+
export interface LanguageServicePlugin<T = {}> {
|
|
68
|
+
(context: LanguageServiceRuntimeContext, service: LanguageService): LanguageServicePluginInstance & T;
|
|
69
|
+
}
|
|
57
70
|
export interface LanguageServicePluginInstance {
|
|
58
71
|
setup?(context: LanguageServiceRuntimeContext): void;
|
|
59
72
|
validation?: {
|
|
73
|
+
resolveRuleContext?(context: RuleContext): void;
|
|
60
74
|
onSemantic?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
61
75
|
onSyntactic?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
62
76
|
onSuggestion?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
@@ -71,7 +85,7 @@ export interface LanguageServicePluginInstance {
|
|
|
71
85
|
findDocumentSymbols?(document: TextDocument): NullableResult<vscode.SymbolInformation[]>;
|
|
72
86
|
findDocumentSemanticTokens?(document: TextDocument, range: vscode.Range, legend: vscode.SemanticTokensLegend): NullableResult<SemanticToken[]>;
|
|
73
87
|
findWorkspaceSymbols?(query: string): NullableResult<vscode.SymbolInformation[]>;
|
|
74
|
-
doExecuteCommand?(command: string, args: any[], context: ExecuteCommandContext): NotNullableResult<void>;
|
|
88
|
+
doExecuteCommand?(command: string, args: any[] | undefined, context: ExecuteCommandContext): NotNullableResult<void>;
|
|
75
89
|
findDocumentColors?(document: TextDocument): NullableResult<vscode.ColorInformation[]>;
|
|
76
90
|
getColorPresentations?(document: TextDocument, color: vscode.Color, range: vscode.Range): NullableResult<vscode.ColorPresentation[]>;
|
|
77
91
|
doFileRename?(oldUri: string, newUri: string): NullableResult<vscode.WorkspaceEdit>;
|
|
@@ -124,3 +138,25 @@ export interface LanguageServicePluginInstance {
|
|
|
124
138
|
*/
|
|
125
139
|
resolveEmbeddedRange?(range: vscode.Range): vscode.Range | undefined;
|
|
126
140
|
}
|
|
141
|
+
export interface Rule {
|
|
142
|
+
onFormat?(ctx: RuleContext): void;
|
|
143
|
+
onSyntax?(ctx: RuleContext): void;
|
|
144
|
+
onSemantic?(ctx: RuleContext): void;
|
|
145
|
+
}
|
|
146
|
+
export interface RuleContext {
|
|
147
|
+
ruleId: string;
|
|
148
|
+
document: TextDocument;
|
|
149
|
+
report(error: vscode.Diagnostic, ...fixes: {
|
|
150
|
+
kinds?: string[];
|
|
151
|
+
getCodeActions(): NullableResult<vscode.CodeAction[]>;
|
|
152
|
+
resolveCodeAction?(codeAction: vscode.CodeAction): NotNullableResult<vscode.CodeAction>;
|
|
153
|
+
}[]): void;
|
|
154
|
+
}
|
|
155
|
+
export interface LanguageServiceConfig {
|
|
156
|
+
languages?: ConfigValue<LanguageModule>;
|
|
157
|
+
plugins?: ConfigValue<LanguageServicePlugin>;
|
|
158
|
+
rules?: ConfigValue<Rule>;
|
|
159
|
+
}
|
|
160
|
+
type ConfigValue<T> = {
|
|
161
|
+
[id: string]: T | undefined;
|
|
162
|
+
};
|
package/out/types.js
CHANGED
package/out/utils/common.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import type * as vscode from 'vscode-languageserver-protocol';
|
|
2
|
-
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
3
2
|
export declare function getOverlapRange(range1Start: number, range1End: number, range2Start: number, range2End: number): {
|
|
4
3
|
start: number;
|
|
5
4
|
end: number;
|
|
6
5
|
} | undefined;
|
|
7
6
|
export declare function isInsideRange(parent: vscode.Range, child: vscode.Range): boolean;
|
|
8
|
-
export declare function getWordRange(wordPattern: RegExp, position: vscode.Position, document: TextDocument): vscode.Range | undefined;
|
|
9
7
|
export declare function stringToSnapshot(str: string): ts.IScriptSnapshot;
|
package/out/utils/common.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.stringToSnapshot = exports.
|
|
2
|
+
exports.stringToSnapshot = exports.isInsideRange = exports.getOverlapRange = void 0;
|
|
3
3
|
function getOverlapRange(range1Start, range1End, range2Start, range2End) {
|
|
4
4
|
const start = Math.max(range1Start, range2Start);
|
|
5
5
|
const end = Math.min(range1End, range2End);
|
|
@@ -23,33 +23,6 @@ function isInsideRange(parent, child) {
|
|
|
23
23
|
return true;
|
|
24
24
|
}
|
|
25
25
|
exports.isInsideRange = isInsideRange;
|
|
26
|
-
function getWordRange(wordPattern, position, document) {
|
|
27
|
-
const lineStart = {
|
|
28
|
-
line: position.line,
|
|
29
|
-
character: 0,
|
|
30
|
-
};
|
|
31
|
-
const lineEnd = {
|
|
32
|
-
line: position.line + 1,
|
|
33
|
-
character: 0,
|
|
34
|
-
};
|
|
35
|
-
const offset = document.offsetAt(position);
|
|
36
|
-
const lineStartOffset = document.offsetAt(lineStart);
|
|
37
|
-
const lineText = document.getText({ start: lineStart, end: lineEnd });
|
|
38
|
-
for (const match of lineText.matchAll(wordPattern)) {
|
|
39
|
-
if (match.index === undefined)
|
|
40
|
-
continue;
|
|
41
|
-
const matchStart = match.index + lineStartOffset;
|
|
42
|
-
const matchEnd = matchStart + match[0].length;
|
|
43
|
-
if (offset >= matchStart && offset <= matchEnd) {
|
|
44
|
-
return {
|
|
45
|
-
start: document.positionAt(matchStart),
|
|
46
|
-
end: document.positionAt(matchEnd),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return undefined;
|
|
51
|
-
}
|
|
52
|
-
exports.getWordRange = getWordRange;
|
|
53
26
|
function stringToSnapshot(str) {
|
|
54
27
|
return {
|
|
55
28
|
getText: (start, end) => str.substring(start, end),
|
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.visitEmbedded = void 0;
|
|
12
12
|
function visitEmbedded(documents, current, cb, rootFile = current) {
|
|
13
|
+
var _a;
|
|
13
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14
15
|
for (const embedded of current.embeddedFiles) {
|
|
15
16
|
if (!(yield visitEmbedded(documents, embedded, cb, rootFile))) {
|
|
@@ -17,7 +18,7 @@ function visitEmbedded(documents, current, cb, rootFile = current) {
|
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
for (const [_, map] of documents.getMapsByVirtualFileName(current.fileName)) {
|
|
20
|
-
if (documents.
|
|
21
|
+
if (((_a = documents.getSourceByUri(map.sourceFileDocument.uri)) === null || _a === void 0 ? void 0 : _a.root) === rootFile) {
|
|
21
22
|
if (!(yield cb(current, map))) {
|
|
22
23
|
return false;
|
|
23
24
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { TextDocument } from 'vscode-languageserver-textdocument';
|
|
2
|
-
import type { LanguageServicePluginInstance, LanguageServiceRuntimeContext } from '../types';
|
|
2
|
+
import type { LanguageServicePluginInstance, LanguageServiceRuntimeContext, Rule, RuleContext } from '../types';
|
|
3
3
|
import { FileRangeCapabilities, VirtualFile } from '@volar/language-service';
|
|
4
4
|
import { SourceMapWithDocuments } from '../documents';
|
|
5
5
|
export declare function documentFeatureWorker<T>(context: LanguageServiceRuntimeContext, uri: string, isValidSourceMap: (file: VirtualFile, sourceMap: SourceMapWithDocuments<FileRangeCapabilities>) => boolean, worker: (plugin: LanguageServicePluginInstance, document: TextDocument) => T, transform: (result: NonNullable<Awaited<T>>, sourceMap: SourceMapWithDocuments<FileRangeCapabilities> | undefined) => Awaited<T> | undefined, combineResult?: (results: NonNullable<Awaited<T>>[]) => NonNullable<Awaited<T>>): Promise<NonNullable<Awaited<T>> | undefined>;
|
|
6
6
|
export declare function languageFeatureWorker<T, K>(context: LanguageServiceRuntimeContext, uri: string, arg: K, transformArg: (arg: K, sourceMap: SourceMapWithDocuments<FileRangeCapabilities>, file: VirtualFile) => Generator<K> | K[], worker: (plugin: LanguageServicePluginInstance, document: TextDocument, arg: K, sourceMap: SourceMapWithDocuments<FileRangeCapabilities> | undefined, file: VirtualFile | undefined) => T, transform: (result: NonNullable<Awaited<T>>, sourceMap: SourceMapWithDocuments<FileRangeCapabilities> | undefined) => Awaited<T> | undefined, combineResult?: (results: NonNullable<Awaited<T>>[]) => NonNullable<Awaited<T>>, reportProgress?: (result: NonNullable<Awaited<T>>) => void): Promise<NonNullable<Awaited<T>> | undefined>;
|
|
7
|
+
export declare function ruleWorker<T>(context: LanguageServiceRuntimeContext, uri: string, isValidSourceMap: (file: VirtualFile) => boolean, worker: (ruleName: string, rule: Rule, ruleCtx: RuleContext) => T, transform: (result: NonNullable<Awaited<T>>, sourceMap: SourceMapWithDocuments<FileRangeCapabilities> | undefined) => Awaited<T> | undefined, combineResult?: (results: NonNullable<Awaited<T>>[]) => NonNullable<Awaited<T>>, reportProgress?: (result: NonNullable<Awaited<T>>) => void): Promise<NonNullable<Awaited<T>> | undefined>;
|
|
@@ -8,13 +8,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.languageFeatureWorker = exports.documentFeatureWorker = void 0;
|
|
11
|
+
exports.ruleWorker = exports.languageFeatureWorker = exports.documentFeatureWorker = void 0;
|
|
12
12
|
const definePlugin_1 = require("./definePlugin");
|
|
13
13
|
function documentFeatureWorker(context, uri, isValidSourceMap, worker, transform, combineResult) {
|
|
14
14
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
|
-
return languageFeatureWorker(context, uri,
|
|
15
|
+
return languageFeatureWorker(context, uri, undefined, (_, map, file) => {
|
|
16
16
|
if (isValidSourceMap(file, map)) {
|
|
17
|
-
return [
|
|
17
|
+
return [undefined];
|
|
18
18
|
}
|
|
19
19
|
return [];
|
|
20
20
|
}, worker, transform, combineResult);
|
|
@@ -22,14 +22,15 @@ function documentFeatureWorker(context, uri, isValidSourceMap, worker, transform
|
|
|
22
22
|
}
|
|
23
23
|
exports.documentFeatureWorker = documentFeatureWorker;
|
|
24
24
|
function languageFeatureWorker(context, uri, arg, transformArg, worker, transform, combineResult, reportProgress) {
|
|
25
|
+
var _a;
|
|
25
26
|
return __awaiter(this, void 0, void 0, function* () {
|
|
26
27
|
const document = context.getTextDocument(uri);
|
|
27
|
-
const virtualFile = context.documents.
|
|
28
|
+
const virtualFile = (_a = context.documents.getSourceByUri(uri)) === null || _a === void 0 ? void 0 : _a.root;
|
|
28
29
|
let results = [];
|
|
29
30
|
if (virtualFile) {
|
|
30
31
|
yield (0, definePlugin_1.visitEmbedded)(context.documents, virtualFile, (file, map) => __awaiter(this, void 0, void 0, function* () {
|
|
31
32
|
for (const mappedArg of transformArg(arg, map, file)) {
|
|
32
|
-
for (const plugin of context.plugins) {
|
|
33
|
+
for (const plugin of Object.values(context.plugins)) {
|
|
33
34
|
const embeddedResult = yield worker(plugin, map.virtualFileDocument, mappedArg, map, file);
|
|
34
35
|
if (!embeddedResult)
|
|
35
36
|
continue;
|
|
@@ -49,7 +50,7 @@ function languageFeatureWorker(context, uri, arg, transformArg, worker, transfor
|
|
|
49
50
|
}));
|
|
50
51
|
}
|
|
51
52
|
else if (document) {
|
|
52
|
-
for (const plugin of context.plugins) {
|
|
53
|
+
for (const plugin of Object.values(context.plugins)) {
|
|
53
54
|
const embeddedResult = yield worker(plugin, document, arg, undefined, undefined);
|
|
54
55
|
if (!embeddedResult)
|
|
55
56
|
continue;
|
|
@@ -74,4 +75,86 @@ function languageFeatureWorker(context, uri, arg, transformArg, worker, transfor
|
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
77
|
exports.languageFeatureWorker = languageFeatureWorker;
|
|
78
|
+
function ruleWorker(context, uri, isValidSourceMap, worker, transform, combineResult, reportProgress) {
|
|
79
|
+
var _a, _b, _c;
|
|
80
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
const document = context.getTextDocument(uri);
|
|
82
|
+
const virtualFile = (_a = context.documents.getSourceByUri(uri)) === null || _a === void 0 ? void 0 : _a.root;
|
|
83
|
+
let results = [];
|
|
84
|
+
if (virtualFile) {
|
|
85
|
+
yield (0, definePlugin_1.visitEmbedded)(context.documents, virtualFile, (file, map) => __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
var _d, _e;
|
|
87
|
+
if (!isValidSourceMap(file)) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
const ruleCtx = {
|
|
91
|
+
ruleId: '',
|
|
92
|
+
document: map.virtualFileDocument,
|
|
93
|
+
report: () => { },
|
|
94
|
+
};
|
|
95
|
+
for (const plugin of Object.values(context.plugins)) {
|
|
96
|
+
(_e = (_d = plugin.validation) === null || _d === void 0 ? void 0 : _d.resolveRuleContext) === null || _e === void 0 ? void 0 : _e.call(_d, ruleCtx);
|
|
97
|
+
}
|
|
98
|
+
for (const ruleName in context.rules) {
|
|
99
|
+
const rule = context.rules[ruleName];
|
|
100
|
+
if (!rule) {
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
ruleCtx.ruleId = ruleName;
|
|
104
|
+
const embeddedResult = yield worker(ruleName, rule, ruleCtx);
|
|
105
|
+
if (!embeddedResult)
|
|
106
|
+
continue;
|
|
107
|
+
const result = transform(embeddedResult, map);
|
|
108
|
+
if (!result)
|
|
109
|
+
continue;
|
|
110
|
+
results.push(result);
|
|
111
|
+
if (!combineResult)
|
|
112
|
+
return false;
|
|
113
|
+
const isEmptyArray = Array.isArray(result) && result.length === 0;
|
|
114
|
+
if (reportProgress && !isEmptyArray) {
|
|
115
|
+
reportProgress(combineResult(results));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
return true;
|
|
119
|
+
}));
|
|
120
|
+
}
|
|
121
|
+
else if (document) {
|
|
122
|
+
const ruleCtx = {
|
|
123
|
+
ruleId: '',
|
|
124
|
+
document,
|
|
125
|
+
report: () => { },
|
|
126
|
+
};
|
|
127
|
+
for (const plugin of Object.values(context.plugins)) {
|
|
128
|
+
(_c = (_b = plugin.validation) === null || _b === void 0 ? void 0 : _b.resolveRuleContext) === null || _c === void 0 ? void 0 : _c.call(_b, ruleCtx);
|
|
129
|
+
}
|
|
130
|
+
for (const ruleName in context.rules) {
|
|
131
|
+
const rule = context.rules[ruleName];
|
|
132
|
+
if (!rule) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
ruleCtx.ruleId = ruleName;
|
|
136
|
+
const embeddedResult = yield worker(ruleName, rule, ruleCtx);
|
|
137
|
+
if (!embeddedResult)
|
|
138
|
+
continue;
|
|
139
|
+
const result = transform(embeddedResult, undefined);
|
|
140
|
+
if (!result)
|
|
141
|
+
continue;
|
|
142
|
+
results.push(result);
|
|
143
|
+
if (!combineResult)
|
|
144
|
+
break;
|
|
145
|
+
const isEmptyArray = Array.isArray(result) && result.length === 0;
|
|
146
|
+
if (reportProgress && !isEmptyArray) {
|
|
147
|
+
reportProgress(combineResult(results));
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (combineResult && results.length > 0) {
|
|
152
|
+
return combineResult(results);
|
|
153
|
+
}
|
|
154
|
+
else if (results.length > 0) {
|
|
155
|
+
return results[0];
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
exports.ruleWorker = ruleWorker;
|
|
77
160
|
//# sourceMappingURL=featureWorkers.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-service",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.1.0-1.2.0-alpha.1.0",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -9,20 +9,19 @@
|
|
|
9
9
|
],
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "https://github.com/
|
|
12
|
+
"url": "https://github.com/volarjs/volar.js.git",
|
|
13
13
|
"directory": "packages/language-service"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/language-core": "1.0.
|
|
17
|
-
"@volar/shared": "1.0.
|
|
18
|
-
"@volar/source-map": "1.0.
|
|
19
|
-
"@volar/
|
|
20
|
-
"@volar/typescript-faster": "1.0.22",
|
|
16
|
+
"@volar/language-core": "1.1.0-1.2.0-alpha.1.0",
|
|
17
|
+
"@volar/shared": "1.1.0-1.2.0-alpha.1.0",
|
|
18
|
+
"@volar/source-map": "1.1.0-1.2.0-alpha.1.0",
|
|
19
|
+
"@volar/typescript-faster": "1.1.0-1.2.0-alpha.1.0",
|
|
21
20
|
"vscode-html-languageservice": "^5.0.3",
|
|
22
21
|
"vscode-json-languageservice": "^5.1.3",
|
|
23
22
|
"vscode-languageserver-protocol": "^3.17.2",
|
|
24
23
|
"vscode-languageserver-textdocument": "^1.0.8",
|
|
25
24
|
"vscode-uri": "^3.0.7"
|
|
26
25
|
},
|
|
27
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "ffc1267f2766722751551182ce1e717be661247a"
|
|
28
27
|
}
|