@volar/language-service 1.7.0 → 1.7.2
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.js +6 -0
- package/out/documents.d.ts +1 -1
- package/out/documents.js +10 -21
- package/out/types.js +2 -2
- package/package.json +5 -7
|
@@ -37,6 +37,12 @@ const linkedEditingRanges = require("./documentFeatures/linkedEditingRanges");
|
|
|
37
37
|
const selectionRanges = require("./documentFeatures/selectionRanges");
|
|
38
38
|
const common_1 = require("./utils/common");
|
|
39
39
|
function createLanguageService(modules, env, config, languageHost) {
|
|
40
|
+
if (languageHost.getCurrentDirectory().indexOf('\\') >= 0) {
|
|
41
|
+
throw new Error('Volar: Current directory must be posix style.');
|
|
42
|
+
}
|
|
43
|
+
if (languageHost.getScriptFileNames().some(fileName => fileName.indexOf('\\') >= 0)) {
|
|
44
|
+
throw new Error('Volar: Script file names must be posix style.');
|
|
45
|
+
}
|
|
40
46
|
const languageContext = (0, language_core_1.createLanguageContext)(languageHost, Object.values(config.languages ?? {}).filter(common_1.notEmpty));
|
|
41
47
|
const context = createLanguageServicePluginContext(modules, env, config, languageHost, languageContext);
|
|
42
48
|
return createLanguageServiceBase(context);
|
package/out/documents.d.ts
CHANGED
|
@@ -34,7 +34,7 @@ export declare function createDocumentsAndSourceMaps(env: ServiceEnvironment, ho
|
|
|
34
34
|
getSourceByUri(sourceFileUri: string): import("@volar/language-core").Source | undefined;
|
|
35
35
|
isVirtualFileUri(virtualFileUri: string): boolean;
|
|
36
36
|
getVirtualFileByUri(virtualFileUri: string): readonly [VirtualFile, import("@volar/language-core").Source] | readonly [undefined, undefined];
|
|
37
|
-
getMirrorMapByUri(virtualFileUri: string): [VirtualFile, MirrorMapWithDocument] | undefined;
|
|
37
|
+
getMirrorMapByUri(virtualFileUri: string): readonly [VirtualFile, MirrorMapWithDocument] | undefined;
|
|
38
38
|
getMapsBySourceFileUri(uri: string): {
|
|
39
39
|
snapshot: ts.IScriptSnapshot;
|
|
40
40
|
maps: [VirtualFile, SourceMapWithDocuments<FileRangeCapabilities>][];
|
package/out/documents.js
CHANGED
|
@@ -152,9 +152,9 @@ function createDocumentsAndSourceMaps(env, host, mapper) {
|
|
|
152
152
|
const map = mapper.getMirrorMap(virtualFile);
|
|
153
153
|
if (map) {
|
|
154
154
|
if (!mirrorMap2DocMirrorMap.has(map)) {
|
|
155
|
-
mirrorMap2DocMirrorMap.set(map,
|
|
155
|
+
mirrorMap2DocMirrorMap.set(map, new MirrorMapWithDocument(getDocumentByFileName(virtualFile.snapshot, fileName), map));
|
|
156
156
|
}
|
|
157
|
-
return mirrorMap2DocMirrorMap.get(map);
|
|
157
|
+
return [virtualFile, mirrorMap2DocMirrorMap.get(map)];
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
},
|
|
@@ -165,18 +165,13 @@ function createDocumentsAndSourceMaps(env, host, mapper) {
|
|
|
165
165
|
const source = mapper.getSource(fileName);
|
|
166
166
|
if (source) {
|
|
167
167
|
const result = [];
|
|
168
|
-
(0, language_core_1.forEachEmbeddedFile)(source.root, (
|
|
169
|
-
for (const [sourceFileName, [sourceSnapshot, map]] of mapper.getMaps(
|
|
168
|
+
(0, language_core_1.forEachEmbeddedFile)(source.root, (virtualFile) => {
|
|
169
|
+
for (const [sourceFileName, [sourceSnapshot, map]] of mapper.getMaps(virtualFile)) {
|
|
170
170
|
if (sourceSnapshot === source.snapshot) {
|
|
171
171
|
if (!map2DocMap.has(map)) {
|
|
172
|
-
map2DocMap.set(map,
|
|
173
|
-
embedded,
|
|
174
|
-
new SourceMapWithDocuments(getDocumentByFileName(sourceSnapshot, sourceFileName), getDocumentByFileName(embedded.snapshot, fileName), map)
|
|
175
|
-
]);
|
|
176
|
-
}
|
|
177
|
-
if (map2DocMap.has(map)) {
|
|
178
|
-
result.push(map2DocMap.get(map));
|
|
172
|
+
map2DocMap.set(map, new SourceMapWithDocuments(getDocumentByFileName(sourceSnapshot, sourceFileName), getDocumentByFileName(virtualFile.snapshot, fileName), map));
|
|
179
173
|
}
|
|
174
|
+
result.push([virtualFile, map2DocMap.get(map)]);
|
|
180
175
|
}
|
|
181
176
|
}
|
|
182
177
|
});
|
|
@@ -194,11 +189,9 @@ function createDocumentsAndSourceMaps(env, host, mapper) {
|
|
|
194
189
|
if (virtualFile) {
|
|
195
190
|
for (const [sourceFileName, [sourceSnapshot, map]] of mapper.getMaps(virtualFile)) {
|
|
196
191
|
if (!map2DocMap.has(map)) {
|
|
197
|
-
map2DocMap.set(map,
|
|
198
|
-
}
|
|
199
|
-
if (map2DocMap.has(map)) {
|
|
200
|
-
yield map2DocMap.get(map);
|
|
192
|
+
map2DocMap.set(map, new SourceMapWithDocuments(getDocumentByFileName(sourceSnapshot, sourceFileName), getDocumentByFileName(virtualFile.snapshot, virtualFileName), map));
|
|
201
193
|
}
|
|
194
|
+
yield [virtualFile, map2DocMap.get(map)];
|
|
202
195
|
}
|
|
203
196
|
}
|
|
204
197
|
},
|
|
@@ -209,14 +202,10 @@ function createDocumentsAndSourceMaps(env, host, mapper) {
|
|
|
209
202
|
};
|
|
210
203
|
function getDocumentByFileName(snapshot, fileName) {
|
|
211
204
|
if (!snapshot2Doc.has(snapshot)) {
|
|
212
|
-
snapshot2Doc.set(snapshot, new Map());
|
|
213
|
-
}
|
|
214
|
-
const map = snapshot2Doc.get(snapshot);
|
|
215
|
-
if (!map.has(fileName)) {
|
|
216
205
|
const uri = env.fileNameToUri(fileName);
|
|
217
|
-
|
|
206
|
+
snapshot2Doc.set(snapshot, vscode_languageserver_textdocument_1.TextDocument.create(uri, host.getLanguageId?.(fileName) ?? (0, common_1.resolveCommonLanguageId)(uri), version++, snapshot.getText(0, snapshot.getLength())));
|
|
218
207
|
}
|
|
219
|
-
return
|
|
208
|
+
return snapshot2Doc.get(snapshot);
|
|
220
209
|
}
|
|
221
210
|
}
|
|
222
211
|
exports.createDocumentsAndSourceMaps = createDocumentsAndSourceMaps;
|
package/out/types.js
CHANGED
|
@@ -7,12 +7,12 @@ var FileType;
|
|
|
7
7
|
FileType[FileType["File"] = 1] = "File";
|
|
8
8
|
FileType[FileType["Directory"] = 2] = "Directory";
|
|
9
9
|
FileType[FileType["SymbolicLink"] = 64] = "SymbolicLink";
|
|
10
|
-
})(FileType
|
|
10
|
+
})(FileType = exports.FileType || (exports.FileType = {}));
|
|
11
11
|
var RuleType;
|
|
12
12
|
(function (RuleType) {
|
|
13
13
|
RuleType[RuleType["Format"] = 0] = "Format";
|
|
14
14
|
RuleType[RuleType["Syntax"] = 1] = "Syntax";
|
|
15
15
|
RuleType[RuleType["Semantic"] = 2] = "Semantic";
|
|
16
|
-
})(RuleType
|
|
16
|
+
})(RuleType = exports.RuleType || (exports.RuleType = {}));
|
|
17
17
|
;
|
|
18
18
|
//# sourceMappingURL=types.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-service",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.2",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,13 +13,11 @@
|
|
|
13
13
|
"directory": "packages/language-service"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/language-core": "1.7.
|
|
17
|
-
"@volar/source-map": "1.7.
|
|
16
|
+
"@volar/language-core": "1.7.2",
|
|
17
|
+
"@volar/source-map": "1.7.2",
|
|
18
|
+
"vscode-languageserver-protocol": "^3.17.3",
|
|
18
19
|
"vscode-languageserver-textdocument": "^1.0.8",
|
|
19
20
|
"vscode-uri": "^3.0.7"
|
|
20
21
|
},
|
|
21
|
-
"
|
|
22
|
-
"vscode-languageserver-protocol": "^3.17.3"
|
|
23
|
-
},
|
|
24
|
-
"gitHead": "38ec4f727b32dbf2cf3284ab02695e3a8effacc5"
|
|
22
|
+
"gitHead": "e6406ffb254a1be0abbdb3eb101d8cc7bf862b18"
|
|
25
23
|
}
|