deno
deno copied to clipboard
VSCode/LSP does not recognize JSR imports in separate importMapFile (outside deno.json)
Version: Deno 1.45.2
This works in Deno CLI, but VSCode (or LSP) does not recognize the std/exists import:
deno.json
{
"importMap": "./import_map.json"
}
import_map.json
{
"imports": {
"std-fs": "jsr:@std/[email protected]",
}
}
test.js
import { exists } from "std-fs/exists"; // works in deno cli, but vs code/lsp can not resolve this
However, if the import map is moved to be contained in deno.json directly, it works:
deno.json
{
"imports": {
"std-fs": "jsr:@std/[email protected]",
},
}
test.js
import { exists } from "std-fs/exists"; // works
I tried deleting deno.lock, deleting all of deno cache dir, restarting vscode etc, and could only get LSP to recognize, or resolve, the import using the latter import map style. Deno CLI works no matter which style is in use.