Commit Graph

3044 Commits

Author SHA1 Message Date
Aleksey Kladov
0343c4a815 migrate ra_assists to the new AST 2019-07-19 13:16:25 +03:00
Aleksey Kladov
e2b28f5bb8 migrate ra_hir to the new rowan 2019-07-19 13:16:25 +03:00
Aleksey Kladov
7e02aa0eff migrate ra_fmt to new rowan 2019-07-19 13:16:24 +03:00
Aleksey Kladov
08fd402ef2 migrate mbe to the new rowan 2019-07-19 13:16:24 +03:00
Aleksey Kladov
d402974aa0 migrate ra_syntax to the new rowan API 2019-07-19 13:16:24 +03:00
Aleksey Kladov
df33e7685b use Parse in mbe 2019-07-18 23:19:04 +03:00
Aleksey Kladov
a6224f3620 make Parse generic 2019-07-18 22:55:04 +03:00
bors[bot]
abe72424a6 Merge #1547
1547: cleanup imports r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-18 17:17:01 +00:00
Aleksey Kladov
1edec77e58 cleanup imports 2019-07-18 20:16:33 +03:00
Aleksey Kladov
2c4c233ba8 prettier colors 2019-07-18 19:57:13 +03:00
bors[bot]
8a6d270ecc Merge #1537
1537: Less magic completions r=matklad a=marcogroppo

Restrict `if`, `not` and `while` postfix magic completions to boolean expressions and expressions of an unknown type.

(this may be controversial, marking as draft for this reason)

See the discussion in #1526.

Co-authored-by: Marco Groppo <marco.groppo@gmail.com>
2019-07-18 16:30:19 +00:00
Ekaterina Babshukova
4abe03879b highlight mutable variables differently 2019-07-18 18:52:50 +03:00
Aleksey Kladov
0fb4b896e2 use more correct phantom types for ptrs 2019-07-18 18:13:32 +03:00
Marco Groppo
d1608538de Restrict some postfix completions to bool and unknown expr.
Restrict `if` and `while` postfix completions to boolean expressions and
expressions of an unknown type.
2019-07-17 21:02:36 +02:00
Jeremy A. Kolb
5e9198f809 jemallocator 0.3 2019-07-17 10:58:17 -04:00
Kirill Bulatov
1037242e6e Add "Run" lens for binary runnables 2019-07-16 15:02:11 +03:00
kjeremy
1fcc002677 cargo update 2019-07-15 15:07:11 -04:00
Florian Diebold
c8284d8424 Switch to Chalk master, without fuel 2019-07-15 08:49:55 +02:00
Florian Diebold
dcb0c02e3a Remove blacklist, instead mark Sized as non-enumerable
This seems to be enough to prevent hanging in rust-analyzer, Chalk and the rustc
repo.
2019-07-15 08:49:55 +02:00
Florian Diebold
e2bce9e7eb Cargo update, including updating Chalk 2019-07-14 18:22:47 +02:00
Florian Diebold
1e60ba8927 Have InferenceContext contain an InferenceResult instead of duplicating all fields 2019-07-14 18:22:47 +02:00
Florian Diebold
0a20770f46 Some renamings for clarity 2019-07-14 18:22:47 +02:00
Alexander Andreev
9c75f30272 Fixed request comments 2019-07-14 09:24:18 +03:00
Alexander Andreev
22b863c534 Fixed comments 2019-07-13 21:51:20 +03:00
Alexander Andreev
1f0e9c149f More resolution modules with attribute path
#1211
2019-07-13 21:26:04 +03:00
Ekaterina Babshukova
2a1e11b36f complete fields in enum variants 2019-07-12 20:31:49 +03:00
Aleksey Kladov
deab4caa7b make Parse fields private
this is in preparation for the new rowan API
2019-07-12 19:41:13 +03:00
bors[bot]
2e466bb365 Merge #1523
1523: account for dependencies when showing memory usage r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-12 15:05:28 +00:00
Aleksey Kladov
e40494c6c1 account for dependencies when showing memory usage 2019-07-12 18:04:48 +03:00
bors[bot]
fa3716efe6 Merge #1520
1520: Ignore workspace/didChangeConfiguration notifications. r=matklad a=bolinfest

If the client happens to send a `workspace/didChangeConfiguration`
notification, it is nicer if rust-analyzer can just ignore it rather than
crash with an "unhandled notification" error.

Co-authored-by: Michael Bolin <bolinfest@gmail.com>
2019-07-11 09:13:10 +00:00
Michael Bolin
e81a47b8eb Remove executeCommandProvider: apply_code_action.
This appears to have been introduced ages ago in
be742a5877
but has since been removed.

As it stands, it is problematic if multiple instances of the
rust-analyzer LSP are launched during the same VS Code session because
VS Code complains about multiple LSP servers trying to register the
same command.

Most LSP servers workaround this by parameterizing the command by the
process id. For example, this is where `rls` does this:

ff0b9057c8/rls/src/server/mod.rs (L413-L421)

Though `apply_code_action` does not seems to be used, so it seems better
to delete it than to parameterize it.
2019-07-10 22:49:35 -07:00
Michael Bolin
a814883cd4 Ignore workspace/didChangeConfiguration notifications. 2019-07-10 20:56:16 -07:00
Ekaterina Babshukova
895597d567 move whitespace manipulation inside AstEditor 2019-07-10 22:03:00 +03:00
Pascal Hertleif
6e87065968 Make clippy a bit happier
Random drive-by fix. I honestly blame rust-analyzer itself on this,
because I set its watch mode to use `cargo clippy` 🤷
2019-07-10 17:05:39 +02:00
Pascal Hertleif
d0ff53de2d Resolve a FIXME
Now that we are using a newer smol_str release this can be simplified :)
2019-07-10 17:04:38 +02:00
Aleksey Kladov
61135d4d4d fix profile name 2019-07-09 11:13:15 +03:00
bors[bot]
f59cd1a4a0 Merge #1515
1515: Trait environment r=matklad a=flodiebold

This adds the environment, i.e. the set of `where` clauses in scope, when solving trait goals. That means that e.g. in
```rust
fn foo<T: SomeTrait>(t: T) {}
```
, we are able to complete methods of `SomeTrait` on the `t`. This affects the trait APIs quite a bit (since every method that needs to be able to solve for some trait needs to get this environment somehow), so I thought I'd do it rather sooner than later ;)

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-07-09 07:50:18 +00:00
bors[bot]
35f28c538a Merge #1512
1512: Infer ? operator r=unrealhoang a=unrealhoang

Logical continuation of https://github.com/rust-analyzer/rust-analyzer/pull/1501

cc https://github.com/rust-analyzer/rust-analyzer/issues/1426

Co-authored-by: Unreal Hoang <unrealhoang@gmail.com>
2019-07-09 00:41:03 +00:00
Unreal Hoang
9a0d4b16b7
beautify tests 2019-07-09 09:27:03 +09:00
Florian Diebold
9afbf2dff4 Unify normalize and implements to simplify code 2019-07-08 21:47:37 +02:00
Florian Diebold
15862fc041 Use environment for associated type normalization as well 2019-07-08 21:20:17 +02:00
Florian Diebold
b1b12072ed Start handling environment in trait resolution
I.e. if we are inside a function with some where clauses, we assume these where
clauses hold.
2019-07-08 21:20:17 +02:00
Florian Diebold
638100dc8b Refactor a bit & introduce Environment struct 2019-07-08 21:20:17 +02:00
Marco Groppo
95d78a8d8d Look for the fXX_runtime lang items during method resolution. 2019-07-08 20:37:29 +02:00
Unreal Hoang
741fc8fbfc
use namespaced consts for KnownName 2019-07-09 01:00:47 +09:00
Shotaro Yamada
a426de60ad Remove unused dependencies 2019-07-09 00:28:00 +09:00
Unreal Hoang
944f71afc6
projection over std::ops::Try::Ok to infer try/? 2019-07-09 00:19:09 +09:00
Aleksey Kladov
e075e096cf don't send LocationLink unless the client opts-in
closes #1474
2019-07-08 14:09:38 +03:00
Aleksey Kladov
b042faeb64 simplify 2019-07-08 13:47:02 +03:00
Aleksey Kladov
227bc0b6d4 add try_conv_with_to_vec 2019-07-08 13:39:16 +03:00
bors[bot]
5ce2b4819e Merge #1504
1504: Simplify LSP handlers r=matklad a=kjeremy

Takes advantage of protocol inheritance via composition and simplifies some responses via the `From`/`Into` traits.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-07-08 09:55:23 +00:00
Muhammad Mominul Huque
09b72489dd
cargo format 2019-07-08 04:09:35 +06:00
Muhammad Mominul Huque
012fec54dc
Constify KnownName's 2019-07-08 03:29:38 +06:00
Jeremy Kolb
9c6e93cd6c Simplify responses by using into() 2019-07-07 17:28:21 -04:00
Jeremy Kolb
3f44aaf363 use flatten branch of lsp-types 2019-07-07 14:13:13 -04:00
bors[bot]
1b38ca3b87 Merge #1501
1501: Infer for loop variable r=flodiebold a=unrealhoang

My take on https://github.com/rust-analyzer/rust-analyzer/issues/1425

Co-authored-by: Unreal Hoang <unrealhoang@gmail.com>
2019-07-07 15:20:09 +00:00
bors[bot]
6c31f5b0a7 Merge #1499
1499: processing attribute #[path] of module  r=matklad a=andreevlex

support two cases
- simple name file `foo.rs`
- declaration in mod.rs

#1211 

Co-authored-by: Alexander Andreev <andreevlex.as@gmail.com>
2019-07-07 13:48:58 +00:00
Unreal Hoang
f7cd40d830
add projection to infer for loop variable 2019-07-07 22:26:51 +09:00
Alexander Andreev
1c582be63b Moved module resolution test in mods.rs 2019-07-07 16:06:54 +03:00
funkill2
ca42f621c6
inline snapshot in complete_postfix 2019-07-07 13:52:25 +03:00
Alexander Andreev
8579a9b834 Added support attribute path in resolusion module fn 2019-07-06 21:54:21 +03:00
Florian Diebold
f854a29c9a Make EnumVariant a GenericDef and simplify some code 2019-07-06 17:43:13 +02:00
Florian Diebold
065d398701 Add trait obligations for where clauses when calling functions/methods
E.g. if we call `foo<T: Into<u32>>(x)`, that adds an obligation that `x:
Into<u32>`, etc.
2019-07-06 17:34:05 +02:00
Alexander Andreev
35a0f04128 Added extract path attribute for current module
#1211
2019-07-06 14:04:56 +03:00
bors[bot]
a9dcd2cdca Merge #1495
1495: use correct file for diagnostics r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-05 16:43:23 +00:00
Aleksey Kladov
0b5e399190 use correct file for diagnostics
closes #1475
2019-07-05 19:40:02 +03:00
bors[bot]
3775e5e27d Merge #1494
1494: properly restrict diagnostics to a single file r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-05 16:30:38 +00:00
Aleksey Kladov
fd30ec406b properly restrict diagnostics to a single file 2019-07-05 19:27:20 +03:00
Jeremy Kolb
001e34e6e3 Clippy trivially_copy_pass_by_ref 2019-07-05 12:02:32 -04:00
bors[bot]
ec6f71576a Merge #1491
1491: More clippy r=matklad a=kjeremy

A few more clippy changes.

I'm a little unsure of the second commit. It's the trivially_copy_pass_by_ref lint and there are a number of places in the code we could use it if it makes sense.

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-07-05 14:19:12 +00:00
Jeremy Kolb
98d769a799 readability 2019-07-05 10:18:01 -04:00
Shotaro Yamada
d0e9cd2bc6 Fix clippy::redundant_clone 2019-07-05 12:45:58 +09:00
Jeremy Kolb
1a950cdbcf &self -> self
https://rust-lang.github.io/rust-clippy/master/index.html#trivially_copy_pass_by_ref
2019-07-04 23:01:40 -04:00
Jeremy Kolb
6b4ec73b7e Clippy changes 2019-07-04 23:00:00 -04:00
Jeremy Kolb
9438bbc75a Formatting again 2019-07-04 19:31:06 -04:00
Jeremy Kolb
b4c0c7f79c Symplify by using into() 2019-07-04 19:08:08 -04:00
Jeremy Kolb
e7fb6c83cc Formatting 2019-07-04 17:43:19 -04:00
Jeremy Kolb
4ad9e986ad Some clippy fixes for 1.36 2019-07-04 17:43:00 -04:00
Jeremy Kolb
a394c04bca Fix formatting 2019-07-04 16:58:52 -04:00
Jeremy Kolb
ad4276ac05 Change default() 2019-07-04 16:57:52 -04:00
Jeremy Kolb
9bfdab7089 Update to lsp-types 0.58.0 2019-07-04 16:57:52 -04:00
bors[bot]
cf8e59ddd8 Merge #1485
1485: rand 0.7.0 r=matklad a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2019-07-04 20:32:52 +00:00
bors[bot]
cacdb0eab8 Merge #1486
1486: allow rustfmt to reorder imports r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-07-04 20:09:32 +00:00
Aleksey Kladov
1834bae5b8 allow rustfmt to reorder imports
This wasn't a right decision in the first place, the feature flag was
broken in the last rustfmt release, and syntax highlighting of imports
is more important anyway
2019-07-04 23:09:09 +03:00
Jeremy Kolb
1e7e7afb61 rand 0.7.0 2019-07-04 15:16:06 -04:00
bors[bot]
4e8664d9d3 Merge #1478
1478: [WIP] Added resolve submodules with raw name r=matklad a=andreevlex

#1211

Co-authored-by: Alexander Andreev <andreevlex.as@gmail.com>
2019-07-03 19:29:21 +00:00
Alexander Andreev
6263aa13d0 Fixed request changes 2019-07-03 22:17:43 +03:00
Alexander Andreev
02e9e46ed6 Move resolve raw name in name.rs
Added test for check module resolution with raw name
2019-07-03 22:01:41 +03:00
Alexander Andreev
018bf3d7b1 Added resolve submodules with raw name
#1211
2019-07-03 17:37:56 +03:00
Ekaterina Babshukova
e0e42095db extend add_impl_members to constants and types 2019-07-03 16:17:18 +03:00
Shotaro Yamada
546442df68 Add completion for type aliases 2019-07-03 03:08:39 +09:00
funkill2
c596cd133c
remove snapshot files 2019-07-02 00:52:03 +03:00
funkill2
532aaba234
inline snapshots 2019-07-02 00:51:18 +03:00
Aleksey Kladov
e7164e6aeb put source maps first for better stats 2019-06-30 16:35:40 +03:00
Aleksey Kladov
6686521040 collect more macros, they are heavy 2019-06-30 15:03:23 +03:00
Aleksey Kladov
d70520eb38 print memory usage for queries 2019-06-30 14:49:45 +03:00
Aleksey Kladov
18a1e092e9 Move memory usage statistics to ra_prof 2019-06-30 13:30:17 +03:00
Ryan Cumming
2959aa446e Remove parse error on array initializer attributes
This is actually allowed by the `rustc` parser but most attributes will
fail later due to attributes on expressions being experimental.
2019-06-30 19:55:50 +10:00
Ryan Cumming
b01496538c Support attributes on array members
Array members are allow to have attributes such as `#[cfg]`.

This is a bit tricky as we don't know if the first expression is an
initializer or a member until we encounter a `;`. This reuses a trick
from `stmt` where we remember if we saw an attribute and then raise an
error if the first expression ends up being an initializer.

This isn't perfect as the error isn't correctly located on the attribute
or initializer; it ends up immediately after the `;`.
2019-06-30 18:36:54 +10:00
bors[bot]
27df89f47d Merge #1456
1456: Deduplicate method candidates r=matklad a=flodiebold

With trait method completion + autoderef, we were getting a lot of duplicates, which was really annoying...

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-06-29 11:12:51 +00:00