Commit Graph

518 Commits

Author SHA1 Message Date
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
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
Florian Diebold
0a20770f46 Some renamings for clarity 2019-07-14 18:22:47 +02: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
Aleksey Kladov
e40494c6c1 account for dependencies when showing memory usage 2019-07-12 18:04:48 +03:00
Florian Diebold
9afbf2dff4 Unify normalize and implements to simplify code 2019-07-08 21:47:37 +02:00
funkill2
ca42f621c6
inline snapshot in complete_postfix 2019-07-07 13:52:25 +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
Jeremy Kolb
001e34e6e3 Clippy trivially_copy_pass_by_ref 2019-07-05 12:02:32 -04:00
Shotaro Yamada
d0e9cd2bc6 Fix clippy::redundant_clone 2019-07-05 12:45:58 +09:00
Jeremy Kolb
4ad9e986ad Some clippy fixes for 1.36 2019-07-04 17:43:00 -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
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
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
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
Florian Diebold
d37f960dfa Complete associated methods on enums (and unions) as well 2019-06-29 12:40:01 +02:00
Florian Diebold
5fd3df0868 Deduplicate method candidates 2019-06-29 12:19:03 +02:00
Ekaterina Babshukova
46c453d0d3 show macros in file structure 2019-06-29 00:08:02 +03:00
Aleksey Kladov
6e2369938a make sure that CrateDefMap is independent from syntax 2019-06-26 21:50:42 +03:00
bors[bot]
f6340022c1 Merge #1429
1429: Add box postfix completion r=matklad a=kanru



Co-authored-by: Kan-Ru Chen <kanru@kanru.info>
2019-06-24 10:21:36 +00:00
Aleksey Kladov
8109ebb101 Add SourceRoot::is_library, in preparation for salsa's durability 2019-06-24 12:35:07 +03:00
Kan-Ru Chen
bf7a35294d Add box postfix completion 2019-06-23 22:18:25 +09:00
Aleksey Kladov
9ff872329a don' collect macros 2019-06-20 16:48:10 +03:00
Aleksey Kladov
0caec7d250 rename XSignature -> XData 2019-06-18 20:20:08 +03:00
Aleksey Kladov
6314e62cfb add analysis-bench to benchmark incremental analysis
Can be used like this:

```
$ cargo run --release -p ra_cli -- \
  analysis-bench ../chalk/ \
  --complete ../chalk/chalk-engine/src/logic.rs:94:0

loading: 225.970093ms

from scratch:   8.492373325s
no change:      445.265µs
trivial change: 95.631242ms
```

Or like this:

```
$ cargo run --release -p ra_cli -- \
  analysis-bench ../chalk/ \
  --highlight ../chalk/chalk-engine/src/logic.rs

loading: 209.873484ms

from scratch:   9.504916942s
no change:      7.731119ms
trivial change: 124.984039ms
```

"from scratch" includes initial analysis of the relevant bits of the
project

"no change" just asks the same question for the second time. It
measures overhead on assembling the answer outside of salsa.

"trivial change" doesn't do an actual salsa change, it just advances
the revision. This test how fast is salsa at validating things.
2019-06-16 19:45:05 +03:00
bors[bot]
b81caed43f Merge #1408
1408: Associated type basics & Deref support r=matklad a=flodiebold

This adds the necessary Chalk integration to handle associated types and uses it to implement support for `Deref` in the `*` operator and autoderef; so e.g. dot completions through an `Arc` work now.

It doesn't yet implement resolution of associated types in paths, though. Also, there's a big FIXME about handling variables in the solution we get from Chalk correctly.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2019-06-16 12:00:41 +00:00
Florian Diebold
9c5e7dd849 Implement autoderef using the Deref trait
- add support for other lang item targets, since we need the Deref lang item
2019-06-15 18:21:23 +02:00
Aleksey Kladov
b0be4207d0 reuse AnalysisHost in batch analysis 2019-06-15 16:29:23 +03:00
Aleksey Kladov
b8cae2cf8f check for cancellation when executing queries
Note that we can't just remove CheckCanceled trait altogether:
sometimes it's useful to check for cancellation while the query is
running! We do this, for example, in the name resolution fixed-point
loop.
2019-06-12 18:47:55 +03:00
bors[bot]
03645c5576 Merge #1382
1382: use salsa's LRU for syntax trees r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2019-06-12 10:36:47 +00:00
Aleksey Kladov
fed52706de make LRU cache configurable 2019-06-12 13:36:24 +03:00
Aleksey Kladov
15668119de make LRU_CAP configurable for batch db 2019-06-12 13:25:30 +03:00
Aleksey Kladov
fc2658b074 use salsa's LRU for syntax trees 2019-06-12 13:25:30 +03:00
bors[bot]
98020ef2f3 Merge #1394
1394: Fix hover for pat that shadows items r=matklad a=sinkuu

```rust
fn x() {}

fn y() {
    let x = 0i32;
    x; // hover on `x` is expected to be `i32`, but the actual result was `fn x()`
}
```

This was because: if [`res.is_empty()`](656a0fa9f9/crates/ra_ide_api/src/hover.rs (L205)), it fallbacks to "index based approach" and adds `fn x()` to `res`, which makes [`res.extend(type_of)` below](656a0fa9f9/crates/ra_ide_api/src/hover.rs (L260-L266)) not happen.

Co-authored-by: Shotaro Yamada <sinkuu@sinkuu.xyz>
2019-06-11 17:24:28 +00:00
Aleksey Kladov
ff6f6b3a52 move docs under code model 2019-06-11 18:28:51 +03:00