sublimelsp / LSP-rust-analyzer

Convenience package for rust-analyzer
MIT License
70 stars 11 forks source link

Add support for experimental docs command #6

Closed Rapptz closed 3 years ago

Rapptz commented 3 years ago

This works okay on my end. I think this could be improved but for now this works for the basic testing I did.

Rapptz commented 3 years ago

I've fixed the review nits, I think.

I moved the checks over to an is_enabled block. I didn't know how you wanted imports sorted though so I went for alphabetical ascending.

I will add that one line per import is weird, and the project that I was looking at didn't use that code style so I wasn't sure it existed.

rchl commented 3 years ago

I moved the checks over to an is_enabled block. I didn't know how you wanted imports sorted though so I went for alphabetical ascending.

Yes, alphabetical is good.

I will add that one line per import is weird, and the project that I was looking at didn't use that code style so I wasn't sure it existed.

A matter of getting used to. :) As far as LSP-julia, it's not a project made by "core" members. The LSP itself is an example of the "official" style. But it's just a style nit and I wouldn't hold it against the PR. :)

Rapptz commented 3 years ago

There is close to 0% chance that someone will discover this functionality on its own. I think it should be added to the readme.

There is no documentation for this one in VSCode, it's only available via a default keybinding and the command palette there. I figured similar treatment was sufficient. I didn't add a keybinding because it's kind of an anti-practice in Sublime Text plugins to do so.

I'm willing to document it though, just not sure where you'd prefer.

rchl commented 3 years ago

I'm willing to document it though, just not sure where you'd prefer.

rust-analyzer has it documented: https://github.com/rust-analyzer/rust-analyzer/blob/a9a978e0bb418b540bd4ede0cc5a16bfb1c79baf/docs/dev/lsp-extensions.md#open-external-documentation

Maybe something like:

## Custom Command Palette Commands

### LSP-rust-analyzer: Open Docs Under Cursor

Opens the URL to documentation for the symbol under the cursor, if available.
Rapptz commented 3 years ago

That's documentation meant for plugin writers, not consumers of the language server (it's also what I used :>). I've pushed the docs change. Thanks for the wording!