withastro / language-tools

Language tools for Astro
MIT License
272 stars 54 forks source link

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

Closed thanh-nguyen-95 closed 3 weeks ago

thanh-nguyen-95 commented 1 month 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 month ago

Seems to work fine for me:

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

thanh-nguyen-95 commented 1 month 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 month 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 month 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 1 month 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 1 month 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 1 month ago

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

Chipsnet commented 1 month ago

I have the same issue.

I noticed that my VSCode astro intellisense was broken and found this Issue, so I uninstalled date-fns and it works fine.

I am using the latest version of Astro extension and VSCode.

OS: Windows 11 23H2 (22631.4112) IDE: Visual Studio Code 1.94.2 bun: 1.1.32 Astro Extension: 2.15.3 Astro version: 4.15.12

Fakerko commented 1 month ago

After the Astro VSCode plugin last update to v2.15.4 its working as expected for now.

Princesseuh commented 1 month ago

Awesome. Could anyone else confirm?

Princesseuh commented 3 weeks ago

Closing, since it seems like this is fixed. Let me know if it still happens.