Commit Graph

2968 Commits

Author SHA1 Message Date
bors[bot]
4248b39993 Merge #902
902: Fix a typo r=matklad a=dwijnand



Co-authored-by: Dale Wijnand <dale.wijnand@gmail.com>
2019-02-26 18:04:24 +00:00
Dale Wijnand
ffca2c1fe4
Fix a typo 2019-02-26 17:59:32 +00:00
Ville Penttinen
6f5fd6c9de Add new type HoverResult to contain the results of hovering
This makes testing hovers easier as well as allows us to do more things with the
results if needed.
2019-02-26 19:30:17 +02:00
Ville Penttinen
3ec2584148 Add support for showing fn signature when hovering 2019-02-26 18:55:08 +02:00
Ville Penttinen
52054e1140 Use TypeAscriptionOwner
This replaces places where we would use node + node.type_ref() with things that
have an ascribed type, with using the TypeAscriptionOwner as the trait bound so
we can simply pass the node.
2019-02-26 11:47:13 +02:00
Ville Penttinen
6eb070d661 Add new trait TypeAscriptionOwner
This trait should be implemented for nodes which have an ascribed type,
e.g. thing : Type. Such as let, const, static, param, named struct fields.
2019-02-26 11:35:57 +02:00
bors[bot]
5e00a398f7 Merge #899
899: Change default value of highlightingOn to false r=matklad a=vipentti

This changes the default value for the vscode setting `rust-analyzer.highlightingOn` to `false`. Since currently the highlighting only supports Zenburn, which people may not be using, I think it makes sense to have this feature disabled by default.

This was discussed in #896 

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-26 08:49:17 +00:00
Ville Penttinen
5a9a314b10 Change default value of highlightingOn to false 2019-02-26 08:56:11 +02:00
bors[bot]
7c9acf2f83 Merge #897
897: Add basic const/static type inference r=flodiebold a=vipentti

This adds basic const/static type inference discussed in #887.

Currently the inference does not work for const/static declared inside a block. In addition the inference does not work inside the bodies of const/static.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-25 12:03:57 +00:00
Aleksey Kladov
4f67df9042 kill accidently commited file 2019-02-25 15:02:12 +03:00
bors[bot]
cec637a3a9 Merge #898
898: rename type to type_alias in the AST as well r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-02-25 10:51:37 +00:00
Aleksey Kladov
78f10fcdc4 rename type to type_alias in the AST as well 2019-02-25 13:49:32 +03:00
Ville Penttinen
cff9a7dfad Move ConstSignature creation to a single method 2019-02-25 10:55:39 +02:00
Ville Penttinen
29f93a7906 Add static type inference 2019-02-25 10:55:23 +02:00
Ville Penttinen
18b0bd9bff Add const type inference 2019-02-25 10:51:46 +02:00
bors[bot]
7ffff9c74c Merge #895
895: complete patterns r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-02-24 20:52:04 +00:00
Aleksey Kladov
330ce2e26b complete patterns 2019-02-24 23:50:02 +03:00
bors[bot]
dfca3cbeb0 Merge #894
894: Rename Type => TypeAlias r=matklad a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-02-24 20:39:27 +00:00
Florian Diebold
bd8ed644e4 Rename Type => TypeAlias 2019-02-24 21:36:49 +01:00
bors[bot]
61d9612633 Merge #892
892: Type aliases r=matklad a=flodiebold

This implements type aliases (i.e. `type` definitions).

There's just one snag: handling recursion. E.g. `type Foo = Foo` makes type inference panic with a query cycle. I think the best way to handle this would be if Salsa provided the ability to catch cycle errors? It seems that there's some work underway to support this [here](https://github.com/salsa-rs/salsa/issues/6) and [here](https://github.com/salsa-rs/salsa/pull/147). Should we wait for this? I don't see a good way to handle this without help from Salsa.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-02-24 20:08:10 +00:00
Florian Diebold
c3c0979561 Add test for recursive type aliases 2019-02-24 20:54:04 +01:00
Florian Diebold
5d72b96988 Implement support for type aliases 2019-02-24 20:54:04 +01:00
bors[bot]
5a684099e9 Merge #893
893: Completion presentation r=matklad a=matklad

Just moves completion code around a bit, to keep logic for producing completions and logic for rendering them into completion items separate.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-02-24 18:56:49 +00:00
Aleksey Kladov
d5f6a5f5e2 move testing functions 2019-02-24 21:54:13 +03:00
Aleksey Kladov
98510ec5d3 move the rest of presentation to presentation 2019-02-24 21:46:04 +03:00
Aleksey Kladov
b7a7872910 move more code to presentation 2019-02-24 21:34:38 +03:00
Aleksey Kladov
a650a93bf5 move res completion to presentation 2019-02-24 21:21:31 +03:00
Aleksey Kladov
2369af8c82 simplify 2019-02-24 20:59:12 +03:00
Aleksey Kladov
5887c0e574 move enum-variants to presentation 2019-02-24 20:56:53 +03:00
Aleksey Kladov
9af525dbd6 simplify 2019-02-24 20:49:55 +03:00
Aleksey Kladov
3c7c5a7354 move presentaion completion to presentation 2019-02-24 19:37:22 +03:00
Aleksey Kladov
b04cadc02c move function rendering to presentation 2019-02-24 19:34:27 +03:00
Aleksey Kladov
d0a261468e introduce completion presentation
This module should remove completion rendering boilerplate from the
"brains" of completion engine.
2019-02-24 18:51:38 +03:00
bors[bot]
67528c4b39 Merge #891
891: Field completion r=matklad a=matklad

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-02-24 14:39:38 +00:00
Aleksey Kladov
6285fcc39b complete fields in struct literals 2019-02-24 17:39:08 +03:00
bors[bot]
c52c8c2c5b Merge #890
890: Clean up imports a bit r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-02-24 14:19:54 +00:00
Florian Diebold
c71740e956 Clean up imports a bit 2019-02-24 15:17:20 +01:00
Aleksey Kladov
65a2be4953 complete struct literals 2019-02-24 17:01:56 +03:00
Aleksey Kladov
666303faf3 support upcastig in AST enum 2019-02-24 16:57:05 +03:00
bors[bot]
043991662c Merge #889
889: Refactor assits r=matklad a=matklad

* assign unique IDs to assists so that clients could do custom stuff
* specify kinds for assists, 
* make introduce_variable a `refactoring.extract` and make it available only when expression is selected
* introduce marks to assists

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-02-24 12:52:44 +00:00
Aleksey Kladov
c110e72a11 add marks to assists 2019-02-24 15:46:06 +03:00
Aleksey Kladov
b3cc7c057d dont show introduce variable everywhere 2019-02-24 14:18:10 +03:00
Aleksey Kladov
ef442b8682 Assign IDs to assists 2019-02-24 14:00:00 +03:00
bors[bot]
f6f160391d Merge #885
885: Parse token trees directy r=matklad a=matklad

This takes advantage of the recent macro refactoring to directly parse token stream into a syntax tree.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-02-24 10:15:43 +00:00
Aleksey Kladov
81bca78349 rename 2019-02-24 13:14:14 +03:00
bors[bot]
c5e74cebdc Merge #886
886: Associated method generics r=matklad a=flodiebold

Refactor associated method resolution a bit and make it work with generics.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-02-24 06:45:08 +00:00
Florian Diebold
82fe7b77a3 Refactor associated method resolution a bit and make it work with generics 2019-02-23 23:00:02 +01:00
Aleksey Kladov
8cf156d85b Add a test for macro parsing 2019-02-23 17:51:23 +03:00
bors[bot]
1eef9fbefe Merge #884
884: Split ty.rs into several modules r=matklad a=flodiebold

It was just getting too big. We now have:

 - ty: the `Ty` enum and helpers
 - ty::infer: actual type inference
 - ty::lower: lowering from HIR to `Ty`
 - ty::op: helpers for binary operations, currently

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-02-23 14:48:54 +00:00
Florian Diebold
dcfb4ee702 Split ty.rs into several modules
It was just getting too big. We now have:

 - ty: the `Ty` enum and helpers
 - ty::infer: actual type inference
 - ty::lower: lowering from HIR to `Ty`
 - ty::op: helpers for binary operations, currently
2019-02-23 15:36:38 +01:00