Commit Graph

399 Commits

Author SHA1 Message Date
Aleksey Kladov
505acc973b Make call info to use real name resolution 2019-04-11 16:29:33 +03:00
Aleksey Kladov
10d66d63d7 introduce SourceAnalyzer 2019-04-11 16:29:33 +03:00
bors[bot]
6d9acb8753 Merge #1131
1131: Use inline snapshots in complete_dot r=matklad a=vipentti

Relates to #1127 

Co-authored-by: Ville Penttinen <villem.penttinen@gmail.com>
2019-04-10 11:05:31 +00:00
Ville Penttinen
57283b4e5f Use inline snapshots in complete_dot 2019-04-10 13:47:20 +03:00
Ville Penttinen
1b19c1c8f2 Use inline snapshots in complete_fn_param 2019-04-10 13:22:50 +03:00
Aleksey Kladov
10726fdb65 type-safer source-map for bindings 2019-04-10 10:48:15 +03:00
Aleksey Kladov
6b993a9760 migrate to salsas interning 2019-04-09 22:51:22 +03:00
Ville Penttinen
45a2b92524 Fix doc comment 2019-04-09 16:08:24 +03:00
Ville Penttinen
07f0069f34 Move display related things from hover to display 2019-04-09 14:45:05 +03:00
Ville Penttinen
fead60aa27 Move FunctionSignature to display/function_signature 2019-04-09 14:45:05 +03:00
Ville Penttinen
bd6ddfcdde Make display modules private 2019-04-09 14:45:05 +03:00
Ville Penttinen
7821c56be7 Move structure to display/structure 2019-04-09 14:45:05 +03:00
Ville Penttinen
027d4d229d Move navigation_target to display/navigation_target 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
Ville Penttinen
dfaebd76ab Add FunctionSignature::from_hir 2019-04-09 14:45:05 +03:00
Ville Penttinen
2fe075f56e Normalize line-endings in display.rs
This changes from CRLF to LF
2019-04-09 14:45:05 +03:00
Ville Penttinen
f4aa15c16b Move FunctionSignature creation to display 2019-04-09 14:45:05 +03:00
Ville Penttinen
ed65e2619a Add no parameter test to call_info 2019-04-09 14:45:05 +03:00
Ville Penttinen
7ba22f1c19 Move FunctionSignature to display, remove write_joined
write_joined is replaced with `join_to_string::join` which provides the
necessary functionality.
2019-04-09 14:45:05 +03:00
Ville Penttinen
84fde47d00 Move test specific things 2019-04-09 14:45:04 +03:00
Ville Penttinen
751b454442 Update test snapshots 2019-04-09 14:45:04 +03:00
Ville Penttinen
0e49abb7fb Refactor CallInfo function signatures to new FunctionSignature type
This is used by CallInfo to create a pretty printed function signature that can
be used with completions and other places as well.
2019-04-09 14:45:04 +03:00
robojumper
2caa690ef6 Rudimentarily autocomplete tuple struct field access 2019-04-06 01:10:48 +02:00
Aleksey Kladov
0de89f786f always produce source for import 2019-04-02 17:58:04 +03:00
Aleksey Kladov
7d6bd5d137 always show token text 2019-04-02 14:49:46 +03:00
Aleksey Kladov
49f13d3a9b fix a panic with glob-import missing a source map 2019-04-02 13:26:09 +03:00
Aleksey Kladov
5287a2506c More future-proof comment kind 2019-04-02 12:18:52 +03:00
Aleksey Kladov
3f3ff2f0f4 fix comment naming 2019-04-02 10:48:59 +03:00
Aleksey Kladov
ae282d8da6 add ast::tokens 2019-04-02 10:23:29 +03:00
bors[bot]
b7e26c32a1 Merge #1067
1067: Take number of arguments at the call-site into account for signature help r=matklad a=kjeremy

Fixes #1065

Co-authored-by: kjeremy <kjeremy@gmail.com>
2019-04-01 11:15:34 +00:00
Aleksey Kladov
9e213385c9 switch to new rowan 2019-04-01 12:06:24 +03:00
kjeremy
80113876e2 Simplify 2019-03-27 11:02:06 -04:00
kjeremy
7b34c4c002 Take number of arguments at the call-site into account for signature help
Fixes #1065
2019-03-27 10:00:51 -04:00
bors[bot]
a82755e241 Merge #1059
1059: Typed ids r=matklad a=matklad

just some type-safety and refactorings. 

closes https://github.com/rust-analyzer/rust-analyzer/issues/1054

bors r+

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-26 16:16:54 +00:00
Aleksey Kladov
e28db444df rename 2019-03-26 19:11:01 +03:00
Wilco Kusee
e03189c110 Move ra_ide_api unit tests 2019-03-25 21:03:32 +01:00
bors[bot]
c4ead49361 Merge #1034
1034: HIR diagnostics API r=matklad a=matklad

This PR introduces diagnostics API for HIR, so we can now start issuing errors and warnings! Here are requirements that this solution aims to fulfill:

* structured diagnostics: rather than immediately rendering error to string, we provide a well-typed blob of data with error-description. These data is used by IDE to provide fixes
* open set diagnostics: there's no single enum with all possible diagnostics, which hopefully should result in better modularity

The `Diagnostic` trait describes "a diagnostic", which can be downcast to a specific diagnostic kind. Diagnostics are expressed in terms of macro-expanded syntax tree: they store pointers to syntax nodes. Diagnostics are self-contained: you don't need any context, besides `db`, to fully understand the meaning of a diagnostic. 

Because diagnostics are tied to the source, we can't store them in salsa. So subsystems like type-checking produce subsystem-local diagnostic (which is a closed `enum`), which is expressed in therms of subsystem IR. A separate step converts these proto-diagnostics into `Diagnostic`, by merging them with source-maps.

Note that this PR stresses type-system quite a bit: we now type-check every function in open files to compute errors!

Discussion on Zulip: https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Diagnostics.20API

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-03-25 11:38:46 +00:00
Aleksey Kladov
309716cffe move tests to where they belong 2019-03-25 14:29:24 +03:00
Sergey Parilin
36cb58f76d structure moved to ra_ide_api
ra_ide_api_light removed completely
2019-03-25 11:41:21 +03:00
Aleksey Kladov
e9af69d9db simplify 2019-03-25 10:56:55 +03:00
Aleksey Kladov
5ce84f3cbc tweak diagnostics API 2019-03-25 10:52:50 +03:00
Aleksey Kladov
c7ffd939f6 more enterprisey diagnostics setup 2019-03-25 10:52:50 +03:00
Aleksey Kladov
7ee2887d1e fixes 2019-03-25 10:52:50 +03:00
Aleksey Kladov
45fbab2b1a check impls as well 2019-03-25 10:52:50 +03:00
Aleksey Kladov
79df62bc74 cleanup 2019-03-25 10:52:50 +03:00
Aleksey Kladov
3fb88e95aa switch modules to new diagnostics 2019-03-25 10:52:50 +03:00
Aleksey Kladov
fcca35969d allow dyn diagnostics 2019-03-25 10:52:12 +03:00
Aleksey Kladov
7e8f17188e diagnostics 2019-03-25 10:52:12 +03:00
Ville Penttinen
4d26bae46d Rename source_edit to source_file_edit to match file_system_edit 2019-03-25 09:13:58 +02:00
Ville Penttinen
b92fcbc956 Further improvements to the SourceChange convenience methods
Rename system_edit to file_system_edit, add more documentation, add
source_file_edit_from to create a SourceChange from `FileId` and `TextEdit`.
2019-03-25 09:03:10 +02:00
Ville Penttinen
22e1c7a112 Add convenience functions to SourceChange for creating single edits 2019-03-24 22:53:41 +02:00
bors[bot]
18a8f48039 Merge #1031
1031: Move most things out of ra_ide_api_light r=matklad a=detrumi

This moves everything except `structure` out of `ra_ide_api_light`. So this PR and #1019 finish up #1009, whichever is merged last should probably remove the `ra_ide_api_light` crate.

Also, `LocalEdit` was removed since it wasn't used any more.

Co-authored-by: Wilco Kusee <wilcokusee@gmail.com>
2019-03-23 17:25:40 +00:00
Wilco Kusee
a3711e08dc Move highlighting and matching_brace 2019-03-23 17:34:49 +01:00
Wilco Kusee
a656b891fb Remove LocalEdit usage 2019-03-23 17:00:49 +01:00
Aleksey Kladov
46a21b07e6 remove obsolete diagnostic 2019-03-23 16:31:11 +03:00
Aleksey Kladov
3f0cf6ebe1 rename persistent hir database -> def database 2019-03-23 15:44:24 +03:00
bors[bot]
331220fee2 Merge #1025
1025: Disable fork feature for proptest r=matklad a=detrumi



Co-authored-by: Wilco Kusee <wilcokusee@gmail.com>
2019-03-23 12:09:07 +00:00
Wilco Kusee
0c15deac76 Move typing to ra_ide_api 2019-03-23 12:11:46 +01:00
Aleksey Kladov
4fd8cfd6ad replace todo with fixme 2019-03-23 11:07:09 +03:00
Wilco Kusee
497934a7b4 Disable fork feature for proptest 2019-03-23 08:57:07 +01:00
bors[bot]
15189bc724 Merge #1021
1021: Wasm dependencies r=matklad a=detrumi

As a first step towards running RA on WASM (see #1007), this tweaks the dependencies somewhat so that projects built using `wasm-pack` can use `ra_ide_api` as a dependency.

There were two problems:
- use of undeclared type or module `MmapInner`
This error occurred because of the `memmap` crate, as a dependency of `fst`
Solution: specify `default-features = false` for the `fst` package (see https://github.com/BurntSushi/fst/issues/70)

- use of undeclared type or module `imp`
This happened in the `wait-timeout` crate ([which uses `Command` under the hood](https://github.com/alexcrichton/wait-timeout/issues/18)), a dependency of `rusty-fork` which is a dependency of `proptest`.
Solution: move `proptest` to dev-dependencies and add `#[cfg(test)]` to the `test_utils` crate.
**Edit:** Oh, that causes trouble with resolving the import when running the tests. Hmm...

Co-authored-by: Wilco Kusee <wilcokusee@gmail.com>
2019-03-22 20:22:37 +00:00
Wilco Kusee
4e6d0933cc
Disable memmap feature in fst dependency 2019-03-22 21:22:03 +01:00
Wilco Kusee
01bca7114c Simplify changes and fix tests 2019-03-22 17:12:32 +01:00
Wilco Kusee
9bd8336c51 Remove LocalEdit usage 2019-03-22 17:12:32 +01:00
Wilco Kusee
58e77660de Move join_lines to ra_ide_api 2019-03-22 17:12:31 +01:00
Sergey Parilin
47c501bcfb Move folding_ranges to ra_ide_api 2019-03-22 16:31:21 +03:00
Sergey Parilin
fda70badf8 line_index and line_index_utils moved to ra_ide_api 2019-03-22 15:24:43 +03:00
Florian Diebold
cbb418ebb8 Rename name field to ctor as well 2019-03-21 22:29:12 +01:00
Florian Diebold
f10f5a81b3 TypeName => TypeCtor 2019-03-21 22:20:03 +01:00
Florian Diebold
8a5fbf4713 Remove the old variants replaced by Ty::Apply 2019-03-21 22:17:00 +01:00
Aleksey Kladov
1b58e3e410 cleanup 2019-03-21 19:21:58 +03:00
Aleksey Kladov
7cae9ddeeb move diagnostics to ide_api 2019-03-21 19:08:54 +03:00
Aleksey Kladov
b931a472c4 move extend selection from ra_ide_api_light to ra_ide_api 2019-03-20 23:52:55 +03:00
Aleksey Kladov
3eb56f7a6a introduce Analysis::from_single_file 2019-03-20 23:38:59 +03:00
Aleksey Kladov
6955e392f8 remove old macro support 2019-03-17 12:53:22 +03:00
Aleksey Kladov
b2a6c17362 remove lower module 2019-03-17 12:52:52 +03:00
Aleksey Kladov
2195d1db6d Replace module_tree with CrateDefMap 2019-03-17 12:49:07 +03: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
Aleksey Kladov
8774067a87 sort navigations to make tests stable 2019-03-14 13:28:45 +03: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
064707c5a0 Use source map 2019-03-06 14:40:42 -05:00
kjeremy
aac421b135 Hover for associated items in patterns 2019-03-06 11:39:11 -05:00
kjeremy
eb3ee7b8e5 Updates 2019-03-05 10:26:36 -05:00
Aleksey Kladov
d1c982d3c7 dont produce giant debug dumps 2019-03-05 17:09:48 +03:00
kjeremy
1578375b89 Make ExpOrPatId private 2019-03-04 09:49:18 -05:00
Jeremy Kolb
79f61dcb0e Format 2019-03-04 08:34:41 -05:00
Jeremy Kolb
e1b59bfe0b Add NavigationTarget::from_impl_item 2019-03-04 08:27:08 -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
Ville Penttinen
1ef2c06131 Allow syntax strings to contain test markers
We simply remove all the CUSTOM_MARKERS before attempting to parse the file.
This allows for the syntax selection to work with most of the test strings.
2019-03-04 09:19:46 +02:00
Ville Penttinen
16ecd276f0 Implement syntax tree support for syntax inside string
This allows us to select a string or portions of it and try parsing it as rust
syntax. This is mostly helpful when developing tests where the test
itself contains some rust syntax as a string.
2019-03-04 09:02:01 +02:00
Ville Penttinen
ac52d9a1f1 Add optional range parameter to SyntaxTreeParams
When range is provided, instead of showing the syntax for the whole file, we'll
show the syntax tree for the given range.
2019-03-03 19:49:50 +02: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
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
Aleksey Kladov
80bb7d86ec align lower module query names 2019-03-02 16:49:06 +03:00