Skip to content

Commit

Permalink
chore: compilerOptions -> vueCompilerOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Mar 15, 2022
1 parent 4aea634 commit 5a6f519
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions packages/typescript-vue-plugin/src/index.ts
Expand Up @@ -25,8 +25,8 @@ const init: ts.server.PluginModuleFactory = (modules) => {

const proxyHost = createProxyHost(ts, info);
const services = createBasicRuntime();
const compilerOptions = proxyHost.host.getVueCompilationSettings?.() ?? {};
const tsRuntime = vue.createTypeScriptRuntime({ typescript: ts, ...services, compilerOptions }, proxyHost.host, true);
const vueCompilerOptions = proxyHost.host.getVueCompilationSettings?.() ?? {};
const tsRuntime = vue.createTypeScriptRuntime({ typescript: ts, ...services, vueCompilerOptions }, proxyHost.host, true);
const _tsPluginApis = apis.register(tsRuntime.context);
const tsPluginProxy: Partial<ts.LanguageService> = {
getSemanticDiagnostics: tsRuntime.apiHook(tsRuntime.context.scriptTsLsRaw.getSemanticDiagnostics, false),
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-language-service/src/documentService.ts
Expand Up @@ -93,7 +93,7 @@ export function getDocumentService(
].map(patchHtmlFormat);

const context: DocumentServiceRuntimeContext = {
compilerOptions: {},
vueCompilerOptions: {},
typescript: ts,
...services,
getVueDocument,
Expand Down Expand Up @@ -153,7 +153,7 @@ export function getDocumentService(
document.version.toString(),
context.htmlLs,
context.compileTemplate,
context.compilerOptions,
context.vueCompilerOptions,
context.typescript,
context.getCssVBindRanges,
context.getCssClasses,
Expand Down
6 changes: 3 additions & 3 deletions packages/vue-language-service/src/languageService.ts
Expand Up @@ -106,12 +106,12 @@ export function createLanguageService(
}>,
) {

const compilerOptions = vueHost.getVueCompilationSettings?.() ?? {};
const vueCompilerOptions = vueHost.getVueCompilationSettings?.() ?? {};
const services = createBasicRuntime();
const tsRuntime = createTypeScriptRuntime({
typescript: ts,
...services,
compilerOptions,
vueCompilerOptions,
}, vueHost, false);
const blockingRequests = new Set<Promise<any>>();
const tsTriggerCharacters = getTsTriggerCharacters(ts.version);
Expand Down Expand Up @@ -274,7 +274,7 @@ export function createLanguageService(
...services,
...tsRuntime.context,
typescript: ts,
compilerOptions,
vueCompilerOptions,
getTextDocument: tsRuntime.getHostDocument,
getPlugins: lsType => {
let plugins = [
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-tsc/src/proxy.ts
Expand Up @@ -38,7 +38,7 @@ export function createProgramProxy(
getProjectReferences: () => options.projectReferences,
};
const services = createBasicRuntime();
const tsRuntime = createTypeScriptRuntime({ typescript: ts, ...services, compilerOptions: vueCompilerOptions }, vueLsHost, false);
const tsRuntime = createTypeScriptRuntime({ typescript: ts, ...services, vueCompilerOptions }, vueLsHost, false);
const tsProgram = tsRuntime.context.scriptTsLsRaw.getProgram(); // TODO: handle template ls?
if (!tsProgram) throw '!tsProgram';

Expand Down
2 changes: 1 addition & 1 deletion packages/vue-typescript/src/types.ts
Expand Up @@ -31,7 +31,7 @@ export interface VueCompilerOptions {

export type BasicRuntimeContext = {
typescript: typeof import('typescript/lib/tsserverlibrary'),
compilerOptions: VueCompilerOptions,
vueCompilerOptions: VueCompilerOptions,
compileTemplate(templateTextDocument: TextDocument): {
htmlTextDocument: TextDocument;
htmlToTemplate: (start: number, end: number) => { start: number, end: number } | undefined;
Expand Down
6 changes: 3 additions & 3 deletions packages/vue-typescript/src/typescriptRuntime.ts
Expand Up @@ -15,7 +15,7 @@ export function createTypeScriptRuntime(
typescript: typeof import('typescript/lib/tsserverlibrary'),
htmlLs: html.LanguageService,
compileTemplate: BasicRuntimeContext['compileTemplate'],
compilerOptions: BasicRuntimeContext['compilerOptions'],
vueCompilerOptions: BasicRuntimeContext['vueCompilerOptions'],
getCssVBindRanges: BasicRuntimeContext['getCssVBindRanges'],
getCssClasses: BasicRuntimeContext['getCssClasses'],
},
Expand All @@ -38,7 +38,7 @@ export function createTypeScriptRuntime(
const templateScriptUpdateUris = new Set<string>();
const initProgressCallback: ((p: number) => void)[] = [];

const templateTsHost = options.compilerOptions.experimentalDisableTemplateSupport ? undefined : createTsLsHost('template');
const templateTsHost = options.vueCompilerOptions.experimentalDisableTemplateSupport ? undefined : createTsLsHost('template');
const scriptTsHost = createTsLsHost('script');
const templateTsLsRaw = templateTsHost ? ts.createLanguageService(templateTsHost) : undefined;
const scriptTsLsRaw = ts.createLanguageService(scriptTsHost);
Expand Down Expand Up @@ -391,7 +391,7 @@ export function createTypeScriptRuntime(
doc.version.toString(),
options.htmlLs,
options.compileTemplate,
options.compilerOptions,
options.vueCompilerOptions,
options.typescript,
options.getCssVBindRanges,
options.getCssClasses,
Expand Down

0 comments on commit 5a6f519

Please sign in to comment.