Skip to content

Commit d55f09a

Browse files
committed
Update languagePlugin.ts
1 parent 7046c76 commit d55f09a

File tree

1 file changed

+3
-15
lines changed

1 file changed

+3
-15
lines changed

packages/language-core/lib/languagePlugin.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,7 @@ export function createVueLanguagePlugin<T>(
6060
createVirtualCode(scriptId, languageId, snapshot) {
6161
const fileName = asFileName(scriptId);
6262
if (plugins.some(plugin => plugin.isValidFile?.(fileName, languageId))) {
63-
const codeKey = getFileRegistryKey(scriptId, fileName);
64-
const code = fileRegistry.get(codeKey);
63+
const code = fileRegistry.get(String(scriptId));
6564
if (code) {
6665
code.update(snapshot);
6766
return code;
@@ -75,7 +74,7 @@ export function createVueLanguagePlugin<T>(
7574
plugins,
7675
ts,
7776
);
78-
fileRegistry.set(codeKey, code);
77+
fileRegistry.set(String(scriptId), code);
7978
return code;
8079
}
8180
}
@@ -85,8 +84,7 @@ export function createVueLanguagePlugin<T>(
8584
return code;
8685
},
8786
disposeVirtualCode(scriptId) {
88-
const fileName = asFileName(scriptId);
89-
fileRegistry.delete(getFileRegistryKey(scriptId, fileName));
87+
fileRegistry.delete(String(scriptId));
9088
},
9189
typescript: {
9290
extraFileExtensions: getAllExtensions(vueCompilerOptions)
@@ -126,13 +124,3 @@ export function getAllExtensions(options: VueCompilerOptions) {
126124
] as const).flatMap(key => options[key])),
127125
];
128126
}
129-
130-
function getFileRegistryKey<T>(scriptId: T, fileName: string) {
131-
if (typeof scriptId === 'object' && scriptId) {
132-
const scheme = (scriptId as { scheme?: string }).scheme;
133-
if (scheme && scheme !== 'file') {
134-
return `${scheme}:${fileName}`;
135-
}
136-
}
137-
return fileName;
138-
}

0 commit comments

Comments
 (0)