Language server broken?

Hi everyone,
since today the language server seems to be broken for me. After running julia for a short time it becomes unresponsive. In the output of the Julia language server there are a stack overflow errors:

[ Info: Starting LS at 1695226578
Internal error: encountered unexpected error during compilation of getproperty:
StackOverflowError()
Internal error: encountered unexpected error during compilation of getproperty:
StackOverflowError()
unknown function (ip: 00007ffa6cbd4006)
Internal error: encountered unexpected error during compilation of getproperty:
StackOverflowError()
unknown function (ip: 00007ffa6cbd4006)
Internal error: encountered unexpected error during compilation of getproperty:
StackOverflowError()
unknown function (ip: 00007ffa6cbd4006)
Internal error: encountered unexpected error during compilation of getproperty:
StackOverflowError()

Does anyone have an idea how to repair it?
I tried downgrading the julia extension (there was an update 7 hours ago), but that didnt fix it.
Ive had this problem occur on two windows and one linux machine

Try deleting ~/.config/Code - OSS/User/globalStorage/julialang.language-julia/ (or similar) and restarting VS Code.

1 Like

I hope I did it correctly, I am currently on the windows machine and deleted julialang.language-julia in the extensions folder. That deleted the julia extension.
After installing again, I get the same error message.
One curious thing I found is that it somehow depends on which project I open. It looks like the problem is only for a specific project I am working on.
I have tried deleting the manifest and project.toml there (no success)
I am experimenting a bit with a completely new folder and copy my files there. So far it looks to be working.
I will give an update here if I find out more

I Think I have found the culprit:
I experimented a bit with code generation and saved some lowered Code into a file “xxx.jl”. The julia extension tries to analyze that and fails because it is not actually proper julia code.

Would be useful if you could share that file somewhere so we can take a look at fixing the underlying issue – the language server process shouldn’t crash even in the presence of invalid Julia files.

Can do,
I will try to create an MWE, the file I had was somewhat big

2 Likes

Ok looks like one cannot make the MWE very minimal, the problem seems to be when the file is too large.
I attach two examples, the smaller file does not crash the language server.
Looks like the lowered code makes many references to local variables, and the linter tries to track them recursively blowing the stack.

CrashLanguageServer.jl (481.2 KB)
doesntcrashLanguageServer.jl (6.4 KB)

1 Like

Thanks! Yup, this is a pretty straightforward case – we’re trying to parse that file as a series of binary operators (or something like that) recursively.

It’s unlikely that I’ll fix this properly (long term we want to move to JuliaSyntax for parsing anyways), but it would be nice to catch parsing errors and notify the user about which file caused the issue.

1 Like

Yes I don’t think it’s a super urgent fix as it’s not very likely to occur to anyone else.
I think in general it would be nice if the main functionality (I.e) sending code to the REPL could be kept even if the language server is having difficulties digesting some files. But probably this has been brought up before and is not easy to provide.

Ahem! It’s occurred for me as well and I went so far as to completely (or so I thought) delete both Julia and VSCode, then reinstall from scratch. Still happened. So if it is a rogue file, I’m not sure where it is.

Following up… I uninstalled both Julia and the extension AND my .julia folder. After reinstalling, Language Server loads without a hitch.

(Now, if I can only figure out why I can no longer select a line of code and Alt-Enter execute it…)

Can it just be that the keyboard shortcuts got remapped?
(Shift+P and enter keyboard shortcuts in the search, then look for Julia execute code)

1 Like

Yeah, that was one of the first things I checked.

(I’ll play a bit more, then start a new topic if need be.)

Try to switch it to a different key combination. I remember once having the issue that vscode didn’t recognize a specific key combination for some reason this is how you could find out if it’s the same problem