feat(oxfmt/lsp): support astro language (#27388)

Need to update each IDE extensions before merge.

- [x] vscode: https://github.com/oxc-project/oxc-vscode/pull/419
- [x] zed: https://github.com/oxc-project/oxc-zed/pull/272
- [x] intellij: https://github.com/oxc-project/oxc-intellij-plugin/pull/620
- [x] coc: https://github.com/oxc-project/coc-oxc/pull/254

Merge IDE first or LSP first does not matter, nothing happens until both are ready.
This commit is contained in:
leaysgur committed 2026-10-08 00:26:11 +00:00
1 parent 4f024a14c2
commit c1adce3925
6 files changed
+49

No files matched your search

+1
View File
@@ -33,6 +33,7 @@ fn get_file_extension_from_language_id(language_id: &LanguageId) -> Option<&'sta
"less" => Some("less"),
"vue" => Some("vue"),
"svelte" => Some("svelte"),
"astro" => Some("astro"),
"yaml" => Some("yaml"),
"angular" => Some("component.html"),
_ => None,
@@ -12,6 +12,24 @@ const x = 1;
--------------------"
`;
exports[`LSP formatting > basic formatting > should handle format/test.astro 1`] = `
"--- URI -----------
file://<fixture>/format/test.astro
--- BEFORE ---------
---
const count=1
---
<button onclick={()=>count}>{count}</button>
--- AFTER ----------
---
const count=1
---
<button onclick={()=>count}>{count}</button>
--------------------"
`;
exports[`LSP formatting > basic formatting > should handle format/test.json 1`] = `
"--- URI -----------
file://<fixture>/format/test.json
@@ -92,6 +110,25 @@ const x = 1;
--------------------"
`;
exports[`LSP formatting > config options > should apply config from config-astro/test.astro 1`] = `
"--- URI -----------
file://<fixture>/config-astro/test.astro
--- BEFORE ---------
---
const count=1
---
<button onclick={()=>count}>{count}</button>
--- AFTER ----------
---
const count = 1;
---
<button onclick={() => count}>{count}</button>
--------------------"
`;
exports[`LSP formatting > config options > should apply config from config-js-semi/test.ts 1`] = `
"--- URI -----------
file://<fixture>/config-js-semi/test.ts
@@ -0,0 +1 @@
{ "astro": {} }
@@ -0,0 +1,4 @@
---
const count=1
---
<button onclick={()=>count}>{count}</button>
@@ -0,0 +1,4 @@
---
const count=1
---
<button onclick={()=>count}>{count}</button>
@@ -14,6 +14,7 @@ describe("LSP formatting", () => {
["format/test.json", "json"],
["format/test.vue", "vue"],
["format/test.svelte", "svelte"],
["format/test.astro", "astro"],
["format/test.toml", "toml"],
["format/formatted.ts", "typescript"],
["format/test.txt", "plaintext"],
@@ -30,6 +31,7 @@ describe("LSP formatting", () => {
["config-no-sort-package-json/package.json", "json"],
["config-vue-indent/test.vue", "vue"],
["config-svelte/test.svelte", "svelte"],
["config-astro/test.astro", "astro"],
["config-sort-imports/test.js", "javascript"],
["config-sort-tailwindcss/test.tsx", "typescriptreact"],
["config-sort-tailwindcss/test.vue", "vue"],