Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 BUG: losing intellisense on typescript imports inside .astro files until editor reload #958

Open
lee-arnold opened this issue Sep 30, 2024 · 10 comments
Labels
needs investigation The cause of the issue is unknown and a deeper investigation is needed to fix it

Comments

@lee-arnold
Copy link

lee-arnold commented Sep 30, 2024

Describe the Bug

MacOS
VS Code extension: 2.14.2
Npm: 10.8.3
Node: 22.9.0
VS Code: 1.93.1

Intelisense in frontmatter imports doesn't seem to be working as expected when dealing with new typescript files. Sometimes I can get it to work for the first instance of a file, but then it fails to import any other files. Either way, reloading the editor after creating any new files fixes the issue.

Steps to Reproduce

  1. npm create astro@latest (4.15.9 as of today)
  2. open the project in vscode
  3. create anything.ts with the contents export const anything = "anything";
  4. create another.ts with the contents export const another = "another";
  5. open index.astro and try to import the exported const.
  6. while typing import anyt... I would expect the import to be listed at the top of the autocomplete list, however it does not appear there.
  7. reload the vscode window and the imports now appear on the autocomplete list

Link to Minimal Reproducible Example

https://github.com/lee-arnold/astro-issue-example

@github-actions github-actions bot added the needs triage Issue needs to be triaged label Sep 30, 2024
@Princesseuh
Copy link
Member

Princesseuh commented Oct 2, 2024

Everything works as expected for me when following your instructions:

Screen.Recording.2024-10-02.at.11.51.44.mov

I'm not sure how to debug this further.

@Princesseuh Princesseuh added needs investigation The cause of the issue is unknown and a deeper investigation is needed to fix it and removed needs triage Issue needs to be triaged labels Oct 2, 2024
@lee-arnold
Copy link
Author

Hey, thanks for the response. Can I ask what OS and versions you're using? I haven't had a chance to test any others yet.

@Princesseuh
Copy link
Member

This is on macOS, 2.14.2 of the Astro extension, VS Code 1.93.1.

@Arttii
Copy link

Arttii commented Oct 3, 2024

I am having this same problem, but on Ubuntu 22.04 with VS Code 1.92.1

@lee-arnold
Copy link
Author

I've noticed with further use that it also fails to recognise new exported functions in files that already existed, again resolved by restarting the language server.

@baranelitez
Copy link

My dupe issue above was about autocompletions on components like <MyComp.. but I guess it boils down to same issue. Running VSCode in Windows 11, under WSL2 (debian). Version is 1.96.0

@joanrieu
Copy link

joanrieu commented Dec 27, 2024

Having the same issue on MacOS with Astro extension v2.15.4.

Any kind of file operation (new/renamed file or new/renamed exports) is not picked up unless I use "restart extension host" or restart VSCode. Until then, imports of these new files/exports are underlined as not found, and are not reported by intellisense either.
This also affects Astro components (.astro files), new components can't be imported unless the extension is restarted.

It's a bit like if a file watcher was stuck and never updating after the initial scan.

UPDATE: Seems to be resolved for my after the latest VSCode update (1.96.2).
UPDATE 2 (a few days later): The issue reappeared.

@fvieira
Copy link

fvieira commented Dec 31, 2024

Just a note that I'm on VSCode 1.96.2 and it still doesn't work.
What I see is that any export (either on a TS file or Astro) gets picked up immediately on a TS file, but only gets picked up on an Astro file after reloading.

This is probably my biggest issue with Astro at the date, as I have to reload VSCode a dozen times a day due to this.

@cbcruk
Copy link

cbcruk commented Jan 2, 2025

I experienced the same issue, but it hasn't occurred yet in Code Insiders (1.96). There could be other factors, such as conflicting extensions, but I haven't been able to reproduce the bug so far.

@amitkummer
Copy link

Without this issue I would not know a restart fixes it :)

Happens to me every time on Debian 12 + NeoVim 0.10.2 + astro-ls 2.15.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs investigation The cause of the issue is unknown and a deeper investigation is needed to fix it
Projects
None yet
Development

No branches or pull requests

8 participants