Jonas Schievink
fccc12982e
Add closing brace hints for macros
2022-05-16 15:23:25 +02:00
Jonas Schievink
867a7dc7a0
Show inlay hints after a }
to indicate the closed item
2022-05-16 14:55:47 +02:00
Lukas Wirth
7cbde1b3a5
Enable reborrow hints in attribute calls
2022-05-14 15:00:14 +02:00
Lukas Wirth
6b696fced8
feat: Add binding mode inlay hints
2022-05-14 14:58:35 +02:00
Lukas Wirth
3577c44dee
fix: Fix fill-arguments completions not working
2022-05-13 19:52:44 +02:00
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
Jonas Platte
c90c88b083
Always put a space after impl in macro pretty-printing
...
… regardless of whether the next symbol is punctuation or not.
2022-01-06 11:33:08 +01:00
bors[bot]
ac3ea3e81c
Merge #11112
...
11112: Evaluate constants in array repeat expression r=HKalbasi a=HKalbasi
cc #8655
Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2022-01-04 21:51:37 +00:00
hkalbasi
75c2acae6e
Evaluate constants in array repeat expression
2022-01-05 01:17:01 +03:30
Lukas Wirth
c5a9985fc5
Remove lossy Definition::from_token
/Definition::from_node
methods
2022-01-04 18:29:53 +01:00
bors[bot]
68bc12c3b8
Merge #11157
...
11157: internal: Remove `SemanticScope::speculative_resolve_as_mac` r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11132
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-01-04 16:49:47 +00:00
Lukas Wirth
19f1ff5c70
give resolve_derive_ident
a more robust api
2022-01-03 16:00:45 +01:00
bors[bot]
8e9ccbf97a
Merge #11177
...
11177: internal: dont descend into comments r=Veykril a=jhgg
fixes #11176
Co-authored-by: Jake Heinz <jh@discordapp.com>
2022-01-03 02:03:03 +00:00
Jake Heinz
04decd5e6b
internal: dont descend into comments
2022-01-03 01:53:58 +00:00
bors[bot]
abbc7e3a0e
Merge #11088
...
11088: closes #10446 hide type inlay hints r=Veykril a=Heinenen
Passes tests as described in #10446
Works for all happy cases, there may be some cases that I forgot as I am not that familiar with Rust and r-a (yet).
Co-authored-by: Heinenen <th.m.heinen@gmail.com>
2022-01-03 00:51:08 +00:00
Lukas Wirth
087122ad1a
fix: Fix highlighting hack for self-params
2022-01-03 01:32:03 +01:00
Lukas Wirth
6b7b09d329
internal: Record unresolved derive invocations in hir
2022-01-02 23:44:23 +01:00
Lukas Wirth
762a3b3030
Fix tool module classification not working correctly
2022-01-02 23:14:18 +01:00
Lukas Wirth
19d894cdec
minor: Cleanup syntax highlighting
2022-01-02 22:23:05 +01:00
Lukas Wirth
22160c418b
fix NameRefClass misclassifying proc-macros
2022-01-02 19:20:10 +01:00
Lukas Wirth
9eed85b171
fix syntactic highlighting for macros
2022-01-02 19:10:23 +01:00
Lukas Wirth
3a525c831f
internal: Handle macro calls better in highlighting
2022-01-02 19:10:10 +01:00
Aleksey Kladov
d846afdeef
check top level entry point invariants
2022-01-02 18:41:32 +03:00
Benjamin Coenen
df6fa50f92
feat(diagnostics): add new config to fill default expression
...
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
2021-12-31 16:29:08 +01:00
hkalbasi
e6139cf47b
show values of constants in hover
2021-12-23 17:53:46 +03:30
Heinenen
05abfc77f5
hide type inlay hints
2021-12-23 12:56:38 +01:00
Heinenen
d7dfe93fc3
hide type inlay hints for enum variant constructors and tuple struct constructors
2021-12-23 12:56:38 +01:00
Lukas Wirth
85ed5a3182
Make hover test not relient on minicore structure
2021-12-22 02:36:31 +01:00
Lukas Wirth
40d5c58a80
Fully render const item completions from hir
2021-12-21 16:35:51 +01:00
bors[bot]
d3aa2579cc
Merge #11069
...
11069: fix: Partially fix `ide_db::search` for crate roots r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10007
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-20 16:50:35 +00:00
Lukas Wirth
5206946674
fix: Partially fix ide_db::search
for crate roots
2021-12-20 17:48:47 +01:00
bors[bot]
f46731a230
Merge #11028
...
11028: Bump MSRV (1.57) r=Veykril a=iDawer
This bumps MSRV on all crates to 1.57 except `la-arena`
#10986 requires >=1.57
Co-authored-by: iDawer <ilnur.iskhakov.oss@outlook.com>
2021-12-20 13:45:35 +00:00
rainy-me
67cc6c1e16
feat: treat fn keyword inside function pointer type as primitive
2021-12-19 01:51:51 +09:00
Laurențiu Nicola
8ad7c0439c
Remove needless clones
2021-12-17 17:35:10 +02:00
Lukas Wirth
d3e538638a
fix: Don't duplicate attribute completions
2021-12-17 15:22:53 +01:00
iDawer
676744be6e
Bump MSRV (1.57)
2021-12-16 01:56:12 +05:00
Lukas Wirth
04a7fbbddb
Move out doc-links tests into a separate module
2021-12-14 12:10:43 +01:00
zhoufan
c3ad945d9b
fixes broken tests
2021-12-14 15:57:58 +08:00
bors[bot]
3f550d2e38
Merge #11000
...
11000: fix: insert whitespaces into assoc items for assist when macro generated r=Veykril a=Veykril
This is obviously only a temporary hack which still produces ugly looking items, but as long as the syntax is valid one can at least have rustfmt fix the formatting again.
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/6588
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-13 15:43:12 +00:00
Lukas Wirth
749eeef3e7
fix: insert whitespaces into assoc items for assist when macro generated
2021-12-13 16:35:32 +01:00
Lukas Wirth
328419534d
Move ws insert rendering for macro expansion into ide_db
2021-12-13 15:55:13 +01:00
bors[bot]
4f04d8477a
Merge #10965
...
10965: minor: Remove dead assists-related function r=Veykril a=lnicola
Unless I'm missing something, `assists_with_fixes` seems to be always used and ends up in the same code path.
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-11 15:06:52 +00:00
bors[bot]
d03397fe11
Merge #10978
...
10978: internal: Only prime direct dependencies of the workspace crates r=jonas-schievink a=lnicola
This reduces the number of primed crates on `self` from 177 to 105.
```text
# baseline
86521 me 20 0 2939M 562M 14320 S 0.0 0.9 0:07.10 37 rust-analyzer
# pr
99947 me 20 0 2935M 549M 14424 S 0.0 0.9 0:07.10 37 rust-analyzer
```
The RAM usage seems to vary a lot, so I'm not sure the improvement shown above is real.
We also drop the topological sorting, although it might still make sense to do the dependencies before the workspace crates. But since it's only used to make the progress reporting a bit more fine, it probably doesn't matter too much.
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-12-10 22:31:55 +00:00
Lukas Wirth
c81aa68afe
Don't show trait flyimports for impl trait and placeholders
2021-12-10 19:18:21 +01:00
Laurențiu Nicola
d012a20f25
Only prime direct dependencies of the workspace crates
2021-12-10 16:24:07 +02:00
Laurențiu Nicola
f5968cfc84
Remove dead assists-related function
2021-12-08 16:55:25 +02:00
bors[bot]
b7afb6fc6c
Merge #10958
...
10958: internal: add "Shuffle Crate Graph" command r=jonas-schievink a=jonas-schievink
May be useful for debugging issues like https://github.com/rust-analyzer/rust-analyzer/issues/10084
bors r+
Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
2021-12-07 15:44:05 +00:00
Jonas Schievink
deb5c1426d
internal: add "Shuffle Crate Graph" command
2021-12-07 16:37:19 +01:00
Lukas Wirth
f781e599cc
Adjust incorrect runnable tests
2021-12-07 15:42:54 +01:00
Lukas Wirth
e09d410dcd
Simplify
2021-12-07 15:06:56 +01:00
Lukas Wirth
b66f181bc0
Fix some TryToNav impls not upmapping ranges out of macros
2021-12-07 15:02:22 +01:00
Lukas Wirth
9b4ca77572
fix: Add highlighting hack back for unresolved attributes
2021-12-05 11:59:07 +01:00
bors[bot]
6434ada19e
Merge #10930
...
10930: fix: Fix self keyword not being tagged as such in highlighting properly r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10575
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-04 18:08:11 +00:00
Lukas Wirth
b35a50cb10
fix: Fix self keyword not being tagged as such in highlighting properly
2021-12-04 19:07:18 +01:00
bors[bot]
372a7cf981
Merge #10929
...
10929: internal: Split up macro/attribute semantic tokens a bit more r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/9172
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-04 17:33:16 +00:00
Lukas Wirth
3472105ad9
Update semantic token docs
2021-12-04 18:23:25 +01:00
Lukas Wirth
e4f2d0e3a8
Introduce SymbolKind::Derive
2021-12-04 18:18:09 +01:00
Lukas Wirth
642c1eb720
Introduce SymbolKind::Attribute
2021-12-04 18:01:22 +01:00
Laurențiu Nicola
b7368d34a6
Bump pulldown-cmark-to-cmark
2021-12-04 15:21:04 +02:00
bors[bot]
3f3289df2a
Merge #10915
...
10915: feat: Resolve builtin-attr and tools in ide layer r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-12-03 19:28:36 +00:00
Lukas Wirth
8da850b6d5
Improve hover message for inert attributes
2021-12-03 20:28:15 +01:00
Lukas Wirth
d174158abc
Rename things: Tool -> ToolModule
2021-12-03 17:15:19 +01:00
Lukas Wirth
70b8331fd5
Basic hover for builtin-attr and tool modules
2021-12-03 17:10:56 +01:00
Lukas Wirth
db559e5049
Simplify
2021-12-03 17:07:06 +01:00
Lukas Wirth
d1677f3286
Remove syntax highlighting hack for builtin attrs
2021-12-03 16:54:34 +01:00
Lukas Wirth
e58af219a4
feat: Resolve builtin-attr and tools in ide layer
2021-12-03 16:32:17 +01:00
bors[bot]
b68cd6eda2
Merge #10891
...
10891: fix: emit trait names in moniker identifier r=Veykril a=tjdevries
Hi,
Not sure if this is the best fix for the problem, but I noticed that functions that part of a trait are not namespaced with the trait name, so this could lead to problems if you had a function and a trait-function both defined in the same module.
Thanks!
TJ
Co-authored-by: TJ DeVries <devries.timothyj@gmail.com>
2021-12-02 11:21:59 +00:00
TJ DeVries
6870bfd099
fixup: include more information for impls
2021-12-02 00:04:03 -05:00
TJ DeVries
d50f18fb65
fixup: properly handle all associated items
2021-12-01 11:43:52 -05:00
Jake Heinz
30b0464ed8
add a fixme:
2021-12-01 12:26:27 +00:00
Jake Heinz
ba92bb1ed9
simplify
2021-12-01 12:25:08 +00:00
Jake Heinz
d2480ecb9f
ide: hack to make self not unresolved reference in async trait wrapped impl's
2021-12-01 12:17:20 +00:00
Jake Heinz
b357569d0f
add test
2021-12-01 10:28:18 +00:00
TJ DeVries
09c7e22ec2
fix: emit trait names in moniker identifier
2021-11-30 11:16:11 -05:00
bors[bot]
2d0db312b5
Merge #10872
...
10872: ide_db: build symbol index from crate def map r=Veykril a=jhgg
fixes #4842 , #10764
Is this looking correct? 👀
- [x] build the symbol index based upon the CrateDefMap for the given crate in `crate_symbols`
- [x] make it multi threaded again, and figure out how to cache each moduleid's symbol index in salsa.
- [x] NavigationTarget for names in macros is wrong, need to figure out how to compute a text range in the original file id?
- [x] cleanup some duped code
- [x] collect macros from `ItemScope.declared_macros()` into symbol index.
- [x] store declared macros in `ItemScope` so we can figure out where macros were defined for the index.
- [x] do something about `SymbolIndex::for_files` - ideally it should use the new module symbol index stuff.
- [x] delete `source_file_to_file_symbols` & co...
- [x] figure out what to do about `library_symbols`
- [x] maybe... speed up the new `library_symbols` - the new impl is probably much slower, and definitely much less parallel. **deciding to do nothing here, we can optimize later if necerssary.**
- [x] fix failing test: `navigation_target::tests::test_nav_for_symbol` - notably the crate def map doesn't seem to find declarations inside function.
- [x] now a bunch of other tests are failing around auto_import & qualify_path handlers. :(
- [x] need to assoc items in traits and impls
Co-authored-by: Jake Heinz <jh@discordapp.com>
2021-11-30 14:07:39 +00:00
Jake Heinz
b0c7ff39b8
remove one need for semantics
2021-11-30 04:50:09 +00:00
bors[bot]
393cbd0982
Merge #10841
...
10841: Emit moniker in lsif r=Veykril a=HKalbasi
fix #10559
Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
Co-authored-by: HKalbasi <45197576+HKalbasi@users.noreply.github.com>
2021-11-29 11:13:39 +00:00
Jake Heinz
1280887561
do something with library_symbols
2021-11-29 09:36:00 +00:00
hkalbasi
df261c10b9
remove duplicate data from CrateOrigin
2021-11-29 11:10:39 +03:30
Jake Heinz
8307d38dc1
cleanups
2021-11-28 00:42:42 +00:00
Lukas Wirth
76022bfd60
fix: Show parameter hints unconditionally for logical not expressions
2021-11-27 19:14:36 +01:00
Jake Heinz
e033d8c2a2
make navigation target go to original file location
2021-11-27 13:48:50 +00:00
Jake Heinz
a1030b07ab
use Semantics::parse_or_expand in another place
2021-11-27 11:55:03 +00:00
Jake Heinz
0447be7589
wip
2021-11-27 11:25:05 +00:00
Jake Heinz
dca8f612d0
ide: fix expansion for 'as _'
2021-11-27 02:22:21 +00:00
Lukas Wirth
4bf75c5d6e
fix: Prioritize tuple fields in highlight_related
2021-11-25 16:34:40 +01:00
Lukas Wirth
f3b25a6fc8
Disable string highlight injection for macros changing string literals
2021-11-23 22:13:10 +01:00
hkalbasi
30ed7fac27
Emit moniker in lsif
2021-11-22 21:29:05 +03:30
Lukas Wirth
ec07bb98f8
fix: Omit generic defaults for types in hover messages
2021-11-22 18:27:03 +01:00
Lukas Wirth
64cb09ddea
Add to macro testing infra to emit token map ids
2021-11-22 16:51:09 +01:00
Lukas Wirth
77f08d0fc3
Split parts of ide_db::call_info
off into ide
2021-11-22 13:23:34 +01:00
Lukas Wirth
54b2de45e1
Unnest ide::display::navigation_target module
2021-11-22 13:04:28 +01:00
Jake Heinz
7cbc6ae920
ide: hover omits unnamed where preds
2021-11-20 11:45:12 +00:00
bors[bot]
a60e009b48
Merge #10806
...
10806: fix: inlay param hint hiding heurstic is case unsensitive r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-19 11:46:49 +00:00
Lukas Wirth
cd290b427c
fix: inlay param hint hiding heurstic is case unsensitive
2021-11-19 12:46:17 +01:00
Jake Heinz
c28dc00b39
ide: dedupe or merge hover actions
2021-11-19 05:36:07 +00:00
bors[bot]
cfa26c3ac3
Merge #10798
...
10798: ide: show go to for function hover return type r=Veykril a=jhgg
I've found myself wanting this... adds to the hover quick go-to for a function's return type:
![image](https://user-images.githubusercontent.com/5489149/142375722-4a385216-494b-45a4-be1c-59664213b8d6.png )
This is particularly useful when you are hovering over a function in a long chain, like:
```rust
foo.bar().b$0az().some_trait_fn();
```
where `baz`'s return type is not immediately obvious, but the chain is not long enough to trigger chain inlay hints...
i guess I could just select `foo.bar().baz()` too to get the types too...
Co-authored-by: Jake Heinz <jh@discordapp.com>
2021-11-18 09:56:44 +00:00
Jake Heinz
876f44b3ea
ide: show go to for function hover return type
2021-11-18 08:00:22 +00:00
Jake Heinz
e8d0989606
ide: display static values in hover
2021-11-18 06:00:51 +00:00
bors[bot]
64a73dcfba
Merge #10785
...
10785: ide: show const value in hover r=jhgg a=jhgg
fixes #10783
I think my original attempt was incorrect, because it looks like `HirDisplay` is used in more places than just the hover.
So, I've attempted it again in 312eafe
, this time specifically just rendering the value in `hover::render`
pictoral:
![image](https://user-images.githubusercontent.com/5489149/142163890-b6aa2ab4-7bd0-4dd3-b35d-5eaa83fffb7f.png )
Co-authored-by: Jake Heinz <jh@discordapp.com>
Co-authored-by: Jake <jh@discordapp.com>
2021-11-18 04:17:16 +00:00
Jake Heinz
aef8882254
more complicated const test
2021-11-18 04:15:02 +00:00
Lukas Wirth
91bbc55eed
Check for derive attributes by item path, not derive
identifier
2021-11-17 20:46:57 +01:00
Jake Heinz
312eafe916
maybe this is better??
2021-11-17 07:02:49 +00:00
Jake Heinz
4fbc4b9356
hir: show const value in hover
2021-11-17 05:49:27 +00:00
Lukas Wirth
366499c3be
Do not use reference search in runnables::related_tests
2021-11-16 21:32:02 +01:00
Lukas Wirth
0ff380fe17
Simplify
2021-11-16 21:26:34 +01:00
Lukas Wirth
b57289c4cb
Skip test/bench attr expansion in resolution instead of collection
2021-11-16 20:23:56 +01:00
Lukas Wirth
92f7db447c
minor: Lift out FxIndex{Map/Set} types into ide_db
2021-11-16 12:15:47 +01:00
Lukas Wirth
d2513deb62
fix: Reimplement mapping out of test/bench attributes for runnables
2021-11-16 11:51:24 +01:00
Jake Heinz
520ff62f4e
flip the default
2021-11-13 23:39:34 +00:00
Jake Heinz
d3d768de0d
inlay hints: add the option to always show constructor inlay hints
2021-11-13 23:12:29 +00:00
Lukas Wirth
2d7f5891f7
Remove faulty logic for ascending test attributes for runnables
2021-11-11 18:47:24 +01:00
Lukas Wirth
a510021065
Replace some more ide usages of ModuleDef with Definition
2021-11-11 18:20:54 +01:00
Jonas Schievink
acbe8bc7ac
Prime a more reasonable set of crates
2021-11-11 14:44:12 +01:00
Lukas Wirth
7776aad166
internal: Flatten Definition::ModuleDef
variant
2021-11-11 00:05:53 +01:00
Lukas Wirth
26419c0379
Fix proc-macro attributes being shadowed by their functions in IDE layer
2021-11-08 14:49:50 +01:00
bors[bot]
10782bbb39
Merge #10685
...
10685: fix: Enable markdown tables r=Veykril a=Veykril
Should fix https://github.com/rust-analyzer/rust-analyzer/issues/10655
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-05 11:25:17 +00:00
Lukas Wirth
439a8194b0
Replace more Name::to_string usages with Name::to_smol_str
2021-11-04 18:12:05 +01:00
Lukas Wirth
4d4574f5b6
Enable markdown tables
2021-11-04 17:36:58 +01:00
bors[bot]
962be38004
Merge #10645
...
10645: fix: make `rename` multi-token mapping aware r=Veykril a=spookyvision
Co-authored-by: Anatol Ulrich <anatol.ulrich@ferrous-systems.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
Co-authored-by: Anatol Ulrich <45840+spookyvision@users.noreply.github.com>
2021-11-04 16:31:16 +00:00
bors[bot]
c96481e25f
Merge #10691
...
10691: minor: Use array `into_iter` in more places r=lnicola a=lnicola
bors r+
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-11-04 05:52:05 +00:00
Laurențiu Nicola
139bf9b4e1
Use array into_iter in more places
2021-11-04 07:51:20 +02:00
Anatol Ulrich
83927e08a8
Update crates/ide/src/rename.rs
...
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-11-03 15:44:32 +01:00
Lukas Wirth
52f5af7165
Expose version string of crates fom HIR
2021-11-03 15:40:06 +01:00
Anatol Ulrich
9bce4d6696
accept identical Indels when merging; add rename test case
2021-11-02 21:38:38 +01:00
Lukas Wirth
7fdbdc4ab2
Enable auto-import and qualify-path in derive attributes
2021-10-28 18:40:38 +02:00
Lukas Wirth
3018ffd85e
Refactor ide handling for paths in derive inputs
2021-10-28 16:47:19 +02:00
Anatol Ulrich
1ac35532c4
remove TODO comment
2021-10-27 17:26:38 +02:00
Anatol Ulrich
df9fb9b159
re-introduce always!
2021-10-27 17:25:42 +02:00
Anatol Ulrich
28c73f8374
unwrap--
2021-10-27 17:23:23 +02:00
Anatol Ulrich
4a1a5ff54e
fix logic error: alias detection was too lenient
2021-10-27 17:20:12 +02:00
Anatol Ulrich
6cd15c296d
wip
2021-10-27 15:40:49 +02:00
Anatol Ulrich
8d3ac328ee
remove resolved TODO questions
2021-10-27 15:40:30 +02:00
Anatol Ulrich
f244ed6a1a
doxx
2021-10-27 04:46:02 +02:00
Anatol Ulrich
2e0610e64e
one down
2021-10-27 04:42:58 +02:00
Anatol Ulrich
95199ac30b
make imports less odd
2021-10-27 04:36:32 +02:00
Anatol Ulrich
6decfceae1
WIP: fix: make rename
multi-token mapping aware
2021-10-27 04:31:14 +02:00
bors[bot]
a3830dfd3b
Merge #10641
...
10641: fix: make `expand_macro` multi-token mapping aware r=spookyvision a=spookyvision
Co-authored-by: Anatol Ulrich <anatol.ulrich@ferrous-systems.com>
Co-authored-by: Anatol Ulrich <45840+spookyvision@users.noreply.github.com>
2021-10-26 18:18:22 +00:00
Anatol Ulrich
b42093915a
Update crates/ide/src/expand_macro.rs
...
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-26 20:17:47 +02:00
Anatol Ulrich
e6913be47b
fix test
2021-10-26 20:15:25 +02:00
Anatol Ulrich
04f2eb0fba
wording
2021-10-26 20:10:09 +02:00
Anatol Ulrich
3f82989153
fix: make expand_macro
multi-token mapping aware
2021-10-26 20:09:14 +02:00
bors[bot]
c48730cb72
Merge #10639 #10640
...
10639: fix: make `goto_declaration` multi-token mapping aware r=Veykril a=spookyvision
10640: assume valid identifier r=Veykril a=spookyvision
improve https://github.com/rust-analyzer/rust-analyzer/pull/10637/ by always returning `Some(potentially_empty_vec)` instead of `None` in the empty case
Co-authored-by: Anatol Ulrich <anatol.ulrich@ferrous-systems.com>
2021-10-26 17:51:33 +00:00
Anatol Ulrich
53be26df50
assume valid identifier
2021-10-26 19:33:50 +02:00
Anatol Ulrich
d8ed15b6a6
fix: make goto_declaration
multi-token mapping aware
2021-10-26 19:31:49 +02:00
Anatol Ulrich
c69879423e
fix imports
2021-10-26 12:34:40 +02:00
Anatol Ulrich
686f8fbea3
simplify
2021-10-26 12:21:18 +02:00
Anatol Ulrich
2490807ca5
fix: make goto_type_definition
multi-token mapping aware
2021-10-25 23:43:58 +02:00
Laurențiu Nicola
8457ae34bd
Set MSRV
2021-10-23 15:07:11 +03:00
Lukas Wirth
1294bfce86
Migrate to edition 2021
2021-10-21 20:10:40 +02:00
bors[bot]
6877240fdf
Merge #10563
...
10563: feat: Make "Generate getter" assist use semantic info r=agluszak a=agluszak
This PR makes "Generate getter" assist use semantic info instead of dealing with types encoded as strings.
Getters for types which are:
- `Copy` no longer return references
- `AsRef<str>` (i.e. `String`) return `&str` (instead of `&String`)
- `AsRef<[T]>` (i.e. `Vec<T>`) return `&[T]` (instead of `&Vec<T>`)
- `AsRef<T>` (i.e. `Box<T>`) return `&T` (instead of `&Box<T>`)
- `Option<T>` return `Option<&T>` (instead of `&Option<T>`)
- `Result<T, E>` return `Result<&T, &E>` (instead of `&Result<T, E>`)
String, Vec, Box and Option were previously handled as special cases.
Closes #10295
Co-authored-by: Andrzej Głuszak <gluszak.andrzej@gmail.com>
2021-10-20 21:02:46 +00:00
Lukas Wirth
8ed86fc25d
Fix standard library doclinks not going to the correct page
2021-10-20 16:36:01 +02:00
Andrzej Głuszak
98676efdc5
Semantic getter
2021-10-17 16:33:14 +02:00
Milo
5a93457c1b
revert
2021-10-16 14:13:43 +01:00
Milo
35e5daacc3
more clippy fixes
2021-10-16 12:32:55 +01:00
Milo
35de195c41
a few clippy fixes
2021-10-14 19:57:21 +01:00
bors[bot]
8619058d3d
Merge #10538
...
10538: fix: matching brace should prefer brace on cursor's right r=Veykril a=codgician
I observed a brace matching issue with the following Rust code:
```rust
let x = (1 + (2 + 3)) * 4;
```
In a situation like `<|>(1 + (2 + 3)) * 4`, the cursor will go to `(1 + (2 + 3)<|>) * 4`, and if user tries to match bracket again it will go like `(1 + <|>(2 + 3)) * 4` while logically the expected result should be `<|>(1 + (2 + 3)) * 4`. This behavior exists in both line cursor style and block cursor style.
This PR fixes this by letting `matching_brace` prefer the brace to cursor's right when the cursor lies between multiple consecutive braces. It **does NOT** fix #1942 but could be related. Please review.
Co-authored-by: codgician <15964984+codgician@users.noreply.github.com>
2021-10-14 11:50:14 +00:00
codgician
7e68db3670
Matching brace prefers brace on cursor's right
2021-10-14 14:15:56 +08:00
bors[bot]
f185d1c533
Merge #10423
...
10423: Internal: refactor for mdbook plugin r=Veykril a=HKalbasi
This PR is for upstreaming changes that I made for mdbook plugin. Changes are adding inlay hints to `StaticIndex` and changing some functions for working around privacy of crates.
Aside this, is it okay if I bring the plugin in tree? It is a simple binary crate. I feel it will better maintained here and become resistant to api changes.
Co-authored-by: hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
2021-10-12 18:35:03 +00:00
Mirko Rainer
eccfa1645b
Saw a FIXME comment and decided to fix it.
...
This renames `descend_into_macros` to `descend_into_macros_single` and `descend_into_macros_many` into `descend_into_macros`.
However, this does not touch a function in `SemanticsImpl` of same name.
2021-10-12 11:52:31 -04:00
hamidreza kalbasi
0f49c97e93
internal changes for mdbook
2021-10-12 11:54:00 +03:30
bors[bot]
64ca0f63bf
Merge #10504
...
10504: Remove needless clone r=lnicola a=k-nasa
## Why
Delete clones for efficiency
## What
- I erased unnecessary clones
Co-authored-by: k-nasa <htilcs1115@gmail.com>
2021-10-10 07:17:52 +00:00
k-nasa
b50cb5c261
Remove neesless clone
2021-10-10 10:50:51 +09:00
Aleksey Kladov
afacdd612d
internal: update expect
2021-10-09 17:17:16 +03:00
bors[bot]
fd3f4c50da
Merge #10467
...
10467: Optimize CodeLens for references/impls r=Veykril a=ericsampson
Don't do unnecessary work.
Followup to #10447 . cc `@Veykril`
Co-authored-by: Eric Sampson <esampson@eaze.com>
2021-10-06 21:47:22 +00:00
Eric Sampson
efca421c43
Refactor to eliminate a vector allocation.
2021-10-06 16:43:37 -05:00
bors[bot]
f30b62b751
Merge #10479
...
10479: fix: fix "index out of bounds" panic in name resolution r=jonas-schievink a=jonas-schievink
Closes https://github.com/rust-analyzer/rust-analyzer/issues/10084
Closes https://github.com/rust-analyzer/rust-analyzer/issues/9163
This is really just a salsa update to a version that removes the problematic code (see https://github.com/rust-analyzer/rust-analyzer/issues/10084#issuecomment-934445711 )
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-10-06 20:54:27 +00:00
Jonas Schievink
cda9668289
Update salsa
2021-10-06 22:42:54 +02:00
Eric Sampson
0d77be67f7
Don't do work and then throw it away.
2021-10-06 01:16:31 -05:00
bors[bot]
5ff992465e
Merge #10447
...
10447: Add enum variant references CodeLens. r=Veykril a=ericsampson
Co-authored-by: Eric Sampson <esampson@eaze.com>
2021-10-05 22:03:23 +00:00
Eric Sampson
6d05b07f7d
Refactor according to PR comments to remove allocations.
2021-10-05 15:42:45 -05:00
bors[bot]
c409cf0e26
Merge #10458
...
10458: feat: Implement custom user snippets r=Veykril a=Veykril
![Y24dX7fOWX](https://user-images.githubusercontent.com/3757771/136059454-ceccfc2c-2c90-46da-8ad1-bac9c2e83ec1.gif )
Allows us to address the following issues:
- `.arc / .rc / .pin, similar to .box?` https://github.com/rust-analyzer/rust-analyzer/issues/7033
- `Add unsafe snippet` https://github.com/rust-analyzer/rust-analyzer/issues/10392 , would allow users to have this without the diagnostic)
- `.ok() postfix snippet is annoying` https://github.com/rust-analyzer/rust-analyzer/issues/9636 , allows us to get rid of the `ok` postfix and similar ones
- `Postfix vec completion` https://github.com/rust-analyzer/rust-analyzer/issues/7773
cc https://github.com/rust-analyzer/rust-analyzer/issues/772
Zulipd discussion: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Custom.20Postfix.20snippets
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-05 16:41:11 +00:00
Lukas Wirth
77cbf4adbc
Bring the implementation closer to VSCode snippet definitions
2021-10-05 17:18:40 +02:00
bors[bot]
86c534f244
Merge #10440
...
10440: Fix Clippy warnings and replace some `if let`s with `match` r=Veykril a=arzg
I decided to try fixing a bunch of Clippy warnings. I am aware of this project’s opinion of Clippy (I have read both [rust-lang/clippy#5537 ](https://github.com/rust-lang/rust-clippy/issues/5537 ) and [rust-analyzer/rowan#57 (comment)](https://github.com/rust-analyzer/rowan/pull/57#discussion_r415676159 )), so I totally understand if part of or the entirety of this PR is rejected. In particular, I can see how the semicolons and `if let` vs `match` commits provide comparatively little benefit when compared to the ensuing churn.
I tried to separate each kind of change into its own commit to make it easier to discard certain changes. I also only applied Clippy suggestions where I thought they provided a definite improvement to the code (apart from semicolons, which is IMO more of a formatting/consistency question than a linting question). In the end I accumulated a list of 28 Clippy lints I ignored entirely.
Sidenote: I should really have asked about this on Zulip before going through all 1,555 `if let`s in the codebase to decide which ones definitely look better as `match` :P
Co-authored-by: Aramis Razzaghipour <aramisnoah@gmail.com>
2021-10-05 08:58:40 +00:00
Aramis Razzaghipour
9583dd5725
Replace if let
with match
where appropriate
2021-10-05 09:00:21 +11:00
Aramis Razzaghipour
f29796da61
Replace if let Some(_) = foo
with if foo.is_some()
2021-10-05 09:00:18 +11:00
Eric Sampson
160a7b097a
initialize vector to required size.
2021-10-04 16:14:01 -05:00
Lukas Wirth
454ecd167c
Make multiple import edits work for completions
2021-10-04 21:44:33 +02:00
Lukas Wirth
046c85ef0c
Add custom non-postfix snippets
2021-10-04 19:22:41 +02:00
Lukas Wirth
88f213eadd
Initial implementation of custom postfix snippets
2021-10-04 17:49:21 +02:00
Eric Sampson
5df6259996
tweak variable names.
2021-10-04 02:42:13 -05:00
Eric Sampson
a0bb31587e
Add enum variant references CodeLens.
2021-10-04 02:18:31 -05:00
bors[bot]
10eaa5a0af
Merge #10441
...
10441: feat: Hide type inlay hints for constructors r=Veykril a=Veykril
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/3022
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-03 13:35:47 +00:00
Lukas Wirth
a31bc668f5
Hide generic constructors if appropriate
2021-10-03 15:35:26 +02:00
Lukas Wirth
992b4648d9
feat: Hide type inlay hints for constructors
2021-10-03 14:53:18 +02:00
bors[bot]
ebe6c38a44
Merge #10438
...
10438: minor: Simplify r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-10-03 11:06:06 +00:00
Lukas Wirth
0943c4be8b
minor: Simplify
2021-10-03 13:05:42 +02:00
Lukas Wirth
86e5406539
Fix rename trying to edit the same range multiple times
2021-10-02 18:50:21 +02:00
Aleksey Kladov
12103b16de
internal: untangle usages of ReferenceCategory somewhat
...
Not everything that can be read or write is a reference, let's try to
use more precise types.
2021-10-02 13:02:06 +03:00
Aleksey Kladov
46eb03d99a
internal: use naming that matches intended use-case
2021-10-02 12:18:18 +03:00
nathan.whitaker
a3661b3900
Add whitespace b/w lifetime and mut in expansion
2021-10-01 15:29:26 -04:00
Cassandra McCarthy
d5cf9f4add
docs: add note about vscode-vim
in on_enter
...
I found myself search for this, so building off of #3013 and #3308 , I
hope this note is useful.
2021-10-01 14:12:32 -04:00
bors[bot]
0646d5cf9e
Merge #10413
...
10413: fix: Fix format highlighting with `concat!` and `unreachable!` r=jonas-schievink a=jonas-schievink
Last item in https://github.com/rust-analyzer/rust-analyzer/issues/10394 , closes https://github.com/rust-analyzer/rust-analyzer/issues/10394
Also documents why/how `is_format_string` even works, since I found that nontrivial.
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-10-01 11:31:32 +00:00
Jonas Schievink
3bc0d89ade
Fix format highlighting with concat!
2021-10-01 13:28:05 +02:00
bors[bot]
47c079a037
Merge #10403
...
10403: feat: Add semantic token modifier for crate root r=Veykril a=lhvy
Resolves #9073
I managed to implement crate root highlighting for crates mentioned specifically by name (e.g. `serde` in `use serde::Serialize;`), but not for crates referred to with `crate` or `super`. How could I implement this?
> P.S. I'm participating in [Hacktoberfest 2021](https://hacktoberfest.digitalocean.com/ ). If this PR is up to standard and merged, I'd appreciate if the `hacktoberfest-accepted` label could be added. Thanks!
Co-authored-by: lhvy <me@lhvy.dev>
2021-10-01 11:18:52 +00:00
lhvy
dbb02370a4
Add semantic token modifier for crate root
2021-10-01 20:52:13 +10:00
Jonas Schievink
cca6ee5757
Expand asm!
to format_args!
2021-10-01 12:33:18 +02:00
Lukas Wirth
c5ceaefa09
Restructure syntax element highlighting
2021-09-30 21:44:56 +02:00
Lukas Wirth
a33939565d
Simplify
2021-09-30 19:12:37 +02:00
bors[bot]
529b7a4167
Merge #10398
...
10398: Give defaultLibrary semantic token modifier to items from standard library r=Veykril a=lhvy
Fixes #8999 , fixes #2155
`builtInCrates` could be an alternate name to `defaultLibrary`, which one is better?
> P.S. I'm participating in [Hacktoberfest 2021](https://hacktoberfest.digitalocean.com/ ). If this PR is up to standard and merged, I'd appreciate if the `hacktoberfest-accepted` label could be added. Thanks!
Co-authored-by: lhvy <me@lhvy.dev>
Co-authored-by: Lucas <me@lhvy.dev>
2021-09-30 16:10:23 +00:00
lhvy
0b2ba8be68
Fix builtin_crates return type change
2021-10-01 02:05:00 +10:00
lhvy
64cbdf6d55
Add comment
2021-10-01 01:58:11 +10:00
Jonas Schievink
4465685878
Work around tidy check
2021-09-30 17:32:18 +02:00
lhvy
2b3baa8503
Give defaultLibrary semantic token modifier to items from standard library
2021-10-01 01:19:24 +10:00
Jonas Schievink
b994469a13
Add const_format_args!
builtin macro, fix highlighting
2021-09-30 17:16:39 +02:00
Jonas Schievink
b8437f71b6
Less hacky assert!
expansion
2021-09-30 16:30:26 +02:00
Jonas Schievink
368c5f6023
Fix format string highlighting in panic!
2021-09-30 15:53:47 +02:00
bors[bot]
ee12b0f173
Merge #10181
...
10181: Begining of lsif r=HKalbasi a=HKalbasi
This PR adds a `lsif` command to cli, which can be used as `rust-analyzer lsif /path/to/project > dump.lsif`. It now generates a valid, but pretty useless lsif (only supports folding ranges). The propose of this PR is to discussing about the structure of lsif generator, before starting anything serious.
cc `@matklad` #8696 #3098
Co-authored-by: hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
2021-09-29 13:13:03 +00:00
hamidreza kalbasi
5bd0f50111
remove glob import and cancellables
2021-09-29 16:25:10 +03:30
Lukas Wirth
b6ed91a6de
Rename *Owner
traits to Has*
2021-09-27 12:54:24 +02:00
Aleksey Kladov
2bf81922f7
internal: more reasonable grammar for blocks
...
Consider these expples
{ 92 }
async { 92 }
'a: { 92 }
#[a] { 92 }
Previously the tree for them were
BLOCK_EXPR
{ ... }
EFFECT_EXPR
async
BLOCK_EXPR
{ ... }
EFFECT_EXPR
'a:
BLOCK_EXPR
{ ... }
BLOCK_EXPR
#[a]
{ ... }
As you see, it gets progressively worse :) The last two items are
especially odd. The last one even violates the balanced curleys
invariant we have (#10357 ) The new approach is to say that the stuff in
`{}` is stmt_list, and the block is stmt_list + optional modifiers
BLOCK_EXPR
STMT_LIST
{ ... }
BLOCK_EXPR
async
STMT_LIST
{ ... }
BLOCK_EXPR
'a:
STMT_LIST
{ ... }
BLOCK_EXPR
#[a]
STMT_LIST
{ ... }
2021-09-26 19:16:09 +03:00
Lukas Wirth
151afdfe5c
Remove inherent methods from ast node that carry semantic meaning
2021-09-26 16:49:03 +02:00
hamidreza kalbasi
7377120fee
add some tests
2021-09-26 12:48:53 +03:30
hamidreza kalbasi
48bebeaa32
support goto definition and find references
2021-09-26 10:04:02 +03:30
hamidreza kalbasi
f2775ac2e9
reuse hover results with resultset
2021-09-26 10:04:02 +03:30
hamidreza kalbasi
e803bd25c4
add hover
2021-09-26 10:04:02 +03:30
hamidreza kalbasi
5163201847
use utf16 instead of utf8
2021-09-26 10:04:02 +03:30
hamidreza kalbasi
557210a688
Begining of lsif
2021-09-26 10:04:02 +03:30
Lukas Wirth
e60f3d265f
Split the hover module up
2021-09-23 20:36:15 +02:00
Lukas Wirth
22c6f0a8a5
Support goto_def for intra-doc-links in macro invocations
2021-09-23 19:17:29 +02:00
Lukas Wirth
d99adc5738
Make hover work for intra doc links in macro invocations
2021-09-23 17:32:39 +02:00
Lukas Wirth
42eb4efb5b
Cleanup
2021-09-23 16:28:03 +02:00
bors[bot]
8a82e6c492
Merge #10284
...
10284: internal: definition based hover functions r=Veykril a=HKalbasi
This is part of #10181 but since it is blocked and `hover.rs` is moving quickly so will cause conflicts, I submitted this PR.
This PR extract some parts of `hover` to `find_definition` (maybe this need to be moved to some other file?) and `hover_for_definition`, with those functions I will be able to calculate definition of every token, and calculate hover (and probably other queries) for each definition only once.
Co-authored-by: hamidreza kalbasi <hamidrezakalbasi@protonmail.com>
2021-09-22 15:23:23 +00:00
hamidreza kalbasi
589c1dfa04
move function to defs.rs
2021-09-22 18:35:54 +03:30
hamidreza kalbasi
18e6b508dd
remove dead code
2021-09-22 11:44:23 +03:30
hamidreza kalbasi
569ac5bee1
use find_definition in go to
2021-09-22 11:37:26 +03:30
hamidreza kalbasi
887b7ddc37
fix derive hover in macro
2021-09-21 19:55:57 +04:30
Lukas Wirth
ba84b91e78
Add a mirror function-like proc-macro expander for tests
2021-09-21 14:55:54 +02:00
hamidreza kalbasi
0777698f29
internal: definition based hover functions
2021-09-19 16:15:44 +04:30
Lukas Wirth
6465868449
Make inlay hints work in attributed items
2021-09-18 13:19:29 +02:00
Lukas Wirth
11a17c803f
Add multi-token mapping test for goto_definition
2021-09-18 12:00:12 +02:00
zhoufan
227450f9b9
do comment handling on the original token
2021-09-18 08:22:57 +08:00
zhoufan
ea3535cefc
fix: multi-token mapping aware goto definition
2021-09-16 09:44:22 +08:00
bors[bot]
959c7ef563
Merge #10250
...
10250: internal: Improve call_hierarchy and incoming/outgoing_calls r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-16 00:26:32 +00:00
Lukas Wirth
d777eddf0d
Improve call_hierarchy and incoming/outgoing_calls
2021-09-16 02:25:02 +02:00
bors[bot]
4c9eef7ede
Merge #10233
...
10233: fix: add multi-token mapping support to hovers r=Veykril a=spookyvision
implement #10070 in [`hover`](https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/ide/src/hover.rs )
Co-authored-by: Anatol Ulrich <anatol.ulrich@ferrous-systems.com>
2021-09-15 16:36:33 +00:00
Anatol Ulrich
45090e4f4b
add multi-token mappings for hover
2021-09-15 18:05:53 +02:00
Anatol Ulrich
b251a30819
# This is a combination of 3 commits.
...
# This is the 1st commit message:
add multi-token mappings for hover
# The commit message #2 will be skipped:
# make fallback an Option instead of vec
# The commit message #3 will be skipped:
# fix indentation
2021-09-15 18:04:45 +02:00
Lukas Wirth
33cdc21832
Don't highlight unsafe traits as unsafe in safe impls
2021-09-15 15:46:45 +02:00
Lukas Wirth
64fb7be247
Revert attributed items inlay hints
2021-09-14 20:30:28 +02:00
bors[bot]
f750eebd0d
Merge #10232
...
10232: internal: Add more tests for ide functionality in attributed items r=Veykril a=Veykril
cc https://github.com/rust-analyzer/rust-analyzer/issues/9868
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-14 12:54:00 +00:00
Lukas Wirth
0f4463e45e
fix source_to_def trying to use attribute macro calls as containers
2021-09-14 14:42:14 +02:00
Lukas Wirth
538ac599d2
Add some more attribute ide tests
2021-09-14 03:57:29 +02:00
Lukas Wirth
6f9de71402
fix: Use original definition ranges for ide_db::search instead of the expanded ranges
2021-09-14 02:49:06 +02:00
bors[bot]
e896def412
Merge #10204
...
10204: feat: Show the type of what is being dereferenced in a deref expression. r=theo-lw a=theo-lw
Addresses issue #10106 .
In-progress - I'm trying to figure out why `hover_deref_expr_with_coercion` is failing.
Co-authored-by: Teddy_Wang <wangtheo662@gmail.com>
2021-09-14 00:41:17 +00:00
Teddy_Wang
8de5d66e25
Improve hover over derference message
2021-09-13 20:19:30 -04:00
Lukas Wirth
e193e3b076
feat: Make inlay hints work in attributed items
2021-09-14 01:59:45 +02:00
Teddy_Wang
4d9728ccb2
Fix hover tests
2021-09-13 19:47:53 -04:00
Lukas Wirth
8f76e41e18
Enable attribte macros in ide fixtures
2021-09-14 01:23:13 +02:00
Lukas Wirth
bb946f78f6
fix: fix expansion order for fn-like macros and attributes in token descending
2021-09-14 01:20:43 +02:00
Teddy_Wang
0c6a993f59
Fix spelling
2021-09-13 19:16:10 -04:00
Lukas Wirth
95746a99b4
Use correct file syntax node for decl_access computation in find_all_refs
2021-09-12 23:19:23 +02:00
bors[bot]
317059985a
Merge #10202
...
10202: fix: Type param hover shows correct sized bounds. r=flodiebold a=iDawer
Closes #9949
This adds implicit `: Sized` bound to type parameters at lowering step.
Hovering on type parameter does not show it's `: Sized` bound be it set explicitly or implicitly. This is because it doesn't track that the bound was set implicitly.
### Perf
```rust
./target/rust-analyzer-baseline-3dae94bf -q analysis-stats --memory-usage .
Database loaded: 4.51s, 311minstr, 110mb (metadata 1.08s, 22minstr, 743kb; build 3.20s, 8730kinstr, -237kb)
crates: 38, mods: 770, decls: 17173, fns: 12835
Item Collection: 29.63s, 85ginstr, 372mb
exprs: 353460, ??ty: 364 (0%), ?ty: 232 (0%), !ty: 144
Inference: 118.25s, 284ginstr, 601mb
Total: 147.88s, 370ginstr, 973mb
./target/rust-analyzer-hover-ty-param-dfb15292 -q analysis-stats --memory-usage .
Database loaded: 4.53s, 311minstr, 110mb (metadata 1.10s, 22minstr, 743kb; build 3.20s, 8672kinstr, -189kb)
crates: 38, mods: 770, decls: 17173, fns: 12835
Item Collection: 29.59s, 85ginstr, 372mb
exprs: 353460, ??ty: 364 (0%), ?ty: 232 (0%), !ty: 144
Inference: 121.69s, 296ginstr, 601mb
Total: 151.28s, 382ginstr, 974mb
```
Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-09-12 07:54:56 +00:00
Teddy_Wang
1d4d9a1e1a
Fix tests by importing core::ops::Deref
2021-09-11 11:40:16 -04:00
Dawer
964c7b3211
minor: fix tests.
2021-09-10 23:02:37 +05:00
Dawer
dfb15292c2
fix: Type param hover shows correct sized bounds.
2021-09-10 20:48:39 +05:00
Dawer
9ce3c075ad
internal: add implicit : Sized
bound to type parameters.
2021-09-10 20:41:53 +05:00
Teddy_Wang
67a9c457e6
Add tests. The tests with coercion fail, but I have no clue why.
2021-09-09 23:31:13 -04:00
bors[bot]
92ce768ea3
Merge #10188
...
10188: fix: add multi-token mapping support to runnables r=jonas-schievink a=lnicola
Closes #10184
changelog fix (first contribution) add multi-token mapping support to runnables
Co-authored-by: Anatol Ulrich <anatol.ulrich@ferrous-systems.com>
2021-09-09 15:07:43 +00:00
Anatol Ulrich
5d08ac20d9
implement #10070 in runnables
...
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-09-09 18:02:53 +03:00
Teddy_Wang
cf696c0ed6
Show the type of what is being dereferenced in a deref expression
2021-09-08 22:28:52 -04:00
Dezhi Wu
87436a08fa
fix super
path wrong display
2021-09-07 17:49:46 +08:00
Dezhi Wu
6d2154e409
cargo fmt
2021-09-07 14:50:33 +08:00
Dezhi Wu
82ae228d98
fix: path display error when start with crate
2021-09-07 14:44:30 +08:00
Lukas Wirth
e2ede38d47
Use correct search scopes for macros
2021-09-02 17:30:55 +02:00
Jonas Schievink
bdba35cc93
fix: multi-token mapping aware find references
2021-09-01 19:19:16 +02:00
Lukas Wirth
68bf359363
fix: make goto_implementation
multi-token mapping aware
2021-09-01 14:51:37 +02:00
bors[bot]
25368d2430
Merge #9954
...
9954: feat: Show try operator propogated types on ranged hover r=matklad a=Veykril
Basically this just shows the type of the inner expression of the `?` expression as well as the type of the expression that the `?` returns from:
![Code_wIrCxMqLH9](https://user-images.githubusercontent.com/3757771/130111025-f7ee0742-214a-493b-947a-b4a671e4be92.png )
Unless both of these types are `core::result::Result` in which case we show the error types only.
![Code_Xruw5FCBNI](https://user-images.githubusercontent.com/3757771/130111024-f9caef82-92e4-4070-b3dd-f2ff9e5d87a9.png )
If both types are `core::option::Option` with different type params we do not show this special hover either as it would be pointless(instead fallback to default type hover)
Very much open to changes to the hover text here(I suppose we also want to show the actual type of the `?` expression, that is its output type?).
Fixes #9931
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-01 09:26:10 +00:00
Lukas Wirth
8bbfd45d97
Minor fixes
2021-09-01 11:25:42 +02:00
Aleksey Kladov
6317292cd5
internal: more obviously correct code for cache priming progerss
...
It doesn't make sense for the prime_caches itself send begin/end events
-- the caller knows perfectly fine when they happen!
2021-08-30 19:18:48 +03:00
Dezhi Wu
ba0947dded
switch log
crate to tracing
2021-08-30 15:11:42 +08:00
Aleksey Kladov
78365c64c8
internal: slightly improve compile times
...
As per style guide, avoid monomorphisations
2021-08-29 12:53:56 +03:00
Lukas Wirth
99f1e66997
Only report unique text ranges in highlight_related
2021-08-29 01:11:29 +02:00
Lukas Wirth
72bfbb0691
Return all usages inside macros in usage searches
2021-08-29 00:49:57 +02:00
Lukas Wirth
512135920d
Highlight all related tokens in macro inputs
2021-08-29 00:49:57 +02:00
Lukas Wirth
0f3617f76f
fix: Fix multiple derives in one attribute not expanding all in expand_macro
2021-08-26 03:32:45 +02:00
Lukas Wirth
3f9f63c1bd
Improve expand_macro
2021-08-26 02:36:33 +02:00
Lukas Wirth
d99b81f839
Expand derive macros under cursor in Expand Macro Recursively
2021-08-24 16:33:52 +02:00
bors[bot]
49c02b93b3
Merge #9993
...
9993: feat: join lines merges assignments r=matklad a=unexge
Closes https://github.com/rust-analyzer/rust-analyzer/issues/9967 .
![Peek 2021-08-22 21-46](https://user-images.githubusercontent.com/16212576/130366571-3ebb1753-f8d5-4884-be8f-222cda71a2a7.gif )
Co-authored-by: unexge <unexge@gmail.com>
2021-08-24 12:14:25 +00:00
Lukas Wirth
631bca786f
Highlight declarations and references for both defs in field shorthands
2021-08-24 03:15:41 +02:00
unexge
3a9ba0e506
feat: join lines merges assignments
2021-08-22 21:28:39 +03:00
bors[bot]
996300f4a0
Merge #9989
...
9989: Fix two more “a”/“an” typos (this time the other way) r=lnicola a=steffahn
Follow-up to #9987
you guys are still merging these fast 😅
_this time I thought – for sure – that I’d get this commit into #9987 before it’s merged…_
Co-authored-by: Frank Steffahn <frank.steffahn@stu.uni-kiel.de>
2021-08-22 16:10:48 +00:00
Frank Steffahn
75073451c6
Fix three more (reverse) “a”/“an” typos
2021-08-22 17:48:15 +02:00
Florian Diebold
424dda8113
Refactor & improve handling of overloaded binary operators
...
Fixes #9971 . Also records them as method resolutions, which we could use
later.
2021-08-22 17:35:50 +02:00
Frank Steffahn
ab23af439d
Fix another “a”/“an” typo
2021-08-22 16:45:58 +02:00
Lukas Wirth
2f179adc41
Expand attributes recursively in expand_macro
2021-08-21 23:24:12 +02:00
Lukas Wirth
a0d5290b7f
Show try operator propogated types on ranged hover
2021-08-21 22:21:27 +02:00
Lukas Wirth
557df6ff3f
Use correct HirFileId in find_related_test
2021-08-20 13:50:40 +02:00
Lukas Wirth
7342dcf0b0
Fix runnables not seeing test and bench attributes
2021-08-20 13:50:06 +02:00
bors[bot]
8dd3a71730
Merge #9955
...
9955: fix: Rename fails on renaming definitions created by macros instead of renaming the macro invocation r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-19 22:13:09 +00:00
Lukas Wirth
c67ecbebc4
Rename fails on renaming definitions created by macros
2021-08-20 00:12:47 +02:00
Lukas Wirth
04076bc5fb
Don't trigger related highlighting on unrelated tokens
2021-08-18 15:03:39 +02:00
bors[bot]
8d7eea9e3a
Merge #9929
...
9929: fix: Handle all rename special cases for record pattern fields r=Veykril a=Veykril
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-17 13:25:08 +00:00
Lukas Wirth
daf3094958
Emit more concise text edits in ide_db::rename
2021-08-17 15:24:01 +02:00
Lukas Wirth
995c8f50a2
some code docs for the ide_db/rename module
2021-08-16 23:06:51 +02:00
Lukas Wirth
5e533e5900
Handle all rename special cases for all record pattern fields
2021-08-16 22:48:38 +02:00
Lukas Wirth
40455db088
Highlight function exit points on fn
keyword
2021-08-16 21:25:22 +02:00
Lukas Wirth
0c0142f61a
Simplify
2021-08-16 16:12:20 +02:00
Lukas Wirth
894a09b749
Simplify
2021-08-14 18:02:51 +02:00
Aleksey Kladov
6df00f8495
internal: make naming consistent
2021-08-14 17:01:28 +03:00
bors[bot]
baf1494374
Merge #9807
...
9807: Implicit `Sized` bounds r=iDawer a=iDawer
This should close #8984
`hir_ty`:
- Type parameters, associated types and `impl Trait` are `Sized` by deafault except `Self` in a trait.
- Implicit `Sized` bound is added to end of predicate list. It does not check if such bound is present already. Also it does not track the bound is implicit.
- Allowed ambiguous unsize coercion if Chalk returns definite guidance.
- Allowed ambiguous autoderef if Chalk returns definite guidance.
`hir_def`:
- `ItemTree` pretty printing shows `?Sized` bounds.
`HirDisplay`:
- `impl Trait` with weird bounds rendered correctly.
- `Sized`/`?Sized` bounds are not shown if they are default.
### Perf
`./target/rust-analyzer-baseline_8a843113 -q analysis-stats --memory-usage .`
```
Database loaded: 1.63s, 287minstr, 91mb
crates: 38, mods: 741, decls: 15914, fns: 11835
Item Collection: 26.80s, 73ginstr, 338mb
exprs: 318994, ??ty: 398 (0%), ?ty: 435 (0%), !ty: 174
Inference: 50.28s, 116ginstr, 516mb
Total: 77.08s, 189ginstr, 855mb
```
`./target/rust-analyzer-sized-fixed_ambig_coercion-de074fe6 -q analysis-stats --memory-usage .`
```
Database loaded: 1.63s, 287minstr, 91mb
crates: 38, mods: 741, decls: 15914, fns: 11835
Item Collection: 26.95s, 73ginstr, 338mb
exprs: 318994, ??ty: 398 (0%), ?ty: 435 (0%), !ty: 166
Inference: 96.39s, 234ginstr, 543mb
Total: 123.33s, 307ginstr, 881mb
```
Co-authored-by: Dawer <7803845+iDawer@users.noreply.github.com>
2021-08-12 17:55:29 +00:00
Lukas Wirth
ec443886ea
Show type actions on ranged type hover
2021-08-11 13:52:57 +02:00
Yoshua Wuyts
4b5139e8a5
impl gen hash for structs
2021-08-10 12:37:10 +02:00
Jake Heinz
4fba518b02
[semantic-highlighting] functions that consume are marked as HlMod::Consuming
2021-08-10 07:31:30 +00:00
Laurențiu Nicola
1b7cdac516
Fix typo in reference modifier description
2021-08-09 14:06:14 +03:00
Yoshua Wuyts
f64aacc0c1
Use minicore
2021-08-08 18:58:42 +02:00
Dawer
14898729f4
Account sized bounds in parentheses printing inside of ptr/ref of rpit.
2021-08-08 00:54:38 +05:00
Lukas Wirth
f55441f7ed
Document reference highlighting mod
2021-08-04 19:00:52 +02:00
Dawer
d9ec88ea23
Adjust fn_hints test
2021-08-04 20:26:51 +05:00
Dawer
0f6621fbfa
Fix tests.
2021-08-04 20:20:14 +05:00
bors[bot]
1b02cafa43
Merge #9734
...
9734: semantic highlighting: add reference hlmod r=matklad a=jhgg
This PR adds the "reference" highlight modifier!
I basically went around and looked for `HlMod::Mutable` to find the callsites to add a reference. I think these all make sense!
Co-authored-by: Jake Heinz <jh@discordapp.com>
Co-authored-by: Jake <jh@discordapp.com>
2021-08-04 09:37:30 +00:00
Jake Heinz
19b1d505db
match style
2021-08-04 06:14:58 +00:00
Jake Heinz
44726b6ca3
fix + update expects
2021-08-04 06:12:41 +00:00
Jake
e01ff775ae
Apply suggestions from code review
...
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-03 23:07:46 -07:00
Jake
28b6a30752
Update crates/ide/src/syntax_highlighting/highlight.rs
...
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-03 09:54:27 -07:00
Lukas Wirth
b96f1adf5c
Give TypeInfo fields and methods more appropriate names
2021-08-03 17:28:51 +02:00
Lukas Wirth
8afa2722b2
Revise TypeInfo::ty usage
2021-08-03 17:24:43 +02:00
Lukas Wirth
25ff7171c4
Introduce TypeInfo
2021-08-03 16:41:53 +02:00
bors[bot]
29506b5a26
Merge #9762
...
9762: fix: Fix ranged hover result range r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-02 16:17:15 +00:00
Lukas Wirth
8e0a7d8c08
Fix ranged hover result range
2021-08-02 18:16:47 +02:00
bors[bot]
cae54d86d8
Merge #9761
...
9761: feat: Show coerced types on type hover r=Veykril a=Veykril
This applies to both the ranged hover request as well as the normal hover type fallback.
![image](https://user-images.githubusercontent.com/3757771/127883884-2935b624-a3e5-4f35-861a-7d6d3266d187.png )
![image](https://user-images.githubusercontent.com/3757771/127883951-4ff96b6b-7576-4886-887b-1198c1121841.png )
We unfortunately have to leave out syntax highlighting here as otherwise the `Type` and `Coerced` words in the hover will get colored.
Note that this does not show all the coercions yet(and almost no pattern coercions) as not all coercion adjustments are implemented yet.
Closes https://github.com/rust-analyzer/rust-analyzer/issues/2677
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-08-02 15:44:43 +00:00
Lukas Wirth
f2d2ce03c7
Also search for pattern nodes in ranged hover
2021-08-02 17:38:16 +02:00
Lukas Wirth
486603d559
Show coerced types on type hover
2021-08-02 17:10:36 +02:00
bors[bot]
0d56ff2a02
Merge #9758
...
9758: internal: explain that we don't `ref` in style.md r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-08-02 13:00:07 +00:00
Aleksey Kladov
12d7f5b56e
internal: explain that we don't ref
in style.md
2021-08-02 15:59:28 +03:00
Lukas Wirth
62ab73767f
resolve_doc_path is able to resolve to macros
2021-08-02 14:33:09 +02:00
Lukas Wirth
1edbaa29f9
Wrap inner tail expressions in MissingOkOrSomeInTailExpr
2021-07-31 20:00:09 +02:00
Lukas Wirth
f7c7f89c3c
Annotate type hints for pattern name ranges instead of the pattern itself
2021-07-31 15:30:45 +02:00
Lukas Wirth
b363755901
Fix hover range for derive inputs
2021-07-31 14:59:31 +02:00
Jake Heinz
0eb1afdcb7
update expects
2021-07-31 06:08:05 +00:00
Jake Heinz
0f434b8620
move to else f
2021-07-31 04:50:19 +00:00
Jake Heinz
2baef17bb1
semantic highlighting: add reference hlmod
2021-07-31 04:42:47 +00: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
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
2b461c50d7
Refine extraction targets of extract_function assist
2021-07-29 15:45:05 +02:00
Alexander González
4d3a0529d5
fix: Revert removing [] from the hover gif
2021-07-28 06:58:19 -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
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
Lukas Wirth
3fab50019c
Simplify
2021-07-26 20:26:24 +02:00
Lukas Wirth
bfe0fa009e
Resolve derive attribute input macro paths in ide layer
2021-07-24 20:35:43 +02:00
Jonas Schievink
3efdf6861f
Complete editable private items
2021-07-23 19:57:16 +02:00
Kevin DeLorey
efb6587664
Added tests to ensure config behavior.
2021-07-22 19:35:47 -06:00
Kevin DeLorey
b75e0e7bb1
Initial commit of highlight related configuration w/ implementation.
2021-07-22 19:35:47 -06:00
Lukas Wirth
ef6fed052c
Correctly classify Rename Names
2021-07-23 02:14:59 +02:00
Laurențiu Nicola
efcc487dff
Fix a couple of clippy nits
2021-07-22 09:03:54 +03:00
Lukas Wirth
c83e37c001
cov-mark
2021-07-20 19:00:52 +02:00
bors[bot]
4705df44c7
Merge #9637
...
9637: Overhaul doc_links testing infra r=Veykril a=Veykril
and fix several issues with current implementation.
Fixes #9617
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-20 16:06:37 +00:00
Lukas Wirth
2e39d4757b
More tests
2021-07-20 18:05:25 +02:00
Lukas Wirth
bb71ebb985
Move doc_links tests from hover to doc_links
2021-07-20 17:57:47 +02:00
Lukas Wirth
a35687fe1f
Minor cleanups
2021-07-20 17:41:10 +02:00
Lukas Wirth
cb7b4a5d5b
Some more fragment fixes
2021-07-20 17:03:39 +02:00
Aleksey Kladov
7ec8434674
internal: remove potentially slow method
2021-07-20 17:19:58 +03:00
Lukas Wirth
e8f1abf5f7
Correctly generate link fragments for associated items
2021-07-20 16:01:27 +02:00
Lukas Wirth
113beab473
Cleanup runnables canonical path impl
2021-07-20 16:00:44 +02:00
Lukas Wirth
97d63d67cd
Resolve paths to assoc items for traits
2021-07-19 20:51:57 +02:00
Lukas Wirth
7a17206646
Add doc-link resolution test infra
2021-07-19 19:58:26 +02:00
Aleksey Kladov
8f3335f5fb
internal: make it clearer where IO happens
2021-07-17 23:56:50 +03:00
Lukas Wirth
4450365ec8
Simplify
2021-07-15 21:28:30 +02:00
Lukas Wirth
ed73460971
Folding ranges respect item visibilities
2021-07-15 17:44:23 +02:00
Lukas Wirth
efea07f31c
Add nested region folding test
2021-07-15 17:02:45 +02:00
Lukas Wirth
658514d378
Don't fold consecutive modules with item lists
2021-07-15 16:35:31 +02:00
bors[bot]
95d85336df
Merge #9595
...
9595: Show test mod runnable in outline modules r=Veykril a=Veykril
This shows a runnable inside outline test modules at the top of its file:
![image](https://user-images.githubusercontent.com/3757771/125494747-169c9238-3faa-4eed-9700-90bd730b4e3c.png )
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-15 00:20:44 +00:00
Lukas Wirth
d837a5d5a7
Show test mod runnable in outline modules
2021-07-14 11:30:51 +02:00
Lukas Wirth
12fe48c04d
Use Type::walk for goto_type_definition
2021-07-14 01:42:30 +02:00
bors[bot]
9bd6836513
Merge #9596
...
9596: Return type arguments in goto_type_definition result r=Veykril a=Veykril
Fixes #9586
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-13 17:25:00 +00:00
Lukas Wirth
796988a269
Return type arguments in goto_type_definition result
2021-07-13 19:24:29 +02:00
Lukas Wirth
d1256a3709
Assign mutable semantic token modifier to assignment operators
2021-07-13 18:32:02 +02:00
Lukas Wirth
b3337c26db
Split main highlighting function up into a few subfunctions
2021-07-13 18:29:57 +02:00
Lukas Wirth
ab2647769c
Return both field and local references for shorthands in goto_def
2021-07-11 16:16:16 +02:00
Lukas Wirth
c41f1279a3
Inline name classification reference calls
2021-07-11 15:39:09 +02:00
Lukas Wirth
c65bb7f8b9
Explicitly check for reference locals or fields in Name classification
2021-07-11 15:04:40 +02:00
bors[bot]
87621de2b9
Merge #9567 #9568
...
9567: remove unneded special case r=matklad a=matklad
bors r+
🤖
9568: feat: add 'for' postfix completion r=lnicola a=mahdi-frms
![Peek 2021-07-11 16-45](https://user-images.githubusercontent.com/62165556/125194692-a0aaf780-e267-11eb-952a-81de7955d9a1.gif )
adds #9561
used ```ele``` as identifier for each element in the iteration
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
Co-authored-by: mahdi-frms <mahdif1380@outlook.com>
2021-07-11 12:51:33 +00:00
Aleksey Kladov
bbb053532e
internal: remove one more needless extern crate
2021-07-11 15:48:49 +03:00
Aleksey Kladov
1171dc74e0
internal: remove unused param
2021-07-11 15:08:00 +03:00
Aleksey Kladov
f42648e305
internal: remove needless distinction between a carte and its root mod
2021-07-11 14:55:24 +03:00
Aleksey Kladov
92059ea438
update tests
2021-07-11 13:55:00 +03:00
Aleksey Kladov
5c26523e94
drop unused fields
2021-07-11 13:51:52 +03:00
Aleksey Kladov
a04775060c
simplify
2021-07-11 13:49:38 +03:00
Aleksey Kladov
ddce16a126
drop unused field
2021-07-11 13:48:26 +03:00
Aleksey Kladov
beb81a40eb
simplify
2021-07-11 13:45:58 +03:00
Aleksey Kladov
96d85a9efb
be explicit about what we *can't* debug
2021-07-11 13:44:28 +03:00
Aleksey Kladov
fa6f78c95b
better name
2021-07-11 13:43:43 +03:00
Aleksey Kladov
0dc186f612
Let the client care about presentation
2021-07-11 13:42:19 +03:00
bors[bot]
325140a165
Merge #9449
...
9449: feat: Emit test names in `Run test` runnables if they come from a macro expansion r=matklad a=Veykril
Fixes #8964
Before:
![Code_D1Tu5Iuh5I](https://user-images.githubusercontent.com/3757771/124174685-f552b380-daac-11eb-9086-c97db014b77c.png )
After:
![image](https://user-images.githubusercontent.com/3757771/124174493-bb81ad00-daac-11eb-96c7-3de6545a62e1.png )
Basically when a macro emits more than one test we name the test functions/modules name in the runnable instead to not emit a bunch of equally named `Run Test` annotations which don't really tell much.
Note that the `Run fibonacci_test Tests` line is below the attributes due to the fact that the function name span is being reused for the generated module in rstest's expansion.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-11 09:37:33 +00:00
Lukas Wirth
f1b3446844
Emit test name in Run test runnables if it comes from a macro expansion
2021-07-09 14:35:42 +02:00
Aleksey Kladov
0db4f3f6a4
internal: ensure consistent passing for config params
...
We pass "context" parametes first, so configs should be on the left.
"Bigger" context wins, so configs goes after db.
2021-07-06 00:00:39 +03:00
Aleksey Kladov
b8a6ea5ab5
feat: make join lines behavior configurable
...
closes #9492
2021-07-05 23:47:20 +03:00
Aleksey Kladov
86720f2953
minor: drop dummy authors field
2021-07-05 14:19:41 +03:00
Aleksey Kladov
6e9780c005
internal: make CompletionItem and SourceChange consistent
...
Before this PR, SourceChange used a bool and CompletionItem used an enum
to signify if edit is a snippet. It makes sense to use the same pattern
in both cases. `bool` feels simpler, as there's only one consumer of
this API, and all producers are encapsulated anyway (we check the
capability at the production site).
2021-07-04 15:44:03 +03:00
Aleksey Kladov
f875b91fdb
feat: join lines joins two ifs into else if
2021-07-03 18:40:23 +03:00
Lukas Wirth
a7d61ddba4
Add cov_mark
2021-07-02 19:34:49 +02:00
Lukas Wirth
59eec29e1b
Fix runnables using wrong file ids for module doctests
2021-07-02 15:43:47 +02:00
Lukas Wirth
0b8e145641
Print runnable kind on assertion failure for better debuggability
2021-07-02 15:34:26 +02:00
Lukas Wirth
f640f2dbb4
Fix incorrect guard for NameRefClass attribute resolution
2021-07-02 15:17:21 +02:00
bors[bot]
334c7eba8d
Merge #9452
...
9452: feat: Add "View Crate Graph (Full)" r=jonas-schievink a=jonas-schievink
Works like "View Crate Graph", but also includes crates.io and sysroot dependencies. The resulting graph might be enormous.
Closes https://github.com/rust-analyzer/rust-analyzer/issues/8867
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-07-01 22:12:53 +00:00
Jonas Schievink
5f13fb9db9
Add "View Crate Graph (Full)"
2021-07-02 00:10:33 +02:00
bors[bot]
0331d19f42
Merge #9451
...
9451: minor: Add `goto_type_action` for field hovers r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-07-01 19:52:14 +00:00
Lukas Wirth
81762024b5
Add goto_type_action
for field hovers
2021-07-01 21:51:26 +02:00
bors[bot]
2f9645501c
Merge #9436
...
9436: minor: Add test for macro expanded test module in runnables r=Veykril a=Veykril
Expected this to fail as thats behaving incorrectly on current nightly but I think I fixed this accidentally with https://github.com/rust-analyzer/rust-analyzer/pull/9435
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-30 17:37:28 +00:00
Lukas Wirth
8d3a378de9
Add test for macro expanded test module in runnables
2021-06-30 19:35:58 +02:00
bors[bot]
3c42aefceb
Merge #9435
...
9435: fix: Don't add test runnables for outline modules in the wrong file r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-30 17:11:34 +00:00
Lukas Wirth
b8507ca98d
Don't add test runnables for outline modules in the wrong file
2021-06-30 19:08:13 +02:00
bors[bot]
11b9233fc4
Merge #9269
...
9269: Recreate status page r=lnicola a=Milo123459
I'm working on redesigning the status page.
Co-authored-by: Milo <50248166+Milo123459@users.noreply.github.com>
2021-06-29 19:53:19 +00:00
Milo
4d8fe6208e
fix
2021-06-29 20:34:52 +01:00
Milo
d85fa40d58
Update crates/ide/src/status.rs
...
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2021-06-29 20:32:33 +01:00
Lukas Wirth
9a1b9b3c78
Resolve attribute paths in attribute highlighting
2021-06-28 21:53:17 +02:00
Lukas Wirth
9957220dfe
Fix NameRef::classify
path resolution inside attributes
2021-06-28 19:07:23 +02:00
Milo
443d2164ef
remove unneeded ifs
2021-06-28 17:52:57 +01:00
Milo
2e60908fde
check if counts should be a thing
2021-06-28 17:50:24 +01:00
Lukas Wirth
34c28c1bbc
Include self
in usage search for modules in their definition source
2021-06-28 16:41:35 +02:00
Milo
d1821e4b6e
fix all reviews
2021-06-28 07:31:54 +01:00
Lukas Wirth
3ce5c66ca1
Deduplicate ast expression walking logic
2021-06-27 01:11:57 +02:00
bors[bot]
2ac1ffc0f3
Merge #9400
...
9400: fix: Fix renaming associated trait items with colliding names r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-25 01:48:50 +00:00
Lukas Wirth
942eeb2f55
Fix renaming associated trait items with colliding names
2021-06-25 03:45:41 +02:00
bors[bot]
83fc0db7e2
Merge #9397
...
9397: fix: Fix break point highlighting not considering outer labels r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-24 19:15:59 +00:00
Lukas Wirth
67075b228e
Fix break point highlighting not considering outer labels
2021-06-24 21:14:43 +02:00
bors[bot]
0f0dbdc7d1
Merge #9396
...
9396: feat: Highlight loop break points r=Veykril a=Veykril
![Code_HmWQMlioKr](https://user-images.githubusercontent.com/3757771/123318732-d47be280-d52f-11eb-8a9a-cb3f591d4195.png )
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-24 19:05:41 +00:00
Lukas Wirth
42efd211bc
Highlight label value block tails
2021-06-24 21:01:37 +02:00
Lukas Wirth
543f925353
Highlight loop break points
2021-06-24 20:57:02 +02:00
bors[bot]
264716e827
Merge #9375
...
9375: feat: Highlight exit and yield points r=Veykril a=Veykril
![Code_YBHOCF3DbU](https://user-images.githubusercontent.com/3757771/123128986-e1270a80-d44b-11eb-9854-065459a2dd50.png )
![Code_YyMhqES0LX](https://user-images.githubusercontent.com/3757771/123128988-e1bfa100-d44b-11eb-9c81-6a6031aad740.png )
Fixes #4691
Fixes #9365
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-24 15:23:25 +00:00
Lukas Wirth
d77655e5c3
Refine tail exit point highlighting to highlight inner tails
2021-06-24 17:19:27 +02:00
Lukas Wirth
d049783b5d
Simplify
2021-06-24 16:50:56 +02:00
Lukas Wirth
066bc4f3a4
Simplify
2021-06-24 01:32:56 +02:00
bors[bot]
b656751536
Merge #9380
...
9380: feat: Implement goto_declaration support r=matklad a=Veykril
This is just a simple implementation that falls back to `goto_definition` for everything but modules where it goes to the actual module declaration if possible.
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-23 22:33:05 +00:00
Lukas Wirth
37d417868e
move goto_declaration fall back into handlers
2021-06-24 00:26:08 +02:00
Lukas Wirth
511ae17d07
Improve feature docs for highlight_related
2021-06-23 18:11:48 +02:00
Lukas Wirth
f283fce594
Mark (method-)calls with never type as exit points
2021-06-23 17:21:47 +02:00
Lukas Wirth
cc791538d6
Simplify
2021-06-23 17:05:00 +02:00
Lukas Wirth
12266d5e56
Strip leading whitespace from test ouput in references
2021-06-23 16:49:36 +02:00
Lukas Wirth
e406140f38
Implement exit point highlighting
2021-06-23 16:43:53 +02:00
Lukas Wirth
9a53f1033e
Implement yield point highlighting
2021-06-23 16:16:32 +02:00
Lukas Wirth
14b66bb458
Rename 'document_highlight' to 'highlight_related'
2021-06-23 15:13:48 +02:00
Lukas Wirth
b26a8ecca1
Move document highlighting computation from rust-analyzer to ide
2021-06-23 15:02:49 +02:00
Aramis Razzaghipour
3e7472f76c
Add public
semantic token modifier for public items
2021-06-23 09:40:04 +10:00
Lukas Wirth
5a74e93c33
Implement goto_declaration support
2021-06-22 20:49:07 +02:00
Lukas Wirth
f615efdfc3
Factor out pick_best_token
ide pattern into ide_db
2021-06-22 17:50:15 +02:00
bors[bot]
ff92afb4c1
Merge #9368
...
9368: fix: Prefer identifier tokens in expand_macro r=Veykril a=Veykril
Fixes #9366
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-22 10:06:34 +00:00
Lukas Wirth
b423c61ce6
Prefer identifier tokens in expand_macro
2021-06-22 12:03:51 +02:00
Lukas Wirth
65d683df36
Collapse documentation and markdown config settings into an enum
2021-06-21 21:57:01 +02:00
Lukas Wirth
99c95b8fa1
Split hover actions config into its own config struct
2021-06-21 21:47:54 +02:00
Jamie Cunliffe
ae823aa23f
Move features into potential_cfg_options
2021-06-21 17:54:05 +01:00
Jamie Cunliffe
284483b347
Improve completion of cfg attributes
...
The completion of cfg will look at the enabled cfg keys when
performing completion.
It will also look crate features when completing a feature cfg
option. A fixed list of known values for some cfg options are
provided.
For unknown keys it will look at the enabled values for that cfg key,
which means that completion will only show enabled options for those.
2021-06-21 17:47:00 +01:00
bors[bot]
25bf451c84
Merge #9264
...
9264: feat: Make documentation on hover configurable r=Veykril a=Veykril
This also implements deprecation support for config options as this renames `hoverActions_linksInHover` to `hover_linksInHover`.
Fixes #9232
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-21 14:15:49 +00:00
Jonas Schievink
8d2a33da05
Don't insert }
when typing {
in string
2021-06-21 14:54:49 +02:00
bors[bot]
f1097c2d26
Merge #9344
...
9344: fix: rename works when invoked on a reference r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-20 14:08:19 +00:00
Aleksey Kladov
cbb1979c19
fix: rename works when invoked on a reference
2021-06-20 17:07:55 +03:00
bors[bot]
3843bd02a0
Merge #9328
...
9328: internal: Update deps r=lnicola a=kjeremy
Co-authored-by: kjeremy <kjeremy@gmail.com>
2021-06-20 03:22:13 +00:00
Milo
044e21ae08
remove num_format
2021-06-19 10:14:15 +01:00
Aleksey Kladov
7df6852b6e
minor: use minicore
2021-06-19 12:03:59 +03:00
Milo
673933e2f7
update crate and deps section
2021-06-19 09:44:11 +01:00
Milo
664cc8c754
use num_format
2021-06-19 08:12:46 +01:00
Milo
d2f7e0fea4
clean up some wording
2021-06-19 07:51:44 +01:00
Milo
08ec80c093
remove incorrect double blank new lines
2021-06-18 23:34:00 +01:00
Aleksey Kladov
a9623f3165
minor: use minicore
2021-06-18 23:38:19 +03:00
Aleksey Kladov
cc73abf72c
minor: use minicore
2021-06-18 23:33:01 +03:00
Aleksey Kladov
89a0e58393
internal: use minicore deref more
2021-06-18 22:47:02 +03:00
Aleksey Kladov
15c4b3fa7f
internal: add Copy to minicore
2021-06-18 22:10:52 +03:00
kjeremy
e0e694620c
Update test
2021-06-18 14:36:12 -04:00
Milo
7d502c7f08
Recreate PR.
2021-06-18 19:22:03 +01:00
Laurențiu Nicola
e3ce88f6f2
Minor clippy perf fixes
2021-06-18 14:40:51 +03:00
Aleksey Kladov
66673eae2b
internal: retire famous_defs_fixture
...
This is now done declaratively via `minicore`.
2021-06-18 00:42:32 +03:00
Aleksey Kladov
ebb591a570
internal: add derive and ord support to minicore
2021-06-18 00:30:22 +03:00
Aleksey Kladov
ca99aaa053
internal: add From to minicore
2021-06-17 21:04:12 +03:00
Aleksey Kladov
08c220ab2c
internal: add default to minicore
2021-06-17 20:49:49 +03:00
Lukas Wirth
95c8c65139
Nest all the or-patterns!
2021-06-17 17:37:14 +02:00
Aleksey Kladov
c42cdff3d2
internal: minimize minicore
...
We want to keep minicore small, so let's split out iterator adapters and
sources into a separate `iterators` region, and use them only when
needed.
2021-06-17 11:28:44 +03:00
Aleksey Kladov
9b3aa591cd
internal: switch some tests to minicore
2021-06-17 11:18:37 +03:00
Aleksey Kladov
8a4d9bb80a
internal: add fn to minicore
2021-06-16 12:15:45 +03:00
bors[bot]
5ba5e6348f
Merge #9293
...
9293: fix: Show diagnostic fixes before assists r=matklad a=lnicola
Closes #9212
Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2021-06-15 20:38:29 +00:00
bors[bot]
9bddd2af55
Merge #9294
...
9294: internal: introduce minicore -- a subset of libcore for testing r=matklad a=matklad
Clearly, we need one more fixed point iteration loop!
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-15 20:14:36 +00:00
Aleksey Kladov
7cbcbccc78
internal: switch some tests to minicore
2021-06-15 23:11:53 +03:00
Lukas Wirth
29054e02fb
Highlight unsafe trait refs as unsafe only in impl blocks and definitions
2021-06-15 21:49:59 +02:00
Laurențiu Nicola
e58f63dc63
Show diagnostic fixes before assists
2021-06-15 20:55:27 +03:00
Aleksey Kladov
4584868a7a
internal: don't #[ignore] tests
...
See the style.md for motivation
2021-06-15 16:37:58 +03:00
bors[bot]
fa4c851619
Merge #9278
...
9278: internal: document that we don't #[ignore] tests r=matklad a=matklad
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-15 08:48:15 +00:00
Aleksey Kladov
3f4ad44082
internal: document that we don't #[ignore] tests
2021-06-15 11:46:47 +03:00
bors[bot]
447d849c9e
Merge #9277
...
9277: internal: more natural order of sources for TypeParam r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-06-14 19:44:59 +00:00
Aleksey Kladov
c2015e7d18
internal: more natural order of sources for TypeParam
...
We usually use first (left) variant of `Either` for "usual" case, and
use right for odd things. For example, pat source is Pat | SelfParam.
2021-06-14 22:42:43 +03:00
bors[bot]
27a70492f7
Merge #9275
...
9275: feat: Support goto type for field expressions and patterns r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-14 19:08:05 +00:00
Lukas Wirth
2c8e89b6f0
Support goto type for field expressions and patterns
2021-06-14 21:07:07 +02:00
Aleksey Kladov
94f7b63522
minor: less ambiguous name
2021-06-14 19:16:03 +03:00
Aleksey Kladov
da534bdd07
internal: flatten module hierarchy
...
It seems that any crate can be made better by flattening the modules
down to a single layer?
2021-06-14 19:14:34 +03:00
Aleksey Kladov
9fb67e7477
internal: document rename challenges
2021-06-14 19:08:12 +03:00
Lukas Wirth
c7c2eb8b08
typo
2021-06-14 18:01:38 +02:00
Aleksey Kladov
26c978f258
internal: adapt diagnostics to the new rename API
2021-06-14 18:46:54 +03:00
Aleksey Kladov
2e8dab631b
internal: prepare to move assist definitions
2021-06-14 17:45:17 +03:00
Aleksey Kladov
1d2772c2c7
internal: move diagnostics to a new crate
2021-06-14 17:45:17 +03:00
Aleksey Kladov
721feb1832
internal: prepare to move rename to base_db
...
It's better to handle magical cases upper in the stack, because it
allows for better re-use of the general implementation below. So, we
pull the `self` case up here.
The end goal is to put `Definition::rename` to the `ide_db`, because
it's a generally re-usable functionality useful for different ide
features, alongside with the search which is already there.
2021-06-14 17:28:39 +03:00
Lukas Wirth
9043c5db86
Don't ignore hover documentation setting for keyword hovers
2021-06-14 15:31:14 +02:00
Lukas Wirth
a93d166f0f
Make documentation on hover configurable
2021-06-14 15:25:10 +02:00
Aleksey Kladov
e696188672
fix: don't use display-related functionality where semantics matters
...
NavigationTarget is strictly a UI-level thing -- it describes where the
cursor should be placed when the user presses goto definition. It
doesn't make any semantic guaratees about rage and focus range and, as
such, is not suitable for driving renames.
2021-06-14 15:43:59 +03:00
Aleksey Kladov
500c909c76
internal: diagnostic code is mandatory
2021-06-13 22:17:36 +03:00
Aleksey Kladov
b404b91da6
minor: dead code
2021-06-13 22:11:33 +03:00
Aleksey Kladov
ff52167c9a
internal: kill diagnostic sink
2021-06-13 22:05:47 +03:00
Aleksey Kladov
935c53b92e
internal: use cov-mark rather than bailing out diagnostic
2021-06-13 21:55:51 +03:00
Aleksey Kladov
b292e1b9da
internal: refactor missing match arms diagnostics
2021-06-13 21:44:31 +03:00
Aleksey Kladov
3478897f86
internal: remove DiagnosticWithFix infra
2021-06-13 21:33:54 +03:00
Aleksey Kladov
fc30c5ccbe
internal: refactor incorrect case diagnostics
2021-06-13 21:09:03 +03:00
Aleksey Kladov
b66f4bb8d1
minor
2021-06-13 20:33:59 +03:00
Aleksey Kladov
de1fc70ccd
internal: refactor find_map diagnostic
2021-06-13 20:32:54 +03:00
Aleksey Kladov
24262f9ff6
minor
2021-06-13 20:20:58 +03:00
Aleksey Kladov
949a6ec469
internal: refactor missing or or some diagnostic
2021-06-13 20:19:11 +03:00
Aleksey Kladov
74f3cca85a
internal: refactor remove this semicolon diagnostics
2021-06-13 20:14:12 +03:00
Aleksey Kladov
8d391ec981
internal: refactor mismatched args count diagnostic
2021-06-13 20:06:25 +03:00
Aleksey Kladov
bccf77f26c
internal: refactor missing unsafe diagnostic
2021-06-13 20:01:01 +03:00
Aleksey Kladov
886b66cd03
internal: refactor BreakOutsideOfLoop diagnostic
2021-06-13 19:51:19 +03:00
Aleksey Kladov
7166e8549b
internal: refactor NoSuchField diagnostic
2021-06-13 19:45:16 +03:00
Aleksey Kladov
d3621eeb02
internal: refactor unimplemented builtin macro diagnostic
2021-06-13 19:35:30 +03:00
Aleksey Kladov
dec207f56a
minor: simplify
2021-06-13 19:27:24 +03:00
Aleksey Kladov
a1940d8c75
internal: check diagnostics in all files and not just the first one
2021-06-13 19:23:37 +03:00
Aleksey Kladov
4af7a35197
internal: remove def-level diagnostics tests
2021-06-13 18:45:38 +03:00
Aleksey Kladov
00303284b5
internal: refactor macro error
2021-06-13 18:41:04 +03:00
Aleksey Kladov
1e4aaee7bb
internal: refactor unresolved proc macro diagnostic
2021-06-13 17:51:44 +03:00
Aleksey Kladov
f85e383b94
internal: refactor inactive code diagnostics
2021-06-13 17:29:25 +03:00
Aleksey Kladov
fa9ed4e0ce
internal: refactor unresolved macro call diagnostic
2021-06-13 17:08:54 +03:00
Aleksey Kladov
6d104de15a
internal: refactor unresolved import diagnostic
2021-06-13 16:42:34 +03:00
Aleksey Kladov
39f190b72c
internal: refactor unresolved extern crate diagnostic
2021-06-13 16:05:43 +03:00
Aleksey Kladov
6383252cc2
internal: unified missing fields diagnostic
2021-06-13 15:48:54 +03:00
Aleksey Kladov
c6509a4592
internal: move missing_fields diagnostics
2021-06-13 15:27:15 +03:00
Aleksey Kladov
efa069d288
internal: start new diagnostics API
...
At the moment, this moves only a single diagnostic, but the idea is
reafactor the rest to use the same pattern. We are going to have a
single file per diagnostic. This file will define diagnostics code,
rendering range and fixes, if any. It'll also have all of the tests.
This is similar to how we deal with assists.
After we refactor all diagnostics to follow this pattern, we'll probably
move them to a new `ide_diagnostics` crate.
Not that we intentionally want to test all diagnostics on this layer,
despite the fact that they are generally emitted in the guts on the
compiler. Diagnostics care to much about the end presentation
details/fixes to be worth-while "unit" testing. So, we'll unit-test only
the primary output of compilation process (types and name res tables),
and will use integrated UI tests for diagnostics.
2021-06-13 14:55:45 +03:00
Aleksey Kladov
0eafc88079
minor: put a mark back
2021-06-13 11:49:32 +03:00
Maan2003
5ac6804bb3
cargo fmt
2021-06-13 09:48:15 +05:30
Maan2003
c50b4579ec
clippy::useless_return
2021-06-13 09:35:29 +05:30
Maan2003
75370312fb
clippy::redundant_closure
2021-06-13 09:29:36 +05:30
Maan2003
705f7e6e26
clippy::clone_on_copy
2021-06-13 09:27:19 +05:30
Maan2003
c9b4ac5be4
clippy::redudant_borrow
2021-06-13 09:24:16 +05:30
Aleksey Kladov
0463d76a1f
internal: cross-crate cov-marks
2021-06-12 23:40:52 +03:00
Aleksey Kladov
7731714578
internal: move diagnostics infra to hir
2021-06-12 22:05:23 +03:00
Aleksey Kladov
6940cfed1e
Move some hir_ty diagnostics to hir
2021-06-12 21:00:22 +03:00
Aleksey Kladov
0413d51317
internal: move missing unsafe diagnostic to hir
2021-06-12 17:39:46 +03:00
Aleksey Kladov
f8009666be
internal: move inference diagnostics to hir
2021-06-12 17:17:23 +03:00
Lukas Wirth
e09723f0af
Highlight tuple field accesses correctly
2021-06-11 21:19:19 +02:00
bors[bot]
863e23f00f
Merge #9219
...
9219: minor: Replace some AssocItem::containing_trait calls trait_or_trait_impl r=Veykril a=Veykril
bors r+
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-11 17:56:00 +00:00
Lukas Wirth
db4a1fcab4
Replace some AssocItem::containing_trait calls trait_or_trait_impl
2021-06-11 19:55:24 +02:00
bors[bot]
21d4416235
Merge #9218
...
9218: Item search now respects trait impl items r=Veykril a=Veykril
Fixes #2977
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-11 17:33:34 +00:00
Lukas Wirth
48f65b3b15
Item search now respects trait impl items
2021-06-11 19:24:52 +02:00
Jonas Schievink
1d6eef1350
Update ungrammar
2021-06-11 18:34:30 +02:00
Kirill Bulatov
a6cdde0d0b
Populate import maps eagerly
2021-06-11 01:27:20 +03:00
Lukas Wirth
26c869ddc0
Don't classify attributes on macro-calls are the macro itself
2021-06-10 00:26:15 +02:00
bors[bot]
5f592f4f58
Merge #9191
...
9191: fix: Don't descend MacroCall TokenTree delimiters r=jonas-schievink a=Veykril
Fixes #9190
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-06-09 13:17:38 +00:00
Lukas Wirth
3c40b15d62
Don't descend MacroCall TokenTree delimiters
2021-06-09 15:02:11 +02:00
Jonas Schievink
fcf22d68d4
Prefer attr macros in "expand macro recursively"
2021-06-08 22:26:01 +02:00
bors[bot]
2f376f7475
Merge #9169
...
9169: internal: steps towards attribute macro token mapping r=jonas-schievink a=jonas-schievink
This doesn't work yet, but we seem to be getting a bit further along (for example, we now stop highlighting `use` items inside item with attribute macros as if they were written verbatim).
bors r+
Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2021-06-07 17:37:48 +00:00
Jonas Schievink
33be5762e5
Attempt to track attr macros during highlighting
2021-06-07 19:32:28 +02:00