Skip to content

Commit

Permalink
chore: update to Volar 2.4.0-alpha.1
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jun 29, 2024
1 parent 7ccf0e8 commit 0d3f989
Show file tree
Hide file tree
Showing 19 changed files with 71 additions and 70 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@lerna-lite/publish": "latest",
"@tsslint/cli": "latest",
"@tsslint/config": "latest",
"@volar/language-service": "~2.4.0-alpha.0",
"@volar/language-service": "~2.4.0-alpha.1",
"typescript": "latest",
"vitest": "latest"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/css/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@types/node": "latest"
},
"peerDependencies": {
"@volar/language-service": "~2.4.0-alpha.0"
"@volar/language-service": "~2.4.0-alpha.1"
},
"peerDependenciesMeta": {
"@volar/language-service": {
Expand Down
2 changes: 1 addition & 1 deletion packages/emmet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"@types/node": "latest"
},
"peerDependencies": {
"@volar/language-service": "~2.4.0-alpha.0"
"@volar/language-service": "~2.4.0-alpha.1"
},
"peerDependenciesMeta": {
"@volar/language-service": {
Expand Down
2 changes: 1 addition & 1 deletion packages/html/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"@types/node": "latest"
},
"peerDependencies": {
"@volar/language-service": "~2.4.0-alpha.0"
"@volar/language-service": "~2.4.0-alpha.1"
},
"peerDependenciesMeta": {
"@volar/language-service": {
Expand Down
2 changes: 1 addition & 1 deletion packages/json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"vscode-languageserver-textdocument": "^1.0.11"
},
"peerDependencies": {
"@volar/language-service": "~2.4.0-alpha.0"
"@volar/language-service": "~2.4.0-alpha.1"
},
"peerDependenciesMeta": {
"@volar/language-service": {
Expand Down
2 changes: 1 addition & 1 deletion packages/markdown/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"vscode-languageserver-textdocument": "^1.0.11"
},
"peerDependencies": {
"@volar/language-service": "~2.4.0-alpha.0"
"@volar/language-service": "~2.4.0-alpha.1"
},
"peerDependenciesMeta": {
"@volar/language-service": {
Expand Down
2 changes: 1 addition & 1 deletion packages/prettier/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"prettier": "^3.3.2"
},
"peerDependencies": {
"@volar/language-service": "~2.4.0-alpha.0",
"@volar/language-service": "~2.4.0-alpha.1",
"prettier": "^2.2 || ^3.0"
},
"peerDependenciesMeta": {
Expand Down
2 changes: 1 addition & 1 deletion packages/prettyhtml/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@starptech/prettyhtml": "^0.10.0"
},
"peerDependencies": {
"@volar/language-service": "~2.4.0-alpha.0"
"@volar/language-service": "~2.4.0-alpha.1"
},
"peerDependenciesMeta": {
"@volar/language-service": {
Expand Down
2 changes: 1 addition & 1 deletion packages/pug-beautify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"@johnsoncodehk/pug-beautify": "^0.2.2"
},
"peerDependencies": {
"@volar/language-service": "~2.4.0-alpha.0"
"@volar/language-service": "~2.4.0-alpha.1"
},
"peerDependenciesMeta": {
"@volar/language-service": {
Expand Down
2 changes: 1 addition & 1 deletion packages/pug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"url": "https://github.com/johnsoncodehk"
},
"dependencies": {
"@volar/language-service": "~2.4.0-alpha.0",
"@volar/language-service": "~2.4.0-alpha.1",
"muggle-string": "^0.4.1",
"pug-lexer": "^5.0.1",
"pug-parser": "^6.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/sass-formatter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"sass-formatter": "^0.7.9"
},
"peerDependencies": {
"@volar/language-service": "~2.4.0-alpha.0"
"@volar/language-service": "~2.4.0-alpha.1"
},
"peerDependenciesMeta": {
"@volar/language-service": {
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-twoslash-queries/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"volar-service-typescript": "0.0.55"
},
"peerDependencies": {
"@volar/language-service": "~2.4.0-alpha.0"
"@volar/language-service": "~2.4.0-alpha.1"
},
"peerDependenciesMeta": {
"@volar/language-service": {
Expand Down
4 changes: 2 additions & 2 deletions packages/typescript/lib/configs/getUserPreferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ export async function getUserPreferences(
document: TextDocument
): Promise<ts.UserPreferences> {
let currentDirectory = '';
if (ctx.language.typescript) {
currentDirectory = ctx.language.typescript.languageServiceHost.getCurrentDirectory();
if (ctx.project.typescript) {
currentDirectory = ctx.project.typescript.languageServiceHost.getCurrentDirectory();
}
const uri = URI.parse(document.uri);
const documentUri = ctx.decodeEmbeddedDocumentUri(uri)?.[0] ?? uri;
Expand Down
9 changes: 5 additions & 4 deletions packages/typescript/lib/plugins/semantic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,11 @@ export function create(
},
},
create(context): LanguageServicePluginInstance<Provide> {
if (!context.language.typescript) {
if (!context.project.typescript) {
console.warn(`[volar] typescript-semantic requires typescript project.`);
return {};
}
const { sys, languageServiceHost, asFileName, asScriptId, getExtraServiceScript } = context.language.typescript;
const { sys, languageServiceHost, asFileName, asUri, getExtraServiceScript } = context.project.typescript;
const created = tsWithImportCache.createLanguageService(
ts,
sys,
Expand All @@ -193,7 +194,7 @@ export function create(
return context.encodeEmbeddedDocumentUri(sourceScript.id, extraServiceScript.code.id);
}

const uri = asScriptId(fileName);
const uri = asUri(fileName);
const sourceScript = context.language.scripts.get(uri);
const serviceScript = sourceScript?.generated?.languagePlugin.typescript?.getServiceScript(sourceScript.generated.root);
if (sourceScript && serviceScript) {
Expand Down Expand Up @@ -916,7 +917,7 @@ export function create(
}
const token: ts.CancellationToken = {
isCancellationRequested() {
return ctx.language.typescript?.languageServiceHost.getCancellationToken?.().isCancellationRequested() ?? false;
return ctx.project.typescript?.languageServiceHost.getCancellationToken?.().isCancellationRequested() ?? false;
},
throwIfCancellationRequested() { },
};
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/lib/semanticFeatures/semanticTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function register(ts: typeof import('typescript'), ctx: SharedContext) {
const start = range ? document.offsetAt(range.start) : 0;
const length = range ? (document.offsetAt(range.end) - start) : document.getText().length;

if (ctx.language.typescript?.languageServiceHost.getCancellationToken?.().isCancellationRequested()) {
if (ctx.project.typescript?.languageServiceHost.getCancellationToken?.().isCancellationRequested()) {
return;
}
const response = safeCall(() => ctx.languageService.getEncodedSemanticClassifications(fileName, { start, length }, ts.SemanticClassificationFormat.TwentyTwenty));
Expand Down
4 changes: 2 additions & 2 deletions packages/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"devDependencies": {
"@types/path-browserify": "latest",
"@types/semver": "latest",
"@volar/typescript": "~2.4.0-alpha.0"
"@volar/typescript": "~2.4.0-alpha.1"
},
"dependencies": {
"path-browserify": "^1.0.1",
Expand All @@ -37,7 +37,7 @@
"vscode-uri": "^3.0.8"
},
"peerDependencies": {
"@volar/language-service": "~2.4.0-alpha.0"
"@volar/language-service": "~2.4.0-alpha.1"
},
"peerDependenciesMeta": {
"@volar/language-service": {
Expand Down
2 changes: 1 addition & 1 deletion packages/vetur/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"vscode-uri": "^3.0.8"
},
"peerDependencies": {
"@volar/language-service": "~2.4.0-alpha.0"
"@volar/language-service": "~2.4.0-alpha.1"
},
"peerDependenciesMeta": {
"@volar/language-service": {
Expand Down
2 changes: 1 addition & 1 deletion packages/yaml/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"vscode-languageserver-textdocument": "^1.0.11"
},
"peerDependencies": {
"@volar/language-service": "~2.4.0-alpha.0"
"@volar/language-service": "~2.4.0-alpha.1"
},
"peerDependenciesMeta": {
"@volar/language-service": {
Expand Down
Loading

0 comments on commit 0d3f989

Please sign in to comment.