@volar/language-service 1.3.0-alpha.3 → 1.4.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/out/baseLanguageService.d.ts +37 -41
- package/out/baseLanguageService.js +11 -8
- package/out/documentFeatures/colorPresentations.d.ts +1 -1
- package/out/documentFeatures/colorPresentations.js +9 -4
- package/out/documentFeatures/documentColors.d.ts +1 -1
- package/out/documentFeatures/documentColors.js +9 -4
- package/out/documentFeatures/documentSymbols.d.ts +1 -1
- package/out/documentFeatures/documentSymbols.js +8 -4
- package/out/documentFeatures/foldingRanges.d.ts +2 -2
- package/out/documentFeatures/foldingRanges.js +7 -2
- package/out/documentFeatures/format.d.ts +2 -2
- package/out/documentFeatures/format.js +12 -6
- package/out/documentFeatures/linkedEditingRanges.d.ts +1 -1
- package/out/documentFeatures/linkedEditingRanges.js +9 -4
- package/out/documentFeatures/selectionRanges.d.ts +1 -1
- package/out/documentFeatures/selectionRanges.js +9 -4
- package/out/documents.js +2 -2
- package/out/index.d.ts +2 -0
- package/out/index.js +41 -1
- package/out/languageFeatures/autoInsert.d.ts +2 -2
- package/out/languageFeatures/autoInsert.js +7 -2
- package/out/languageFeatures/callHierarchy.d.ts +3 -3
- package/out/languageFeatures/callHierarchy.js +15 -13
- package/out/languageFeatures/codeActionResolve.d.ts +2 -2
- package/out/languageFeatures/codeActionResolve.js +7 -7
- package/out/languageFeatures/codeActions.d.ts +1 -1
- package/out/languageFeatures/codeActions.js +7 -6
- package/out/languageFeatures/codeLens.d.ts +1 -1
- package/out/languageFeatures/codeLens.js +8 -6
- package/out/languageFeatures/codeLensResolve.d.ts +1 -1
- package/out/languageFeatures/codeLensResolve.js +7 -7
- package/out/languageFeatures/complete.d.ts +1 -1
- package/out/languageFeatures/complete.js +29 -23
- package/out/languageFeatures/completeResolve.d.ts +1 -1
- package/out/languageFeatures/completeResolve.js +4 -5
- package/out/languageFeatures/definition.d.ts +1 -1
- package/out/languageFeatures/definition.js +11 -12
- package/out/languageFeatures/documentHighlights.d.ts +1 -1
- package/out/languageFeatures/documentHighlights.js +11 -9
- package/out/languageFeatures/documentLinks.d.ts +1 -1
- package/out/languageFeatures/documentLinks.js +9 -4
- package/out/languageFeatures/documentSemanticTokens.d.ts +1 -2
- package/out/languageFeatures/documentSemanticTokens.js +29 -8
- package/out/languageFeatures/fileReferences.d.ts +1 -1
- package/out/languageFeatures/fileReferences.js +6 -4
- package/out/languageFeatures/fileRename.d.ts +2 -1
- package/out/languageFeatures/fileRename.js +5 -3
- package/out/languageFeatures/hover.d.ts +1 -1
- package/out/languageFeatures/hover.js +7 -2
- package/out/languageFeatures/inlayHints.d.ts +1 -1
- package/out/languageFeatures/inlayHints.js +7 -6
- package/out/languageFeatures/references.d.ts +1 -1
- package/out/languageFeatures/references.js +5 -3
- package/out/languageFeatures/rename.d.ts +1 -1
- package/out/languageFeatures/rename.js +7 -5
- package/out/languageFeatures/renamePrepare.d.ts +1 -1
- package/out/languageFeatures/renamePrepare.js +7 -2
- package/out/languageFeatures/signatureHelp.d.ts +2 -2
- package/out/languageFeatures/signatureHelp.js +19 -2
- package/out/languageFeatures/validation.d.ts +1 -1
- package/out/languageFeatures/validation.js +21 -25
- package/out/languageFeatures/workspaceSymbols.d.ts +1 -1
- package/out/languageFeatures/workspaceSymbols.js +7 -5
- package/out/transformer/completionItem.js +2 -2
- package/out/transformer/documentSymbol.js +2 -2
- package/out/transformer/locationsLike.js +2 -2
- package/out/transformer/selectionRanges.js +2 -2
- package/out/types.d.ts +56 -80
- package/out/types.js +0 -1
- package/out/utils/SemanticTokensBuilder.d.ts +13 -0
- package/out/utils/SemanticTokensBuilder.js +42 -0
- package/out/utils/common.d.ts +3 -0
- package/out/utils/common.js +25 -1
- package/out/utils/featureWorkers.js +14 -22
- package/package.json +5 -6
package/out/types.d.ts
CHANGED
|
@@ -51,89 +51,65 @@ export interface ConfigurationHost {
|
|
|
51
51
|
/**
|
|
52
52
|
* LanguageServicePlugin
|
|
53
53
|
*/
|
|
54
|
-
export type
|
|
55
|
-
export type NullableResult<T> =
|
|
54
|
+
export type Result<T> = T | Thenable<T>;
|
|
55
|
+
export type NullableResult<T> = Result<T | undefined | null>;
|
|
56
56
|
export type SemanticToken = [number, number, number, number, number];
|
|
57
|
-
export interface LanguageServicePlugin
|
|
58
|
-
(context
|
|
57
|
+
export interface LanguageServicePlugin {
|
|
58
|
+
(context?: LanguageServicePluginContext): LanguageServicePluginInstance;
|
|
59
59
|
}
|
|
60
|
-
export interface
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
};
|
|
67
|
-
validation?: {
|
|
68
|
-
onSemantic?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
69
|
-
onSyntactic?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
70
|
-
onSuggestion?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
71
|
-
onDeclaration?(document: TextDocument): NullableResult<vscode.Diagnostic[]>;
|
|
72
|
-
};
|
|
73
|
-
doHover?(document: TextDocument, position: vscode.Position): NullableResult<vscode.Hover>;
|
|
74
|
-
findImplementations?(document: TextDocument, position: vscode.Position): NullableResult<vscode.LocationLink[]>;
|
|
75
|
-
findReferences?(document: TextDocument, position: vscode.Position): NullableResult<vscode.Location[]>;
|
|
76
|
-
findFileReferences?(document: TextDocument): NullableResult<vscode.Location[]>;
|
|
77
|
-
findDocumentHighlights?(document: TextDocument, position: vscode.Position): NullableResult<vscode.DocumentHighlight[]>;
|
|
78
|
-
findDocumentLinks?(document: TextDocument): NullableResult<vscode.DocumentLink[]>;
|
|
79
|
-
findDocumentSymbols?(document: TextDocument): NullableResult<vscode.DocumentSymbol[]>;
|
|
80
|
-
findDocumentSemanticTokens?(document: TextDocument, range: vscode.Range, legend: vscode.SemanticTokensLegend): NullableResult<SemanticToken[]>;
|
|
81
|
-
findWorkspaceSymbols?(query: string): NullableResult<vscode.WorkspaceSymbol[]>;
|
|
82
|
-
findDocumentColors?(document: TextDocument): NullableResult<vscode.ColorInformation[]>;
|
|
83
|
-
getColorPresentations?(document: TextDocument, color: vscode.Color, range: vscode.Range): NullableResult<vscode.ColorPresentation[]>;
|
|
84
|
-
doFileRename?(oldUri: string, newUri: string): NullableResult<vscode.WorkspaceEdit>;
|
|
85
|
-
getFoldingRanges?(document: TextDocument): NullableResult<vscode.FoldingRange[]>;
|
|
86
|
-
getSelectionRanges?(document: TextDocument, positions: vscode.Position[]): NullableResult<vscode.SelectionRange[]>;
|
|
87
|
-
getSignatureHelp?(document: TextDocument, position: vscode.Position, context?: vscode.SignatureHelpContext): NullableResult<vscode.SignatureHelp>;
|
|
88
|
-
format?(document: TextDocument, range: vscode.Range, options: vscode.FormattingOptions): NullableResult<vscode.TextEdit[]>;
|
|
89
|
-
formatOnType?(document: TextDocument, position: vscode.Position, key: string, options: vscode.FormattingOptions): NullableResult<vscode.TextEdit[]>;
|
|
90
|
-
getIndentSensitiveLines?(document: TextDocument): NullableResult<number[]>;
|
|
91
|
-
definition?: {
|
|
92
|
-
on?(document: TextDocument, position: vscode.Position): NullableResult<vscode.LocationLink[]>;
|
|
93
|
-
onType?(document: TextDocument, position: vscode.Position): NullableResult<vscode.LocationLink[]>;
|
|
94
|
-
};
|
|
95
|
-
complete?: {
|
|
96
|
-
triggerCharacters?: string[];
|
|
97
|
-
isAdditional?: boolean;
|
|
98
|
-
on?(document: TextDocument, position: vscode.Position, context?: vscode.CompletionContext): NullableResult<vscode.CompletionList>;
|
|
99
|
-
resolve?(item: vscode.CompletionItem): NotNullableResult<vscode.CompletionItem>;
|
|
100
|
-
};
|
|
101
|
-
rename?: {
|
|
102
|
-
prepare?(document: TextDocument, position: vscode.Position): NullableResult<vscode.Range | vscode.ResponseError<void>>;
|
|
103
|
-
on?(document: TextDocument, position: vscode.Position, newName: string): NullableResult<vscode.WorkspaceEdit>;
|
|
104
|
-
};
|
|
105
|
-
codeAction?: {
|
|
106
|
-
on?(document: TextDocument, range: vscode.Range, context: vscode.CodeActionContext): NullableResult<vscode.CodeAction[]>;
|
|
107
|
-
resolve?(codeAction: vscode.CodeAction): NotNullableResult<vscode.CodeAction>;
|
|
108
|
-
};
|
|
109
|
-
codeLens?: {
|
|
110
|
-
on?(document: TextDocument): NullableResult<vscode.CodeLens[]>;
|
|
111
|
-
resolve?(codeLens: vscode.CodeLens): NotNullableResult<vscode.CodeLens>;
|
|
112
|
-
};
|
|
113
|
-
referencesCodeLens?: {
|
|
114
|
-
on?(document: TextDocument): NullableResult<vscode.Location[]>;
|
|
115
|
-
resolve?(document: TextDocument, location: vscode.Location, references: vscode.Location[]): NotNullableResult<vscode.Location[]>;
|
|
60
|
+
export interface AutoInsertionContext {
|
|
61
|
+
lastChange: {
|
|
62
|
+
range: vscode.Range;
|
|
63
|
+
rangeOffset: number;
|
|
64
|
+
rangeLength: number;
|
|
65
|
+
text: string;
|
|
116
66
|
};
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
67
|
+
}
|
|
68
|
+
export interface LanguageServicePluginInstance {
|
|
69
|
+
isAdditionalCompletion?: boolean;
|
|
70
|
+
triggerCharacters?: string[];
|
|
71
|
+
signatureHelpTriggerCharacters?: string[];
|
|
72
|
+
signatureHelpRetriggerCharacters?: string[];
|
|
73
|
+
autoFormatTriggerCharacters?: string[];
|
|
74
|
+
provideHover?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.Hover>;
|
|
75
|
+
provideDocumentSymbols?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.DocumentSymbol[]>;
|
|
76
|
+
provideDocumentHighlights?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.DocumentHighlight[]>;
|
|
77
|
+
provideLinkedEditingRanges?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LinkedEditingRanges>;
|
|
78
|
+
provideDefinition?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LocationLink[]>;
|
|
79
|
+
provideTypeDefinition?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LocationLink[]>;
|
|
80
|
+
provideImplementation?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.LocationLink[]>;
|
|
81
|
+
provideCodeLenses?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.CodeLens[]>;
|
|
82
|
+
provideCodeActions?(document: TextDocument, range: vscode.Range, context: vscode.CodeActionContext, token: vscode.CancellationToken): NullableResult<vscode.CodeAction[]>;
|
|
83
|
+
provideDocumentFormattingEdits?(document: TextDocument, range: vscode.Range, options: vscode.FormattingOptions, token: vscode.CancellationToken): NullableResult<vscode.TextEdit[]>;
|
|
84
|
+
provideOnTypeFormattingEdits?(document: TextDocument, position: vscode.Position, key: string, options: vscode.FormattingOptions, token: vscode.CancellationToken): NullableResult<vscode.TextEdit[]>;
|
|
85
|
+
provideLinks?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.DocumentLink[]>;
|
|
86
|
+
provideCompletionItems?(document: TextDocument, position: vscode.Position, context: vscode.CompletionContext, token: vscode.CancellationToken): NullableResult<vscode.CompletionList>;
|
|
87
|
+
provideDocumentColors?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.ColorInformation[]>;
|
|
88
|
+
provideColorPresentations?(document: TextDocument, color: vscode.Color, range: vscode.Range, token: vscode.CancellationToken): NullableResult<vscode.ColorPresentation[]>;
|
|
89
|
+
provideFoldingRanges?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.FoldingRange[]>;
|
|
90
|
+
provideSignatureHelp?(document: TextDocument, position: vscode.Position, context: vscode.SignatureHelpContext, token: vscode.CancellationToken): NullableResult<vscode.SignatureHelp>;
|
|
91
|
+
provideRenameRange?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.Range | vscode.ResponseError<void>>;
|
|
92
|
+
provideRenameEdits?(document: TextDocument, position: vscode.Position, newName: string, token: vscode.CancellationToken): NullableResult<vscode.WorkspaceEdit>;
|
|
93
|
+
provideReferences?(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.Location[]>;
|
|
94
|
+
provideSelectionRanges?(document: TextDocument, positions: vscode.Position[], token: vscode.CancellationToken): NullableResult<vscode.SelectionRange[]>;
|
|
95
|
+
provideInlayHints?(document: TextDocument, range: vscode.Range, token: vscode.CancellationToken): NullableResult<vscode.InlayHint[]>;
|
|
96
|
+
provideCallHierarchyItems(document: TextDocument, position: vscode.Position, token: vscode.CancellationToken): NullableResult<vscode.CallHierarchyItem[]>;
|
|
97
|
+
provideCallHierarchyIncomingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Result<vscode.CallHierarchyIncomingCall[]>;
|
|
98
|
+
provideCallHierarchyOutgoingCalls(item: vscode.CallHierarchyItem, token: vscode.CancellationToken): Result<vscode.CallHierarchyOutgoingCall[]>;
|
|
99
|
+
provideDocumentSemanticTokens?(document: TextDocument, range: vscode.Range, legend: vscode.SemanticTokensLegend, token: vscode.CancellationToken): NullableResult<SemanticToken[]>;
|
|
100
|
+
provideWorkspaceSymbols?(query: string, token: vscode.CancellationToken): NullableResult<vscode.WorkspaceSymbol[]>;
|
|
101
|
+
provideSyntacticDiagnostics?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Diagnostic[]>;
|
|
102
|
+
provideSemanticDiagnostics?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Diagnostic[]>;
|
|
103
|
+
provideFileReferences?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Location[]>;
|
|
104
|
+
provideReferencesCodeLenses?(document: TextDocument, token: vscode.CancellationToken): NullableResult<vscode.Location[]>;
|
|
105
|
+
provideAutoInsertionEdit?(document: TextDocument, position: vscode.Position, context: AutoInsertionContext, token: vscode.CancellationToken): NullableResult<string | vscode.TextEdit>;
|
|
106
|
+
provideFileRenameEdits?(oldUri: string, newUri: string, token: vscode.CancellationToken): NullableResult<vscode.WorkspaceEdit>;
|
|
107
|
+
provideFormattingIndentSensitiveLines?(document: TextDocument, token: vscode.CancellationToken): NullableResult<number[]>;
|
|
108
|
+
resolveCodeLens?(codeLens: vscode.CodeLens, token: vscode.CancellationToken): Result<vscode.CodeLens>;
|
|
109
|
+
resolveCodeAction?(codeAction: vscode.CodeAction, token: vscode.CancellationToken): Result<vscode.CodeAction>;
|
|
110
|
+
resolveCompletionItem?(item: vscode.CompletionItem, token: vscode.CancellationToken): Result<vscode.CompletionItem>;
|
|
111
|
+
resolveReferencesCodeLens?(document: TextDocument, location: vscode.Location, references: vscode.Location[], token: vscode.CancellationToken): Result<vscode.Location[]>;
|
|
112
|
+
resolveRuleContext?(context: RuleContext, ruleType: 'format' | 'syntax' | 'semantic'): Result<RuleContext>;
|
|
137
113
|
resolveEmbeddedRange?(range: vscode.Range): vscode.Range | undefined;
|
|
138
114
|
}
|
|
139
115
|
export interface Rule {
|
package/out/types.js
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { SemanticTokens } from 'vscode-languageserver-protocol';
|
|
2
|
+
export declare class SemanticTokensBuilder {
|
|
3
|
+
private _id;
|
|
4
|
+
private _prevLine;
|
|
5
|
+
private _prevChar;
|
|
6
|
+
private _data;
|
|
7
|
+
private _dataLen;
|
|
8
|
+
constructor();
|
|
9
|
+
private initialize;
|
|
10
|
+
push(line: number, char: number, length: number, tokenType: number, tokenModifiers: number): void;
|
|
11
|
+
get id(): string;
|
|
12
|
+
build(): SemanticTokens;
|
|
13
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.SemanticTokensBuilder = void 0;
|
|
3
|
+
class SemanticTokensBuilder {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.initialize();
|
|
6
|
+
}
|
|
7
|
+
initialize() {
|
|
8
|
+
this._id = Date.now();
|
|
9
|
+
this._prevLine = 0;
|
|
10
|
+
this._prevChar = 0;
|
|
11
|
+
this._data = [];
|
|
12
|
+
this._dataLen = 0;
|
|
13
|
+
}
|
|
14
|
+
push(line, char, length, tokenType, tokenModifiers) {
|
|
15
|
+
let pushLine = line;
|
|
16
|
+
let pushChar = char;
|
|
17
|
+
if (this._dataLen > 0) {
|
|
18
|
+
pushLine -= this._prevLine;
|
|
19
|
+
if (pushLine === 0) {
|
|
20
|
+
pushChar -= this._prevChar;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
this._data[this._dataLen++] = pushLine;
|
|
24
|
+
this._data[this._dataLen++] = pushChar;
|
|
25
|
+
this._data[this._dataLen++] = length;
|
|
26
|
+
this._data[this._dataLen++] = tokenType;
|
|
27
|
+
this._data[this._dataLen++] = tokenModifiers;
|
|
28
|
+
this._prevLine = line;
|
|
29
|
+
this._prevChar = char;
|
|
30
|
+
}
|
|
31
|
+
get id() {
|
|
32
|
+
return this._id.toString();
|
|
33
|
+
}
|
|
34
|
+
build() {
|
|
35
|
+
return {
|
|
36
|
+
resultId: this.id,
|
|
37
|
+
data: this._data,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
exports.SemanticTokensBuilder = SemanticTokensBuilder;
|
|
42
|
+
//# sourceMappingURL=SemanticTokensBuilder.js.map
|
package/out/utils/common.d.ts
CHANGED
|
@@ -5,3 +5,6 @@ export declare function getOverlapRange(range1Start: number, range1End: number,
|
|
|
5
5
|
} | undefined;
|
|
6
6
|
export declare function isInsideRange(parent: vscode.Range, child: vscode.Range): boolean;
|
|
7
7
|
export declare function stringToSnapshot(str: string): ts.IScriptSnapshot;
|
|
8
|
+
export declare function syntaxToLanguageId(syntax: string): string;
|
|
9
|
+
export declare function sleep(ms: number): Promise<unknown>;
|
|
10
|
+
export declare function notEmpty<T>(value: T | null | undefined): value is T;
|
package/out/utils/common.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
-
exports.stringToSnapshot = exports.isInsideRange = exports.getOverlapRange = void 0;
|
|
2
|
+
exports.notEmpty = exports.sleep = exports.syntaxToLanguageId = 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);
|
|
@@ -31,4 +31,28 @@ function stringToSnapshot(str) {
|
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
33
|
exports.stringToSnapshot = stringToSnapshot;
|
|
34
|
+
function syntaxToLanguageId(syntax) {
|
|
35
|
+
switch (syntax) {
|
|
36
|
+
case 'js': return 'javascript';
|
|
37
|
+
case 'cjs': return 'javascript';
|
|
38
|
+
case 'mjs': return 'javascript';
|
|
39
|
+
case 'ts': return 'typescript';
|
|
40
|
+
case 'cts': return 'typescript';
|
|
41
|
+
case 'mts': return 'typescript';
|
|
42
|
+
case 'jsx': return 'javascriptreact';
|
|
43
|
+
case 'tsx': return 'typescriptreact';
|
|
44
|
+
case 'pug': return 'jade';
|
|
45
|
+
case 'md': return 'markdown';
|
|
46
|
+
}
|
|
47
|
+
return syntax;
|
|
48
|
+
}
|
|
49
|
+
exports.syntaxToLanguageId = syntaxToLanguageId;
|
|
50
|
+
function sleep(ms) {
|
|
51
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
52
|
+
}
|
|
53
|
+
exports.sleep = sleep;
|
|
54
|
+
function notEmpty(value) {
|
|
55
|
+
return value !== null && value !== undefined;
|
|
56
|
+
}
|
|
57
|
+
exports.notEmpty = notEmpty;
|
|
34
58
|
//# sourceMappingURL=common.js.map
|
|
@@ -76,48 +76,44 @@ function languageFeatureWorker(context, uri, arg, transformArg, worker, transfor
|
|
|
76
76
|
}
|
|
77
77
|
exports.languageFeatureWorker = languageFeatureWorker;
|
|
78
78
|
function ruleWorker(context, api, uri, isValidSourceMap, worker, transform, combineResult, reportProgress) {
|
|
79
|
-
var _a, _b, _c, _d, _e, _f, _g, _h
|
|
79
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
80
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
81
81
|
const document = context.getTextDocument(uri);
|
|
82
82
|
const virtualFile = (_a = context.documents.getSourceByUri(uri)) === null || _a === void 0 ? void 0 : _a.root;
|
|
83
83
|
let results = [];
|
|
84
84
|
if (virtualFile) {
|
|
85
85
|
yield (0, definePlugin_1.visitEmbedded)(context.documents, virtualFile, (file, map) => __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
var _l, _m, _o, _p, _q
|
|
86
|
+
var _j, _k, _l, _m, _o, _p, _q;
|
|
87
87
|
if (!isValidSourceMap(file)) {
|
|
88
88
|
return true;
|
|
89
89
|
}
|
|
90
90
|
let ruleCtx = {
|
|
91
91
|
// project context
|
|
92
|
-
modules: { typescript: (
|
|
92
|
+
modules: { typescript: (_j = context.typescript) === null || _j === void 0 ? void 0 : _j.module },
|
|
93
93
|
uriToFileName: context.uriToFileName,
|
|
94
94
|
fileNameToUri: context.fileNameToUri,
|
|
95
95
|
rootUri: context.rootUri,
|
|
96
96
|
locale: context.locale,
|
|
97
|
-
getConfiguration: (
|
|
98
|
-
onDidChangeConfiguration: (
|
|
99
|
-
settings: (
|
|
97
|
+
getConfiguration: (_k = context.configurationHost) === null || _k === void 0 ? void 0 : _k.getConfiguration,
|
|
98
|
+
onDidChangeConfiguration: (_l = context.configurationHost) === null || _l === void 0 ? void 0 : _l.onDidChangeConfiguration,
|
|
99
|
+
settings: (_o = (_m = context.config.lint) === null || _m === void 0 ? void 0 : _m.settings) !== null && _o !== void 0 ? _o : {},
|
|
100
100
|
// document context
|
|
101
101
|
ruleId: '',
|
|
102
102
|
document: map.virtualFileDocument,
|
|
103
103
|
report: () => { },
|
|
104
104
|
};
|
|
105
105
|
for (const plugin of Object.values(context.plugins)) {
|
|
106
|
-
const fn = (_r = plugin.rules) === null || _r === void 0 ? void 0 : _r[api];
|
|
107
106
|
try {
|
|
108
|
-
if (
|
|
109
|
-
ruleCtx = yield
|
|
110
|
-
}
|
|
111
|
-
else if ((_s = plugin.rules) === null || _s === void 0 ? void 0 : _s.onAny) {
|
|
112
|
-
ruleCtx = yield plugin.rules.onAny(ruleCtx);
|
|
107
|
+
if (plugin.resolveRuleContext) {
|
|
108
|
+
ruleCtx = yield plugin.resolveRuleContext(ruleCtx, api === 'onFormat' ? 'format' : api === 'onSyntax' ? 'syntax' : 'semantic');
|
|
113
109
|
}
|
|
114
110
|
}
|
|
115
111
|
catch (err) {
|
|
116
112
|
console.warn('plugin rule context setup crashed on ' + map.virtualFileDocument.uri + ': ' + err);
|
|
117
113
|
}
|
|
118
114
|
}
|
|
119
|
-
for (const ruleName in (
|
|
120
|
-
const rule = (
|
|
115
|
+
for (const ruleName in (_p = context.config.lint) === null || _p === void 0 ? void 0 : _p.rules) {
|
|
116
|
+
const rule = (_q = context.config.lint) === null || _q === void 0 ? void 0 : _q.rules[ruleName];
|
|
121
117
|
if (!rule) {
|
|
122
118
|
continue;
|
|
123
119
|
}
|
|
@@ -156,21 +152,17 @@ function ruleWorker(context, api, uri, isValidSourceMap, worker, transform, comb
|
|
|
156
152
|
report: () => { },
|
|
157
153
|
};
|
|
158
154
|
for (const plugin of Object.values(context.plugins)) {
|
|
159
|
-
const fn = (_g = plugin.rules) === null || _g === void 0 ? void 0 : _g[api];
|
|
160
155
|
try {
|
|
161
|
-
if (
|
|
162
|
-
ruleCtx = yield
|
|
163
|
-
}
|
|
164
|
-
else if ((_h = plugin.rules) === null || _h === void 0 ? void 0 : _h.onAny) {
|
|
165
|
-
ruleCtx = yield plugin.rules.onAny(ruleCtx);
|
|
156
|
+
if (plugin.resolveRuleContext) {
|
|
157
|
+
ruleCtx = yield plugin.resolveRuleContext(ruleCtx, api === 'onFormat' ? 'format' : api === 'onSyntax' ? 'syntax' : 'semantic');
|
|
166
158
|
}
|
|
167
159
|
}
|
|
168
160
|
catch (err) {
|
|
169
161
|
console.warn('plugin rule context setup crashed on ' + document.uri + ': ' + err);
|
|
170
162
|
}
|
|
171
163
|
}
|
|
172
|
-
for (const ruleName in (
|
|
173
|
-
const rule = (
|
|
164
|
+
for (const ruleName in (_g = context.config.lint) === null || _g === void 0 ? void 0 : _g.rules) {
|
|
165
|
+
const rule = (_h = context.config.lint) === null || _h === void 0 ? void 0 : _h.rules[ruleName];
|
|
174
166
|
if (!rule) {
|
|
175
167
|
continue;
|
|
176
168
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-service",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0-alpha.0",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,15 +13,14 @@
|
|
|
13
13
|
"directory": "packages/language-service"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/language-core": "1.
|
|
17
|
-
"@volar/
|
|
18
|
-
"
|
|
19
|
-
"@volar/typescript-faster": "1.3.0-alpha.3",
|
|
16
|
+
"@volar/language-core": "1.4.0-alpha.0",
|
|
17
|
+
"@volar/source-map": "1.4.0-alpha.0",
|
|
18
|
+
"typescript-auto-import-cache": "^0.0.1",
|
|
20
19
|
"vscode-html-languageservice": "^5.0.4",
|
|
21
20
|
"vscode-json-languageservice": "^5.2.0",
|
|
22
21
|
"vscode-languageserver-protocol": "^3.17.3",
|
|
23
22
|
"vscode-languageserver-textdocument": "^1.0.8",
|
|
24
23
|
"vscode-uri": "^3.0.7"
|
|
25
24
|
},
|
|
26
|
-
"gitHead": "
|
|
25
|
+
"gitHead": "2607410cae341cf802b446062d446ad497be2057"
|
|
27
26
|
}
|