withastro / language-tools

Language tools for Astro
MIT License
267 stars 52 forks source link

🐛 BUG: extension not doing anything (no syntax color, no intellisense, etc) #856

Closed trusktr closed 4 months ago

trusktr commented 5 months ago

Describe the Bug

I've got the extension installed, but it isn't doing anything when opening a project in a subfolder:

Screenshot 2024-04-22 at 1 23 05 AM

Steps to Reproduce

  1. Clone the astro to astro/ folder.
  2. run code astro/examples/framework-lit to open the framework-lit example in VS Code
  3. Open the index.astro file and there is no highlight, no intellisense, etc.

It looks like the plugin does not work in subfolders of a project where the config is higher up. The astro repository has a lot of packages and examples, so it would be preferable to open those separately (because then everything is scoped to the workspace, for example searching across files, fuzzy finding files, etc, will be conveniently limited to the workspace).

trusktr commented 5 months ago

For now, I can set language mode to HTML to get some color (but no type checking, etc). Once I open other files (f.e. none-astro files such as .ts files) the intellisense works fine, so another workaround is to move as much code as I can into components instead of in the Astro files.

trusktr commented 5 months ago

It looks like the Astro plugin also gets in the way of TypeScript working normally with non-astro files. For example here TypeScript does not find type definitions for a package that ships with type defs built in:

Screenshot 2024-04-22 at 1 55 57 AM

If I uninstall the Astro plugin and restart TS server, the problem goes away (going to definition on the module name will take me to @lume/element's code in node_modules).

Princesseuh commented 5 months ago

On the first screenshot you shared, the extension looks disabled (it's grayed out)

Everything looks fine to me:

image

When following your steps.

For your second problem, I cannot help without a reproduction.

Princesseuh commented 4 months ago

Closing due to inactivity.