Commit Graph

1631 Commits

Author SHA1 Message Date
bors
cc695363e4 Auto merge of #12202 - iDawer:ide.sig_help-fix, r=lnicola
fix: don't panic at fully qualified call syntax in signature help

Closes  #12200
Regressed from #12082
2022-05-10 12:28:34 +00:00
iDawer
956b8fb954 signature_help: detect fully qualified call syntax for parameter fallback 2022-05-10 17:18:42 +05:00
bors
cf152e8a94 Auto merge of #12201 - Veykril:inlay-hide, r=Veykril
fix: Add cast expressions to param name inlay hint heuristics
2022-05-10 11:44:06 +00:00
Lukas Wirth
822d9b55b7 fix: Add cast expressions to param name inlay hint heuristics 2022-05-10 13:43:43 +02:00
Jonas Schievink
7e45915aa4 Resolve assoc. types of supertraits in the IDE layer 2022-05-09 17:30:49 +02:00
Jonas Schievink
37443eb9a1 Maybe everything else *should* have to deal with it 2022-05-05 16:28:59 +02:00
Jonas Schievink
34dc8e9383 Wrap floats in token trees in FLOAT_LITERAL node 2022-05-05 16:28:59 +02:00
Jonas Schievink
1bc3305d95 Split float literal tokens at the . 2022-05-05 16:28:58 +02:00
Laurențiu Nicola
9856144b0b Lower values of char and byte literals 2022-05-05 08:12:08 +03:00
rainy-me
ddff1b22f9 fix: add docs and remove unnecessary check 2022-05-05 13:41:33 +09:00
rainy-me
5f4351fbb6 fix: doc url link type 2022-05-05 00:41:29 +09:00
bors
cc12d9df3f Auto merge of #12120 - iDawer:ide.sig_help, r=Veykril
fix: Don't show signature help after closing bracket

Stop showing signature help after closing angle/round brackets.

Fixes #11624
2022-05-02 12:13:16 +00:00
Lukas Wirth
b6e19add06 minor: Add a test for display rendering record variants 2022-05-02 12:51:00 +02:00
Peh
1f011fa4a3 style: rename crates to kebab case 2022-05-01 10:48:58 +00:00
iDawer
dffbab45f4 Don't show signature help after closing bracket 2022-04-29 23:26:54 +05:00
Laurențiu Nicola
4a57307674 Revert "Correctly fix formatting doc tests with generics"
This reverts commit 5f3327a6b8.
2022-04-27 15:30:54 +03:00
Laurențiu Nicola
0d02be7330 Revert "Update crates/ide/src/runnables.rs"
This reverts commit bf47acf1d3.
2022-04-27 15:30:54 +03:00
bors
198c075580 Auto merge of #12083 - Veykril:inlays, r=Veykril
minor: Add test for parameter and reborrow hint order
2022-04-26 09:53:26 +00:00
Lukas Wirth
5e413997a1 minor: Add test for parameter and reborrow hint order 2022-04-26 11:46:03 +02:00
iDawer
729cd8530b signature_help: use corresponding param list for methods 2022-04-26 11:50:28 +05:00
Lukas Wirth
4255996965 Re-export FxHashMap and FxHashSet from ide_db 2022-04-25 18:51:59 +02:00
bors
c1de78f54c Auto merge of #12072 - bitgaoshu:master, r=jonas-schievink
fix #11973 associated type is unresolved
2022-04-25 11:07:09 +00:00
bitgaoshu
5d1aff3357 #11973 associated type is unresolved 2022-04-24 20:51:48 +08:00
iDawer
baa4fa09ef Add fallback for return type 2022-04-23 17:21:21 +05:00
iDawer
fae9049ccd Fall back to parameter definitions on error types in signature help 2022-04-23 17:21:21 +05:00
Jonas Schievink
c6ffffccbd Allows triggering commands after an assist edit 2022-04-19 18:45:48 +02:00
Lukas Wirth
3de9a42810 Disable rustfmt for expand_macro on wasm platforms 2022-04-17 14:00:19 +02:00
Lukas Wirth
895a16265c Fix macro patterns not getting formatted properly 2022-04-17 13:46:00 +02:00
Lukas Wirth
e2f1a9a558 feat: Attempt to format expand_macro output with rustfmt if possible 2022-04-17 13:33:39 +02:00
bors
a912f2a9f6 Auto merge of #12001 - Veykril:refs, r=Veykril
fix: Do reference search on all downmapped tokens with the same kind only

cc https://github.com/rust-lang/rust-analyzer/issues/11668
2022-04-15 17:43:24 +00:00
Lukas Wirth
58660dee2a fix: Do reference search on all downmapped tokens with the same kind only 2022-04-15 19:42:48 +02:00
bors
5e41205e9c Auto merge of #12000 - Veykril:hlmac, r=Veykril
fix: Tag `macro_rules` macro bang with `MacroBang` tag

cc https://github.com/rust-lang/rust-analyzer/issues/11996
2022-04-15 17:19:33 +00:00
Lukas Wirth
be27efabfa fix: Tag macro_rules macro bang with MacroBang tag 2022-04-15 19:16:18 +02:00
Jonas Schievink
f96fd40104 add docs 2022-04-14 13:23:19 +02:00
Jonas Schievink
99e9e52fbc Remove trailing ; when turning assignment into == comparison 2022-04-13 16:01:09 +02:00
Jonas Schievink
b9dd7db817 Add more no-op tests 2022-04-13 15:47:33 +02:00
Jonas Schievink
cde2a1de36 Add trailing ; when typing = in assignment 2022-04-12 19:39:19 +02:00
bors[bot]
49847a25ae
Merge #11883
11883: fix(ide): move moudle directory when rename r=rainy-me a=rainy-me

fix: #10992

Added `FileSystemEdit::MoveDir` variant for move dirs. Original implemented as recursively move child mod files but had many issues like

1. left empty dir after rename file
2. only affect rust file
3. not performant

so changed to current version

Co-authored-by: rainy-me <github@yue.coffee>
2022-04-12 15:17:00 +00:00
rainy-me
3dd581b97d fix: move dir on rename mod 2022-04-12 23:01:53 +09:00
Lukas Wirth
7f3572fa0d Simplify 2022-04-10 20:02:06 +02:00
Lukas Wirth
15e7112da3 fix: Check whether a parameter can be converted to a local 2022-04-09 00:55:45 +02:00
Jonas Schievink
5d8b4c40eb Determine function unsafety semantically 2022-04-07 18:33:03 +02:00
Lukas Wirth
3632d5946f minor: Remove pointless rebindings 2022-04-07 01:29:31 +02:00
Lukas Wirth
96b641e95e internal: Add more doc-link tests 2022-04-06 20:58:46 +02:00
Lukas Wirth
4a1423337f fix: Attempt to resolve paths in const arguments heuristically
While we don't support const args in type inference yet, we can at least
make use of the fallback path resolution to resolve paths in const args
in the IDE layer to enable some features for them.
2022-04-06 20:24:24 +02:00
Lukas Wirth
7959c24876 fix: Fix path qualifiers not resolving generic type params when shadowed by trait 2022-04-06 19:38:45 +02:00
Jonas Schievink
872b7b9660 Wrap macros in expr position in MacroExpr node 2022-04-05 17:43:34 +02:00
Lukas Wirth
f610e2c2ed Simplify completion import insertion 2022-04-02 01:42:21 +02:00
bors[bot]
ce8e028e9b
Merge #11872
11872: internal: Remove `PathResolution::AssocItem` r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-04-01 17:12:44 +00:00
Lukas Wirth
c290e68ff9 internal: Remove PathResolution::AssocItem 2022-04-01 18:32:05 +02:00
bors[bot]
50225fe630
Merge #11869
11869: fix: code blocks with tilde also works like code block r=Veykril a=moreal

The `rustdoc` uses the `pulldown_cmark` package to parse *doc_comment* and the package also treat triple `~` characters also as code block fences. So when we run `cargo doc`, they will be placed also.

<img width="965" alt="image" src="https://user-images.githubusercontent.com/26626194/161208072-5a09a209-57fc-4a52-b190-b0a9be9ffcd6.png">

But `rust-analyzer` doesn't support it so it doesn't have any injected code highlights and any `Run doctest` hint. This pull request tries to allow also them. 🙇🏻‍♂️ 

Before:

<img width="224" alt="image" src="https://user-images.githubusercontent.com/26626194/161207405-b1d6cfda-82b1-4f60-8e42-c51d0ed98f38.png">

After:

<img width="161" alt="image" src="https://user-images.githubusercontent.com/26626194/161207693-8e39997c-9ca6-4e69-8c65-e9b70899f7db.png">


Co-authored-by: Lee Dogeon <dev.moreal@gmail.com>
2022-04-01 12:40:51 +00:00
Lee Dogeon
e3f32d13e1 Code blocks with tilde also works like code block 2022-04-01 20:29:32 +09:00
Lukas Wirth
75689f2ad8 internal: Enforce Resolver to always have a module scope 2022-03-31 11:12:08 +02:00
Lukas Wirth
ef92453dfe internal: Refactor FamousDefs builtin crate search 2022-03-30 22:23:54 +02:00
Lukas Wirth
0ae795136d Sort runnable test results to make them deterministic 2022-03-26 19:38:20 +01:00
hkalbasi
22eaee25b8 organize const eval tests 2022-03-24 13:20:35 +04:30
hkalbasi
0e2989e421 Support constants in const eval 2022-03-24 13:09:22 +04:30
bors[bot]
75fada4aab
Merge #11805
11805: fix: Don't try to resolve methods on unknown types r=Veykril a=flodiebold

Fixes #10454, and some type mismatches.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2022-03-23 20:20:09 +00:00
Florian Diebold
fa923f9b19 Adjust value in syntax highlighting benchmark 2022-03-23 19:28:01 +01:00
bors[bot]
652233283b
Merge #11791
11791: fix: some fixes and improvements to signature help r=jonas-schievink a=jonas-schievink

bors r+

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2022-03-23 00:36:11 +00:00
Lukas Wirth
8e91bb7660 minor: Bump dependencies 2022-03-22 17:42:24 +01:00
Jonas Schievink
4e07864f59 signature help: skip lifetimes when non-lifetime arguments are present 2022-03-22 16:44:27 +01:00
Jonas Schievink
4bb5df0ce5 Avoid signature help inside multiline expressions
Fixes #11768
2022-03-22 16:08:46 +01:00
Jonas Schievink
c9cefb9916 Improve readability of signature help tests 2022-03-22 15:03:19 +01:00
Laurențiu Nicola
1a37b17162 Replace write! with direct calls 2022-03-21 10:43:36 +02:00
bors[bot]
6f2b118605
Merge #11775
11775: internal: Treat `global_asm` and `asm` macros as unsafe r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 18:31:27 +00:00
Lukas Wirth
ddf144051a internal: Treat {global_}asm macros as unsafe 2022-03-20 19:31:00 +01:00
bors[bot]
fedf724d82
Merge #11774
11774: feat: Tag macro calls as unsafe if they expand to unsafe expressions r=Veykril a=Veykril

as long as they aren't inside an unsafe block inside the macro that is.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 18:15:29 +00:00
Lukas Wirth
68de7b30e0 feat: Tag macro calls as unsafe if they expand to unsafe expressions 2022-03-20 19:07:44 +01:00
bors[bot]
966b692422
Merge #11771
11771: feat: Visualize compiler inserted reborrows via inlay hints r=Veykril a=Veykril

Disabled by default.

![image](https://user-images.githubusercontent.com/3757771/159165178-baaf968a-4381-468e-933f-5326ca1b203d.png)

Closes https://github.com/rust-analyzer/rust-analyzer/issues/11275


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-20 13:47:16 +00:00
Lukas Wirth
5a87f09a71 Update inlay hint feature docs 2022-03-20 14:41:27 +01:00
Lukas Wirth
37b48ceb8f feat: Visualize compiler inserted reborrows via inlay hints 2022-03-20 14:38:16 +01:00
bors[bot]
a82caff588
Merge #11765
11765: fix: Fix closure hints using macro ranges r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-19 19:26:34 +00:00
Lukas Wirth
2598575a35 fix: Fix closure hints using macro ranges 2022-03-19 20:24:09 +01:00
bors[bot]
7315d97347
Merge #11755
11755: feat: Implement lifetime elision hints r=Veykril a=Veykril

With names on:
![Code_erl26zKvuf](https://user-images.githubusercontent.com/3757771/159134856-e2c75d2d-f17c-45c7-9a78-3da5ee8b1acd.png)
With names off:
![Code_MRP1Pbfe9d](https://user-images.githubusercontent.com/3757771/159134857-30fac3a1-825e-4f49-ba9b-9fa0bb215694.png)


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-19 19:15:06 +00:00
Lukas Wirth
7da5b80f25 Change skip trivial behaviour 2022-03-19 20:12:14 +01:00
Lukas Wirth
7ab0aaa82a Add option to skip trivial cases 2022-03-19 19:01:19 +01:00
Lukas Wirth
45756c823f Use numbers for lifetimes by default, add setting to prefer using parameter names 2022-03-19 18:11:56 +01:00
Jonas Schievink
55d2a25123 Rename call info to "signature help"
It is no longer limited to just calls
2022-03-18 20:19:35 +01:00
Jonas Schievink
0642724e94 Provide signature help when editing generic args 2022-03-18 19:59:41 +01:00
Lukas Wirth
c22fed895e Fix test fixtures 2022-03-18 18:57:15 +01:00
Lukas Wirth
b634d99361 Give the lifetimes better names 2022-03-18 18:55:03 +01:00
Lukas Wirth
673e2b1d8f feat: Implement lifetime elision hints 2022-03-18 18:11:16 +01:00
Lukas Wirth
828196be3b fix: Fix runnables trying to add doc tests in the crate root from #[macro_export] macros 2022-03-18 12:01:59 +01:00
Lukas Wirth
bd17933c31 feat: Add return type hints for closures with block bodies 2022-03-16 21:25:03 +01:00
Lukas Wirth
4fe5f03c7f Rename compound things to variant things 2022-03-16 13:41:47 +01:00
hkalbasi
b301b040f5 Add const generics 2022-03-14 14:38:37 +03:30
Matthias Krüger
5a0078c9d1 more clippy fixes:
clippy::search_is_some
clippy::redundant_static_lifetimes
clippy::match_single_binding
clippy::match_ref_pats
clippy::map_entry
clippy::manual_map
clippy::iter_overeager_cloned
clippy::into_iter_on_ref
clippy::extra_unused_lifetimes
2022-03-12 16:50:49 +01:00
Matthias Krüger
56e4ea59d9 more clippy fixes:
clippy::match_like_matches_macro
clippy::to_string_in_format_args
clippy::single_char_add_str
clippy::filter_map_identity
clippy::clone_on_copy
clippy::useless_format
clippy::unused_unit
2022-03-12 16:50:49 +01:00
Matthias Krüger
d64d711db2 fix clippy::map_flatten 2022-03-12 16:50:49 +01:00
Matthias Krüger
451fcd3c79 fix clippy::redundant_closure 2022-03-12 16:50:49 +01:00
Matthias Krüger
1f70886b15 fix clippy::single_char_pattern 2022-03-12 16:50:49 +01:00
Matthias Krüger
7912e33ed6 fix clippy::needless_borrow 2022-03-12 16:50:49 +01:00
yipinliu
c15ebcd84c Optimize imports 2022-03-12 21:06:33 +08:00
yipinliu
0c54921f93 Fixed code style issues 2022-03-12 20:36:56 +08:00
yipinliu
8247925313 Fixed tidy test 2022-03-12 20:04:14 +08:00
yipinliu
581e1bf0d7 Highlight escape sequences in byte strings 2022-03-12 19:03:14 +08:00
Lukas Wirth
62265ee9cb fix: Allow configuration of colons in inlay-hints 2022-03-11 21:15:36 +01:00
Lukas Wirth
6c8c02f625 Don't parse source files to generate macro completion details 2022-03-10 22:21:58 +01:00
bors[bot]
5b51cb835a
Merge #11664
11664: fix: Properly handle proc-macro crate types for nameres r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-09 21:45:42 +00:00