Commit Graph

4366 Commits

Author SHA1 Message Date
Aleksey Kladov
43ed3d1196 Handle start imports in import groups 2019-12-19 16:57:22 +01:00
Aleksey Kladov
6edc54a1e6 Refactor macro tests 2019-12-19 16:23:23 +01:00
Aleksey Kladov
5c3c2b8690 Fix parsing of interpolated expressions 2019-12-19 14:43:19 +01:00
bors[bot]
8dd0e0086f
Merge #2589 #2591
2589: Touch up docs r=matklad a=matklad



2591: Remove dead code r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-18 16:54:28 +00:00
Aleksey Kladov
afdeacf3c1 Remove dead code 2019-12-18 17:52:52 +01: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
d33fc26e05 Touch up docs 2019-12-18 17:42:49 +01:00
Aleksey Kladov
04715cbe1c Forbid <T>::foo syntax in mod paths 2019-12-18 17:41:33 +01:00
Aleksey Kladov
88c6109897 Move PathKindUp 2019-12-18 17:06:52 +01:00
Aleksey Kladov
d043689735 Touch up docs 2019-12-18 17:04:20 +01: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
Edwin Cheng
41544a4088 Refactoring 2019-12-18 13:10:37 +08:00
Edwin Cheng
2ea1cfd780 Rename range to by_kind 2019-12-18 11:36:10 +08:00
Edwin Cheng
e16f3a5ee2 Add test for token map 2019-12-18 11:20:23 +08:00
Edwin Cheng
325532d119 Fix shift id for delim and other tokens 2019-12-18 11:20:23 +08:00
Edwin Cheng
320416d756 Add TokenTextRange 2019-12-18 11:20:22 +08:00
Edwin Cheng
59295854f8 Add token id to delims 2019-12-18 11:20:22 +08:00
Edwin Cheng
aceb9d7fb0 Add token ids for all tt::Leaf 2019-12-18 11:20:22 +08:00
bors[bot]
ff8f80579a
Merge #2582
2582: Drop dead code r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-17 15:03:38 +00:00
Aleksey Kladov
0630f8110f Drop dead code 2019-12-17 16:03:15 +01:00
bors[bot]
b90f9e6d59
Merge #2581
2581: Refactor PathKind r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-17 14:39:07 +00:00
Aleksey Kladov
aca022f1d4 Refactor PathKind 2019-12-17 15:38:28 +01: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
Aleksey Kladov
3e2f4e4293 Improve recovery for incomplete lambdas 2019-12-17 12:11:01 +01:00
Florian Diebold
91853590a9 Add test mark 2019-12-15 21:06:08 +01:00
Florian Diebold
6e1c2d0df8 Handle impl Trait more correctly
When calling a function, argument-position impl Trait is transparent; same for
return-position impl Trait when inside the function. So in these cases, we need
to represent that type not by `Ty::Opaque`, but by a type variable that can be
unified with whatever flows into there.
2019-12-15 18:56:38 +01:00
Florian Diebold
ac961b2614 Add test for unifying impl Trait 2019-12-15 17:45:32 +01:00
Omer Ben-Amram
6fba427bf3 remove unnecessary turbofish. 2019-12-15 18:15:24 +02:00
Omer Ben-Amram
40116af598 cfg gated tests that only work on windows. 2019-12-15 17:54:24 +02:00
Omer Ben-Amram
2e2fae32df improved path checking to consider only paths that may contain a windows drive. 2019-12-15 17:46:00 +02:00
Omer Ben-Amram
ebf302d261 move import inside cfg block 2019-12-15 17:03:39 +02:00
Omer Ben-Amram
324cbe839f Lowercase drive letters on windows before sending to extension. 2019-12-15 16:51:57 +02: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
bors[bot]
202ad1e2d9
Merge #2552
2552: fix goto definition when inbetween tokens r=matklad a=succcubbus

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.

this resulted in goto actions not working when running them on the first
character of some identifier e.g. for `module::<|>method()` or
`method(<|>parameter)`.

now only IDENTs will be searched for in goto actions, though i'm not sure
if this is correct or if goto should also work for some other token types.  

Co-authored-by: succcubbus <16743652+succcubbus@users.noreply.github.com>
2019-12-14 17:20:18 +00:00
Aleksey Kladov
f720855e1e Use all-features by default 2019-12-14 17:05:12 +01:00