Commit Graph

4334 Commits

Author SHA1 Message Date
Aleksey Kladov
1c8467e20a Fix highlighting token names 2019-12-17 14:45:46 +01: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
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
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
Omer Ben-Amram
5e4e713fc9 Merge branch 'refs/heads/master' into feature/granular-scopes 2019-12-14 17:29:30 +02:00
bors[bot]
77db617765
Merge #2554
2554: Add macros for known names and paths r=matklad a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-12-14 14:08:08 +00:00
bors[bot]
7238037de4
Merge #2548
2548: Support setting cargo features and resolve `default` features by default r=matklad a=oxalica

Fixes #2524 


Co-authored-by: oxalica <oxalicc@pm.me>
2019-12-14 11:57:49 +00: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
kjeremy
03fe6b38b8 Remove some unwraps in add_new 2019-12-13 18:28:01 -05:00
Florian Diebold
f02fcc1644 Use path macro 2019-12-13 22:33:38 +01:00
Florian Diebold
6911bc89a7 Rename N! to name! 2019-12-13 22:33:38 +01:00
Florian Diebold
259c42f00e Add macros for known names and paths 2019-12-13 22:33:37 +01:00
kjeremy
a234b5a3ca LSP 3.15 supports the deprecated tag on completions 2019-12-13 16:08:47 -05: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
bors[bot]
9c9f4635b4
Merge #2550
2550: Infer - and ! using std::ops::{Neg, Not} r=flodiebold a=kiljacken

Found some low hanging fruit while taking a cursory look at index inferring.

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2019-12-13 19:49:01 +00: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
98f98cbb54 Refactor tt::Delimiter 2019-12-13 21:53:34 +08:00
Emil Lauridsen
7705209051 Correctly infer - and ! using std::ops::{Neg,Not} 2019-12-13 12:45:38 +01:00
Emil Lauridsen
95dc2de8e9 Add helper for resolving associated type of trait in infer 2019-12-13 12:45:37 +01:00
bors[bot]
16cf6bcf4b
Merge #2544
2544: Map first and last tokens in original_range r=matklad a=edwin0cheng

This PR try to fix the first part of the `original_range` : Try to map the first token and last token of a `SyntaxNode` , If success, return the union range of mapped tokens. 

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2019-12-13 10:21:19 +00:00
oxalica
af4eb26645
Support setting cargo features 2019-12-13 18:16:34 +08:00
Edwin Cheng
47f2b5d0d9 Map first and last node in original_range 2019-12-13 02:39:14 +08:00
Aleksey Kladov
332f2205b0 Correct obsolete comment 2019-12-12 17:17:57 +01:00
Aleksey Kladov
125559c14b Move use tree lowering to a separate module 2019-12-12 17:15:57 +01:00
bors[bot]
254c8efc5b
Merge #2540
2540: Dedupe from_source impls r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-12 14:51:02 +00:00
Aleksey Kladov
8e65b77387 Dedupe from_source impls 2019-12-12 15:50:16 +01:00
bors[bot]
c213c3b36b
Merge #2539
2539: Remove old location infra r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-12-12 14:20:02 +00:00
Aleksey Kladov
7a255a2f93 Remove old location infra 2019-12-12 15:19:07 +01:00
Aleksey Kladov
56710f119b Move enum&union to new loc 2019-12-12 15:11:57 +01:00
Aleksey Kladov
f135a8ea55 Move structs to new loc 2019-12-12 14:58:04 +01:00