Commit graph

19291 commits

Author SHA1 Message Date
bors[bot]
61bb0cfbbe
Merge #10320
10320: feat: Hover/GotoDef works in macro invocations and on doc attribute strings r=Veykril a=Veykril

![image](https://user-images.githubusercontent.com/3757771/134554781-b903d33d-674f-4ed4-8acb-71ff5913f1cb.png)
cc https://github.com/rust-analyzer/rust-analyzer/issues/10271 


Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-23 17:56:55 +00:00
Laurențiu Nicola
db5e01189a Change the global setting when toggling inlay hints 2021-09-23 20:45:45 +03: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
bors[bot]
eb727c7222
Merge #10319
10319: internal: Cleanup hover a bit r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-23 14:28:27 +00:00
Lukas Wirth
42eb4efb5b Cleanup 2021-09-23 16:28:03 +02:00
bors[bot]
88a214f2dc
Merge #10315
10315: Fix title of User Manual page r=lnicola a=terrynsun

Asciidoc uses the first line of a doc as the title, so you can't put
comments before the heading.

---
I had an old copy of the Manual page open and I noticed that the "User Manual" heading (and page title) had disappeared in the live version:

![image](https://user-images.githubusercontent.com/2858750/134455658-3885b754-9eae-4dca-a6d4-4b1453910850.png)

With this change (and how it was a few days ago):

![image](https://user-images.githubusercontent.com/2858750/134455865-5acc7538-ccf8-4346-941f-3a5561b3181e.png)


Co-authored-by: Terry Sun <terrynsun@gmail.com>
2021-09-23 04:55:34 +00:00
Terry Sun
04e1d72354 Fix title of User Manual page
Asciidoc uses the first line of a doc as the title, so you can't put
comments before the heading.
2021-09-22 21:39:21 -07:00
bors[bot]
075fe761f3
Merge #10313
10313: Mark large benchmark data files as binary to filter greps r=lnicola a=joshtriplett

When doing a git grep (of rust-analyzer or of rust-lang/rust with
--recurse-submodules), if the grep happens to match within the large
benchmark data files, the resulting long single lines can cause a text
pager or editor to slow down and distract from more useful matches.

These test data files aren't formatted for human consumption, so mark
them as binary, which causes git grep to instead just state that they
match without printing the matching "line".

Co-authored-by: Josh Triplett <josh@joshtriplett.org>
2021-09-22 20:04:30 +00:00
Josh Triplett
dfd28c1764 Mark large benchmark data files as binary to filter greps
When doing a git grep (of rust-analyzer or of rust-lang/rust with
--recurse-submodules), if the grep happens to match within the large
benchmark data files, the resulting long single lines can cause a text
pager or editor to slow down and distract from more useful matches.

These test data files aren't formatted for human consumption, so mark
them as binary, which causes git grep to instead just state that they
match without printing the matching "line".
2021-09-22 12:51:58 -07: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
bors[bot]
6b77e320f0
Merge #10306
10306: Generate function assist creates bad param names for const/static item args r=XFFXFF a=XFFXFF

Try to fix #10278 

Co-authored-by: zhoufan <1247714429@qq.com>
2021-09-21 22:54:56 +00:00
zhoufan
8690cfb868 Change the style of the code 2021-09-22 06:32:23 +08:00
zhoufan
7912d3a4b3 Generate function assist creates bad param names for const/static item args 2021-09-22 00:15:57 +08:00
hamidreza kalbasi
887b7ddc37 fix derive hover in macro 2021-09-21 19:55:57 +04:30
bors[bot]
254022c13c
Merge #10304
10304: internal: Generate ast nodes for each ast trait r=Veykril a=Veykril

Generate a `DynTrait` node per ast trait that implements the trait itself as well as conversions via the `AstNode` trait. This is a trick already employed in `hir_def::attr` with `AttrsOwner` where it was manually implemented for.

This basically gives us stack trait objects for these(only useful for `hir_def::attr` currently) as well as simple conversions of `SyntaxNode` to a trait, in cases where only a result of a function call of such a trait is of interest.

It doesn't have many uses yet but as its autogenerated it doesn't add any maintenance costs. 

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-21 14:15:53 +00:00
Lukas Wirth
83e97adfff Simplify 2021-09-21 16:15:30 +02:00
Lukas Wirth
b36f12dba5 Simplify 2021-09-21 16:05:21 +02:00
Lukas Wirth
6d6e0b8f21 Generate ast nodes for each ast trait 2021-09-21 15:52:11 +02:00
bors[bot]
168b00fbba
Merge #10303
10303: internal: Add a mirror function-like proc-macro expander for tests r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-21 12:56:37 +00:00
Lukas Wirth
ba84b91e78 Add a mirror function-like proc-macro expander for tests 2021-09-21 14:55:54 +02:00
bors[bot]
063df5a482
Merge #10301
10301: minor: Merge iter_for_each_to_for and for_to_iter_for_each assists modules r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-21 08:34:51 +00:00
Lukas Wirth
8b1e8197fe Merge iter_for_each_to_for and for_to_iter_for_each assists modules 2021-09-21 10:34:11 +02:00
bors[bot]
6a98383fa5
Merge #10299
10299: minor: Rename some assists r=Veykril a=Veykril

Trying to make our assist names a bit more uniform
`fill_match_arms` -> `add_missing_match_arms`
`infer_function_return_type` -> `add_return_type`
`replace_impl_trait_with_generic` -> `introduce_named_generic`
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-20 22:54:39 +00:00
Lukas Wirth
8b2be8572f Rename some assists 2021-09-21 00:54:09 +02:00
longfangsong
cd599ec202 Address comments 2021-09-20 21:37:18 +08:00
bors[bot]
f1d7f98ed0
Merge #10293
10293: fix: Don't bail on parse errors in macro input for builtin expansion r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/8158

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-19 22:33:42 +00:00
Lukas Wirth
e7e87fc69d Don't bail on parse errors in macro input for builtin expansion 2021-09-20 00:33:13 +02:00
bors[bot]
b7bedf16a1
Merge #10289
10289: fix: Only strip derive attributes when preparing macro input r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/10246
cc https://github.com/rust-analyzer/rowan/pull/114, follow up to https://github.com/rust-analyzer/rust-analyzer/pull/10025

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-19 21:46:51 +00:00
bors[bot]
05d291881a
Merge #10292
10292: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-19 21:39:36 +00:00
Lukas Wirth
a6dde501df Only strip derive attributes when preparing macro input 2021-09-19 23:38:38 +02:00
Lukas Wirth
9c39363ada Simplify 2021-09-19 23:34:07 +02:00
bors[bot]
06ea89d3de
Merge #10290
10290: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2021-09-19 17:01:23 +00:00
Lukas Wirth
3987bf5d6f Simplify 2021-09-19 19:00:06 +02:00
bors[bot]
b02027d4fe
Merge #10287
10287: internal: more focused tests for const arguments r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-19 13:35:46 +00:00
Aleksey Kladov
a6181bfdb7 internal: more focused tests for const arguments 2021-09-19 16:35:10 +03:00
bors[bot]
bd2cd6a15f
Merge #10283
10283: minor: simplify generics parsing r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-19 11:51:38 +00:00
Aleksey Kladov
09531b703d minor: simplify 2021-09-19 14:50:53 +03:00
hamidreza kalbasi
0777698f29 internal: definition based hover functions 2021-09-19 16:15:44 +04:30
Aleksey Kladov
0005678649 minor: simplify 2021-09-19 14:26:35 +03:00
bors[bot]
e458f66214
Merge #10282
10282: fix: don't allow two turbo-fishes in generic arguments r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-19 09:10:32 +00:00
Aleksey Kladov
f99bdf4cc0 fix: don't allow two turbo-fishes in generic arguments 2021-09-19 12:09:50 +03:00
bors[bot]
1c81c36219
Merge #10280
10280: internal: type argument parsing refactoring r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-19 08:54:02 +00:00
Aleksey Kladov
8ae1f9c335 internal: add erroneous test for double turbo fish
We parse `f` successfully, but that is a bug.
2021-09-19 11:42:10 +03:00
Aleksey Kladov
8009ccc27d minor: improve readability 2021-09-19 11:34:25 +03:00
Aleksey Kladov
25adc5e9f0 minor: reduce duplication 2021-09-19 11:19:31 +03:00
bors[bot]
7729473dd2
Merge #10276
10276: internal: parser cleanup r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2021-09-18 13:09:51 +00:00