Jonas Schievink
9bd11459ba
Revert "Auto merge of #12149 - jonas-schievink:literally-just-a-literal, r=jonas-schievink"
...
This reverts commit cc9ae2b89e
, reversing
changes made to 7dfd1cb572
.
2022-05-13 15:08:14 +02:00
bors
135164f547
Auto merge of #12226 - Veykril:reborrow-inlay-hints, r=Veykril
...
feat: Allow reborrow inlay hints to be restricted to mutable reborrows only
2022-05-12 12:21:06 +00:00
Lukas Wirth
c2190ad87c
feat: Allow reborrow inlay hints to be restricted to mutable reborrows only
2022-05-12 14:00:06 +02:00
Lukas Wirth
ca46c68b04
internal: Remove redundant offset data in annotations
2022-05-12 13:06:49 +02:00
Jonas Schievink
ac3c18bc17
Include assoc. types in trait signature help
2022-05-10 16:54:31 +02:00
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
Lukas Wirth
1f1185dcbb
Specific proc-macro crate type for other test fixture where needed
2022-03-09 22:18:09 +01:00
Lukas Wirth
3edc5dcea8
fix: Properly handle proc-macro crate types for nameres
2022-03-09 14:33:39 +01:00
bors[bot]
d70ea759b3
Merge #11663
...
11663: Internal: Add hir_def::MacroId, add Macro{Id} to ModuleDef{Id} r=Veykril a=Veykril
With this we can now handle macros like we handle ModuleDefs making them work more like other definitions and allowing us to remove a bunch of special cases. This also enables us to track the modules these macros are defined in, instead of only recording the crate they come from.
Introduces a new class of `MacroId`s (for each of the 3 macro kinds) into `hir_def`. We can't reuse `MacroDefId` as that is defined in `hir_expand` which doesn't know of modules, so now we have two different macro ids, this unfortunately requires some back and forth mapping between the two via database accesses which I hope won't be too expensive.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-09 10:26:34 +00:00
Lukas Wirth
4e94fb7028
Fix ProcMacroData recording wrong name for derives
2022-03-09 01:13:38 +01:00
Lukas Wirth
c37fe779c6
Add data queries for macros
2022-03-09 00:41:54 +01:00
Lukas Wirth
eba90936c1
Move ide crates to new hir::Macro
2022-03-08 23:52:26 +01:00
bors[bot]
49646b71d4
Merge #11445
...
11445: Upstream inlay hints r=lnicola a=lnicola
Closes https://github.com/rust-analyzer/rust-analyzer/issues/2797
Closes https://github.com/rust-analyzer/rust-analyzer/issues/3394 (since now resolve the hints for the range given only, not for the whole document. We don't actually resolve anything due to [hard requirement](https://github.com/rust-analyzer/rust-analyzer/pull/11445#issuecomment-1035227434 ) on label being immutable. Any further heavy actions could go to the `resolve` method that's now available via the official Code API for hints)
Based on `@SomeoneToIgnore's` branch, with a couple of updates:
- I squashed, more or less successfully, the commits on that branch
- downloading the `.d.ts` no longer works, but you can get it manually from https://raw.githubusercontent.com/microsoft/vscode/release/1.64/src/vscode-dts/vscode.proposed.inlayHints.d.ts
- you might need to pass `--enable-proposed-api matklad.rust-analyzer`
- if I'm reading the definition right, `InlayHintKind` needs to be serialized as a number, not string
- this doesn't work anyway -- the client-side gets the hints, but they don't display
Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-03-07 16:49:12 +00:00
Luna Razzaghipour
6da1228898
Emit more detailed highlighting for %
, >>
, <<
2022-03-07 20:16:03 +11:00
Lukas Wirth
ab21cf2f4f
internal: Re-arrange ide_db modules
2022-03-06 19:04:04 +01:00
Lukas Wirth
97076c074d
internal: Simplify and optimize syntax_highlighting
2022-03-06 03:49:54 +01:00
Lukas Wirth
e8edbb5d6f
Add a macro case for the keyword highlighting test fixture
2022-03-06 00:26:15 +01:00
Lukas Wirth
d460b7c9d1
Fix extern crate self having self unresolved
2022-03-06 00:17:40 +01:00
Lukas Wirth
e5bb661b7a
Highlight Self
as a keyword by default
2022-03-06 00:13:45 +01:00
Lukas Wirth
b454f11f38
Fix hover for Self
keyword
2022-03-05 23:47:44 +01:00
Lukas Wirth
5c0aee013e
Fix highlighting of Self
2022-03-05 23:34:37 +01:00
Lukas Wirth
c0d6471143
fix: Recognize Self
as a proper keyword
2022-03-05 23:20:06 +01:00
Andy Russell
49fab593ad
show variadic args in hover function signature
2022-03-04 16:44:31 -05:00
bors[bot]
908c17bfa6
Merge #11595
...
11595: fix: lower string literals with actual value instead of default r=lnicola a=tysg
Fixes #11582 . Some questions below in the code review section.
Co-authored-by: Tianyi Song <42670338+tysg@users.noreply.github.com>
2022-03-04 20:21:43 +00:00
Lukas Wirth
4a866fc672
Simplify
2022-03-04 20:23:25 +01:00
Lukas Wirth
32bf7af83e
Support locals with multiple declaration sites
2022-03-04 19:49:08 +01:00
hkalbasi
4fa8749c44
Preserve order of generic args
2022-03-04 11:46:14 +03:30
Kirill Bulatov
b1d8dae930
Load hints for part of the file only
2022-03-04 07:45:51 +02:00
Tianyi Song
89a19f57f8
Lower string literals with real val, not default
2022-03-04 10:16:35 +08:00
Lukas Wirth
464dd814ca
slightly improve highlighting performance for derive annotated items
2022-03-03 22:59:34 +01:00
Lukas Wirth
8ded3ec9cf
fix: Fix semantic highlighting breaking for lifetimes in macros
2022-03-03 22:53:03 +01:00
bors[bot]
342c3c42bb
Merge #11433
...
11433: minor: Add scary warning to `onEnter` r=lnicola a=lnicola
Closes #11432
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2022-02-28 10:15:44 +00:00
Laurențiu Nicola
6bf97692ae
Add scary warning to onEnter
2022-02-28 12:15:15 +02:00
Lukas Wirth
47ce4436e4
Make hir::Local::name infallible
2022-02-26 16:36:44 +01:00
Lukas Wirth
36603e0478
Rename test highlighting output files
2022-02-26 14:52:42 +01:00
Lukas Wirth
c99fb4b1ac
Split up highlighting tests a bit more
2022-02-26 14:45:09 +01:00
Lukas Wirth
48189bc1b4
Re-order and cleanup highlighting tests
2022-02-26 14:29:03 +01:00
Lukas Wirth
03d33556c9
fix: Don't emit unresolvedReference highlight tags in unlinked files
2022-02-26 13:53:54 +01:00
Jonas Schievink
a247fffdf6
Resolve $crate
in HirDisplay
of Path
2022-02-25 18:38:51 +01:00
Moritz Vetter
3da08071ce
add logic to highlight continue and break keywords according to expectations
2022-02-24 18:58:14 +01:00
Moritz Vetter
cad0cf6950
refactor helper function to work with function taking expression enum instead of break expression
2022-02-24 18:58:14 +01:00
Moritz Vetter
1c074499f3
add some breaking tests (TDD - style)
2022-02-24 18:58:14 +01:00
Lukas Wirth
e759db361e
Resolve functions as proc-macros via FileAstId
2022-02-23 11:21:46 +01:00
Lukas Wirth
2e124d15fb
fix: Fix expand_macro always expanding the first listed derive
2022-02-22 12:32:27 +01:00
Lukas Wirth
b494795a42
update references::derive test output
2022-02-22 10:52:35 +01:00
Lukas Wirth
1bbef5af85
Fix syntax highlighting not highlighting derives anymore
2022-02-22 10:20:44 +01:00
Lukas Wirth
f13c98034b
Make replace_derive_with_manual_impl work again
2022-02-22 10:20:44 +01:00
Lukas Wirth
be3168dabe
Fix expand_macro
not working for derive attributes
2022-02-22 10:20:44 +01:00
Lukas Wirth
7b89d5ede2
internal: Expand the derive attribute into a pseudo expansion
2022-02-22 10:20:40 +01:00
bors[bot]
c0ee2f23ff
Merge #11490
...
11490: Correctly fix formatting doc tests with generics r=Veykril a=KarlWithK
Before the doc_test would be outputted like this:
```zsh
"Foo<T, U>::t"
```
However, this would cause problems with shell redirection. I've changed it
so when generics are involved we simply wrap the expression under quotes as so:
```zsh
"\"Foo<T, U>::t\""
```
Note:
At the cost of adding this, I had to allocate a new string via
`format!{}`. However, I argue this is alright as this for just for
outputting the name of the doc test.
The following tests have been changed:
```
runnables::tests::doc_test_type_params
runnables::tests::test_doc_runnables_impl_mod
runnables::tests::test_runnables_doc_test_in_impl
```
Closes https://github.com/rust-analyzer/rust-analyzer/issues/11489
Co-authored-by: KarlWithK <jocelinc60@outlook.com>
Co-authored-by: SeniorMars <jocelinc60@outlook.com>
2022-02-21 21:57:44 +00:00
SeniorMars
bf47acf1d3
Update crates/ide/src/runnables.rs
...
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-21 15:23:09 -06:00
bors[bot]
b663b733d9
Merge #11522
...
11522: fix: Make code lenses work on attributed items r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11213
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-21 17:08:19 +00:00
Lukas Wirth
c6645f2eb6
fix: Make code lenses work on attributed items
2022-02-21 18:07:47 +01:00
bors[bot]
979b5b32bc
Merge #11455
...
11455: Handle proc-macro functions as the proc-macro they resolve to r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11212
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-02-21 16:56:37 +00:00
Lukas Wirth
0d3cd90d08
Move fn to proc-macro conversion to name classification
2022-02-21 17:56:11 +01:00
bors[bot]
24255e5b3d
Merge #11481
...
11481: Display parameter names when hovering over a function pointer r=Veykril a=Vannevelj
Implements #11474
The idea is pretty straightforward: previously we constructed the hover based on just the parameter types, now we pass in the parameter names as well. I went for a quick-hit approach here but I expect someone will be able to point me to a better way of resolving the identifier.
I haven't figured out yet how to actually run my rust-analyzer locally so I can see it in action but the unit test indicates it should work.
Co-authored-by: Jeroen Vannevel <jer_vannevel@outlook.com>
2022-02-21 13:08:31 +00:00
Chayim Refael Friedman
13ac5c3491
Fix various IDE features
...
As a side benefit, we got `let` guard support for `move_guard` for free.
2022-02-21 08:34:35 +02:00
KarlWithK
5f3327a6b8
Correctly fix formatting doc tests with generics
...
Before the doc_test would be outputted like this:
"Foo<T, U>::t"
However, this would cause shells with shell redirection. I've changed it
so when generics are involved we simply wrap the expression under escape
chanters as so:
"\"Foo<T, U>::t\""
Note:
At the cost of adding this, I had to allocate a new string via
format!{}. However, I argue this is alright as this for just for
outputting the name of the doc test.
The following tests have been changed:
runnables::tests::doc_test_type_params
runnables::tests::test_doc_runnables_impl_mod
runnables::tests::test_runnables_doc_test_in_impl
2022-02-17 20:27:37 -06:00
Jeroen Vannevel
842ffde43d
test names
2022-02-15 19:22:36 +00:00
Jeroen Vannevel
d985394ce2
add test for function pointer without identifier
2022-02-15 19:20:50 +00:00
Jeroen Vannevel
c450d0ce41
cleanup
2022-02-15 14:47:23 +00:00
Jeroen Vannevel
73e49493bd
rough, but appears to work
2022-02-15 14:39:22 +00:00
Lukas Wirth
95db3c1476
fix: keyword hover works on non-keyword tokens if expanded to keyword
2022-02-15 10:09:19 +01:00
bors[bot]
aafa40cebd
Merge #11369
...
11369: feat: Add type hint for keyword expression hovers r=Veykril a=danii
Adds the return type of keywords to tool-tips where it makes sense. This applies to: `if`, `else`, `match`, `loop`, `unsafe` and `await`. Thanks to `@Veykril` for sharing the idea of putting return type highlighting on other keywords!
![image](https://user-images.githubusercontent.com/39541871/151611737-12325c23-a1f9-4fca-ae48-279b374bdcdf.png )
Closes #11359
Co-authored-by: Daniel Conley <himself@danii.dev>
2022-02-14 21:07:41 +00:00
Daniel Conley
768804f11d
Hide Keyword Expression Hover For Units ()
...
Cleaned up the code for keyword expression hovers.
Added a check to hide units `()` in keyword expression hovers.
2022-02-14 15:26:40 -05:00
Lukas Wirth
cef8a17ea5
Handle proc-macro functions as the proc-macro they resolve to
2022-02-11 22:06:03 +01:00
Tianyi Song
e62e926a8a
Use text range of name after macro expansion
2022-02-11 14:17:12 +08:00
TheDoctor314
add80bccfc
Add test
...
The rename function should not change any path segments that refer to a
module by super.
2022-02-08 21:19:14 +05:30
Moritz Vetter
ba2ef69c79
Bump pulldown-cmark-to-cmark, adjust usages and fix test
2022-02-06 09:04:06 +01:00
Lukas Wirth
f6def3ccdf
fix: Fix proc-macro server not using the supplied span in Ident::new
2022-01-31 17:02:57 +01:00
Lukas Wirth
45ff51ba22
Make more precise range macro upmapping
2022-01-31 15:53:44 +01:00
Lukas Wirth
5fd3688018
Fix token ascension single token check being inverted
2022-01-31 13:26:09 +01:00
Lukas Wirth
ddf7b70a0f
Fix cfg_attr invalidating derive identifier IDE functionality
2022-01-30 22:47:16 +01:00
Daniel Conley
261abbf45e
Add Keyword Return Type Highlighting
2022-01-28 14:44:17 -05:00
bors[bot]
2cb85c14b6
Merge #11281
...
11281: ide: parallel prime caches r=jonas-schievink a=jhgg
cache priming goes brrrr... the successor to #10149
---
this PR implements a parallel cache priming strategy that uses a topological work queue to feed a pool of worker threads the crates to index in parallel.
## todo
- [x] should we keep the old prime caches?
- [x] we should use num_cpus to detect how many cpus to use to prime caches. should we also expose a config for # of worker CPU threads to use?
- [x] something is wonky with cancellation, need to figure it out before this can merge.
Co-authored-by: Jake Heinz <jh@discordapp.com>
2022-01-25 16:03:35 +00:00
Laurențiu Nicola
e3e6133ff4
Bump pulldown-cmark and pulldown-cmark-to-cmark
2022-01-21 19:49:57 +02:00
Jonas Schievink
a3d06f824b
status: output all crates a file belongs to
2022-01-17 18:10:01 +01:00
bors[bot]
7a52f83700
Merge #11294
...
11294: internal: Move format specifier lexing from syntax to ide_db r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-15 12:18:46 +00:00
Lukas Wirth
91279db2b4
Move format specifier lexing from syntax to ide_db
2022-01-15 13:14:59 +01:00
bors[bot]
4c34909308
Merge #11293
...
11293: feat: Add very simplistic ident completion for format_args! macro input r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-15 11:24:21 +00:00
Lukas Wirth
82fccb971e
feat: Add very simplistic ident completion for format_args! macro input
2022-01-15 12:23:26 +01:00
Jake Heinz
25f67b6939
make it a config
2022-01-15 02:47:47 +00:00
bors[bot]
9ba6cfa9c7
Merge #11283
...
11283: fix: Adjust `.` typing auto indentation r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/629
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-14 11:16:18 +00:00
Lukas Wirth
ba3efafc0d
fix: Adjust .
typing auto indentation
2022-01-14 12:15:43 +01:00
Jake Heinz
bcc99091f3
hacky fix for cancelling
2022-01-14 10:30:51 +00:00
Jake Heinz
6c5504a617
one last bit of cleanup
2022-01-14 10:10:47 +00:00
Jake Heinz
c3f30ae4f0
removed scoped threads, cleanup
2022-01-14 10:06:28 +00:00
Jake Heinz
f83c0166be
cleanup + detect num cpus
2022-01-14 09:48:59 +00:00
Jake Heinz
0b0bfc6fdd
cleanup
2022-01-14 09:36:03 +00:00
Jake Heinz
c8aa2f6a61
use index map
2022-01-14 09:35:41 +00:00
Jake Heinz
5f0c1aa2de
make progress callback dyn
2022-01-14 09:33:40 +00:00
Jake Heinz
2b0d8a86a2
fix warnings
2022-01-14 09:25:45 +00:00
Jake Heinz
343b0ccfb9
simplify
2022-01-14 09:21:25 +00:00
Jake Heinz
3168148cc6
ide: parallel prime caches
2022-01-14 09:16:35 +00:00
Jonas Schievink
09219e10f1
Mostly restore hir
API boundary
2022-01-12 19:56:47 +01:00
Lukas Wirth
b32f611b6e
fix: Fix outline modules spilling inner doc injections into their parent
2022-01-08 14:54:31 +01:00
Lukas Wirth
6746ba5839
Record attribute calls on assoc items in TraitData and ImplData
2022-01-08 10:45:12 +01:00
bors[bot]
40009e07d0
Merge #11145
...
11145: feat: add config to use reasonable default expression instead of todo! when filling missing fields r=Veykril a=bnjjj
Use `Default::default()` in struct fields when we ask to fill it instead of putting `todo!()` for every fields
before:
```rust
pub enum Other {
One,
Two,
}
pub struct Test {
text: String,
num: usize,
other: Other,
}
fn t_test() {
let test = Test {<|>};
}
```
after:
```rust
pub enum Other {
One,
Two,
}
pub struct Test {
text: String,
num: usize,
other: Other,
}
fn t_test() {
let test = Test {
text: String::new(),
num: 0,
other: todo!(),
};
}
```
Co-authored-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
Co-authored-by: Coenen Benjamin <benjamin.coenen@hotmail.com>
2022-01-07 14:10:11 +00:00
Lukas Wirth
ca4baa6e55
Use FileAstId<ast::Adt>
in nameres where appropriate instead
2022-01-07 14:20:27 +01:00
Laurențiu Nicola
e14d9208f5
Move pretty-printing test out of assist
2022-01-06 16:38:25 +02:00
Lukas Wirth
dc135cc076
internal: Support registered tools and attributes in ide layer
2022-01-06 14:56:50 +01:00