Marco Groppo
e85ee60c42
Initial support for lang items.
2019-04-20 00:10:19 +02:00
Aleksey Kladov
c4a5aa45dc
add a couple of profiling points
2019-04-15 01:10:07 +03:00
Florian Diebold
4f8a49f43c
Refactor method candidate generation a bit
...
This fixes the order in which candidates are chosen a bit (not completely
though, as the ignored test demonstrates), and makes autoderef work with trait
methods. As a side effect, this also makes completion of trait methods work :)
2019-04-14 21:53:35 +02:00
Florian Diebold
413c87f155
Get substs for trait refs in impl blocks
2019-04-14 11:28:53 +02:00
Aleksey Kladov
62d01dd4df
hide resolver
2019-04-13 11:00:15 +03:00
Aleksey Kladov
f4a94e74bc
fold ScopeWithSyntax into SourceAnalyzer
2019-04-13 10:49:01 +03:00
Aleksey Kladov
cec67b2b65
obsolete fixm
2019-04-13 09:50:02 +03:00
Aleksey Kladov
3aae223d93
hide some scopes
2019-04-13 09:31:03 +03:00
Aleksey Kladov
0fd93bc14a
use really correct resolver for expressions
2019-04-13 00:44:47 +03:00
Aleksey Kladov
20013de2ab
fix typo
2019-04-11 17:15:20 +03:00
Aleksey Kladov
ebb0c377f0
remove resolver from CompletonContext
2019-04-11 16:49:35 +03:00
Aleksey Kladov
5471c1ef4b
generalize SourceAnalyzer to handle all defs with bodies
2019-04-11 16:37:29 +03:00
Aleksey Kladov
07cc047b4f
minimize the API
2019-04-11 16:29:33 +03:00
Aleksey Kladov
b6809b6695
rename
2019-04-11 16:29:33 +03:00
Aleksey Kladov
6c2ba945ed
reduce visibility
2019-04-11 16:29:33 +03:00
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