denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.5k stars 5.19k forks source link

LSP only suggests the src path for all hooks, even when `preact` has been declared in the import map #24476

Open ooker777 opened 2 weeks ago

ooker777 commented 2 weeks ago

My import map:

"imports": {
    "$fresh/": "https://deno.land/x/fresh@1.6.8/",
    "preact": "https://esm.sh/preact@10.22.0",
    "preact/": "https://esm.sh/preact@10.22.0/",
    "@preact/signals": "https://esm.sh/*@preact/signals@1.2.2",
    "@preact/signals-core": "https://esm.sh/*@preact/signals-core@1.5.1",
    "tailwindcss": "npm:tailwindcss@3.4.1",
    "tailwindcss/": "npm:/tailwindcss@3.4.1/",
    "tailwindcss/plugin": "npm:/tailwindcss@3.4.1/plugin.js",
    "$std/": "https://deno.land/std@0.216.0/"
  },
  "compilerOptions": {
    "jsx": "react-jsx",
    "jsxImportSource": "preact"
  },

I'm using VS Code. Plugin v3.38.0. Deno v1.44.4

lucacasonato commented 2 weeks ago

Can you add the piece of code that is auto completing incorrectly?

ooker777 commented 2 weeks ago

I'm not sure what you are referring to. You just need to start typing use and wait for the suggestions.

ndtoan96 commented 1 day ago

I got the same issue. And the thing it suggests causes error too. For example in my case, when I type "useSignal", it suggest import from "https://esm.sh/v135/@preact/signals@1.2.2/X-ZS8q/dist/signals.js". I did and it causes error "Cycle detected". Meanwhile, if I import manually from "@preact/signals" then it works fine.

Causing me headache the whole evening.