@volar/language-service 1.3.0-alpha.3 → 1.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/baseLanguageService.d.ts +37 -41
- package/out/baseLanguageService.js +26 -19
- package/out/documentFeatures/colorPresentations.d.ts +1 -1
- package/out/documentFeatures/colorPresentations.js +8 -4
- package/out/documentFeatures/documentColors.d.ts +1 -1
- package/out/documentFeatures/documentColors.js +8 -4
- package/out/documentFeatures/documentSymbols.d.ts +1 -1
- package/out/documentFeatures/documentSymbols.js +8 -15
- package/out/documentFeatures/foldingRanges.d.ts +2 -2
- package/out/documentFeatures/foldingRanges.js +6 -2
- package/out/documentFeatures/format.d.ts +2 -2
- package/out/documentFeatures/format.js +32 -39
- package/out/documentFeatures/linkedEditingRanges.d.ts +1 -1
- package/out/documentFeatures/linkedEditingRanges.js +8 -4
- package/out/documentFeatures/selectionRanges.d.ts +1 -1
- package/out/documentFeatures/selectionRanges.js +8 -4
- package/out/documents.js +3 -4
- 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 +12 -6
- package/out/languageFeatures/callHierarchy.d.ts +3 -3
- package/out/languageFeatures/callHierarchy.js +69 -76
- package/out/languageFeatures/codeActionResolve.d.ts +2 -2
- package/out/languageFeatures/codeActionResolve.js +10 -20
- package/out/languageFeatures/codeActions.d.ts +1 -1
- package/out/languageFeatures/codeActions.js +26 -31
- package/out/languageFeatures/codeLens.d.ts +1 -1
- package/out/languageFeatures/codeLens.js +19 -25
- package/out/languageFeatures/codeLensResolve.d.ts +1 -1
- package/out/languageFeatures/codeLensResolve.js +9 -19
- package/out/languageFeatures/complete.d.ts +1 -1
- package/out/languageFeatures/complete.js +35 -41
- package/out/languageFeatures/completeResolve.d.ts +1 -1
- package/out/languageFeatures/completeResolve.js +6 -17
- package/out/languageFeatures/definition.d.ts +1 -1
- package/out/languageFeatures/definition.js +41 -51
- package/out/languageFeatures/documentHighlights.d.ts +1 -1
- package/out/languageFeatures/documentHighlights.js +37 -44
- package/out/languageFeatures/documentLinks.d.ts +1 -1
- package/out/languageFeatures/documentLinks.js +13 -16
- package/out/languageFeatures/documentSemanticTokens.d.ts +1 -2
- package/out/languageFeatures/documentSemanticTokens.js +19 -8
- package/out/languageFeatures/fileReferences.d.ts +1 -1
- package/out/languageFeatures/fileReferences.js +8 -16
- package/out/languageFeatures/fileRename.d.ts +2 -1
- package/out/languageFeatures/fileRename.js +8 -16
- package/out/languageFeatures/hover.d.ts +1 -1
- package/out/languageFeatures/hover.js +10 -9
- package/out/languageFeatures/inlayHints.d.ts +1 -1
- package/out/languageFeatures/inlayHints.js +16 -21
- package/out/languageFeatures/references.d.ts +1 -1
- package/out/languageFeatures/references.js +29 -39
- package/out/languageFeatures/rename.d.ts +1 -1
- package/out/languageFeatures/rename.js +57 -69
- package/out/languageFeatures/renamePrepare.d.ts +1 -1
- package/out/languageFeatures/renamePrepare.js +6 -2
- package/out/languageFeatures/signatureHelp.d.ts +2 -2
- package/out/languageFeatures/signatureHelp.js +18 -2
- package/out/languageFeatures/validation.d.ts +1 -1
- package/out/languageFeatures/validation.js +143 -165
- package/out/languageFeatures/workspaceSymbols.d.ts +1 -1
- package/out/languageFeatures/workspaceSymbols.js +8 -15
- package/out/transformer/completionItem.js +9 -4
- package/out/transformer/completionList.js +6 -3
- package/out/transformer/documentSymbol.js +9 -4
- package/out/transformer/foldingRanges.js +2 -3
- package/out/transformer/hover.js +5 -2
- package/out/transformer/locationLike.js +4 -1
- package/out/transformer/locationsLike.js +2 -2
- package/out/transformer/selectionRanges.js +2 -2
- package/out/transformer/textEdit.js +20 -5
- package/out/transformer/workspaceSymbol.js +4 -1
- 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/definePlugin.js +11 -23
- package/out/utils/featureWorkers.js +127 -155
- package/package.json +5 -6
|
@@ -5,25 +5,40 @@ function transform(textEdit, getOtherRange, document) {
|
|
|
5
5
|
if (vscode.TextEdit.is(textEdit)) {
|
|
6
6
|
let range = getOtherRange(textEdit.range);
|
|
7
7
|
if (range) {
|
|
8
|
-
return
|
|
8
|
+
return {
|
|
9
|
+
...textEdit,
|
|
10
|
+
range,
|
|
11
|
+
};
|
|
9
12
|
}
|
|
10
13
|
;
|
|
11
14
|
const cover = tryRecover(getOtherRange, textEdit.range, textEdit.newText, document);
|
|
12
15
|
if (cover) {
|
|
13
|
-
return
|
|
16
|
+
return {
|
|
17
|
+
...textEdit,
|
|
18
|
+
range: cover.range,
|
|
19
|
+
newText: cover.newText,
|
|
20
|
+
};
|
|
14
21
|
}
|
|
15
22
|
}
|
|
16
23
|
else if (vscode.InsertReplaceEdit.is(textEdit)) {
|
|
17
24
|
const insert = getOtherRange(textEdit.insert);
|
|
18
25
|
const replace = insert ? getOtherRange(textEdit.replace) : undefined;
|
|
19
26
|
if (insert && replace) {
|
|
20
|
-
return
|
|
21
|
-
|
|
27
|
+
return {
|
|
28
|
+
...textEdit,
|
|
29
|
+
insert,
|
|
30
|
+
replace,
|
|
31
|
+
};
|
|
22
32
|
}
|
|
23
33
|
const recoverInsert = tryRecover(getOtherRange, textEdit.insert, textEdit.newText, document);
|
|
24
34
|
const recoverReplace = recoverInsert ? tryRecover(getOtherRange, textEdit.replace, textEdit.newText, document) : undefined;
|
|
25
35
|
if (recoverInsert && recoverReplace && recoverInsert.newText === recoverReplace.newText) {
|
|
26
|
-
return
|
|
36
|
+
return {
|
|
37
|
+
...textEdit,
|
|
38
|
+
insert: recoverInsert.range,
|
|
39
|
+
replace: recoverReplace.range,
|
|
40
|
+
newText: recoverInsert.newText,
|
|
41
|
+
};
|
|
27
42
|
}
|
|
28
43
|
}
|
|
29
44
|
}
|
|
@@ -9,7 +9,10 @@ function transform(symbol, getOtherLocation) {
|
|
|
9
9
|
if (!loc) {
|
|
10
10
|
return;
|
|
11
11
|
}
|
|
12
|
-
return
|
|
12
|
+
return {
|
|
13
|
+
...symbol,
|
|
14
|
+
location: loc,
|
|
15
|
+
};
|
|
13
16
|
}
|
|
14
17
|
exports.transform = transform;
|
|
15
18
|
//# sourceMappingURL=workspaceSymbol.js.map
|
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
|
|
@@ -1,31 +1,19 @@
|
|
|
1
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
1
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
2
|
exports.visitEmbedded = void 0;
|
|
12
|
-
function visitEmbedded(documents, current, cb, rootFile = current) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (!(yield visitEmbedded(documents, embedded, cb, rootFile))) {
|
|
17
|
-
return false;
|
|
18
|
-
}
|
|
3
|
+
async function visitEmbedded(documents, current, cb, rootFile = current) {
|
|
4
|
+
for (const embedded of current.embeddedFiles) {
|
|
5
|
+
if (!await visitEmbedded(documents, embedded, cb, rootFile)) {
|
|
6
|
+
return false;
|
|
19
7
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
8
|
+
}
|
|
9
|
+
for (const [_, map] of documents.getMapsByVirtualFileName(current.fileName)) {
|
|
10
|
+
if (documents.getSourceByUri(map.sourceFileDocument.uri)?.root === rootFile) {
|
|
11
|
+
if (!await cb(current, map)) {
|
|
12
|
+
return false;
|
|
25
13
|
}
|
|
26
14
|
}
|
|
27
|
-
|
|
28
|
-
|
|
15
|
+
}
|
|
16
|
+
return true;
|
|
29
17
|
}
|
|
30
18
|
exports.visitEmbedded = visitEmbedded;
|
|
31
19
|
//# sourceMappingURL=definePlugin.js.map
|