Commit Graph

12390 Commits

Author SHA1 Message Date
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
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
Alexander Gonzalez
41943f2328 refactor: Apply PR suggestions 2021-07-27 18:31:21 -04:00
Alexander Gonzalez
743c037a34 chore: Remove unnecessary println! call 2021-07-27 18:31:21 -04:00
Alexander Gonzalez
506db1852c test: Add tests for when hovering fails 2021-07-27 18:29:22 -04:00
Alexander Gonzalez
48f43df7d6 docs: Improve the comments in crates/ide/src/hover.rs 2021-07-27 18:29:22 -04:00
Alexander Gonzalez
6310786ca5 test: Add hover_range tests 2021-07-27 18:29:22 -04:00
Alexander Gonzalez
1a0a5da1a4 refactor: Make handle_hover handle ranges too 2021-07-27 18:29:22 -04:00
Alexander Gonzalez
79860808cb chore: Remove unnecessary log 2021-07-27 18:29:22 -04:00
Alexander Gonzalez
18644720eb feat: Completed the client side implementation of rust-analyzer/hoverRange 2021-07-27 18:29:22 -04:00
Alexander Gonzalez
8ca3bb8fcd feat: Add the hover_range capability 2021-07-27 18:29:22 -04:00
Alexander Gonzalez
20c64cc0e6 feat: Extend the server with the hover_range capability 2021-07-27 18:29:22 -04:00
Laurențiu Nicola
ea0014c500 Remove some redundant clones 2021-07-27 21:32:55 +03:00
bors[bot]
6a2a0b7abb
Merge #9710
9710: fix: Don't qualify self as crate in add_missing_impl_members assist r=Veykril a=Veykril

Fixes #7499

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-27 17:30:37 +00:00
Lukas Wirth
456f5c6d09 Don't qualify self as crate in add_missing_impl_members assist 2021-07-27 19:29:47 +02:00
Aleksey Kladov
7d6c4142b2 fix: add capability for "open cargo.toml" lsp extension 2021-07-27 19:40:19 +03:00
bors[bot]
3a59b56324
Merge #9702
9702: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-26 18:28:32 +00:00
Lukas Wirth
3fab50019c Simplify 2021-07-26 20:26:24 +02:00
Aleksey Kladov
891867b1f1 fix: correctly update diagnostics when files are opened and closed
Basically, this tracks the changes to `subscriptions` we use when
issuing a publish_diagnostics.
2021-07-26 21:22:06 +03:00
Jonas Schievink
18b6327a29 Remove the legacy macro scoping hack 2021-07-26 19:58:14 +02:00
Aleksey Kladov
410679285b internal: prepare to track changes to mem_docs 2021-07-26 20:17:10 +03:00
bors[bot]
f0db648cb6
Merge #9558
9558: Do not erase Cargo diagnostics from the closed documents r=matklad a=SomeoneToIgnore

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6850

The LSP specification at https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#textDocument_publishDiagnostics states that


> Diagnostics notification are sent from the server to the client to signal results of validation runs.
> 
> Diagnostics are “owned” by the server so it is the server’s responsibility to clear them if necessary. The following rule is used for VS Code servers that generate diagnostics:
> 
>  *  if a language is single file only (for example HTML) then diagnostics are cleared by the server when the file is closed.
>  *  if a language has a project system (for example C#) diagnostics are not cleared when a file closes. When a project is opened all diagnostics for all files are recomputed (or read from a cache).
> 
> When a file changes it is the server’s responsibility to re-compute diagnostics and push them to the client. If the computed set is empty it has to push the empty array to clear former diagnostics. Newly pushed diagnostics always replace previously pushed diagnostics. There is no merging that happens on the client side.


So for projects we should not clear any diagnostics from cargo/json projects.
Our "standalone file" mode is in a way a project too, with sysroot attached and a potential support for dynamic standalone files.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2021-07-26 14:53:05 +00:00
Lukas Wirth
f43cd562bc Fix generic_arg not parsing opt_generic_arg_list properly in arg lists 2021-07-26 15:21:19 +02:00
bors[bot]
d571ca814e
Merge #9593
9593: fix: Adding remove_unused_param for method and fixing same for assoc func r=matklad a=feniljain

Solves #9571 

Co-authored-by: vi_mi <fenil.jain2018@vitstudent.ac.in>
2021-07-26 10:36:31 +00:00
Jonas Platte
c0107d2ea6
Fix some grammar / spelling mistakes 2021-07-26 10:12:41 +02:00
Lukas Wirth
0a13259fc6 Kepp catch-all arm in fill_match_arms if it has a non-empty expression 2021-07-25 15:51:47 +02:00
bors[bot]
2fe586a8a7
Merge #9688
9688: feat: Resolve derive attribute input macro paths in ide layer r=Veykril a=Veykril

Enables goto def, syntax highlighting and hover for `Foo` in `#[derive(Foo)]`.
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/4413
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-24 18:37:13 +00:00
Lukas Wirth
bfe0fa009e Resolve derive attribute input macro paths in ide layer 2021-07-24 20:35:43 +02:00
Laurențiu Nicola
1da21b797a Fix typo 2021-07-24 11:20:40 +03:00
Laurențiu Nicola
d9ec9d95c5 Bump deps 2021-07-24 11:16:32 +03:00
Jonas Schievink
c495a7374f Resolve tuple field visibility FIXME 2021-07-23 20:20:41 +02:00