D
Deno

help

Deno language server stops working in VS Code

Nnoxifoxi8/28/2023
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?
MMrcool8/31/2023
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
Nnoxifoxi8/31/2023
thanks, I moved the deno.json into the src folder:
No description
MMrcool8/31/2023
You have deno.json under dev dir is that the one you moved ?
Nnoxifoxi8/31/2023
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
MMrcool8/31/2023
If dev is actually the whole project , then using enablePath is the correct approach
Nnoxifoxi9/1/2023
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
}
MMrcool9/1/2023
How many files do you have under src?
Nnoxifoxi9/1/2023
4 + deno.json/.lock
MMrcool9/1/2023
So that means enablePaths isn't really working
Nnoxifoxi9/1/2023
it works, for 10 minutes and then it stops working
MMrcool9/1/2023
It's preloading 1000 files which means is looking at other directories then src
Nnoxifoxi9/1/2023
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
Nnoxifoxi9/1/2023
No description
ABAltair 680b9/1/2023
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.
Nnoxifoxi9/1/2023
I moved the deno.json back to the project's root.
No description
ABAltair 680b9/1/2023
Did that help?
Nnoxifoxi9/1/2023
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…
MMrcool9/1/2023
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
MMrcool9/1/2023
No there is a top level exclude, like the example I showed
Nnoxifoxi9/1/2023
oh ok, the manual doesn't mention anything about that
MMrcool9/1/2023
Its a recent feature, I opened an issue for the manual
Nnoxifoxi9/1/2023
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
Nnoxifoxi9/1/2023
when I use "deno.enablePaths": [ "src" ], instead I don't get the Deno environment in the src folder:
No description
MMrcool9/1/2023
how did you use exclude ?
Nnoxifoxi9/1/2023
/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/" ]
}
MMrcool9/1/2023
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
Nnoxifoxi9/4/2023
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.
MMrcool9/4/2023
what happens without the exclude ? the lsp crashes ?

Looking for more? Join the community!

Recommended Posts
Getting free disk space without using child_process.Hello everyone! I would like to create a small CLI tool using Typescript and Deno. I would like to mtest --filter a stepCan I only run a certain step in the test?fastwebsockets how to end client calls and avoid Error in websocket connection Unexpected EOFWhat is the issue in this client code that causes the error? ```rust pub async fn connect() -> Resuldeno compile --include argumentIn `deno compile`, how can i include a whole directory instead of just a file? Also, is there a way `deno run` as a library`deno run` does a lot of useful things behind the scenes, many of which are not exposed as a libraryPermissions with npm/node importsI'm trying to run a command and it's like I need to add `--allow-read` permissions because of the `nBroadcastChannelWhen using BroadcastChannel api, in the background does deno send the broadcast to every instance orIs it possible to create a TCP server on Deno Deploy?Is it possible to create a TCP server on Deno Deploy?oak server can't accept requests from another server?hi, I'm trying out deno with oak to make a simple server. I set up cors(x/cors), it accepts requestsaddEventListener for keydown in terminal via deno?Is there something like `addEventlistener("keydown")` in deno, so i can capture terminal inputs?Deno KV Type ErrorWhen I run await (await kv.get<typeThing>(["example"])).id (the value is an object), it returns a tyHow to improve seo ?https://deno.land/x/blog My question is when you use tool like this that work with md, how can i do Hashbang with TS file (without .ts extension)Hi y'all, I have a few convenience scripts written in Typescript for Deno that all have a wrapper scAstro + Deno - Remote ImportsFirst of all thanks a lot for the nice template, it looks great !! I followed the guide posted hereDebugging test in VSCode always breaks on line 54 of colors.tsWhen debugging tests in VSCode the debugger always breaks on line 54 of colors.ts. This behavior is Building from `src` offline?Hey guys! I'm new to Deno (and web dev as well to be honest), so could you help me here please. I'Any plan to fix Deno.listenTls() timing out a WebSocket connection?Any plan to fix Deno.listenTls() timing out a WebSocket connection? ``` {code: 1001, reason: 'No rePlaying sound from fileHow can i play the sound from a local file using deno?Deno with the --inspect-wait arg doesn't expose /json/protocol - should it?I'm testing out connecting to a Deno process via the v8 inspector protocol: https://deno.land/manual`deno test` and VSCode test runner are failing to run all test filesIn my Fresh projects, I'm trying to run all my tests with a single command. This used to not be an i