Commit graph

3248 commits

Author SHA1 Message Date
bors[bot]
00b09bcd8c Merge #908
908: Enable markup for hover on expressions which resolve using type_of r=matklad a=vipentti

This adds highlighting when hovering over items which are resolved using
`type_of`.

This adds basic highlighting, discussed in #904.

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-03-02 14:21:44 +00:00
bors[bot]
fd7240837b Merge #915
915: Bring BodySyntaxMapping in line with other source-map instances r=flodiebold a=matklad

* rename to SourceMap
* don't store the actual body inline, just return a pair

r? @flodiebold 

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-02 14:09:46 +00:00
Aleksey Kladov
f0a9d026fc remove comment 2019-03-02 17:01:20 +03:00
Aleksey Kladov
8fc08d36e3 remove second way to get the body 2019-03-02 16:59:18 +03:00
Aleksey Kladov
03b2ab8e1f rename syntax_mapping as well 2019-03-02 16:56:09 +03:00
bors[bot]
30b87eb880 Merge #914
914: A bit of cleanup in ty.rs r=flodiebold a=flodiebold



Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-03-02 13:55:08 +00:00
Florian Diebold
862b663501 A bit of cleanup in ty.rs 2019-03-02 14:53:12 +01:00
Aleksey Kladov
80bb7d86ec align lower module query names 2019-03-02 16:49:06 +03:00
Aleksey Kladov
fe5574b05a rename scopes 2019-03-02 16:38:28 +03:00
Aleksey Kladov
ca957edf96 rename to source_map 2019-03-02 16:36:25 +03:00
Aleksey Kladov
f4c5383103 dont store body inside source map 2019-03-02 16:18:40 +03:00
Aleksey Kladov
eaf1df26e9 rename syntax-mapping -> source-map 2019-03-02 15:40:40 +03: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
Ville Penttinen
da26820ebd Enable markup for hover on expressions which resolve using type_of
This adds highlighting when hovering over items which are resolved using
`type_of`.
2019-02-28 09:33:06 +02: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