taco
taco
DDeno
Created by taco on 1/7/2025 in #help
JSDoc inline import with Deno LSP does not find or apply type from npm package
Hello! When using the Deno LSP (tested in both VSCode with Deno for VSCode v3.43.2 and neovim with coc-deno 3.15.0), JSDoc imports from npm packages are not working. In the same project before initializing the Deno LSP, everything is found and functional with tsserver. I'm running Deno 2.1.3-1 on Arch Linux, kernel 6.6.63-1-lts Steps to reproduce, in a new folder:
deno init
deno add npm:pg
deno add npm:@types/pg
touch index.js
deno init
deno add npm:pg
deno add npm:@types/pg
touch index.js
This results in this deno.json:
{
"tasks": {
"dev": "deno run --watch main.ts"
},
"imports": {
"@std/assert": "jsr:@std/assert@1",
"@types/pg": "npm:@types/pg@^8.11.10",
"pg": "npm:pg@^8.13.1"
}
}
{
"tasks": {
"dev": "deno run --watch main.ts"
},
"imports": {
"@std/assert": "jsr:@std/assert@1",
"@types/pg": "npm:@types/pg@^8.11.10",
"pg": "npm:pg@^8.13.1"
}
}
In index.js:
/**
* @param {import('pg').}
*/
/**
* @param {import('pg').}
*/
Removing the . after import('pg') and placing it back causes tsserver to give all types from @types/pg. Nothing happens with the Deno LSP. The same exact thing can be seen with
/**
* @param {import('pg').Pool} pool
*/
const example = (pool) => {
pool // Remove and type pool to see the intellisense
}
/**
* @param {import('pg').Pool} pool
*/
const example = (pool) => {
pool // Remove and type pool to see the intellisense
}
With the Deno LSP, the type for pool is:
(parameter) pool: any
@param - pool
(parameter) pool: any
@param - pool
With tsserver, the type is:
(parameter) pool: Pool
@param pool
(parameter) pool: Pool
@param pool
The deno LSP status is in the attached text.
1 replies