scalameta / coc-metals

Deprecated in favor of scalameta/nvim-metals
http://scalameta.org/metals/
Apache License 2.0
167 stars 24 forks source link

Statusline text when Metals is idle #376

Closed jqno closed 3 years ago

jqno commented 3 years ago

Describe the feature

Other LSP implementations that I use, have some sort of content for coc#status() all the time, so also when it's not doing anything at the moment. For instance, Eclipse JDT (through coc-java) displays JDT.LS whenever it's not indexing or compiling or whatever.

This is useful to me, because that way I can see at a glance whether a certain language server is active or not.

However, with coc-metals, the statusline is empty when it's not doing something.

Potential ways to implement?

I was hoping it would be as simple as injecting a string constant somewhere, but I have to admit I haven't looked yet. If this request is accepted, I'd be willing to try and make a PR for it.

ckipp01 commented 3 years ago

Thanks for the request @jqno. I believe I've seen this in Typescript as well. I honestly haven't really thought much about it before, but I do think this is something that's probably possible to do. I wouldn't be opposed to it. It looks like coc-java has a progress item and a status item. The status item gets created, set to empty, and then only changed after it's initiated, an error, or starting. So it seems it's only every in those states, and all other status' are handled by the progress item. You can sort of see this here: https://github.com/neoclide/coc-java/blob/827b40d14265604564d240c48e0105b7d8223bf6/src/index.ts#L223-L250

I think we could probably do something similar where we check to see if statusBarEnabled is true and if so, initialize it, and then use that for the initialization process, and then once initialized set it to Metals. Then all other other stuff could just be handled by the existing progress: StatusBarItem.

It will be a bit more involved than just setting a string, but it shouldn't be too much work. I'd happily accept a pr for this.

jqno commented 3 years ago

Thanks for the quick and informative reply. I'll see if I can take a stab at this in the coming days.

Just out of curiousity, what do you think the "idle" statusline should say? Simply Metals?

coc-python also shows version information for Python. I guess we could do something like that here too, though probably I should not bite off more than I can chew ;)

ckipp01 commented 3 years ago

I guess my opinion would be to keep it minimal. If the main goal is to know what server is currently active, then just having Metals will accomplish that. I think that's a good starting point, and then we can work from there if we truly feel like we want to show more info.

ckipp01 commented 3 years ago

Closed via https://github.com/scalameta/coc-metals/pull/377