-
Notifications
You must be signed in to change notification settings - Fork 78
Keep server alive for a project #141
Comments
👍 Ensime server requires some time to start, so it's quite important not to relaunch it. |
Hi, I've been toying with a language server for a couple of days and I wanted a similar configuration. I have something that works-ish, so I'll share it in case it's useful.
startServerProcess () {
const scriptPath = require.resolve('my-client/lib/client_process.js')
return super.spawnChildNode([scriptPath])
}
I have a few outstanding issues:
I'm a bit out of my depth on this, but if you have any feedback, I'd love to hear it, or if you're interested, I can try to share some code! |
I think this is tied up with #71 and the various connection problems. My plan is to make the servers restartable from code and to provide an easy way for ide-x authors to specify how long to idle before shutting them down (or opt out entirely to do it themselves). Hoping to begin working on this tomorrow as well as having auto-restarting on connection/server failure. |
@damieng although this functionality is useful on its own, I don't see how it addresses the described use-case for server lifecycle tied to projects. It requires altering current logic of In the end, when you launch a language server, you do it for some notion of a "project" or "workspace" ( |
So the possibilities as far as I see it are:
|
That's exactly what I wanted opening this issue. I would only make this predicate not too narrow, i.e. not just "specific file is present", but a general
But shouldStartForProject(editor: atom$Project): boolean
Independently of the previous alternative I see it useful for scripting languages (or markup languages) which don't need a project definition (i.e. server works with each source file independently). |
Development of atom-languageclient has officially moved to https://github.com/atom-ide-community/atom-languageclient 🎉 If this is still an issue please consider opening an issue on that repo. |
In Scala projects it makes sense to keep language server alive for the whole project, because the startup is quite slow.
Currently, server is started only when I open a Scala source, then every time I close the last tab with Scala source, server is stopped and if I open a new tab, new server is started again.
I'd like to implement a workflow where server is started when I open a new project (in Atom terminology) which looks like a Scala project (checking sbt or ENSIME configuration files presence), then stop it only when the project is removed from the workspace.
I thought at first, that this method could be helpful:
atom-languageclient/lib/auto-languageclient.js
Lines 75 to 76 in 1153b29
But this is about adding condition on an editor, not workspace or project. I also see that server is considered unused and is stopped when all associated editors are closed in
atom-languageclient/lib/server-manager.js
Line 158 in 1153b29
But I don't know how to override this behavior for my client. Is it possible to do? And if not, would it be viable to support such workflow?
The text was updated successfully, but these errors were encountered: