Commit Graph

506 Commits

Author SHA1 Message Date
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
Aleksey Kladov
c4512fadb1 remove inherent source impls 2019-06-11 18:28:51 +03:00
Aleksey Kladov
dd63f17027 use Source for module, part 2 2019-06-11 18:28:51 +03:00
Aleksey Kladov
0145d06515 use Source for module, part 1 2019-06-11 18:28:51 +03:00
Aleksey Kladov
178d8e96b5 use Source for StructField 2019-06-11 18:28:51 +03:00
Aleksey Kladov
8b94b429e5 use Source for MacroDef 2019-06-11 18:28:51 +03:00
Aleksey Kladov
a6e339e822 use Source for impl block 2019-06-11 18:28:51 +03:00
Aleksey Kladov
f411c2988d use Source for Trait 2019-06-11 18:28:51 +03:00
Aleksey Kladov
5e6213b516 simplify 2019-06-11 18:28:51 +03:00
Aleksey Kladov
f2ccc54468 use Source for TypeAlias 2019-06-11 18:28:51 +03:00
Aleksey Kladov
647c8f3df8 reduce duplication in hover 2019-06-11 18:28:51 +03:00
Aleksey Kladov
46bc8675ed use Source for statics and consts 2019-06-11 18:28:51 +03:00
Aleksey Kladov
4f94af3c4a use Source for Function 2019-06-11 18:28:51 +03:00