Skip to content

Commit

Permalink
chore: update compiler (#929)
Browse files Browse the repository at this point in the history
* chore: update compiler

* test: add test for multibytes charactesr

* chore: changeset
  • Loading branch information
Princesseuh authored Aug 6, 2024
1 parent 492b2bf commit e8e18a8
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .changeset/cuddly-moons-decide.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@astrojs/language-server": patch
"astro-vscode": patch
"@astrojs/check": patch
---

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
2 changes: 1 addition & 1 deletion packages/language-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"test:match": "pnpm run test -g"
},
"dependencies": {
"@astrojs/compiler": "^2.10.1",
"@astrojs/compiler": "^2.10.2",
"@jridgewell/sourcemap-codec": "^1.4.15",
"@volar/kit": "~2.4.0-alpha.15",
"@volar/language-core": "~2.4.0-alpha.15",
Expand Down
17 changes: 16 additions & 1 deletion packages/language-server/test/typescript/scripts.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FullDocumentDiagnosticReport, Position } from '@volar/language-server';
import { type FullDocumentDiagnosticReport, Position, Range } from '@volar/language-server';
import { expect } from 'chai';
import { type LanguageServer, getLanguageServer } from '../server.js';

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

expect(hoverInfo).to.be.null;
});

it('supports script tags in files with multibytes characters', async () => {
const document = await languageServer.openFakeDocument(
`πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€πŸš€
<script>doesntExists</script>`,
'astro'
);

const diagnostics = (await languageServer.handle.sendDocumentDiagnosticRequest(
document.uri
)) as FullDocumentDiagnosticReport;

expect(diagnostics.items).length(1);
expect(diagnostics.items[0].range).to.deep.equal(Range.create(1, 8, 1, 20));
});
});
2 changes: 1 addition & 1 deletion packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@
"vscode-tmgrammar-test": "^0.1.2"
},
"dependencies": {
"@astrojs/compiler": "^2.10.1",
"@astrojs/compiler": "^2.10.2",
"prettier": "^3.2.5",
"prettier-plugin-astro": "^0.14.1"
}
Expand Down
15 changes: 9 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e8e18a8

Please sign in to comment.