@volar/language-server 1.2.0-alpha.16 → 1.2.0-alpha.18
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.
|
@@ -71,14 +71,15 @@ function register(connection, projects) {
|
|
|
71
71
|
}
|
|
72
72
|
}));
|
|
73
73
|
connection.onRequest(protocol_1.GetVirtualFileNamesRequest.type, (document) => __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
var _p, _q;
|
|
74
|
+
var _p, _q, _r;
|
|
75
75
|
const project = yield projects.getProject(document.uri);
|
|
76
76
|
const fileNames = [];
|
|
77
77
|
if (project) {
|
|
78
78
|
const rootVirtualFile = (_q = (_p = project.project) === null || _p === void 0 ? void 0 : _p.getLanguageService().context.core.virtualFiles.getSource(shared.uriToFileName(document.uri))) === null || _q === void 0 ? void 0 : _q.root;
|
|
79
79
|
if (rootVirtualFile) {
|
|
80
|
+
const kinds = (_r = document.fileKinds) !== null && _r !== void 0 ? _r : [language_core_1.FileKind.TypeScriptHostFile];
|
|
80
81
|
(0, language_core_1.forEachEmbeddedFile)(rootVirtualFile, e => {
|
|
81
|
-
if (e.snapshot.getLength() && e.kind
|
|
82
|
+
if (e.snapshot.getLength() && kinds.includes(e.kind)) {
|
|
82
83
|
fileNames.push(e.fileName);
|
|
83
84
|
}
|
|
84
85
|
});
|
|
@@ -87,15 +88,15 @@ function register(connection, projects) {
|
|
|
87
88
|
return fileNames;
|
|
88
89
|
}));
|
|
89
90
|
connection.onRequest(protocol_1.GetVirtualFileRequest.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
90
|
-
var
|
|
91
|
+
var _s, _t, _u, _v;
|
|
91
92
|
const project = yield projects.getProject(params.sourceFileUri);
|
|
92
93
|
if (project) {
|
|
93
|
-
const [virtualFile, source] = (
|
|
94
|
+
const [virtualFile, source] = (_t = (_s = project.project) === null || _s === void 0 ? void 0 : _s.getLanguageService().context.core.virtualFiles.getVirtualFile(params.virtualFileName)) !== null && _t !== void 0 ? _t : [];
|
|
94
95
|
if (virtualFile && source) {
|
|
95
96
|
const mappings = {};
|
|
96
97
|
for (const mapping of virtualFile.mappings) {
|
|
97
|
-
const sourceUri = shared.fileNameToUri((
|
|
98
|
-
(
|
|
98
|
+
const sourceUri = shared.fileNameToUri((_u = mapping.source) !== null && _u !== void 0 ? _u : source.fileName);
|
|
99
|
+
(_v = mappings[sourceUri]) !== null && _v !== void 0 ? _v : (mappings[sourceUri] = []);
|
|
99
100
|
mappings[sourceUri].push(mapping);
|
|
100
101
|
}
|
|
101
102
|
return {
|
|
@@ -109,11 +110,11 @@ function register(connection, projects) {
|
|
|
109
110
|
projects.reloadProject();
|
|
110
111
|
});
|
|
111
112
|
connection.onNotification(protocol_1.WriteVirtualFilesNotification.type, (params) => __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
var
|
|
113
|
+
var _w;
|
|
113
114
|
const fs = yield Promise.resolve().then(() => require('fs'));
|
|
114
115
|
const project = yield projects.getProject(params.uri);
|
|
115
116
|
if (project) {
|
|
116
|
-
const ls = (
|
|
117
|
+
const ls = (_w = (yield project.project)) === null || _w === void 0 ? void 0 : _w.getLanguageServiceDontCreate();
|
|
117
118
|
if (ls) {
|
|
118
119
|
const sourceFiles = new Set(ls.context.host.getScriptFileNames());
|
|
119
120
|
for (const virtualFile of ls.context.core.typescript.languageServiceHost.getScriptFileNames()) {
|
package/out/common/project.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
59
59
|
};
|
|
60
60
|
languageServiceHost: embedded.LanguageServiceHost;
|
|
61
61
|
getLanguageService: () => {
|
|
62
|
+
triggerCharacters: string[];
|
|
62
63
|
format: (uri: string, options: embeddedLS.FormattingOptions, range?: embeddedLS.Range | undefined, onTypeParams?: {
|
|
63
64
|
ch: string;
|
|
64
65
|
position: embeddedLS.Position;
|
|
@@ -66,7 +67,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
66
67
|
getFoldingRanges: (uri: string) => Promise<embeddedLS.FoldingRange[] | undefined>;
|
|
67
68
|
getSelectionRanges: (uri: string, positions: embeddedLS.Position[]) => Promise<embeddedLS.SelectionRange[] | undefined>;
|
|
68
69
|
findLinkedEditingRanges: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.LinkedEditingRanges | undefined>;
|
|
69
|
-
findDocumentSymbols: (uri: string) => Promise<embeddedLS.
|
|
70
|
+
findDocumentSymbols: (uri: string) => Promise<embeddedLS.DocumentSymbol[] | undefined>;
|
|
70
71
|
findDocumentColors: (uri: string) => Promise<embeddedLS.ColorInformation[] | undefined>;
|
|
71
72
|
getColorPresentations: (uri: string, color: embeddedLS.Color, range: embeddedLS.Range) => Promise<embeddedLS.ColorPresentation[] | undefined>;
|
|
72
73
|
doValidation: (uri: string, token?: embeddedLS.CancellationToken | undefined, response?: ((result: embeddedLS.Diagnostic[]) => void) | undefined) => Promise<embeddedLS.Diagnostic[]>;
|
|
@@ -75,7 +76,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
75
76
|
findDefinition: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.LocationLink[] | undefined>;
|
|
76
77
|
findTypeDefinition: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.LocationLink[] | undefined>;
|
|
77
78
|
findImplementations: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.LocationLink[] | undefined>;
|
|
78
|
-
prepareRename: (uri: string, position: embeddedLS.Position) => Promise<NonNullable<embeddedLS.
|
|
79
|
+
prepareRename: (uri: string, position: embeddedLS.Position) => Promise<NonNullable<embeddedLS.Range | embeddedLS.ResponseError<void> | null | undefined> | undefined>;
|
|
79
80
|
doRename: (uri: string, position: embeddedLS.Position, newName: string) => Promise<embeddedLS.WorkspaceEdit | undefined>;
|
|
80
81
|
getEditsForFileRename: (oldUri: string, newUri: string) => Promise<embeddedLS.WorkspaceEdit | undefined>;
|
|
81
82
|
getSemanticTokens: (uri: string, range: embeddedLS.Range | undefined, legend: embeddedLS.SemanticTokensLegend, cancelToken: embeddedLS.CancellationToken, reportProgress?: ((tokens: embeddedLS.SemanticToken[]) => void) | undefined) => Promise<embeddedLS.SemanticToken[] | undefined> | undefined;
|
|
@@ -89,7 +90,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
89
90
|
doCodeLensResolve: (item: embeddedLS.CodeLens) => Promise<embeddedLS.CodeLens>;
|
|
90
91
|
findDocumentHighlights: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.DocumentHighlight[] | undefined>;
|
|
91
92
|
findDocumentLinks: (uri: string) => Promise<embeddedLS.DocumentLink[]>;
|
|
92
|
-
findWorkspaceSymbols: (query: string) => Promise<embeddedLS.
|
|
93
|
+
findWorkspaceSymbols: (query: string) => Promise<embeddedLS.WorkspaceSymbol[]>;
|
|
93
94
|
doAutoInsert: (uri: string, position: embeddedLS.Position, autoInsertContext: {
|
|
94
95
|
lastChange: {
|
|
95
96
|
range: embeddedLS.Range;
|
|
@@ -108,6 +109,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
108
109
|
context: embeddedLS.LanguageServicePluginContext;
|
|
109
110
|
};
|
|
110
111
|
getLanguageServiceDontCreate: () => {
|
|
112
|
+
triggerCharacters: string[];
|
|
111
113
|
format: (uri: string, options: embeddedLS.FormattingOptions, range?: embeddedLS.Range | undefined, onTypeParams?: {
|
|
112
114
|
ch: string;
|
|
113
115
|
position: embeddedLS.Position;
|
|
@@ -115,7 +117,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
115
117
|
getFoldingRanges: (uri: string) => Promise<embeddedLS.FoldingRange[] | undefined>;
|
|
116
118
|
getSelectionRanges: (uri: string, positions: embeddedLS.Position[]) => Promise<embeddedLS.SelectionRange[] | undefined>;
|
|
117
119
|
findLinkedEditingRanges: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.LinkedEditingRanges | undefined>;
|
|
118
|
-
findDocumentSymbols: (uri: string) => Promise<embeddedLS.
|
|
120
|
+
findDocumentSymbols: (uri: string) => Promise<embeddedLS.DocumentSymbol[] | undefined>;
|
|
119
121
|
findDocumentColors: (uri: string) => Promise<embeddedLS.ColorInformation[] | undefined>;
|
|
120
122
|
getColorPresentations: (uri: string, color: embeddedLS.Color, range: embeddedLS.Range) => Promise<embeddedLS.ColorPresentation[] | undefined>;
|
|
121
123
|
doValidation: (uri: string, token?: embeddedLS.CancellationToken | undefined, response?: ((result: embeddedLS.Diagnostic[]) => void) | undefined) => Promise<embeddedLS.Diagnostic[]>;
|
|
@@ -124,7 +126,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
124
126
|
findDefinition: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.LocationLink[] | undefined>;
|
|
125
127
|
findTypeDefinition: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.LocationLink[] | undefined>;
|
|
126
128
|
findImplementations: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.LocationLink[] | undefined>;
|
|
127
|
-
prepareRename: (uri: string, position: embeddedLS.Position) => Promise<NonNullable<embeddedLS.
|
|
129
|
+
prepareRename: (uri: string, position: embeddedLS.Position) => Promise<NonNullable<embeddedLS.Range | embeddedLS.ResponseError<void> | null | undefined> | undefined>;
|
|
128
130
|
doRename: (uri: string, position: embeddedLS.Position, newName: string) => Promise<embeddedLS.WorkspaceEdit | undefined>;
|
|
129
131
|
getEditsForFileRename: (oldUri: string, newUri: string) => Promise<embeddedLS.WorkspaceEdit | undefined>;
|
|
130
132
|
getSemanticTokens: (uri: string, range: embeddedLS.Range | undefined, legend: embeddedLS.SemanticTokensLegend, cancelToken: embeddedLS.CancellationToken, reportProgress?: ((tokens: embeddedLS.SemanticToken[]) => void) | undefined) => Promise<embeddedLS.SemanticToken[] | undefined> | undefined;
|
|
@@ -138,7 +140,7 @@ export declare function createProject(context: ProjectContext): Promise<{
|
|
|
138
140
|
doCodeLensResolve: (item: embeddedLS.CodeLens) => Promise<embeddedLS.CodeLens>;
|
|
139
141
|
findDocumentHighlights: (uri: string, position: embeddedLS.Position) => Promise<embeddedLS.DocumentHighlight[] | undefined>;
|
|
140
142
|
findDocumentLinks: (uri: string) => Promise<embeddedLS.DocumentLink[]>;
|
|
141
|
-
findWorkspaceSymbols: (query: string) => Promise<embeddedLS.
|
|
143
|
+
findWorkspaceSymbols: (query: string) => Promise<embeddedLS.WorkspaceSymbol[]>;
|
|
142
144
|
doAutoInsert: (uri: string, position: embeddedLS.Position, autoInsertContext: {
|
|
143
145
|
lastChange: {
|
|
144
146
|
range: embeddedLS.Range;
|