#Deno language server stops working in VS Code

51 messages · Page 1 of 1 (latest)

proper solstice
#

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)
(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

Restarting VS Code fixes that for a short amount of time.
How do I fix this issue?

ember cradle
#

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

proper solstice
ember cradle
#

You have deno.json under dev dir is that the one you moved ?

proper solstice
#

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

ember cradle
#

If dev is actually the whole project , then using enablePath is the correct approach

proper solstice
#

this is my settings.json:

{
    "deno.enablePaths": [ "src" ],
    // "deno.enable": true,
    "deno.lint": true,
    "deno.unstable": true
}
ember cradle
#

How many files do you have under src?

proper solstice
#

4

#
  • deno.json/.lock
ember cradle
#

So that means enablePaths isn't really working

proper solstice
#

it works, for 10 minutes

#

and then it stops working

ember cradle
#

It's preloading 1000 files which means is looking at other directories then src

proper solstice
#

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.
#

(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.
#

LS broken again and throws random errors at me (which a VS code restart fixes, temporarily) hobbHands

topaz timber
#

I've always put deno.json in the project root.

topaz timber
# proper solstice

Do you have any files in the project root? Can't tell by the above image.

proper solstice
topaz timber
proper solstice
#

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: #general message but should not be a permanent solution…

ember cradle
#

Where are the large number of files coming from?

#

It might be a bug with enablePaths not working as intended, I'll test it

ember cradle
#

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"]
}
#

oh I didn't link to the issue

proper solstice
ember cradle
#

No there is a top level exclude, like the example I showed

proper solstice
#

oh ok, the manual doesn't mention anything about that

ember cradle
#

Its a recent feature, I opened an issue for the manual

proper solstice
#

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:

ember cradle
#

how did you use exclude ?

proper solstice
#

/deno.json:

{
    "tasks": {
        "dev": "export DEV=DEV && deno run -A --watch src/main.ts",
        "start": "deno run -A --watch src/main.ts"
    },
    "exclude": [ "static/" ]
}
ember cradle
#

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

proper solstice
proper solstice
#

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.