sveltejs / language-tools

The Svelte Language Server, and official extensions which use it
MIT License
1.26k stars 200 forks source link

Cannot find name 'svelteHTML' / Cannot find name '__sveltets_2_any', .... #2584

Open mysolo opened 3 days ago

mysolo commented 3 days ago

Describe the bug

bug on a version 109.2.2 , 109.2.1. no bug on a version 109.2.0

use "svelte": "3.52.0" in a project.

VSCode return a multiple error on a

=> Cannot find name 'svelteHTML' on a each => Cannot find name '__sveltets_2_ensureArray' on a component => Cannot find name '__sveltets_2_any' etc... ### Reproduction simple
Screenshot 2024-11-13 at 15 59 21 Screenshot 2024-11-13 at 15 59 29

Expected behaviour

No error on a code

System Info

  • OS: Mac os X
  • IDE: VSCode Version: 1.95.2
  • Svelte for VS Code v109.2.2

Which package is the issue about?

Svelte for VS Code extension, svelte-language-server

Additional Information, eg. Screenshots

No response

dummdidumm commented 2 days ago

I am unable to reproduce this. Please provide a reproduction repository.

mysolo commented 2 days ago

git@github.com:mysolo/vsc-svelte-debug.git

I replace version for svelte/sveltekit/typescript.

clone repos cd repos vsc .

open page.svelte

anders-hard commented 1 day ago

I also got this after some VSCode upgrade(?) sometime over the last week. OSX, Svelte 4.0.5, cursor 0.42.5, VSCode 1.93.1, Svelte for VSCode 109.2.2

image
dummdidumm commented 1 day ago

I am unable to reproduce this. Wondering if this is OS-dependent; I'm on Windows.

I suspect this came in as a result of #2561. Can you check

  • whether or not there's a .svelte2tsx-language-server-files folder inside your node_modules?
  • if yes what files does it contain?
  • if yes what are the file contents? (they should not be empty)
anders-hard commented 1 day ago

Yes, I have three files. The svelte-html.d.ts is empty, the others are not.

image
anders-hard commented 1 day ago

I managed to get rid of the error by removing the node_modules folder, upgrading svelte and re-installing node modules. That removes the svelte-html.d.ts file (it would re-create if I deleted it before).

dummdidumm commented 1 day ago

I was able to reproduce this for the early Svelte 4 versions and fixed the bug related to that. Still not able to reproduce this for Svelte 3, but added some extra checks. @mysolo could you try with the latest version of the extension?

mysolo commented 1 day ago

@mysolo could you try with the latest version of the extension?

I still have the problem with version 109.2.3

mysolo commented 1 day ago

I am unable to reproduce this. Wondering if this is OS-dependent; I'm on Windows.

I suspect this came in as a result of #2561. Can you check

* whether or not there's a `.svelte2tsx-language-server-files` folder inside your `node_modules`?

yes

* if yes what files does it contain?

ls -al node_modules/.svelte2tsx-language-server-files git:(feat/posthog|…12⚑13 total 168 drwxr-xr-x 5 mysolo staff 160 Nov 9 01:39 . drwxr-xr-x 82 mysolo staff 2624 Nov 9 01:39 .. -rw-r--r-- 1 mysolo staff 64575 Nov 15 15:29 svelte-jsx.d.ts -rw-r--r-- 1 mysolo staff 964 Nov 9 01:39 svelte-native-jsx.d.ts -rw-r--r-- 1 mysolo staff 14526 Nov 15 15:29 svelte-shims.d.ts

* if yes what are the file contents? (they should _not_ be empty)

they not be empty

dummdidumm commented 1 day ago

This is truly strange. This means they are properly copied over into the hidden folder, but then not actually loaded or picked up, for whatever reason. I'm not sure how to investigate this further. @jasonlyu123 do you have any ideas how to help @mysolo debug this / any ideas why this could happen?

dummdidumm commented 8 hours ago

@reskume mentioned this happens on case sensitive file systems, which may hint at what the problem is