Skip to content

Commit

Permalink
chore: bump Volar
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsoncodehk committed Jun 22, 2024
1 parent 0781998 commit 961e5a9
Show file tree
Hide file tree
Showing 17 changed files with 162 additions and 163 deletions.
2 changes: 1 addition & 1 deletion extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@
"devDependencies": {
"@types/semver": "^7.5.3",
"@types/vscode": "^1.82.0",
"@volar/vscode": "~2.3.0",
"@volar/vscode": "~2.3.1",
"@vue/language-core": "2.0.21",
"@vue/language-server": "2.0.21",
"@vue/typescript-plugin": "2.0.21",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@lerna-lite/publish": "latest",
"@tsslint/cli": "latest",
"@tsslint/config": "latest",
"@volar/language-service": "~2.3.0",
"@volar/language-service": "~2.3.1",
"typescript": "latest",
"vite": "latest",
"vitest": "latest"
Expand Down
8 changes: 4 additions & 4 deletions packages/component-meta/lib/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -685,11 +685,11 @@ function createSchemaResolvers(
if (sourceFile?.generated) {
const script = sourceFile.generated.languagePlugin.typescript?.getServiceScript(sourceFile.generated.root);
if (script) {
for (const [source, _, map] of language.maps.forEach(script.code)) {
for (const [start] of map.getSourceOffsets(declaration.getStart())) {
for (const [end] of map.getSourceOffsets(declaration.getEnd())) {
for (const [sourceScript, map] of language.maps.forEach(script.code)) {
for (const [start] of map.toSourceLocation(declaration.getStart())) {
for (const [end] of map.toSourceLocation(declaration.getEnd())) {
return {
file: source,
file: sourceScript.id,
range: [start, end],
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/component-meta/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"directory": "packages/component-meta"
},
"dependencies": {
"@volar/typescript": "~2.3.0",
"@volar/typescript": "~2.3.1",
"@vue/language-core": "2.0.21",
"path-browserify": "^1.0.1",
"vue-component-type-helpers": "2.0.21"
Expand Down
8 changes: 4 additions & 4 deletions packages/language-core/lib/plugins/file-md.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { SourceMap } from '@volar/language-core';
import { CodeInformation, Mapping, defaultMapperFactory } from '@volar/language-core';
import type { SFCBlock } from '@vue/compiler-sfc';
import { Segment, toString } from 'muggle-string';
import type { VueLanguagePlugin } from '../types';
Expand Down Expand Up @@ -52,7 +52,7 @@ const plugin: VueLanguagePlugin = () => {
codes.push([content, undefined, 0]);
codes.push('\n</template>');

const file2VueSourceMap = new SourceMap(buildMappings(codes));
const file2VueSourceMap = defaultMapperFactory(buildMappings(codes) as unknown as Mapping<CodeInformation>[]);
const sfc = parse(toString(codes));

if (sfc.descriptor.template) {
Expand All @@ -77,11 +77,11 @@ const plugin: VueLanguagePlugin = () => {
function transformRange(block: SFCBlock) {
block.loc.start.offset = -1;
block.loc.end.offset = -1;
for (const [start] of file2VueSourceMap.getSourceOffsets(block.loc.start.offset)) {
for (const [start] of file2VueSourceMap.toSourceLocation(block.loc.start.offset)) {
block.loc.start.offset = start;
break;
}
for (const [end] of file2VueSourceMap.getSourceOffsets(block.loc.end.offset)) {
for (const [end] of file2VueSourceMap.toSourceLocation(block.loc.end.offset)) {
block.loc.end.offset = end;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/language-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"directory": "packages/language-core"
},
"dependencies": {
"@volar/language-core": "~2.3.0",
"@volar/language-core": "~2.3.1",
"@vue/compiler-dom": "^3.4.0",
"@vue/shared": "^3.4.0",
"computeds": "^0.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/language-plugin-pug/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const plugin: VueLanguagePlugin = ({ modules }) => {
if (prop === 'offset') {
const htmlOffset = target.offset;
const nums: number[] = [];
for (const mapped of map.getSourceOffsets(htmlOffset)) {
for (const mapped of map.toSourceLocation(htmlOffset)) {
nums.push(mapped[0]);
}
return Math.max(-1, ...nums);
Expand Down
4 changes: 2 additions & 2 deletions packages/language-plugin-pug/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"@vue/language-core": "2.0.21"
},
"dependencies": {
"@volar/source-map": "~2.3.0",
"volar-service-pug": "0.0.51"
"@volar/source-map": "~2.3.1",
"volar-service-pug": "0.0.52"
}
}
4 changes: 2 additions & 2 deletions packages/language-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"directory": "packages/language-server"
},
"dependencies": {
"@volar/language-core": "~2.3.0",
"@volar/language-server": "~2.3.0",
"@volar/language-core": "~2.3.1",
"@volar/language-server": "~2.3.1",
"@vue/language-core": "2.0.21",
"@vue/language-service": "2.0.21",
"@vue/typescript-plugin": "2.0.21",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ export function create(
}
ast = getAst(ts, fileName, virtualCode.snapshot, serviceScript.scriptKind);
let mapped = false;
for (const [_1, _2, map] of context.language.maps.forEach(virtualCode)) {
for (const [sourceOffset] of map.getSourceOffsets(document.offsetAt(selection))) {
for (const [_sourceScript, map] of context.language.maps.forEach(virtualCode)) {
for (const [sourceOffset] of map.toSourceLocation(document.offsetAt(selection))) {
sourceCodeOffset = sourceOffset;
mapped = true;
break;
Expand Down
4 changes: 2 additions & 2 deletions packages/language-service/lib/plugins/vue-twoslash-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ export function create(
}

for (const [pointerPosition, hoverOffset] of hoverOffsets) {
for (const [_1, _2, map] of context.language.maps.forEach(virtualCode)) {
for (const [sourceOffset] of map.getSourceOffsets(hoverOffset)) {
for (const [_sourceScript, map] of context.language.maps.forEach(virtualCode)) {
for (const [sourceOffset] of map.toSourceLocation(hoverOffset)) {
const quickInfo = await tsPluginClient?.getQuickInfoAtPosition(sourceScript.generated.root.fileName, sourceOffset);
if (quickInfo) {
inlayHints.push({
Expand Down
24 changes: 12 additions & 12 deletions packages/language-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@
"update-html-data": "node ./scripts/update-html-data.js"
},
"dependencies": {
"@volar/language-core": "~2.3.0",
"@volar/language-service": "~2.3.0",
"@volar/typescript": "~2.3.0",
"@volar/language-core": "~2.3.1",
"@volar/language-service": "~2.3.1",
"@volar/typescript": "~2.3.1",
"@vue/compiler-dom": "^3.4.0",
"@vue/language-core": "2.0.21",
"@vue/shared": "^3.4.0",
"@vue/typescript-plugin": "2.0.21",
"computeds": "^0.0.1",
"path-browserify": "^1.0.1",
"volar-service-css": "0.0.51",
"volar-service-emmet": "0.0.51",
"volar-service-html": "0.0.51",
"volar-service-json": "0.0.51",
"volar-service-pug": "0.0.51",
"volar-service-pug-beautify": "0.0.51",
"volar-service-typescript": "0.0.51",
"volar-service-typescript-twoslash-queries": "0.0.51",
"volar-service-css": "0.0.52",
"volar-service-emmet": "0.0.52",
"volar-service-html": "0.0.52",
"volar-service-json": "0.0.52",
"volar-service-pug": "0.0.52",
"volar-service-pug-beautify": "0.0.52",
"volar-service-typescript": "0.0.52",
"volar-service-typescript-twoslash-queries": "0.0.52",
"vscode-html-languageservice": "^5.2.0",
"vscode-languageserver-textdocument": "^1.0.11",
"vscode-uri": "^3.0.8"
},
"devDependencies": {
"@types/node": "latest",
"@types/path-browserify": "latest",
"@volar/kit": "~2.3.0",
"@volar/kit": "~2.3.1",
"vscode-languageserver-protocol": "^3.17.5"
}
}
2 changes: 1 addition & 1 deletion packages/tsc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"vue-tsc": "./bin/vue-tsc.js"
},
"dependencies": {
"@volar/typescript": "~2.3.0",
"@volar/typescript": "~2.3.1",
"@vue/language-core": "2.0.21",
"semver": "^7.5.4"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function collectExtractProps(
const sourceFile = program.getSourceFile(fileName)!;
const checker = program.getTypeChecker();
const script = volarFile.generated?.languagePlugin.typescript?.getServiceScript(volarFile.generated.root);
const maps = script ? [...language.maps.forEach(script.code)].map(([_1, _2, map]) => map) : [];
const maps = script ? [...language.maps.forEach(script.code)].map(([_sourceScript, map]) => map) : [];
const sfc = volarFile.generated.root.sfc;

sourceFile.forEachChild(function visit(node) {
Expand All @@ -40,7 +40,7 @@ export function collectExtractProps(
const { name } = node;
for (const map of maps) {
let mapped = false;
for (const source of map.getSourceOffsets(name.getEnd() - (isTsPlugin ? volarFile.snapshot.getLength() : 0))) {
for (const source of map.toSourceLocation(name.getEnd() - (isTsPlugin ? volarFile.snapshot.getLength() : 0))) {
if (
source[0] >= sfc.template!.startTagEnd + templateCodeRange[0]
&& source[0] <= sfc.template!.startTagEnd + templateCodeRange[1]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export function getPropertiesAtLocation(
return;
}
let mapped = false;
for (const [_1, _2, map] of language.maps.forEach(virtualScript.code)) {
for (const [position2, mapping] of map.getGeneratedOffsets(position)) {
for (const [_sourceScript, map] of language.maps.forEach(virtualScript.code)) {
for (const [position2, mapping] of map.toGeneratedLocation(position)) {
if (isCompletionEnabled(mapping.data)) {
position = position2;
mapped = true;
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"directory": "packages/typescript-plugin"
},
"dependencies": {
"@volar/typescript": "~2.3.0",
"@volar/typescript": "~2.3.1",
"@vue/language-core": "2.0.21",
"@vue/shared": "^3.4.0"
},
Expand Down
Loading

0 comments on commit 961e5a9

Please sign in to comment.