Commit graph

58 commits

Author SHA1 Message Date
Edwin Cheng
34322ea9a3 Use classify_name_ref in hover 2019-06-11 00:34:43 +08:00
Edwin Cheng
d46278d320 Remove node function in NavTarget 2019-06-08 22:27:11 +08:00
Alan Du
682bf04bf4 Fix clippy::new_without_default 2019-06-04 18:05:07 -04:00
Laurențiu Nicola
be15541b03 Sort hover results in tests 2019-05-30 21:20:17 +03:00
Aleksey Kladov
61e1474ab3 fix typos in mbe tests 2019-05-28 18:46:11 +03:00
Florian Diebold
85633656df Fix hover on the beginning of a nested expression
E.g. in
```
let foo = 1u32;
if true {
   <|>foo;
}
```
the hover shows `()`, the type of the whole if expression, instead of the more
sensible `u32`. The reason for this was that the search for an expression was
slightly left-biased: When on the edge between two tokens, it first looked at
all ancestors of the left token and then of the right token. Instead merge the
ancestors in ascending order, so that we get the smaller of the two possible
expressions.
2019-04-28 16:03:49 +02:00
Aleksey Kladov
0fd93bc14a use really correct resolver for expressions 2019-04-13 00:44:47 +03:00
Aleksey Kladov
b6809b6695 rename 2019-04-11 16:29:33 +03:00
Aleksey Kladov
10d66d63d7 introduce SourceAnalyzer 2019-04-11 16:29:33 +03:00
Ville Penttinen
07f0069f34 Move display related things from hover to display 2019-04-09 14:45:05 +03:00
Ville Penttinen
946b5789d1 Move completion label functions to display 2019-04-09 14:45:05 +03:00
Aleksey Kladov
9e213385c9 switch to new rowan 2019-04-01 12:06:24 +03:00
Aleksey Kladov
4fd8cfd6ad replace todo with fixme 2019-03-23 11:07:09 +03:00
Florian Diebold
8a5fbf4713 Remove the old variants replaced by Ty::Apply 2019-03-21 22:17:00 +01:00
Florian Diebold
c5ee60e05b Replace Display by a pretty printing trait for Ty
This allows removing the names from Adt and FnDef (and more later), as a first
step towards aligning more with chalk's Ty :)
2019-03-16 16:36:59 +01:00
kjeremy
27fc99776f Remove superfluous semicolons
Doesn't change the result of the test but it does prevent the
syntax tree from rendering.
2019-03-08 16:45:26 -05:00
Ville Penttinen
b168104d95 Use ast::Name::text() instead of name().syntax().text() 2019-03-07 20:58:41 +02:00
Ville Penttinen
5c0556c2ca Fix EnumVariants not showing properly when hovering
This fixes documentation as well for EnumVariants
2019-03-07 20:33:33 +02:00
Ville Penttinen
4a0bb3d7c5 Add support for goto definition and hover on Self
This fixes #943
2019-03-07 17:34:44 +02:00
kjeremy
aac421b135 Hover for associated items in patterns 2019-03-06 11:39:11 -05:00
Jeremy Kolb
3d8d880c59 Use ImplItems instead of just Function 2019-03-04 08:27:08 -05:00
kjeremy
49da9a3e81 Make goto definition/hover resolve constructors 2019-03-04 08:27:08 -05:00
Florian Diebold
affaf7700a Represent unknown types as {unknown} instead of [unknown]
Since the latter could actually be a real type...
2019-03-03 03:00:17 +01:00
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
Aleksey Kladov
03b2ab8e1f rename syntax_mapping as well 2019-03-02 16:56:09 +03:00
Aleksey Kladov
eaf1df26e9 rename syntax-mapping -> source-map 2019-03-02 15:40:40 +03:00
kjeremy
d0efa77e0e Update hover message since we do support globs 2019-02-28 14:48:21 -05: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
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
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
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
Aleksey Kladov
78f10fcdc4 rename type to type_alias in the AST as well 2019-02-25 13:49:32 +03:00
bors[bot]
3d8a0982a1 Merge #866
866: Implement basic support for Associated Methods r=flodiebold a=vipentti

This is my attempt at learning to understand how the type inference works by adding basic support for associated methods. Currently it does not resolve associated types or constants. 

The basic idea is that `Resolver::resolve_path` returns a new `PathResult` type, which has two variants, `FullyResolved` and `PartiallyResolved`, fully resolved matches the previous behavior, where as `PartiallyResolved` contains the `PerNs<Resolution` in addition to a `segment_index` which contains the index of the segment which we failed to resolve. This index can then be used to continue inference in `infer_path_expr` using the `Type` we managed to resolve.

This changes some of the previous apis, so looking for feedback and suggestions.

This should enable fixing #832

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-02-22 19:58:22 +00:00
Ville Penttinen
816971ebc9 Implement basic support for Associated Methods and Constants
This is done in `infer_path_expr`. When `Resolver::resolve_path` returns
`PartiallyResolved`, we use the returned `Resolution` together with the given
`segment_index` to check if we can find something matching the segment at
segment_index in the impls for that particular type.
2019-02-21 12:25:55 +02:00
Florian Diebold
72712b8a42 Fix handling of generics in tuple variants and refactor a bit
Also make them display a tiny bit nicer.

Fixes #860.
2019-02-20 22:48:55 +01:00
Pascal Hertleif
4fd3613434 Fix some typos 2019-02-12 15:02:57 +01:00
Aleksey Kladov
12e3b4c70b reformat the world 2019-02-08 14:49:43 +03:00
Jeremy Kolb
a892067951 Make doc comments optional 2019-01-26 10:35:23 -05:00
Aleksey Kladov
9457b1f0e6 rename source_file -> parse 2019-01-26 11:51:36 +03:00
Aleksey Kladov
4711cbcace rename FilesDatabase -> SourceDatabase 2019-01-26 11:20:30 +03:00
Aleksey Kladov
be1a005ebd fold syntax database into files database 2019-01-26 11:09:39 +03:00
gfreezy
5c8cb56506 move rename to a new mod 2019-01-19 15:36:58 +03:00
Aleksey Kladov
05ba45c667 remove Canceled from API impl 2019-01-15 21:02:42 +03:00
Aleksey Kladov
8ba9c2d4ce remove Cancelable from type inference 2019-01-15 20:54:18 +03:00
Aleksey Kladov
040a622c52 remove Cancelable from funciton body 2019-01-15 19:01:59 +03:00
Aleksey Kladov
11f3c8afb2 remove Cancelable from source binders 2019-01-15 18:13:49 +03:00
Marcus Klaas de Vries
d67eabb512 Fix type inference for raw (byte) strings 2019-01-14 20:56:14 +01:00
Jeremy Kolb
da326dca60 Remove duplication 2019-01-13 20:25:14 -05:00