Making resource space for language servers

Describe your feature request
The thing with repls are, they use a lot of resources depending on the language you’re using. That also implies for language servers, which are running on the same repl. It would be good if they would get their own resource space to at least run normally, since the typescript language server shuts down a lot of times (don’t know if it’s because of the ram or cpu usage, but it just hangs up after like 10 mins)

What problem(s) would this feature solve?

A lot of users really need intellisense, especially if they’re working with an offline editor like vscode. If language servers could run separately, they would always work in repls. Some language servers are lightweight but some (like the typescript one) have to work for javascript, typescript, jsx, and they really do consume some resources ig. Just to be clear, I’m not saying they use a lot of resources, I’m saying that they should not get overshadowed by other processes you may have (like running the code) and not work if so.

Explain what you were trying to do when you came across the problem leading to this feature request

Pretty much any javascript / typescript repl’s language server (they use the same one im pretty sure) kinda dies after some time (5-10 mins). You have to reload the site, but then it takes some time to load again, and it’s really not convenient.

Also, please don’t tell me to “pay for extra resources”. Language servers are kinda their own thing, and imo everyone deserves a decent intellisense at coding.

Thanks in advance!

Replit Profile: https://replit.com/@AljaBerginc

3 Likes

This doesn’t seem to be a goal anymore (at least not a high-priority one), but an initial goal stated during the desktop app beta testing was to allow the LSP to be run on the user’s local computer to reduce resource usage.
An alternative could indeed be to allocate shared processes in virtual machines just for language servers, and this would make it work for users of mobiles or very slow/limited computers. (if not possible to share the LSP across global repls it could be shared across the user/team)

if you’re on a legacy non-modules repl, you can change the languages.<language>.pattern if you feel that it’s trying to process too many files. Otherwise, you could remove the modules and configure the repl and language servers yourself. You can use older repls such as https://replit.com/@AljaBerginc/When-frontend?v=1#.replit for examples on what the config looks like.

I haven’t noticed this issue, but it has been 3 months since I’ve properly used a Free plan / global cluster repl. Could you link a specific repl as well as steps to reproduce the issue? This could be a bug in the typescript language server itself:

3 Likes

Thanks for repying!

After testing with a classic nodejs repl, the lsp seems to turn off after about 5-10 minutes. One thing I noticed is that when it’s running, the repl’s ram is almost always 100%. When the lsp gets shut down, the ram drops down to almost nothing. Here’s an image of the resource tab when the lsp dies (the ram is at the bottom):
image

When that happens, the website still thinks the lsp is running (it says “active” when checking it).
And as you might’ve guessed, this situation is the same as the one you linked at the end. The language server process stops working and the frontend doesn’t know it so nothing automatically restarts it (except kill 1 or reloading the page).
This means that intellisense, hovering over variables, formatting (if it’s the default one), and the variable renaming don’t work. When trying to rename a variable, it says that the client is not created (since the language server is not running), just like in the post you linked at the end.

A reason this may be happening is because of an oom killer of some sort (which is pretty much what brought me to make this post). No idea though, just speculating.

And that’s pretty much the issue. Also, to reproduce it, just make a repl with the typescript language server as a formatter (make the repl as a free plan repl, it probably doesn’t happen when you have more resources) and start typing some code. I tried it on this repl: https://replit.com/@AljaBerginc/lsp-test

Thanks for helping!

3 Likes

As a temporary workaround, to not have to reload the page or kill 1 every time an LSP dies, you could try my LSP reloader extension. It shows you the LSPs you have configured and lets you kill them and have them restarted. It might work or it might not, but you can give it a try if you want to.

1 Like