Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support LSP General Progress method #125

Closed
ayoub-benali opened this issue Feb 17, 2020 · 12 comments
Closed

Support LSP General Progress method #125

ayoub-benali opened this issue Feb 17, 2020 · 12 comments

Comments

@ayoub-benali
Copy link

ayoub-benali commented Feb 17, 2020

LSP Spec since 3.15 defines General Progress Support among other things.

It would be nice for Metals to migrate the status bar notifications to this protocol if possible sparing clients one custom endpoint.

Search terms
LSP, spec, status bar, notification

@ckipp01
Copy link
Member

ckipp01 commented Feb 19, 2020

So I just looked into this a bit. lsp4j was recently updated to cover a large portion of 3.15, but unfortunately it looks like General Progress Support is not yet integrated eclipse-lsp4j/lsp4j#397

There is also a current issues for it here

@olafurpg
Copy link
Member

Does the progress notification support all the use-cases we have for metals/status? For example, we use it to display warnings like that there's no imported build.

@ckipp01
Copy link
Member

ckipp01 commented Feb 19, 2020

My initial thought after looking through it is no. General Progress Support seems to be a very general approach to what we are using metals/slow-task for. There may be certain things we could port over to it, but it actually looks like both metals/status and metals/slow-task both have things that General Progress Support wouldn't cover.

@olafurpg
Copy link
Member

An important feature of metals/slowTask is cancellation and it doesn't look like $/progress supports cancellation.

We can probably fallback to $/progress for some use-cases in situations when the client doesn't support metals/status

@ckipp01
Copy link
Member

ckipp01 commented May 30, 2022

So I might be revisiting this. I've tried getting slowTask working correctly with nvim-metals but never really nailed down the UX. Looking tonight I just realized that $/progress does support cancellable, which is the main reason we're using metals/slowTask. I'll play around with this a bit, but there is a chance we get get rid of metals/slowTask with this.

EDIT: Although it seems Neovim core doesn't support cancellable here :/

@kluen
Copy link

kluen commented Oct 25, 2023

@ckipp01 Did you ever get around to experimenting further? I saw that you added support for cancellable to Neovim shortly after your last post ;)

@ckipp01
Copy link
Member

ckipp01 commented Oct 25, 2023

@ckipp01 Did you ever get around to experimenting further? I saw that you added support for cancellable to Neovim shortly after your last post ;)

So I did look into it a bit, but the way we do progress with metals status is sort of intertwined in more places than I thought. I don't think it'd be a super difficult change, but one that I wasn't able to do quickly so I sort of never returned. This would be a great standalone task for someone looking to contribute to metals.

@PeuTit
Copy link

PeuTit commented Nov 3, 2023

Hey I'm willing to work on this. Where should I look for to make this happen?

@kluen
Copy link

kluen commented Nov 3, 2023

@ckipp01 Am I correct assuming that we need support for this in lsp4j first?

We are using the LanguageClient here, which does not seem to support the necessary messages yet.

@tgodzik
Copy link
Contributor

tgodzik commented Nov 8, 2023

The interface should work ok, those unsupported exceptions are just the defaults, but with the correct client connected this should work ok.

I think the ideal situation is replacing slow task that we use for example for NewProjectProvider. If you are interested @PeuTit I would start with experimenting with that part. The part we want to replace is the trackSlowTask and trackSlowFuture from StatusBar. It already has access to the client interface there, so I would try to hack around it quickly, figure out what is the difference between the current approach and the one in progress when it comes to the UI and editor experience. We can then see if the new approach is something we are happy with.

Let me know if you need any help!

@keirlawson
Copy link

Created an initial PoC here which is working nicely for me with Helix, feedback appreciated :) scalameta/metals#6055

@keirlawson
Copy link

With scalameta/metals#6055 merged this should now be fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants