Commit Graph

74 Commits

Author SHA1 Message Date
Aleksey Kladov
67ba9072fa Remove hir for imports 2019-12-21 12:18:20 +01:00
kjeremy
0d5d63a80e Clippy lints 2019-12-20 15:14:30 -05:00
bors[bot]
02f9e04ee9
Merge #2617
2617: Remove index resolving from hover r=matklad a=kjeremy

I have left in `HoverResult`'s support for multiple entries because we may still want that at some point.

Per https://github.com/rust-analyzer/rust-analyzer/issues/2542#issuecomment-565238142

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-12-20 18:16:16 +00:00
kjeremy
77626d7bda Remove unused imports 2019-12-20 11:18:24 -05:00
kjeremy
428358925c Remove the index resolution from hover
We are reasonably precise now to do this.
2019-12-20 11:16:47 -05:00
Edwin Cheng
4a7e19946a Fix parser for macro call in pattern position 2019-12-20 23:26:04 +08:00
Aleksey Kladov
3d4b48e481 Fix resolve for field init shorthand 2019-12-20 14:48:14 +01:00
Aleksey Kladov
77af7b087f Fix highlighting for field init shorthand 2019-12-20 14:12:14 +01:00
Aleksey Kladov
d057afb945 Improve highlighting test 2019-12-20 14:12:14 +01:00
Aleksey Kladov
a04177f135 Add local functions to bodies 2019-12-20 11:52:17 +01:00
Kirill Bulatov
f407ac2be3 Omit default types for hover pop-ups 2019-12-19 16:47:09 +02:00
Kirill Bulatov
4ed78f80f4 Remove TruncateOptions struct 2019-12-19 16:43:41 +02:00
Kirill Bulatov
4fb25ef43b Do not add any new configuration parameters 2019-12-19 16:18:09 +02:00
Kirill Bulatov
3969c7c853 Ensure hover shows full type declaration 2019-12-19 12:45:00 +02:00
Kirill Bulatov
14c167a9f6 Omit default parameter types 2019-12-19 12:27:33 +02:00
bors[bot]
b63c7ecab9
Merge #2311
2311: See through Macros for SignatureHelp r=matklad a=kjeremy

Note: we meed to skip the trivia filter to make sure that
`covers!(call_info_bad_offset)` succeeds otherwise we exit call_info
too early.

Also the test doesn't pass: `FnCallNode::with_node` always detects
a MacroCall which is obviously wrong.

Fixes #2310 

Co-authored-by: kjeremy <kjeremy@gmail.com>
Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-12-18 16:44:35 +00:00
Aleksey Kladov
7c25224f05 Don't bother with focus range for navigation to locals 2019-12-18 16:45:42 +01:00
Aleksey Kladov
46a299bcee Refactor goto tests to always specify texts 2019-12-18 16:00:35 +01:00
Aleksey Kladov
69c944a1e2 Add blank lines for readability 2019-12-18 16:00:35 +01:00
Jeremy Kolb
83dc5e7949 cargo fmt 2019-12-18 09:11:47 -05:00
Jeremy Kolb
cdc6af6bda Pass test 2019-12-18 08:58:48 -05:00
kjeremy
7ec43ee07a WIP: See through Macros for SignatureHelp
Note: we meed to skip the trivia filter to make sure that
`covers!(call_info_bad_offset)` succeeds otherwise we exit call_info
too early.

Also the test doesn't pass: `FnCallNode::with_node` always detects
a MacroCall.
2019-12-18 08:49:06 -05:00
bors[bot]
f51a3fed9f
Merge #2580
2580: Fix highlighting token names r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-17 13:46:12 +00:00
Aleksey Kladov
1c8467e20a Fix highlighting token names 2019-12-17 14:45:46 +01:00
bors[bot]
4a58522119
Merge #2562
2562: Fix NavigationTarget ranges r=matklad a=edwin0cheng

Fix the issue described in https://github.com/rust-analyzer/rust-analyzer/pull/2544#issuecomment-565572553

This PR change the order for finding `full_range` of `focus_range` in following orders:
1. map both ranges to macro_call
2. map focus range to a token inside macro call, and full range to the whole of macro call
3. map both ranges to the whole of macro call

And fix the corresponding tests and make these tests easily to follow.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-17 13:37:32 +00:00
Omer Ben-Amram
9a6d496497 use a module instead of prefixed consts. 2019-12-15 13:18:37 +02:00
Omer Ben-Amram
50ecb1e19b introduce named constants for highlighting tag names. 2019-12-15 12:39:31 +02:00
bors[bot]
3e8f9eb6c4
Merge #2559
2559: Add some granularity to syntax highlighting. r=matklad a=omerbenamram

Hi,

I wanted to start using `rust-analyzer` a bit more frequently - one of the main blockers for me so far was the highlighting.

I just discovered it's possible to override the default colors with `ralsp.<something>` setting without waiting for #2061!

However, the current implementation was lumping a bunch of different tokens into `type` and `literal`.
The golden standard IMO is what Clion is currently doing (and is my current daily driver for rust).

Clion allows users to control the coloring for specific literal kinds, and the default is to distinguish between them (numerics get a different color from strings, and special colors for bytestrings).

I've also splitted the builtin types, which are also allowed to be highlighted speratly.
My goal is to match the default experience I'm getting with clion.
The only blockers now I think is that `rust-analyzer` doesn't corrently infer types in some situations, so the highlighting information is incorrect in those cases.

This is what it looks like so far (with colors overriden to match clion's theme):
![image](https://user-images.githubusercontent.com/2467993/70848219-ccd97900-1e76-11ea-89e1-2e467cfcc9fb.png)

If there are any other changes you feel is necessary let me know.

I did leave the default colors to match the current behavior, since I'm not familiar with the colors for this theme, I added some random (different) colors in the test to check that it indeed was working.



Co-authored-by: Omer Ben-Amram <omerbenamram@gmail.com>
2019-12-15 09:00:11 +00:00
Omer Ben-Amram
feb5a4a8b8 fixed rainbow-highlighting test 2019-12-15 10:20:22 +02:00
Edwin Cheng
3ba4b3c554 Use simpler logic on original_range 2019-12-15 02:34:16 +08:00
bors[bot]
d6223253b6
Merge #2561
2561: Split generic and non-generic paths r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-14 18:16:48 +00:00
Aleksey Kladov
2619950b3b Use different types for path with and without generics 2019-12-14 19:15:40 +01:00
Edwin Cheng
b53587c7bd Re-export Origin to replace ExpansionOrigin 2019-12-15 01:46:39 +08:00
Edwin Cheng
61360fdfec Fix original_source find order 2019-12-15 01:24:51 +08:00
Omer Ben-Amram
083010f633 removed type.alias 2019-12-14 13:29:42 +02:00
Omer Ben-Amram
67641d3f5f added decorations 2019-12-14 13:24:07 +02:00
succcubbus
c82529a97f for goto and hover pick the token based on a priority 2019-12-13 22:00:05 +01:00
succcubbus
4f7da04c67 add tests for goto on tuple fields 2019-12-13 21:59:25 +01:00
succcubbus
6c133017a8 try both surrounding tokens for hover 2019-12-13 21:10:25 +01:00
succcubbus
6c42eb1930 add failing test 2019-12-13 19:54:07 +01:00
succcubbus
f54fef85aa use find() instead of filter().next() 2019-12-13 19:54:02 +01:00
succcubbus
4df741ecb2 fix goto definition when inbetween tokens
fixes both goto_definition and goto_type_definition.
before, when running goto between some non-trivia token and an
identifier, goto would be attempted for the non-trivia token.
but this does not make sense for e.g. L_PAREN or COLONCOLON only for
IDENTs. now only IDENTs will be searched for in goto actions.
2019-12-13 19:20:02 +01:00
Omer Ben-Amram
30672c420e scopes resolution is more granular 2019-12-13 19:03:48 +02:00
Edwin Cheng
47f2b5d0d9 Map first and last node in original_range 2019-12-13 02:39:14 +08:00
Gabriel Luo
20ccabc01d Fixed #2250
Tuple in type annotation expands correctly;
Expansion will prefer the following delimiter when possible. 
New regression tests added to verify the consistency between tuple expansion in type annotation and tuple expansion in rvalue.
2019-12-10 22:18:05 -05:00
Aleksey Kladov
b683cbd93d Report correct original range in goto_definition 2019-12-09 19:46:35 +01:00
bors[bot]
6b1c2ee168
Merge #2500 #2505 #2506
2500: Fix format_args expansion & go to definition r=matklad a=flodiebold

The expansion of format_args wasn't yet correct enough to type-check. Also make macros in statement position expand to expressions for now, since it's not handled correctly in HIR lowering yet. This finally fixes go to definition within print macros, I think 🙂 

2505: Remove more dead code r=matklad a=matklad



2506: Remove one more Ty r=matklad a=matklad



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-08 16:53:21 +00:00
Aleksey Kladov
61c3887b70 Remove one more Ty 2019-12-08 17:50:43 +01:00
Aleksey Kladov
a1639d0d1e Remove more dead code 2019-12-08 17:45:14 +01:00
Florian Diebold
2223620313 Fix range in goto_through_format test 2019-12-08 13:02:52 +01:00