Commit Graph

2940 Commits

Author SHA1 Message Date
Wilco Kusee
c9d6efc468 Add expander unit tests 2019-03-03 20:33:50 +01:00
Wilco Kusee
d149bb885b Add parser unit tests 2019-03-03 12:45:30 +01:00
Wilco Kusee
725805dc79 Split parse and expand errors 2019-03-03 10:40:03 +01:00
Wilco Kusee
dffe318701 Formatting 2019-03-02 20:49:13 +01:00
Wilco Kusee
d3a252b559 Replace option with result in mbe 2019-03-02 20:30:13 +01:00
bors[bot]
592b906604 Merge #910
910: Update hover message since we do support globs r=matklad a=kjeremy

#909 drew attention to this.

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-02-28 19:53:15 +00:00
kjeremy
d0efa77e0e Update hover message since we do support globs 2019-02-28 14:48:21 -05:00
Aleksey Kladov
198de68117 add syntax-trees video 2019-02-28 22:08:17 +03:00
bors[bot]
84e47113e0 Merge #906
906: Add support for goto definition and hover for struct fields r=matklad a=vipentti

This works partially towards fixing #512

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-27 15:59:56 +00:00
Ville Penttinen
c879f43186 Enable hover support for NamedFieldDefs
Additionally add type ascription for const and statics as well.
2019-02-27 17:52:37 +02:00
Ville Penttinen
bb4521be1c Allow goto-definition to work for named fields in struct initializer
Now goto definition should work when done on a named field in a struct
initializer.
2019-02-27 17:51:59 +02:00
bors[bot]
e1dd31e7e2 Merge #905
905: Update deps r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-02-27 15:22:53 +00:00
kjeremy
7463f5debb Fix the build 2019-02-27 09:35:04 -05:00
kjeremy
61a0d6ab8e Update deps 2019-02-27 08:58:13 -05:00
bors[bot]
2e2a6dd2fb Merge #900
900: Add new trait ast::TypeAscriptionOwner r=vipentti a=vipentti

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.

In addition, we update some places where previously we used node + node.type_ref() with `TypeAscriptionOwner` in the trait bounds.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-27 12:18:55 +00:00
Ville Penttinen
d3ce69aee3 Remove TypeRef from item opts which implement TypeAscriptionOwner 2019-02-27 14:08:09 +02:00
bors[bot]
1927eb088a Merge #901
901: Add basic support for showing fn signature when hovering r=matklad a=vipentti

This adds basic support for displaying function signature when hovering over a usage of a function. 

Additionally refactored `hover` to return `HoverResult` to ease with testing and in general to be more robust.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-27 11:50:38 +00:00
bors[bot]
c8e78809e5 Merge #903
903: Work around for issue in vscode reporting a failure in request r=matklad a=vipentti

vscode would report "A request has failed" when it got "Content modified"
message and this would cause a pop-up to appear. This works around the issue by
returning an "empty" response that vscode can ignore.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-27 11:09:47 +00:00
Ville Penttinen
6eb45c1c2b Remove RawResponse::empty() 2019-02-27 12:57:59 +02:00
Ville Penttinen
33cebe1724 Work around for issue in vscode reporting a failure in request
vscode would report "A request has failed" when it got "Content modified"
message and this would cause a pop-up to appear. This works around the issue by
returning an "empty" response that vscode can ignore.
2019-02-27 12:49:04 +02:00
Ville Penttinen
e3525527e3 Add support for hovering over the name of an item 2019-02-27 09:49:22 +02:00
Ville Penttinen
79114c67b1 Replace visit_fn with crate::completion::function_label 2019-02-26 21:30:46 +02:00
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