Skip to content

Commit

Permalink
chore: update compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
Princesseuh committed Aug 14, 2024
1 parent 86656d2 commit e5732ff
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 13 deletions.
7 changes: 7 additions & 0 deletions .changeset/lovely-pigs-nail.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
"@astrojs/language-server": patch
"@astrojs/ts-plugin": patch
"astro-vscode": patch
---

Updates internal dependencies
2 changes: 1 addition & 1 deletion packages/language-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"test:match": "pnpm run test -g"
},
"dependencies": {
"@astrojs/compiler": "^2.10.2",
"@astrojs/compiler": "^2.10.3",
"@jridgewell/sourcemap-codec": "^1.4.15",
"@volar/kit": "~2.4.0-alpha.15",
"@volar/language-core": "~2.4.0-alpha.15",
Expand Down
75 changes: 75 additions & 0 deletions packages/language-server/test/typescript/organize-imports.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,79 @@ describe('TypeScript - Organize & Sort Imports', () => {
},
]);
});

it('Can organize imports in files using CRLF', async () => {
const document = await languageServer.openFakeDocument(
`---\r\n\r\nimport os from "node:os";\r\n\r\nimport fs from "node:fs";\r\n\r\n---\r\n\r\n`,
'astro',
);
const organizeEdits = await languageServer.handle.sendCodeActionsRequest(
document.uri,
Range.create(6, 0, 6, 0),
{
diagnostics: [],
only: ['source.organizeImports'],
triggerKind: 1,
},
);

expect(organizeEdits).to.deep.equal([
{
data: {
original: {
edit: {
documentChanges: [
{
edits: [
{
newText: '',
range: Range.create(4, 0, 5, 0),
},
{
newText: '',
range: Range.create(6, 0, 7, 0),
},
],
textDocument: {
uri: URI.from({
scheme: 'volar-embedded-content',
authority: 'tsx',
path: '/' + encodeURIComponent(document.uri),
}).toString(),
version: null,
},
},
],
},
},
pluginIndex: 3,
uri: document.uri,
version: (organizeEdits?.[0] as any).data.version,
},
diagnostics: [],
edit: {
documentChanges: [
{
edits: [
{
newText: '',
range: Range.create(2, 0, 3, 0),
},
{
newText: '',
range: Range.create(4, 0, 5, 0),
},
],
textDocument: {
uri: document.uri,
version: null,
},
},
],
},
kind: 'source.organizeImports',
title: 'Organize Imports',
},
]);
});
});
2 changes: 1 addition & 1 deletion packages/ts-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"dependencies": {
"@volar/language-core": "~2.4.0-alpha.15",
"@volar/typescript": "~2.4.0-alpha.15",
"@astrojs/compiler": "^2.10.2",
"@astrojs/compiler": "^2.10.3",
"@jridgewell/sourcemap-codec": "^1.4.15",
"semver": "^7.3.8",
"vscode-languageserver-textdocument": "^1.0.11"
Expand Down
2 changes: 1 addition & 1 deletion packages/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@
"vscode-tmgrammar-test": "^0.1.2"
},
"dependencies": {
"@astrojs/compiler": "^2.10.2",
"@astrojs/compiler": "^2.10.3",
"prettier": "^3.2.5",
"prettier-plugin-astro": "^0.14.1"
}
Expand Down
20 changes: 10 additions & 10 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 e5732ff

Please sign in to comment.