If you have a Deno project in a sub-folder of your repository, then its deno.json won't get recognized. It looks like the VSCode Extension only checks the root of your project for a deno.json file. However, it should also be checking deno.enablePaths locations.
As a result, monorepos using deno cannot use imports properly.
To Reproduce
Create a subfolder, like ./projects/deno
In .vscode/settings.json, enable Deno and add deno.enablePaths: './projects/deno'
Add a deno.json file at ./projects/deno/deno.json
In deno.json, add imports like so:
{
"imports": {
"~public/": "./public/"
}
}
Create a file at ./projects/deno/public/test.ts: export default 1
Create a file at ./projects/deno/root.ts: import test from '~public/test.ts
Watch as it errors.
Workaround: Open ./projects/deno in VSCode directly (not desired).
Expected behavior
Import paths should work relative to the location of the deno.json file. And in fact, they do. However, the VSCode extension doesn't seem to pick them up.
The workaround is to open the nested folder in VSCode directly. However, this is a workaround at best.
Describe the bug
If you have a Deno project in a sub-folder of your repository, then its
deno.json
won't get recognized. It looks like the VSCode Extension only checks the root of your project for adeno.json
file. However, it should also be checkingdeno.enablePaths
locations.As a result, monorepos using deno cannot use
imports
properly.To Reproduce
./projects/deno
.vscode/settings.json
, enable Deno and adddeno.enablePaths: './projects/deno'
deno.json
file at./projects/deno/deno.json
deno.json
, addimports
like so:./projects/deno/public/test.ts
:export default 1
./projects/deno/root.ts
:import test from '~public/test.ts
Workaround: Open
./projects/deno
in VSCode directly (not desired).Expected behavior
Import paths should work relative to the location of the
deno.json
file. And in fact, they do. However, the VSCode extension doesn't seem to pick them up.The workaround is to open the nested folder in VSCode directly. However, this is a workaround at best.
Screenshots
See above.
Versions
vscode: 1.89.1 deno: 1.43.3 extension: v3.37.1
Thank you for your help.