Skip to content

Commit e8e18a8

Browse files
authoredAug 6, 2024Β·Β·
chore: update compiler (#929)
* chore: update compiler * test: add test for multibytes charactesr * chore: changeset
1 parent 492b2bf commit e8e18a8

File tree

5 files changed

+34
-9
lines changed

5 files changed

+34
-9
lines changed
 

β€Ž.changeset/cuddly-moons-decide.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@astrojs/language-server": patch
3+
"astro-vscode": patch
4+
"@astrojs/check": patch
5+
---
6+
7+
Fixes an issue where errors inside script and style tags could be offset by a few characters when multi bytes characters were present in the file

β€Žpackages/language-server/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"test:match": "pnpm run test -g"
2222
},
2323
"dependencies": {
24-
"@astrojs/compiler": "^2.10.1",
24+
"@astrojs/compiler": "^2.10.2",
2525
"@jridgewell/sourcemap-codec": "^1.4.15",
2626
"@volar/kit": "~2.4.0-alpha.15",
2727
"@volar/language-core": "~2.4.0-alpha.15",

β€Žpackages/language-server/test/typescript/scripts.test.ts

+16-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { FullDocumentDiagnosticReport, Position } from '@volar/language-server';
1+
import { type FullDocumentDiagnosticReport, Position, Range } from '@volar/language-server';
22
import { expect } from 'chai';
33
import { type LanguageServer, getLanguageServer } from '../server.js';
44

@@ -59,4 +59,19 @@ describe('TypeScript - Diagnostics', async () => {
5959

6060
expect(hoverInfo).to.be.null;
6161
});
62+
63+
it('supports script tags in files with multibytes characters', async () => {
64+
const document = await languageServer.openFakeDocument(
65+
`πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€
66+
<script>doesntExists</script>`,
67+
'astro'
68+
);
69+
70+
const diagnostics = (await languageServer.handle.sendDocumentDiagnosticRequest(
71+
document.uri
72+
)) as FullDocumentDiagnosticReport;
73+
74+
expect(diagnostics.items).length(1);
75+
expect(diagnostics.items[0].range).to.deep.equal(Range.create(1, 8, 1, 20));
76+
});
6277
});

β€Žpackages/vscode/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@
229229
"vscode-tmgrammar-test": "^0.1.2"
230230
},
231231
"dependencies": {
232-
"@astrojs/compiler": "^2.10.1",
232+
"@astrojs/compiler": "^2.10.2",
233233
"prettier": "^3.2.5",
234234
"prettier-plugin-astro": "^0.14.1"
235235
}

β€Žpnpm-lock.yaml

+9-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.