withastro / language-tools

Language tools for Astro
MIT License
259 stars 50 forks source link

🐛 BUG: Refactoring `astro.config.mjs` file name is wrong #896

Open openscript opened 1 month ago

openscript commented 1 month ago

Describe the Bug

When I refactor astro.config.mjs to astro.config.ts the imports are updated and become invalid.

image

After the plugin is done with refactoring the native file name change refactoring is chiming in:

image

This will break the imports (missing '):

image

Steps to Reproduce

  1. Clone https://github.com/openscript/astro-i18n-demo/tree/repro/refactor-astro-config-file-name
  2. Open VSCode with Astro Extension 2.11.0
  3. Refactor astro.config.mjs to astro.config.ts
Version: 1.91.0
Commit: ea1445cc7016315d0f5728f8e8b12a45dc0a7286
Date: 2024-07-01T18:52:41.959Z
Electron: 29.4.0
ElectronBuildId: 9728852
Chromium: 122.0.6261.156
Node.js: 20.9.0
V8: 12.2.281.27-electron.0
OS: Linux x64 6.9.7-arch1-1
Princesseuh commented 1 month ago

The first refactor looks correct to me, .ts files are to be imported with .js extensions. Doing both renames at the same time will kinda never work, as they cannot know that it already happened or not, but perhaps there's a way to untangle it so that both extensions don't try to do it.

(The "native renaming" as you put it isn't native, it's TypeScript and our TS plugin doing it)