Some features of rust-analyzer requires support for custom commands on
the client side. Specifically, hover & code lens need this.
Stock LSP doesn't have a way for the server to know which client-side
commands are available. For that reason, we historically were just
sending the commands, not worrying whether the client supports then or
not.
That's not really great though, so in this PR we add infrastructure for
the client to explicitly opt-into custom commands, via `extensions`
field of the ClientCapabilities.
To preserve backwards compatability, if the client doesn't set the
field, we assume that it does support all custom commands. In the
future, we'll start treating that case as if the client doesn't support
commands.
So, if you maintain a rust-analyzer client and implement
`rust-analyzer/runSingle` and such, please also advertise this via a
capability.
9724: internal: Use more strictly typed syntax nodes for analysis in extract_function assist r=Veykril a=Veykril
This also prevents it from looking into local items unnecessarily(which might even cause problems in some cases)
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
9718: Bump notify to 5.0.0-pre.11 r=lnicola a=deontologician
It looks like the `INotifyWatcher::new` method was removed sometime after `5.0.0-pre.3` and then added back in `5.0.0-pre.11`. Without the `=`, cargo can resolve some version from `5.0.0-pre.4` -> `5.0.0-pre.10` which will not compile.
Co-authored-by: Josh Kuhn <deontologician@gmail.com>
9716: internal: Stop reexporting `hir_def`'s `ItemInNs` from HIR r=jonas-schievink a=jonas-schievink
Resolves a FIXME and simplifies downstream code
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
9700: fix: Remove the legacy macro scoping hack r=matklad a=jonas-schievink
This stops prepending `self::` to single-ident macro paths, resolving even legacy-scoped macros using the fixed-point algorithm. This is not correct, but a lot easier than fixing this properly (which involves pushing a new scope for every macro definition and invocation).
This allows resolution of macros from the prelude, fixing https://github.com/rust-analyzer/rust-analyzer/issues/9687.
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
9693: feat: Add the Hover Range capability which enables showing the type of an expression r=matklad a=alexfertel
Closes https://github.com/rust-analyzer/rust-analyzer/issues/389
This PR extends the `textDocument/hover` method to allow getting the type of an expression. It looks like this:
![type_of_expression](https://user-images.githubusercontent.com/22298999/126914293-0ce49a92-545d-4005-a59e-9294fa2330d6.gif)
Edit: One thing I noticed is that when hovering a selection that includes a macro it doesn't work, so maybe this would need a follow-up issue discussing what problem that may have.
(PS: What a great project! I am learning a lot! 🚀)
Co-authored-by: Alexander Gonzalez <alexfertel97@gmail.com>
Co-authored-by: Alexander González <alexfertel97@gmail.com>
9703: docs: Fix several typos and grammar mistakes r=matklad a=alexfertel
I took some time to clean up the dev docs a bit since I spent the whole week reading them. I am not a native speaker, so if you find something wrong please tell me and I'll fix it 😁
Co-authored-by: Alexander Gonzalez <alexfertel97@gmail.com>
9701: fix: correctly update diagnostics when files are opened and closed r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>