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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 BUG: Reload Window Required After Creating Layout or Component for Intellisense to Recognize #685

Closed
Daubenmire opened this issue Nov 9, 2023 · 12 comments
Labels
- P4: important Violate documented behavior or significantly improves performance (priority) ecosystem: upstream Issue is caused by a bug / missing feature upstream

Comments

@Daubenmire
Copy link

Describe the Bug

Every time I create a new layout or component and attempt to use it I have to ctrl+shift+p -> Reload Window to refresh VSCode in order for Intellisense to recognize it and not give an error.
image
image

If I either close VS Code and reopen or I ctrl+shift+p -> Reload Window the component or layout will immediately be available and work correctly.
image
image

Steps to Reproduce

  1. npm create astro@latest
  2. open blank project
  3. create a new layout (MainLayout.astro for ex.)
  4. create a second layout (AnotherLayout.astro for ex.)
  5. attempt to use in MainLayout.astro
  6. sometime this second layout is recognized without issue.....
  7. create a third layout (MainHead.astro for ex.)
  8. attempt to use in MainLayout.astro and it will not be recognized by intellisense and give an error.
  9. delete tag
  10. reload window
  11. use tag in MainLayout.astro and it will be recognized and work correctly.
@Princesseuh
Copy link
Member

If you try to use the quick fix to import the component, does it work?

@Daubenmire
Copy link
Author

If you try to use the quick fix to import the component, does it work?

Yes the quick fix will bring up a window to allow you to import it.

image

I also just noticed while trying to test this that it looks like the first one I create will work and import correctly after opening a new project but successive ones will not.

I opened VSCode, created layout QuickFix.astro and went to put it in MainLayout.astro and intellisense worked correctly. Making the second layout called AnotherQuick.astro and trying to insert in Mainlayout.astro gave the same bug as reported. I was able to test the quick fix on and get it to import. Screenshot is from a third layout showing quick fix pop-up.

@Princesseuh
Copy link
Member

Princesseuh commented Nov 10, 2023

I believe this is a bug in https://github.com/volarjs/typescript-auto-import-cache, thank you for the issue! I'll keep this open and mark it as being upstream.

@Princesseuh Princesseuh added bug ecosystem: upstream Issue is caused by a bug / missing feature upstream - P4: important Violate documented behavior or significantly improves performance (priority) and removed bug labels Nov 10, 2023
@sammwashere
Copy link

Is there a way to maybe disable the typescript auto import cache in VS Code?

@Brian-ChM
Copy link

I have the same problem, it seems to happen only on linux.

@zhibisora
Copy link

I also encountered this issue on macos.

@nasheomirro
Copy link

Happens on Windows as well. I also want to add that Astro files still show as suggestions even when they are deleted until the next reload/restart of the extension, it doesn't add the import statements if you do click or press enter on the bugged suggestion.

@tysian
Copy link

tysian commented Mar 7, 2024

Seems like tsconfig.json is not detected when new file is created

Existing file
image
vs
Freshly created file without reloading the window
image

@einarmagnus
Copy link

For what it is worth: it is enough for me to run "Astro: reload project" to get it working again. That's a lot quicker than reloading the whole window.

@Princesseuh
Copy link
Member

The latest version of the extension should improve the problem here somewhat, however there are still some issues remaining. Apologies for the inconvenience, it was a tough nut to crack!

@Reimirno
Copy link

Same problem on windows. (astro extension v2.8.4)

@Princesseuh
Copy link
Member

The vast majority of these issues have been fixed in recent updates and we're getting less and less reports of this happening. There are still some remaining caching issues around deletions that are being worked on independently from this, but I cannot reproduce issues around creating new components anymore.

If this still happens, please create a new issue with reproduction steps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P4: important Violate documented behavior or significantly improves performance (priority) ecosystem: upstream Issue is caused by a bug / missing feature upstream
Projects
None yet
Development

No branches or pull requests

9 participants