9fans / acme-lsp

Language Server Protocol tools for the acme text editor
MIT License
194 stars 25 forks source link

Add support for acme dump file #15

Open fhs opened 5 years ago

fhs commented 5 years ago

acme-lsp should make use of the dump ctl message to set the command to restart acme-lsp from a dump file.

It's not clear whether we should keep a persistent window open for dumping purposes, or "/LSP/Diagnostics" window should become persistent, or something else.

lobre commented 10 months ago

Can you briefly explain how such a thing would be done? I don't understand the mechanism.

I see this in acme(4). I guess you are referring to it, but I struggle to understand what it means, and how to use it.

...
ctl    Text messages may be written to ctl to affect the window.

       dump command
           Set the command string to recreate the window from a dump file.
    ...

So apparently, one can write to the ctl file of an acme window to affect this window. And one of the possible writeable messages is dump <command>.

But what is the "command string" in that context? What would acme do exactly when such a message is posted? And when should acme-lsp write to that file?

Help to understand would be appreciated! Thanks.

fhs commented 8 months ago

@lobre The "command string" is just the acme-lsp command line arguments. Acme-lsp should write to this file when it starts up. This will tell acme that it should save the "command string" in the dump file, so that acme can restart acme-lsp later when loading from the dump file.

You can look at some examples, such as the Watch command here: https://github.com/9fans/go/blob/fab41a57aacc9863ab73fde7d3a76dfe9aaafada/acme/Watch/main.go#L77 It should be a simple change I think, unless I'm forgetting something.