Deno language server stops working in VS Code
After some random time the language server stops working and I suddenly get code errors like this:
(Even when I use
"deno.enablePaths": [ "src" ]
in settings.json)
Increasing "deno.documentPreloadLimit"
(to something like 10000
) just delays the problem a little bit.
the language server output:
Restarting VS Code fixes that for a short amount of time.
How do I fix this issue?29 Replies
You should remove that top deno.json
Since the lsp now preloads all files it will get confused trying to preloads all JavaScript files under dev
Keep deno.json only inside the projects dirs
thanks, I moved the
deno.json
into the src folder:You have deno.json under dev dir is that the one you moved ?
I didn't know this causes issues, because the whole dev folder is the project, but LSP just shouldn't do anything with static
it's now under
/home/nox/dev/src/deno.json
If dev is actually the whole project , then using enablePath is the correct approach
this is my
settings.json
:
How many files do you have under src?
4
+ deno.json/.lock
So that means enablePaths isn't really working
it works, for 10 minutes
and then it stops working
It's preloading 1000 files which means is looking at other directories then src
it isn't saying that anymore π€·ββοΈ
(don't mind the path change, it's exactly the same folder just one level deeper)
but one thing I just did was deleting the
deno.lock
file, now it's no longer complaining π€
ok, here we go again:
LS broken again and throws random errors at me (which a VS code restart fixes, temporarily) I've always put deno.json in the project root.
Do you have any files in the project root? Can't tell by the above image.
I moved the deno.json back to the project's root.
Did that help?
so far nothing has changed, the Language Server stops working after a few minutes. gonna code more later today and test it.
This might be a workaround: https://discord.com/channels/684898665143206084/684898665151594506/1147037300417638431 but should not be a permanent solutionβ¦
Where are the large number of files coming from?
It might be a bug with enablePaths not working as intended, I'll test it
enablePaths didnt work for me as well
this issue suggest to use
exclude
in deno.json as a workaround
exclude worked for me
deno.json
oh I didn't link to the issue
https://github.com/denoland/deno/issues/19802@mrcool for the linter I guess? https://deno.land/manual@v1.36.3/getting_started/configuration_file#lint
No there is a top level exclude, like the example I showed
oh ok, the manual doesn't mention anything about that
Its a recent feature, I opened an issue for the manual
doesn't seem to work though, I don't get the normal vanilla JS auto completion in my
static
folder (when I use "deno.enable": true,
):when I use
"deno.enablePaths": [ "src" ],
instead I don't get the Deno environment in the src
folder:how did you use exclude ?
/deno.json
:
Exclude means that folder won't have deno lsp enabled in it
did you want to exclude static ?
it should be used on the folder where you have thousand of files that don't need the lsp
which folder do you have that have that many files ?, beacuse the lsp is trying to preload them all
yes, the static folder contains static files, like html, javascript, css and images
It seems like LSP works properly now:
in
.vscode/settings.json
I use "deno.enablePaths": [ "src" ]
in deno.json
I use "exclude": [ "static/" ]
(this seems to be the resolving line)
I don't get shown by VS Code when I edit files in src/
that this is a deno environment (because of deno.enablePaths
), but I get full code suggestions by LSP.what happens without the exclude ? the lsp crashes ?