Language tools breaking changes #4383
-
Hey all, Thank you for this project, we use it for the CLI of gql.tada. Something that I noticed is that after 2.0.1 there were some breaking changes that we can partially resolve. We were able to resolve the breaking change wehere Given the following file we will extract call-expressions like |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
After a quick look, I figured this was the missing piece: language-tools/packages/language-core/lib/languageModule.ts Lines 130 to 134 in 2cfa7ef
const projectHost: TypeScriptProjectHost = {
...ts.sys,
configFileName: realTsConfig,
getCurrentDirectory: () => rootPath,
getProjectVersion: () => '0',
getScriptFileNames: () => parsedCommandLine.fileNames,
getCompilationSettings: () => parsedCommandLine.options,
getScriptSnapshot,
scriptIdToFileName: serviceEnv.typescript!.uriToFileName,
fileNameToScriptId: serviceEnv.typescript!.fileNameToUri,
};
const vueLanguagePlugin = createVueLanguagePlugin(
ts,
serviceEnv.typescript!.uriToFileName,
ts.sys.useCaseSensitiveFileNames,
() => projectHost.getProjectVersion?.() ?? '',
() => projectHost.getScriptFileNames(),
parsedCommandLine.options,
parsedCommandLine.vueOptions,
);
const language = createTypeScriptLanguage(
ts,
[vueLanguagePlugin],
projectHost,
);
const sourceScript = language.scripts.set('.../test.vue', snapshot, 'vue');
if (sourceScript?.generated) {
return sourceScript.generated.languagePlugin.typescript?.getServiceScript(sourceScript.generated.root)?.code;
} |
Beta Was this translation helpful? Give feedback.
After a quick look, I figured this was the missing piece:
language-tools/packages/language-core/lib/languageModule.ts
Lines 130 to 134 in 2cfa7ef
getBasePlugins
is not a use case intended for external use, you may want to usecreateVueLanguagePlugin
instead.