Commit Graph

1157 Commits

Author SHA1 Message Date
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