You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Astro VS CODE] source.organizeImports is still broken #18638
Unit Test: No. The existing packages/language-tools/language-server/test/typescript/organize-imports.test.ts already covers this and passes. The problem is in releasing, which a unit test can't check.
Priority:P3: minor bug. Organize-imports-on-save only handles one region of .astro files that have both frontmatter and <script> tags. Everything else in the extension works.
The #17909 fix (#17916) is on main, but it never reached the VS Code Marketplace or Open VSX. The extension versions that include it (astro-vscode 2.17.0–2.17.2) went to npm, but both stores still stop at 2.16.20, which is older than the fix. After the Changesets v3 migration (#17856), the release workflow's VS Code publish step depended on a changesets/action output that no longer worked as expected, so it was skipped. #18104 fixed the workflow later, but astro-vscode hasn't had a new version since then.
I found a potential fix for this issue. It doesn't change any code: it adds a patch changeset for astro-vscode (.changeset/chilly-lemons-go.md), so the next release publishes 2.17.3 through the fixed workflow. A maintainer could also publish 2.17.2 to the stores by hand. This needs human review, especially to check that the vsce/ovsx publish steps and their tokens still work.
Full Triage Report
Issue
"[Astro VS CODE] source.organizeImports is broken again". The reporter says #17909 is happening again. Environment: Astro 7.4.5, Node 26.13.0, macOS arm64, pnpm, VS Code with astro-build.astro-vscode. Repro: https://github.com/Eptagone/astro-vscode-sort-imports. It uses editor.codeActionsOnSave: { "source.organizeImports": "explicit" } on an .astro file that has imports in the frontmatter and in a <script>.
#17916 (8eaa4f21e) fixed it, changeset: "Fixes organize imports across frontmatter and multiple script tags". Volar's @volar/language-servicewithCodeAction dedupes code actions by title only. Each TypeScript region of an .astro file (the frontmatter and each <script>) returns its own action titled "Organize Imports", so all but one were dropped. The fix is a pnpm patch that adds JSON.stringify(item.data) to the dedupe key: patches/@volar__language-service@2.4.30.patch, registered in pnpm-workspace.yaml under patchedDependencies.
Reproduction
I drove the language server over LSP with the existing test harness (language-server/test/server.ts). I sent source.organizeImports for the whole document (triggerKind 2, as on save) and for a cursor position, using the reporter's file with unused pooServer / pooClient imports added:
Server
Actions returned
Regions fixed
Language server built from main
2
frontmatter + script
VS Code extension bundle built from main (pnpm -C packages/language-tools/vscode build)
2
frontmatter + script
Published extension 2.16.20 (Marketplace vsix)
1
only the script; pooServer is left in the frontmatter
The 2.16.20 bundle contains the unpatched dedupe (e=>[e.title]). organize-imports.test.ts passes 6/6 on main.
Marketplace and Open VSX: newest is 2.16.20. Downloading 2.17.2 from the Marketplace returns ExtensionAssetNotFoundException.
.github/workflows/release.yml history:
chore: migrate Changesets to v3 #17856 (09-16) moved to changesets/action v2 and CLI v3. The vscode publish gate still read steps.changesets.outputs.publishedPackages. When published == true, the fallback that works out the release list from the commit diff was skipped, so HAS_VSCODE stayed false and the Marketplace/Open VSX steps were skipped.
This is a bug (high confidence). Maintainers chose the expected behaviour explicitly in #17916, with a changeset and tests. Missing the store releases was accidental, as the later workflow fixes show.
Fix
I added .changeset/chilly-lemons-go.md:
---'astro-vscode': patch---
Publishes the Astro VS Code extension with the fix for `source.organizeImports` only organizing imports in one region of `.astro` files that have both frontmatter and `<script>` tags
pnpm changeset status shows astro-vscode -> 2.17.3. The current workflow will detect that version bump and run vsce publish / ovsx publish.
No source changes; git diff packages/ is empty.
Alternative: publish 2.17.2 to the stores by hand.
Note: the fix depends on a pnpm patch to Volar pinned to @2.4.30. Future Volar upgrades must carry the patch forward, and it may be worth upstreaming.
This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
changed the title [-][Astro VS CODE] source.organizeImports is broken again[/-][+][Astro VS CODE] source.organizeImports is still broken[/+]on Nov 6, 2026
Activity
astro-factory commentedon Nov 5, 2026
Triage complete
triage: needs triagemain.packages/language-tools/language-server/test/typescript/organize-imports.test.tsalready covers this and passes. The problem is in releasing, which a unit test can't check..astrofiles that have both frontmatter and<script>tags. Everything else in the extension works.The #17909 fix (#17916) is on
main, but it never reached the VS Code Marketplace or Open VSX. The extension versions that include it (astro-vscode2.17.0–2.17.2) went to npm, but both stores still stop at 2.16.20, which is older than the fix. After the Changesets v3 migration (#17856), the release workflow's VS Code publish step depended on achangesets/actionoutput that no longer worked as expected, so it was skipped. #18104 fixed the workflow later, butastro-vscodehasn't had a new version since then.I found a potential fix for this issue. It doesn't change any code: it adds a patch changeset for
astro-vscode(.changeset/chilly-lemons-go.md), so the next release publishes 2.17.3 through the fixed workflow. A maintainer could also publish 2.17.2 to the stores by hand. This needs human review, especially to check that thevsce/ovsxpublish steps and their tokens still work.Full Triage Report
Issue
"[Astro VS CODE] source.organizeImports is broken again". The reporter says #17909 is happening again. Environment: Astro 7.4.5, Node 26.13.0, macOS arm64, pnpm, VS Code with
astro-build.astro-vscode. Repro: https://github.com/Eptagone/astro-vscode-sort-imports. It useseditor.codeActionsOnSave: { "source.organizeImports": "explicit" }on an.astrofile that has imports in the frontmatter and in a<script>.What #17909 was
#17916 (
8eaa4f21e) fixed it, changeset: "Fixes organize imports across frontmatter and multiple script tags". Volar's@volar/language-servicewithCodeActiondedupes code actions bytitleonly. Each TypeScript region of an.astrofile (the frontmatter and each<script>) returns its own action titled "Organize Imports", so all but one were dropped. The fix is a pnpm patch that addsJSON.stringify(item.data)to the dedupe key:patches/@volar__language-service@2.4.30.patch, registered inpnpm-workspace.yamlunderpatchedDependencies.Reproduction
I drove the language server over LSP with the existing test harness (
language-server/test/server.ts). I sentsource.organizeImportsfor the whole document (triggerKind 2, as on save) and for a cursor position, using the reporter's file with unusedpooServer/pooClientimports added:mainmain(pnpm -C packages/language-tools/vscode build)pooServeris left in the frontmatterThe 2.16.20 bundle contains the unpatched dedupe (
e=>[e.title]).organize-imports.test.tspasses 6/6 onmain.Diagnosis
astro-vscode: 2.16.20 (08-25), 2.17.0 (09-16), 2.17.1 (10-06), 2.17.2 (10-08).ExtensionAssetNotFoundException..github/workflows/release.ymlhistory:steps.changesets.outputs.publishedPackages. Whenpublished == true, the fallback that works out the release list from the commit diff was skipped, soHAS_VSCODEstayed false and the Marketplace/Open VSX steps were skipped.published-packages); Revert "Fix changesets action output name in release workflow" #18103 reverted that.[ci] releasecommit.astro-vscodeversion bump since, so the fixed workflow has never published it.Verification
This is a bug (high confidence). Maintainers chose the expected behaviour explicitly in #17916, with a changeset and tests. Missing the store releases was accidental, as the later workflow fixes show.
Fix
I added
.changeset/chilly-lemons-go.md:pnpm changeset statusshowsastro-vscode -> 2.17.3. The current workflow will detect that version bump and runvsce publish/ovsx publish.git diff packages/is empty.@2.4.30. Future Volar upgrades must carry the patch forward, and it may be worth upstreaming.This report was made by an LLM. The analysis may be wrong, and the potential fix might not work, but is intended as a starting point for exploring the issue.
[-][Astro VS CODE] source.organizeImports is broken again[/-][+][Astro VS CODE] source.organizeImports is still broken[/+]Princesseuh commentedon Nov 11, 2026
Release is out and should normally have the fix