Commit Graph

12419 Commits

Author SHA1 Message Date
bors[bot]
d6f2352a08
Merge #9757
9757: intenral: completion cleanups r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-02 12:41:15 +00:00
Lukas Wirth
62ab73767f resolve_doc_path is able to resolve to macros 2021-08-02 14:33:09 +02:00
Aleksey Kladov
5f3662e01c minor: encode usage convention into API 2021-08-02 15:28:39 +03:00
Aleksey Kladov
8b6ea1545f simplify 2021-08-02 14:27:11 +03:00
Aleksey Kladov
71cd67fe47 failing test 2021-08-02 14:27:11 +03:00
Lukas Wirth
1edbaa29f9 Wrap inner tail expressions in MissingOkOrSomeInTailExpr 2021-07-31 20:00:09 +02:00
bors[bot]
eb513c22f7
Merge #9746
9746: internal: add API to check what are the max limits in practice r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-31 15:27:11 +00:00
Aleksey Kladov
f952dc61d1 internal: add API to check what are the max limits in practice 2021-07-31 18:26:43 +03:00
bors[bot]
93873b0ce1
Merge #9739
9739: generate function assist favors deref cmpt types r=matklad a=mahdi-frms

Fixes #9713

Although that's still not relying on sematic info.

Co-authored-by: mahdi-frms <mahdif1380@outlook.com>
2021-07-31 15:08:29 +00:00
bors[bot]
a423b307e6
Merge #9744
9744: fix: Annotate type hints for pattern name ranges instead of the pattern itself r=Veykril a=Veykril

The current type hints do not go well with `bindings_after_at` which is likely to land with 1.56(https://github.com/rust-lang/rust/pull/85305 🎉very excited for this), hence annotate the names of ident patterns instead of the entire pattern.

This changes where the typehints go for ident patterns that use @ bindings, some example comparisons:

Before:
![Code_82ILMppkve](https://user-images.githubusercontent.com/3757771/127741276-e1dd173b-2964-4df0-abae-860283b2e1be.png)
After:
![Code_tPttN2rJpw](https://user-images.githubusercontent.com/3757771/127741277-e7fc2836-4f31-4c45-a3a9-69cbff3d52d9.png)

This change has no visible effect on patterns without ``@`` bindings.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-31 13:41:04 +00:00
Lukas Wirth
f7c7f89c3c Annotate type hints for pattern name ranges instead of the pattern itself 2021-07-31 15:30:45 +02:00
bors[bot]
6b733eac67
Merge #9743
9743: internal: a bit of completion profiling r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-31 13:23:00 +00:00
Aleksey Kladov
a5049e13bf internal: make non-zero times stand out in profile 2021-07-31 16:22:03 +03:00
Aleksey Kladov
08756012a5 internal: document query implication of completion rendering 2021-07-31 16:13:15 +03:00
Aleksey Kladov
d4e381f7b2 minor: follow code style 2021-07-31 16:05:07 +03:00
Lukas Wirth
b363755901 Fix hover range for derive inputs 2021-07-31 14:59:31 +02:00
Lukas Wirth
7c7c4543da Replace useless types 2021-07-31 14:29:15 +02:00
bors[bot]
0cf28cedef
Merge #9740
9740: feat: `add_explicit_type` is applicable for closure parameters r=Veykril a=Veykril

Closes https://github.com/rust-analyzer/rust-analyzer/issues/8886
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-31 12:05:41 +00:00
Lukas Wirth
778e6e8ba8 add_explicit_type is applicable for closure parameters 2021-07-31 14:04:34 +02:00
mahdi-frms
a5edf6de79 generate function assist favors deref cmpt types 2021-07-31 16:34:09 +04:30
Laurențiu Nicola
90e05ba57e Bump deps 2021-07-31 11:25:03 +03:00
bors[bot]
33f12a3608
Merge #9732
9732: feat: gate custom clint-side commands behind capabilities r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-07-30 16:27:10 +00:00
Aleksey Kladov
be84f85c1d feat: gate custom clint-side commands behind capabilities
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.
2021-07-30 19:16:33 +03:00
bors[bot]
1f817833e7
Merge #9727
9727: internal: Simplify extract_function assist r=Veykril a=Veykril

also fixes #7839(blocked on #9728)

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-30 14:56:50 +00:00
Lukas Wirth
3e351cc0ba Add trailing comma when extracting match arm expressions into functions 2021-07-30 16:48:13 +02:00
bors[bot]
4cc961007f
Merge #9731
9731: feat: Add `replace_char_with_string` assist r=Veykril a=Veykril

Adds the counterpart for the `replace_string_with_char` assist and fixes the assist not escaping the `'` in the string `"'"` when transforming that to a char.
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-30 14:47:38 +00:00
Lukas Wirth
17a47a830b Add replace_char_with_string assist 2021-07-30 16:46:06 +02:00
bors[bot]
0a3ac7a96c
Merge #9728
9728: fix: Attach comma token to MATCH_ARM instead of MATCH_ARM_LIST r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-30 14:11:37 +00:00
Lukas Wirth
82c1e61887 Fix assists assuming comma belonging to MATCH_ARM_LIST 2021-07-30 16:01:26 +02:00
Lukas Wirth
f04cff102f Simplify 2021-07-30 13:12:52 +02:00
Lukas Wirth
836784f02b Fix move_item test fixture indentations 2021-07-30 13:03:28 +02:00
Lukas Wirth
4de447b293 Attach comma token to MATCH_ARM instead of MATCH_ARM_LIST 2021-07-29 23:02:52 +02:00
Lukas Wirth
322513b06c Reorder definitions in extract_function 2021-07-29 22:10:40 +02:00
Lukas Wirth
b21f66fce3 Simplify extract_function assist 2021-07-29 22:07:56 +02:00
bors[bot]
8232804d3e
Merge #9706
9706: minor: perf and grammar fixes r=lnicola a=lnicola



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-07-29 16:14:10 +00:00
Lukas Wirth
b537cb186e Use more strictly typed syntax nodes for analysis in extract_function assist 2021-07-29 17:26:37 +02:00
Lukas Wirth
2b461c50d7 Refine extraction targets of extract_function assist 2021-07-29 15:45:05 +02:00
bors[bot]
8d3b294ef7
Merge #9719
9719: feat: Make flyimport respect `#[doc(hidden)]` r=jonas-schievink a=jonas-schievink

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7718 (we still don't respect `#[doc(hidden)]` on reexports, but that is tracked by https://github.com/rust-analyzer/rust-analyzer/issues/9197)

bors r+

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-07-28 17:31:17 +00:00
Jonas Schievink
8764cc955f Make flyimport respect #[doc(hidden)] 2021-07-28 19:22:59 +02:00
Josh Kuhn
9f5f4c342a
Bump notify to 5.0.0-pre.11 2021-07-28 10:09:58 -07:00
Jonas Schievink
18f86baa62 Stop reexporting hir_def's ItemInNs from HIR 2021-07-28 17:39:04 +02:00
Jonas Schievink
0fbf396f0d Make most completions respect #[doc(hidden)] 2021-07-28 15:59:02 +02:00
bors[bot]
33dcc895c1
Merge #9700
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>
2021-07-28 12:07:25 +00:00
bors[bot]
068ede0991
Merge #9693
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>
2021-07-28 11:21:33 +00:00
Alexander González
4d3a0529d5 fix: Revert removing [] from the hover gif 2021-07-28 06:58:19 -04:00
Laurențiu Nicola
636933153d Small grammar fix 2021-07-28 12:40:21 +03:00
Aleksey Kladov
ea9f6920fb minor: simplify 2021-07-28 12:35:21 +03:00
Alexander Gonzalez
04e3869adb refactor: Reuse the from_proto call in handle_hover 2021-07-27 18:31:21 -04:00
Alexander Gonzalez
5b30d9c4a9 feat: Add the Hover Range server capability 2021-07-27 18:31:21 -04:00
Alexander Gonzalez
e57ad5456c fix: Typos 2021-07-27 18:31:21 -04:00