Lukas Wirth
c81aa68afe
Don't show trait flyimports for impl trait and placeholders
2021-12-10 19:18:21 +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
54b2de45e1
Unnest ide::display::navigation_target module
2021-11-22 13:04:28 +01:00
Jake Heinz
c28dc00b39
ide: dedupe or merge hover actions
2021-11-19 05:36:07 +00:00
Jake Heinz
876f44b3ea
ide: show go to for function hover return type
2021-11-18 08:00:22 +00:00
Lukas Wirth
7776aad166
internal: Flatten Definition::ModuleDef
variant
2021-11-11 00:05:53 +01:00
Milo
35e5daacc3
more clippy fixes
2021-10-16 12:32:55 +01: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
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
hamidreza kalbasi
589c1dfa04
move function to defs.rs
2021-09-22 18:35:54 +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
hamidreza kalbasi
0777698f29
internal: definition based hover functions
2021-09-19 16:15:44 +04:30
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
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
538ac599d2
Add some more attribute ide tests
2021-09-14 03:57:29 +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
Teddy_Wang
4d9728ccb2
Fix hover tests
2021-09-13 19:47:53 -04:00
Teddy_Wang
0c6a993f59
Fix spelling
2021-09-13 19:16:10 -04: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
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
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
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
Lukas Wirth
a0d5290b7f
Show try operator propogated types on ranged hover
2021-08-21 22:21:27 +02:00
Lukas Wirth
0c0142f61a
Simplify
2021-08-16 16:12:20 +02: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
Yoshua Wuyts
f64aacc0c1
Use minicore
2021-08-08 18:58:42 +02:00
Dawer
0f6621fbfa
Fix tests.
2021-08-04 20:20:14 +05:00
Lukas Wirth
b96f1adf5c
Give TypeInfo fields and methods more appropriate names
2021-08-03 17:28:51 +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
Lukas Wirth
62ab73767f
resolve_doc_path is able to resolve to macros
2021-08-02 14:33:09 +02:00
Lukas Wirth
b363755901
Fix hover range for derive inputs
2021-07-31 14:59:31 +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
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
Lukas Wirth
ef6fed052c
Correctly classify Rename Names
2021-07-23 02:14:59 +02:00
Lukas Wirth
bb71ebb985
Move doc_links tests from hover to doc_links
2021-07-20 17:57:47 +02:00
Lukas Wirth
cb7b4a5d5b
Some more fragment fixes
2021-07-20 17:03:39 +02:00
Lukas Wirth
e8f1abf5f7
Correctly generate link fragments for associated items
2021-07-20 16:01:27 +02:00
Lukas Wirth
97d63d67cd
Resolve paths to assoc items for traits
2021-07-19 20:51:57 +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
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
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
Lukas Wirth
a7d61ddba4
Add cov_mark
2021-07-02 19:34:49 +02:00
Lukas Wirth
f640f2dbb4
Fix incorrect guard for NameRefClass attribute resolution
2021-07-02 15:17:21 +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
Lukas Wirth
b8507ca98d
Don't add test runnables for outline modules in the wrong file
2021-06-30 19:08:13 +02:00
Lukas Wirth
9957220dfe
Fix NameRef::classify
path resolution inside attributes
2021-06-28 19:07:23 +02:00
Lukas Wirth
f615efdfc3
Factor out pick_best_token
ide pattern into ide_db
2021-06-22 17:50:15 +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
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
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
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
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
Aleksey Kladov
8a4d9bb80a
internal: add fn to minicore
2021-06-16 12:15:45 +03:00
Aleksey Kladov
7cbcbccc78
internal: switch some tests to minicore
2021-06-15 23:11:53 +03:00
Aleksey Kladov
3f4ad44082
internal: document that we don't #[ignore] tests
2021-06-15 11:46:47 +03:00
Lukas Wirth
c7c2eb8b08
typo
2021-06-14 18:01:38 +02: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