Stream: t-compiler/wg-rls-2.0

Topic: Available code lens actions?


Martin Asquino (Jun 29 2020 at 18:35, on Zulip):

Hey! Sorry to ask here, I reckon it might not be the best place, but I think it's better than an issue, as it really isn't one :slight_smile: .

I'm trying to find an example of code that generates a code lens with a applySourceEdit or selectAndApplySourceEdit command, but I can't seem to find a way to get one of those. I browsed through the repo a little and didn't find anything that could help me there, but maybe I wasn't paying enough attention. Can anyone point me to an example or explain a situation in which that code lens would appear?

Florian Diebold (Jun 29 2020 at 18:46, on Zulip):

applySourceEdit and selectAndApplySourceEdit don't exist anymore, they used to be used for code actions but have been replaced by a different protocol extension: https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/lsp-extensions.md#snippet-textedit

Martin Asquino (Jun 29 2020 at 20:07, on Zulip):

@Florian Diebold I see, nice! I'm adding an extension to LanguageClient-neovim and, considering the date of the commits on those files, I should probably account for users not using the latest version of rust-analyzer. Did this action (applySourceChange) apply for for example extract variable actions? I will probably downgrade to a version of rust-analyzer that has them and try them out, is that a proper action to be looking at for this command?

Florian Diebold (Jun 29 2020 at 20:43, on Zulip):

Yes, but I would not recommend trying to keep compatibility with old versions

Martin Asquino (Jun 29 2020 at 20:52, on Zulip):

yeah I might just abandon that idea, it does feel like I'll end up in a slippery slope of having to maintain all version of all servers anyways, so yeah, probably not a good idea. Thanks for the help! :bow:

Last update: Sep 27 2020 at 13:45UTC