noxifoxi
noxifoxiβ€’17mo ago

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:
An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option.deno-ts(2705)
An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your '--lib' option.deno-ts(2705)
(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:
Starting Deno language server...
version: 1.36.3 (release, x86_64-unknown-linux-gnu)
executable: /home/nox/.deno/bin/deno
Connected to "Visual Studio Code" 1.81.1
Auto-resolved configuration file: "file:///home/nox/dev/deno.json"
Resolved lock file: "file:///home/nox/dev/deno.lock"
Enabling import suggestions for: https://deno.land
Hit the language server document preload limit of 1000 file system entries. You may want to use the "deno.enablePaths" configuration setting to only have Deno partially enable a workspace or increase the limit via "deno.documentPreloadLimit". In cases where Deno ends up using too much memory, you may want to lower the limit.
Server ready.
client asked to cancel request 4, but no such pending request exists, ignoring
client asked to cancel request 7, but no such pending request exists, ignoring
client asked to cancel request 419, but no such pending request exists, ignoring
successfully cancelled request with ID: 627
Unable to send result to client.
client asked to cancel request 697, but no such pending request exists, ignoring
Starting Deno language server...
version: 1.36.3 (release, x86_64-unknown-linux-gnu)
executable: /home/nox/.deno/bin/deno
Connected to "Visual Studio Code" 1.81.1
Auto-resolved configuration file: "file:///home/nox/dev/deno.json"
Resolved lock file: "file:///home/nox/dev/deno.lock"
Enabling import suggestions for: https://deno.land
Hit the language server document preload limit of 1000 file system entries. You may want to use the "deno.enablePaths" configuration setting to only have Deno partially enable a workspace or increase the limit via "deno.documentPreloadLimit". In cases where Deno ends up using too much memory, you may want to lower the limit.
Server ready.
client asked to cancel request 4, but no such pending request exists, ignoring
client asked to cancel request 7, but no such pending request exists, ignoring
client asked to cancel request 419, but no such pending request exists, ignoring
successfully cancelled request with ID: 627
Unable to send result to client.
client asked to cancel request 697, but no such pending request exists, ignoring
Restarting VS Code fixes that for a short amount of time. How do I fix this issue?
29 Replies
Mrcool πŸ‡΅πŸ‡Έ
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
noxifoxi
noxifoxiOPβ€’17mo ago
thanks, I moved the deno.json into the src folder:
No description
Mrcool πŸ‡΅πŸ‡Έ
You have deno.json under dev dir is that the one you moved ?
noxifoxi
noxifoxiOPβ€’17mo ago
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
Mrcool πŸ‡΅πŸ‡Έ
If dev is actually the whole project , then using enablePath is the correct approach
noxifoxi
noxifoxiOPβ€’17mo ago
this is my settings.json:
{
"deno.enablePaths": [ "src" ],
// "deno.enable": true,
"deno.lint": true,
"deno.unstable": true
}
{
"deno.enablePaths": [ "src" ],
// "deno.enable": true,
"deno.lint": true,
"deno.unstable": true
}
Mrcool πŸ‡΅πŸ‡Έ
How many files do you have under src?
noxifoxi
noxifoxiOPβ€’17mo ago
4 + deno.json/.lock
Mrcool πŸ‡΅πŸ‡Έ
So that means enablePaths isn't really working
noxifoxi
noxifoxiOPβ€’17mo ago
it works, for 10 minutes and then it stops working
Mrcool πŸ‡΅πŸ‡Έ
It's preloading 1000 files which means is looking at other directories then src
noxifoxi
noxifoxiOPβ€’17mo ago
it isn't saying that anymore πŸ€·β€β™€οΈ
Starting Deno language server...
version: 1.36.3 (release, x86_64-unknown-linux-gnu)
executable: /home/nox/.deno/bin/deno
Connected to "Visual Studio Code" 1.81.1
Auto-resolved configuration file: "file:///home/nox/dev/bingobrawlers.new/deno.json"
Resolved lock file: "file:///home/nox/dev/bingobrawlers.new/deno.lock"
Enabling import suggestions for: https://deno.land
Server ready.
Starting Deno language server...
version: 1.36.3 (release, x86_64-unknown-linux-gnu)
executable: /home/nox/.deno/bin/deno
Connected to "Visual Studio Code" 1.81.1
Auto-resolved configuration file: "file:///home/nox/dev/bingobrawlers.new/deno.json"
Resolved lock file: "file:///home/nox/dev/bingobrawlers.new/deno.lock"
Enabling import suggestions for: https://deno.land
Server ready.
(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:
client asked to cancel request 449, but no such pending request exists, ignoring
successfully cancelled request with ID: 468
Unable to send result to client.
client asked to cancel request 449, but no such pending request exists, ignoring
successfully cancelled request with ID: 468
Unable to send result to client.
LS broken again and throws random errors at me (which a VS code restart fixes, temporarily) hobbHands
noxifoxi
noxifoxiOPβ€’17mo ago
No description
Fifth-Normal-Form
Fifth-Normal-Formβ€’17mo ago
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.
noxifoxi
noxifoxiOPβ€’17mo ago
I moved the deno.json back to the project's root.
No description
Fifth-Normal-Form
Fifth-Normal-Formβ€’17mo ago
Did that help?
noxifoxi
noxifoxiOPβ€’17mo ago
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…
Mrcool πŸ‡΅πŸ‡Έ
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
{
"exclude": ["path_with_many_files_that_dont_need_lsp"]
}
{
"exclude": ["path_with_many_files_that_dont_need_lsp"]
}
oh I didn't link to the issue https://github.com/denoland/deno/issues/19802
Mrcool πŸ‡΅πŸ‡Έ
No there is a top level exclude, like the example I showed
noxifoxi
noxifoxiOPβ€’17mo ago
oh ok, the manual doesn't mention anything about that
Mrcool πŸ‡΅πŸ‡Έ
Its a recent feature, I opened an issue for the manual
noxifoxi
noxifoxiOPβ€’17mo ago
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,):
No description
noxifoxi
noxifoxiOPβ€’17mo ago
when I use "deno.enablePaths": [ "src" ], instead I don't get the Deno environment in the src folder:
No description
Mrcool πŸ‡΅πŸ‡Έ
how did you use exclude ?
noxifoxi
noxifoxiOPβ€’17mo ago
/deno.json:
{
"tasks": {
"dev": "export DEV=DEV && deno run -A --watch src/main.ts",
"start": "deno run -A --watch src/main.ts"
},
"exclude": [ "static/" ]
}
{
"tasks": {
"dev": "export DEV=DEV && deno run -A --watch src/main.ts",
"start": "deno run -A --watch src/main.ts"
},
"exclude": [ "static/" ]
}
Mrcool πŸ‡΅πŸ‡Έ
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
noxifoxi
noxifoxiOPβ€’16mo ago
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.
Mrcool πŸ‡΅πŸ‡Έ
what happens without the exclude ? the lsp crashes ?

Did you find this page helpful?