Visitar URL original
fix(language-server): strip AstroComponent suffix from Svelte and Vue auto-imports by IAmYhvr · Pull Request #17542 · withastro/astro · GitHub
Skip to content

fix(language-server): strip AstroComponent suffix from Svelte and Vue auto-imports - #17542

Merged
Princesseuh merged 3 commits into
withastro:mainfrom
IAmYhvr:strip-astrocomponent
Sep 11, 2026
Merged

Princesseuh merged 3 commits into
withastro:mainfrom
IAmYhvr:strip-astrocomponent

Conversation

@IAmYhvr

@IAmYhvr IAmYhvr commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Changes

  • Fix a regression introduced in fix(language-server): rewrite Astro component auto-import names #15908 where auto-importing Svelte and Vue components appended "AstroComponent" to component names
  • Update names of a couple internal functions and variables to better match their fixed behavior
  • Simplify a tiny bit of logic in completions.ts coincidentally made redundant by this fix

Before:

image

After:

image

Testing

  • Tweaked two existing tests to cover .svelte and .vue imports
  • Repro'd with the latest VS Code extension (2.16.18) and verified it was fixed in the dev build

Docs

This is a bugfix, so I don't believe it needs any documentation.

@changeset-bot

changeset-bot Bot commented Jul 29, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 480c41b

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@IAmYhvr

IAmYhvr commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

This PR has merge conflicts now. I'm busy for the next few days, but will fix them once my schedule is clearer.

@IAmYhvr
IAmYhvr force-pushed the strip-astrocomponent branch from 6d803dd to 2078eec Compare September 3, 2026 22:08
@IAmYhvr

IAmYhvr commented Sep 3, 2026

Copy link
Copy Markdown
Contributor Author

I asked an LLM how to fix the merge conflicts created by the LLM-generated pull request. I learned nothing and feel hollow, but that's how software development is done in 2026. This PR is ready for review again! 🎉

@ematipico
ematipico requested review from Princesseuh and a lite review from Copilot September 10, 2026 14:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The functional change and test updates look consistent with the regression fix, with only a minor changeset wording nit noted.

Pull request overview

This PR fixes a language-server regression where auto-imported Svelte and Vue components in .astro files incorrectly kept the internal AstroComponent suffix, aligning the completion labels and inserted import edits with expected component names.

Changes:

  • Extend component import/source detection and import-text rewriting to cover .svelte and .vue (in addition to .astro).
  • Apply the rewritten import text to completion additional edits and broaden component-source handling in completions.
  • Update unit tests and add a changeset for the language server + VS Code extension packages.
File summaries
File Description
packages/language-tools/language-server/test/units/utils.test.ts Updates unit coverage to include .svelte/.vue import rewriting and already-imported source detection.
packages/language-tools/language-server/src/plugins/typescript/utils.ts Generalizes “component import” recognition and import-text rewriting to include .astro/.svelte/.vue.
packages/language-tools/language-server/src/plugins/typescript/completions.ts Uses the broader component-source detection and ensures completion edits get rewritten for Svelte/Vue as well.
.changeset/sunny-buttons-call.md Adds a patch changeset for @astrojs/language-server and astro-vscode.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .changeset/sunny-buttons-call.md Resolved

@Princesseuh Princesseuh left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

(Change suggested by GitHub Copilot)

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@Princesseuh
Princesseuh merged commit fae64dd into withastro:main Sep 11, 2026
27 checks passed
@astrobot-houston astrobot-houston mentioned this pull request Sep 11, 2026
@IAmYhvr
IAmYhvr deleted the strip-astrocomponent branch September 13, 2026 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants