@volar/language-core 1.5.1 → 1.5.3
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/virtualFiles.d.ts +1 -0
- package/out/virtualFiles.js +12 -5
- package/package.json +3 -3
package/out/virtualFiles.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import type { FileRangeCapabilities, Language, VirtualFile } from './types';
|
|
|
5
5
|
export type VirtualFiles = ReturnType<typeof createVirtualFiles>;
|
|
6
6
|
export interface Source {
|
|
7
7
|
fileName: string;
|
|
8
|
+
languageId: string | undefined;
|
|
8
9
|
snapshot: ts.IScriptSnapshot;
|
|
9
10
|
root: VirtualFile;
|
|
10
11
|
language: Language;
|
package/out/virtualFiles.js
CHANGED
|
@@ -17,15 +17,22 @@ function createVirtualFiles(languages) {
|
|
|
17
17
|
const key = normalizePath(fileName);
|
|
18
18
|
const value = sourceFiles.get(key);
|
|
19
19
|
if (value) {
|
|
20
|
-
value.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
if (value.languageId !== languageId) {
|
|
21
|
+
// languageId changed
|
|
22
|
+
this.deleteSource(fileName);
|
|
23
|
+
return this.updateSource(fileName, snapshot, languageId);
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
value.snapshot = snapshot;
|
|
27
|
+
value.language.updateVirtualFile(value.root, snapshot);
|
|
28
|
+
sourceFilesDirty = true;
|
|
29
|
+
return value.root; // updated
|
|
30
|
+
}
|
|
24
31
|
}
|
|
25
32
|
for (const language of languages) {
|
|
26
33
|
const virtualFile = language.createVirtualFile(fileName, snapshot, languageId);
|
|
27
34
|
if (virtualFile) {
|
|
28
|
-
sourceFiles.set(key, { fileName, snapshot, root: virtualFile, language });
|
|
35
|
+
sourceFiles.set(key, { fileName, languageId, snapshot, root: virtualFile, language });
|
|
29
36
|
sourceFilesDirty = true;
|
|
30
37
|
return virtualFile; // created
|
|
31
38
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volar/language-core",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"main": "out/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"directory": "packages/language-core"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@volar/source-map": "1.5.
|
|
16
|
+
"@volar/source-map": "1.5.3"
|
|
17
17
|
},
|
|
18
|
-
"gitHead": "
|
|
18
|
+
"gitHead": "4d4849277f76523ad1f2719cc94e09abb8c7c77c"
|
|
19
19
|
}
|