Skip to content

Commit

Permalink
feat: sync volar 1.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jul 14, 2023
1 parent f02830c commit 5f9eee7
Show file tree
Hide file tree
Showing 16 changed files with 146 additions and 142 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"devDependencies": {
"@types/node": "latest",
"@volar/language-service": "~1.8.3",
"@volar/language-service": "~1.9.0",
"typescript": "latest",
"vite": "latest",
"vitest": "latest"
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@
"devDependencies": {
"@types/semver": "^7.3.13",
"@types/vscode": "1.67.0",
"@volar/vscode": "~1.8.3",
"@volar/vscode": "~1.9.0",
"@vue/language-core": "1.8.4",
"@vue/language-server": "1.8.4",
"esbuild": "0.15.18",
Expand Down
4 changes: 2 additions & 2 deletions packages/vscode-vue/src/nodeClientMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { activate as commonActivate, deactivate as commonDeactivate, getDocument
import { middleware } from './middleware';
import * as serverLib from '@vue/language-server';
import { config } from './config';
import type { ExportsInfoForLabs } from '@volar/vscode';
import { ExportsInfoForLabs, supportLabsVersion } from '@volar/vscode';

export async function activate(context: vscode.ExtensionContext) {

Expand Down Expand Up @@ -112,7 +112,7 @@ export async function activate(context: vscode.ExtensionContext) {

return {
volarLabs: {
version: '1.6.2',
version: supportLabsVersion,
codegenStackSupport: true,
languageClients,
languageServerProtocol: serverLib,
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-component-meta/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"directory": "packages/vue-component-meta"
},
"dependencies": {
"@volar/typescript": "~1.8.3",
"@volar/typescript": "~1.9.0",
"@vue/language-core": "1.8.4",
"typesafe-path": "^0.2.2",
"vue-component-type-helpers": "1.8.4"
Expand Down
3 changes: 2 additions & 1 deletion packages/vue-component-meta/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ function createComponentMetaCheckerWorker(

const scriptSnapshots = new Map<string, ts.IScriptSnapshot>();
const _host: vue.TypeScriptLanguageHost = {
getCurrentDirectory: () => rootPath,
workspacePath: rootPath,
rootPath: rootPath,
getProjectVersion: () => projectVersion.toString(),
getCompilationSettings: () => parsedCommandLine.options,
getScriptFileNames: () => fileNames,
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-language-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
"directory": "packages/vue-language-core"
},
"dependencies": {
"@volar/language-core": "~1.8.3",
"@volar/source-map": "~1.8.3",
"@volar/language-core": "~1.9.0",
"@volar/source-map": "~1.9.0",
"@vue/compiler-dom": "^3.3.0",
"@vue/reactivity": "^3.3.0",
"@vue/shared": "^3.3.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-language-core/src/languageModule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function createLanguage(
},
resolveHost(host) {
const sharedTypesSnapshot = ts.ScriptSnapshot.fromString(sharedTypes.getTypesCode(vueCompilerOptions));
const sharedTypesFileName = path.join(host.getCurrentDirectory(), sharedTypes.baseName);
const sharedTypesFileName = path.join(host.rootPath, sharedTypes.baseName);
return {
...host,
getScriptFileNames() {
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-language-plugin-pug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@vue/language-core": "1.8.4"
},
"dependencies": {
"@volar/source-map": "~1.8.3",
"volar-service-pug": "0.0.9"
"@volar/source-map": "~1.9.0",
"volar-service-pug": "0.0.10"
}
}
6 changes: 3 additions & 3 deletions packages/vue-language-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"directory": "packages/vue-language-server"
},
"dependencies": {
"@volar/language-core": "~1.8.3",
"@volar/language-server": "~1.8.3",
"@volar/typescript": "~1.8.3",
"@volar/language-core": "~1.9.0",
"@volar/language-server": "~1.9.0",
"@volar/typescript": "~1.9.0",
"@vue/language-core": "1.8.4",
"@vue/language-service": "1.8.4",
"vscode-languageserver-protocol": "^3.17.3",
Expand Down
4 changes: 2 additions & 2 deletions packages/vue-language-server/src/languageServerPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export function createServerPlugin(connection: Connection) {
vueOptions = vue2.createParsedCommandLine(ts, sys, ctx.project.tsConfig).vueOptions;
}
else if (typeof ctx?.project.tsConfig === 'object' && ts) {
vueOptions = vue2.createParsedCommandLineByJson(ts, sys, ctx.host.getCurrentDirectory(), ctx.project.tsConfig).vueOptions;
vueOptions = vue2.createParsedCommandLineByJson(ts, sys, ctx.host.rootPath, ctx.project.tsConfig).vueOptions;
}
newSysVersion = await sys.sync();
}
Expand Down Expand Up @@ -126,7 +126,7 @@ export function createServerPlugin(connection: Connection) {
host,
hostToVueOptions.get(host)!,
{},
host.getCurrentDirectory() + '/tsconfig.json.global.vue',
host.rootPath + '/tsconfig.json.global.vue',
ts,
);
checkers.set(host, checker);
Expand Down
24 changes: 12 additions & 12 deletions packages/vue-language-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,26 @@
"update-html-data": "node ./scripts/update-html-data.js"
},
"dependencies": {
"@volar/language-core": "~1.8.3",
"@volar/language-service": "~1.8.3",
"@volar/typescript": "~1.8.3",
"@volar/language-core": "~1.9.0",
"@volar/language-service": "~1.9.0",
"@volar/typescript": "~1.9.0",
"@vue/compiler-dom": "^3.3.0",
"@vue/language-core": "1.8.4",
"@vue/reactivity": "^3.3.0",
"@vue/shared": "^3.3.0",
"volar-service-css": "0.0.9",
"volar-service-emmet": "0.0.9",
"volar-service-html": "0.0.9",
"volar-service-json": "0.0.9",
"volar-service-pug": "0.0.9",
"volar-service-pug-beautify": "0.0.9",
"volar-service-typescript": "0.0.9",
"volar-service-typescript-twoslash-queries": "0.0.9",
"volar-service-css": "0.0.10",
"volar-service-emmet": "0.0.10",
"volar-service-html": "0.0.10",
"volar-service-json": "0.0.10",
"volar-service-pug": "0.0.10",
"volar-service-pug-beautify": "0.0.10",
"volar-service-typescript": "0.0.10",
"volar-service-typescript-twoslash-queries": "0.0.10",
"vscode-html-languageservice": "^5.0.4",
"vscode-languageserver-textdocument": "^1.0.8"
},
"devDependencies": {
"@volar/kit": "~1.8.3",
"@volar/kit": "~1.9.0",
"vscode-languageserver-protocol": "^3.17.3",
"vscode-uri": "^3.0.7"
}
Expand Down
4 changes: 3 additions & 1 deletion packages/vue-language-service/tests/utils/createTester.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ function createTester(root: string) {
parsedCommandLine.fileNames = parsedCommandLine.fileNames.map(fileName => fileName.replace(/\\/g, '/'));
const scriptSnapshots = new Map<string, ts.IScriptSnapshot>();
const host: TypeScriptLanguageHost = {
workspacePath: root,
rootPath: root,
getProjectVersion: () => '0',
getScriptFileNames: () => parsedCommandLine.fileNames,
getCurrentDirectory: () => root.replace(/\\/g, '/'),
getCompilationSettings: () => parsedCommandLine.options,
getScriptSnapshot,
};
Expand All @@ -34,6 +35,7 @@ function createTester(root: string) {
const languageService = createLanguageService(
{ typescript: ts as any },
{
workspaceUri: rootUri,
rootUri,
uriToFileName,
fileNameToUri,
Expand Down
3 changes: 2 additions & 1 deletion packages/vue-tsc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ export function createProgram(options: ts.CreateProgramOptions) {
scriptSnapshot: ts.IScriptSnapshot,
}>();
const languageHost: vue.TypeScriptLanguageHost = {
workspacePath: ctx.options.host!.getCurrentDirectory().replace(windowsPathReg, '/'),
rootPath: ctx.options.host!.getCurrentDirectory().replace(windowsPathReg, '/'),
getCompilationSettings: () => ctx.options.options,
getScriptFileNames: () => {
return ctx.options.rootNames as string[];
Expand All @@ -68,7 +70,6 @@ export function createProgram(options: ts.CreateProgramOptions) {
return ctx.projectVersion.toString();
},
getProjectReferences: () => ctx.options.projectReferences,
getCurrentDirectory: () => ctx.options.host!.getCurrentDirectory().replace(windowsPathReg, '/'),
getCancellationToken: ctx.options.host!.getCancellationToken ? () => ctx.options.host!.getCancellationToken!() : undefined,
};
const vueTsLs = vueTs.createLanguageService(languageHost, vueCompilerOptions, ts as any, ts.sys);
Expand Down
2 changes: 1 addition & 1 deletion packages/vue-typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"directory": "packages/vue-typescript"
},
"dependencies": {
"@volar/typescript": "~1.8.3",
"@volar/typescript": "~1.9.0",
"@vue/language-core": "1.8.4"
}
}
2 changes: 1 addition & 1 deletion packages/vue-typescript/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function createLanguageService(
),
);
const languageServiceHost = createLanguageServiceHost(languageContext, ts, sys);
const languageService = ts.createLanguageService(languageServiceHost, getDocumentRegistry(ts, sys.useCaseSensitiveFileNames, host.getCurrentDirectory()));
const languageService = ts.createLanguageService(languageServiceHost, getDocumentRegistry(ts, sys.useCaseSensitiveFileNames, host.workspacePath));
decorateLanguageService(languageContext.virtualFiles, languageService, false);
return {
...languageService,
Expand Down
Loading

0 comments on commit 5f9eee7

Please sign in to comment.