withastro / language-tools

Language tools for Astro
MIT License
268 stars 53 forks source link

🐛 BUG: Installing date-fns package breaks import intellisense #967

Open thanh-nguyen-95 opened 1 week ago

thanh-nguyen-95 commented 1 week ago

Describe the Bug

Installing date-fns package makes Astro Language Server stops autocompletion on imports.

Everything works as intended if I'm using VSCode with the latest Astro extension (2.15.2).

Additional info:

Steps to Reproduce

  1. npm init astro using default options
  2. npm install date-fns
  3. Intellisense stops working

Link to Minimal Reproducible Example

https://github.com/thanh-nguyen-95/astro-ls-error-with-date-fns

Princesseuh commented 1 week ago

Seems to work fine for me:

https://github.com/user-attachments/assets/28200abb-ef85-415a-9746-6bd6ed5c3af8

thanh-nguyen-95 commented 1 week ago

It DOES work in VSCode with the official extension as I mentioned in the bug report.

I'm using Neovim with a plugin, which uses @astrojs/language-server under the hood. I'm not sure why it stops working after I installed date-fns so I created an issue to see if anyone else has this problem. I assume the VSCode extension also uses @astrojs/language-server so it should work for me, but it's not.

I'm well aware this could be an edge case and could be solved by removing date-fns. Please feel free to close this issue if there's no further update.

Princesseuh commented 1 week ago

Ah apologies, I missed that part of the original post. Unfortunately, I barely have the time to debug VS Code issues, and so Neovim issues are insanely low priority. I'm sorry.

They do both use the same language server, there's only one LS for Astro

thanh-nguyen-95 commented 1 week ago

It's fine, really. This could very well be a problem with Neovim plugins that I'm using.

Thank you for taking your time and checking out my issue. I'll remove date-fns for now.

You can close this issue now. Thank you

Fakerko commented 4 days ago

Guys, I have the same issue. When I add package date-fns, it completely broke .astro files intellisense. When I remove date-fns package, it's working again.

I tried uninstall all other VSCode plugins and tried fresh astro project, but it's caused by the date-fns.

Fakerko commented 4 days ago

Recorded video to demonstrate the issue. When the date-fns is imported, only .astro files are broken.

https://github.com/user-attachments/assets/1745c393-fd2c-41d6-8676-55c0f30e9afd

Fakerko commented 2 days ago

@Princesseuh this should be re-open, I am using VSCode not Neovim.