Commit graph

8396 commits

Author SHA1 Message Date
Hannes De Valkeneer
e9d025b618 fixup! feat: add debug code lens
avoid repetition of `--no-run`
2020-03-12 21:28:26 +01:00
Hannes De Valkeneer
a034257e5e fixup! feat: add debug code lens 2020-03-12 21:00:40 +01:00
hdevalke
60b154ff92
Update crates/rust-analyzer/src/main_loop/handlers.rs
use `Vec::new` instead of `Vec::with_capacity(0)`

Co-Authored-By: Veetaha <veetaha2@gmail.com>
2020-03-12 20:56:34 +01:00
Hannes De Valkeneer
e903fd0d97 feat: add debug code lens
Refs #3539
2020-03-11 22:26:47 +01:00
bors[bot]
05b4fc6d79
Merge #3558
3558: Fix parsing of stement-ish binary expressions r=matklad a=matklad

closes #3512



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-11 13:29:36 +00:00
Aleksey Kladov
4a745cc8cf Fix parsing of stement-ish binary expressions
closes #3512
2020-03-11 14:28:18 +01:00
bors[bot]
bddf6b5266
Merge #3557
3557: Continue multiline non-doc comment blocks r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-11 11:58:55 +00:00
Aleksey Kladov
85c30b1915 Continue multiline non-doc comment blocks 2020-03-11 12:58:16 +01:00
Aleksey Kladov
90fe534f03 Split on enter tests 2020-03-11 12:58:16 +01:00
Aleksey Kladov
52da9e90a6 Move on enter to a separate module 2020-03-11 12:58:16 +01:00
bors[bot]
c48dcf7411
Merge #3549
3549: Implement env! macro r=matklad a=edwin0cheng

This PR implements `env!` macro by adding following things:

1. Added `additional_outdirs` settings in vscode. (naming to be bikeshed)
2. Added `ExternSourceId` which is a wrapping for SourceRootId but only used in extern sources. It is because `OUT_DIR` is not belonged to any crate and we have to access it behind an `AstDatabase`.
3. This PR does not implement the `OUT_DIR` parsing from `cargo check`. I don't have general design about this,  @kiljacken could we reuse some cargo watch code for that ?

~~Block on [#3536]~~

PS: After this PR , we (kind of) completed the `include!(concat!(env!('OUT_DIR'),  "foo.rs")` macro call combo. [Exodia Obliterate!](https://www.youtube.com/watch?v=RfqNH3FoGi0)

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-11 10:51:07 +00:00
bors[bot]
7b323b45a1
Merge #3555
3555: Introduce completion test utils r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-11 10:10:49 +00:00
Aleksey Kladov
dad8f1e064 Introduce completion test utils 2020-03-11 11:09:57 +01:00
Aleksey Kladov
9b0b59c5d2 Add a test for disabled argument snippets 2020-03-11 10:39:39 +01:00
bors[bot]
bf77850c81
Merge #3542
3542: Renames work on struct field shorthands r=matklad a=m-n

When renaming either a local or a struct field, struct field shorthands are now renamed correctly.

Happy to refactor this if it doesn't fit the design of the code. Thanks for adding the suggestion of where to start on the issue.

I wasn't sure if I should also look at the behavior of renaming when placing the cursor at the field shorthand; the following describes the behavior with this patch:

```rust
#[test]
fn test_rename_field_shorthand_for_unspecified() {
    // when renaming a shorthand, should we have a way to specify
    // between renaming the field and the local?
    //
    // If not is this the correct default?
    test_rename(
        r#"
struct Foo {
    i: i32,
}
 impl Foo {
    fn new(i: i32) -> Self {
        Self { i<|> }
    }
}
"#,
        "j",
        r#"
struct Foo {
    i: i32,
}
 impl Foo {
    fn new(j: i32) -> Self {
        Self { i: j }
    }
}
"#,
    );
}
```
Resolves #3431

Co-authored-by: Matt Niemeir <matt.niemeir@gmail.com>
2020-03-11 09:22:09 +00:00
Matt Niemeir
13ccbb2919 find_usages limited to actual usages again 2020-03-10 22:27:38 -05:00
Edwin Cheng
6ea7c31915 Add extern source 2020-03-11 11:04:02 +08:00
bors[bot]
0714a065d5
Merge #3552
3552: Fix completion with a partially unknown type r=matklad a=flodiebold

To test whether the receiver type matches for the impl, we unify the given self
type (in this case `HashSet<{unknown}>`) with the self type of the
impl (`HashSet<?0>`), but if the given self type contains Unknowns, they won't
be unified with the variables in those places. So we got a receiver type that
was different from the expected one, and concluded the impl doesn't match.

The fix is slightly hacky; if after the unification, our variables are still
there, we make them fall back to Unknown. This does make some sense though,
since we don't want to 'leak' the variables.

Fixes #3547.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-03-10 20:35:45 +00:00
Florian Diebold
adc7b8ea2d Fix completion with a partially unknown type
To test whether the receiver type matches for the impl, we unify the given self
type (in this case `HashSet<{unknown}>`) with the self type of the
impl (`HashSet<?0>`), but if the given self type contains Unknowns, they won't
be unified with the variables in those places. So we got a receiver type that
was different from the expected one, and concluded the impl doesn't match.

The fix is slightly hacky; if after the unification, our variables are still
there, we make them fall back to Unknown. This does make some sense though,
since we don't want to 'leak' the variables.

Fixes #3547.
2020-03-10 21:02:13 +01:00
bors[bot]
e5df8c4028
Merge #3551
3551: Move FeatureFlags r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-10 17:56:44 +00:00
Aleksey Kladov
14094e4477 Move FeatureFlags 2020-03-10 18:56:15 +01:00
Aleksey Kladov
bf582e77d6 Pull completion options up to the rust-analyzer 2020-03-10 18:47:09 +01:00
Aleksey Kladov
2347c03dcd Introduce CompletionOptions 2020-03-10 18:40:22 +01:00
bors[bot]
daf3609654
Merge #3550
3550: Force latest stable r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-03-10 17:34:37 +00:00
kjeremy
dda6ce6f13 Force latest stable 2020-03-10 13:31:13 -04:00
Edwin Cheng
5a292309c5 Add and fix tests 2020-03-11 01:06:01 +08:00
Edwin Cheng
e00a1e0b79 Setup Env in world 2020-03-11 01:06:01 +08:00
Edwin Cheng
22f064cca7 Add resolve_extern_path in DB 2020-03-11 01:06:01 +08:00
Edwin Cheng
8153a0b3ef Add ExternSourceId and env functions 2020-03-11 01:06:01 +08:00
Edwin Cheng
c1db5d26a0 Add additional_outdirs in config 2020-03-11 01:06:01 +08:00
bors[bot]
6b9d66bbee
Merge #3536
3536: Add get and set for `Env` r=matklad a=edwin0cheng

This PR add three things :

1. Add `get` and `set` in `Env`.
2. Implement fixture meta for `with_single_file`. 
3. Add `env` meta in fixture.

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-10 16:46:21 +00:00
Aleksey Kladov
34bc0f4f55
Merge pull request #3506 from slyngbaek/3183
Next steps in assoc item completion #3183
2020-03-10 17:45:57 +01:00
Edwin Cheng
95ba7da1ab Check only one fixture 2020-03-11 00:45:03 +08:00
Edwin Cheng
773f3afd36 Add fixture meta for single file fixture 2020-03-11 00:45:03 +08:00
bors[bot]
d53627beba
Merge #3546
3546: ⬆️ fst r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-10 14:04:02 +00:00
Aleksey Kladov
59a3ec5f33 ⬆️ fst 2020-03-10 15:03:32 +01:00
bors[bot]
d563e3868b
Merge #3545
3545: Remove c2-chacha dependency r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-03-10 13:52:39 +00:00
kjeremy
ba0cd6edc8 Remove c2-chaha dependency 2020-03-10 09:51:27 -04:00
Matt Niemeir
ce8121bd65 Renaming a local renames struct field shorthand 2020-03-09 22:14:17 -05:00
Matt Niemeir
a9b6aec8a7 Struct field rename renames field in constructor field shorthand 2020-03-09 22:14:17 -05:00
Steffen Lyngbaek
f67e6a850e Switch to explicit offsets for impl_def
Blacklists are prone to more errors
2020-03-09 13:02:09 -07:00
bors[bot]
530ff9f57f
Merge #3533
3533: Updates insta to 0.15.0 and bumps console to 0.10.0 r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-03-09 14:38:20 +00:00
bors[bot]
6f4762f310
Merge #3532
3532: Fix SelectionRange return type r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-03-09 14:29:59 +00:00
kjeremy
d1e9f0af04 Updates insta to 0.15.0 and bumps console to 0.10.0 2020-03-09 10:28:30 -04:00
kjeremy
c981c8b0d0 Fix SelectionRange return type 2020-03-09 10:17:16 -04:00
Aleksey Kladov
bf3eef8897 Set extension version during release 2020-03-09 14:24:00 +01:00
Aleksey Kladov
5770fa71fa Disable jemalloc, it doesn't work out of the box with musl 2020-03-09 13:55:14 +01:00
bors[bot]
07051c0607
Merge #3531
3531: Use jemalloc for linux builds r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-09 11:38:43 +00:00
Aleksey Kladov
264ce7b722 Use jemalloc for linux builds 2020-03-09 12:35:31 +01:00
bors[bot]
5da29058fc
Merge #3530
3530: Fix quotes r=matklad a=matklad

closes #3501



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-09 11:31:59 +00:00