Commit graph

5526 commits

Author SHA1 Message Date
bors[bot]
7bbdca6182
Merge #3564
3564: Better handling of a few kinds of cargo/clippy diagnostics r=matklad a=kiljacken

This was initially supposed to just be a fix for #3433, but I caught a few things that ended up being useful as well.

This PR primarily makes us handle multi-edit fix suggestions properly. Instead of just applying the first fix we apply all the parts of the fix in a single action.

Second up, this PR handles diagnostics with multiple primary spans, f.x. the unused import diagnostic from rustc:
![image](https://user-images.githubusercontent.com/209321/76531793-03269480-6476-11ea-9180-41c0ea705553.png)

The LSP doesn't handle this too well, as it only support a single complete range for each diagnostic, so we get duplicate messages in the problem panel of VSCode:
![image](https://user-images.githubusercontent.com/209321/76531901-29e4cb00-6476-11ea-9746-cd57f8974b85.png)

However, I feel like the improved visual aspect in-editor outweighs the duplication in the problem panel. I'm open to not including the second commit if anybody really doesn't like the idea of duplicate diagnostics in the problem pane.

Fixes #3433
Fixes #3257

Co-authored-by: Emil Lauridsen <mine809@gmail.com>
2020-03-12 14:46:42 +00:00
Aleksey Kladov
afd64ef4f7
Merge pull request #3562 from FireofGods/display_for_node
Add `std::fmt::Display` as a supertrait for `AstNode`
2020-03-12 15:40:53 +01:00
Emil Lauridsen
98e8ad5e60 Handle diagnostics with multiple primary spans 2020-03-12 15:24:20 +01:00
Emil Lauridsen
637c795b3c Correctly handle multi-line fixes from cargo/clippy 2020-03-12 15:01:53 +01:00
Steffen Lyngbaek
58248e24cd Switch from Vec<InlayKind> to object with props
- Instead of a single object type, use several individual nested types
  to allow toggling from the settings GUI
- Remove unused struct definitions
- Install and test that the toggles work
2020-03-11 20:14:39 -07:00
Hannes De Valkeneer
e903fd0d97 feat: add debug code lens
Refs #3539
2020-03-11 22:26:47 +01:00
Fireassember
31eec5e80c implementing Display for enums too. 2020-03-11 22:54:24 +02:00
Edwin Cheng
8f7703b006 Update comment
Co-Authored-By: bjorn3 <bjorn3@users.noreply.github.com>
2020-03-12 02:00:56 +08:00
Edwin Cheng
8c159b54e9 Add test on hover 2020-03-11 23:14:15 +08:00
Edwin Cheng
759bcea96d Implement dummy assert macro 2020-03-11 23:08:12 +08:00
Aleksey Kladov
4a745cc8cf Fix parsing of stement-ish binary expressions
closes #3512
2020-03-11 14:28:18 +01: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
Steffen Lyngbaek
974ed7155a Deduplicate some Inlay definitions
- Remove match conversion for InlayKind since we're using remote
2020-03-10 18:59:49 -07:00
Steffen Lyngbaek
cfb48df149 Address Issues from Github
- Updated naming of config
- Define struct in ra_ide and use remote derive in rust-analyzer/config
- Make inlayConfig type more flexible to support more future types
- Remove constructor only used in tests
2020-03-10 14:36:01 -07:00
Steffen Lyngbaek
e98aff109a Parameter inlay hint separate from variable type inlay? #2876
Add setting to allow enabling either type inlay hints or parameter
inlay hints or both. Group the the max inlay hint length option
into the object.

- Add a new type for the inlayHint options.
- Add tests to ensure the inlays don't happen on the server side
2020-03-10 14:33:45 -07: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
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
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
Aleksey Kladov
59a3ec5f33 ⬆️ fst 2020-03-10 15:03:32 +01: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
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
34b0409298 Print crate name in profil 2020-03-09 11:55:43 +01:00
bors[bot]
a6133206d1
Merge #3527
3527: Simplify r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-09 10:19:26 +00:00
Aleksey Kladov
100cbc57ce Simplify 2020-03-09 11:19:03 +01:00
Aleksey Kladov
d0d5aa935b Simplify 2020-03-09 11:17:39 +01:00
Aleksey Kladov
254ef1860b Minimize API 2020-03-09 11:16:06 +01:00
Aleksey Kladov
0320ebdd10 Use Index for CrateGraph 2020-03-09 11:11:59 +01:00
bors[bot]
0dbd8ff59b
Merge #3526
3526: Silence "file out of workspace" errors r=matklad a=matklad

We really should fix this limitation of the VFS, but it's some way off
at the moment, so let's just silence the user-visible error for now.

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-09 09:59:02 +00:00
Aleksey Kladov
43bc03faf0 Silence "file out of workspace" errors
We really should fix this limitation of the VFS, but it's some way off
at the moment, so let's just silence the user-visible error for now.
2020-03-09 10:54:14 +01:00
bors[bot]
57c27f9139
Merge #3519
3519: Show mod path on hover r=matklad a=SomeoneToIgnore

Closes #1064

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-03-09 09:33:46 +00:00
Kirill Bulatov
e1aa96f2c5 Less abstract CrateData api 2020-03-09 11:26:46 +02:00
bors[bot]
beb4f49541
Merge #3513
3513: Completion in macros r=matklad a=flodiebold

I experimented a bit with completion in macros. It's kind of working, but there are a lot of rough edges.

 - I'm trying to expand the macro call with the inserted fake token. This requires some hacky additions on the HIR level to be able to do "hypothetical" expansions. There should probably be a nicer API for this, if we want to do it this way. I'm not sure whether it's worth it, because we still can't do a lot if the original macro call didn't expand in nearly the same way. E.g. if we have something like `println!("", x<|>)` the expansions will look the same and everything is fine; but in that case we could maybe have achieved the same result in a simpler way. If we have something like `m!(<|>)` where `m!()` doesn't even expand or expands to something very different, we don't really know what to do anyway.
 - Relatedly, there are a lot of cases where this doesn't work because either the original call or the hypothetical call doesn't expand. E.g. if we have `m!(x.<|>)` the original token tree doesn't parse as an expression; if we have `m!(match x { <|> })` the hypothetical token tree doesn't parse. It would be nice if we could have better error recovery in these cases.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-03-09 08:56:58 +00:00
bors[bot]
30062da628
Merge #3516
3516: Handle visibility in more cases in completion r=matklad a=flodiebold

This means we don't show private items when completing paths or method calls.

We might want to show private items if we can edit their definition and provide a "make public" assist, but I feel like we'd need better sorting of completion items for that, so they can be not shown or sorted to the bottom by default. Until then, they're usually more of a distraction to me.

Co-authored-by: Florian Diebold <flodiebold@gmail.com>
2020-03-09 08:50:19 +00:00
bors[bot]
0363c9495a
Merge #3518
3518: Add parse_to_token_tree r=matklad a=edwin0cheng

This PR introduce a function for parsing `&str` to `tt::TokenTree`:

```rust
// Convert a string to a `TokenTree`
pub fn parse_to_token_tree(text: &str) -> Option<(tt::Subtree, TokenMap)> {
````

Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-09 08:43:07 +00:00
bors[bot]
7ac99aad28
Merge #3524
3524: Ignore client-specific notifications r=matklad a=matklad

closes #3523



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-09 08:27:31 +00:00
Aleksey Kladov
8aeab8d7b0 Ignore client-specific notifications
closes #3523
2020-03-09 09:26:41 +01:00
Steffen Lyngbaek
9138d39947 Clean up completion matching.
- Add test to ensure nested completions don't happen
2020-03-08 17:50:41 -07:00
Kirill Bulatov
605dc98451 Omit unit struct hints 2020-03-08 23:21:08 +02:00
Kirill Bulatov
5cffef56e2 Consider crate declaration names 2020-03-08 23:00:50 +02:00
Edwin Cheng
e7206467d5 Add parse_to_token_tree 2020-03-09 00:13:04 +08:00
Florian Diebold
05e1c7b197 Handle visibility for assoc item path completion as well 2020-03-08 15:15:46 +01:00
Steffen Lyngbaek
7c439355ce Don't allow nested completions 2020-03-08 03:24:34 -07:00
Florian Diebold
afdf08e964 Move hypothetical expansion to hir_expand 2020-03-08 11:10:48 +01:00
Florian Diebold
d9c77c5453 Handle visibility for path completion (not in all cases yet) 2020-03-08 10:51:40 +01:00
Florian Diebold
734e68da4c Handle visibility in method call completion 2020-03-07 23:03:56 +01:00
Kirill Bulatov
32f5276465 Show mod path in hover tooltip 2020-03-07 23:20:18 +02:00
Florian Diebold
f617455d10 Remove TODOs 2020-03-07 19:58:18 +01:00
Florian Diebold
941a574409 Fix CompletionContext module field (by removing it)
Two uses only needed the crate; one was wrong and should use the module from the
scope instead.
2020-03-07 17:53:22 +01:00
Florian Diebold
020c00e44d Add some sanity checks 2020-03-07 17:47:49 +01:00
Florian Diebold
cbca4effce Fix record pattern completion 2020-03-07 16:53:16 +01:00
Florian Diebold
b719e211cf Fix record literal completion 2020-03-07 16:48:39 +01:00
Florian Diebold
6bea6199b3 Fix range for postfix snippets 2020-03-07 16:44:51 +01:00
Florian Diebold
8cc4210278 Add more tests 2020-03-07 15:48:06 +01:00
Florian Diebold
24e98121d8 Try to complete within macros 2020-03-07 15:48:06 +01:00
Edwin Cheng
18f88ad10b Prevent include! macro include itself 2020-03-07 19:08:42 +08:00
Edwin Cheng
2e178b5475 Fix test and add more comment 2020-03-07 13:02:54 +08:00
Edwin Cheng
36c7684687 Use a not so dummy implementation of env macro 2020-03-07 12:53:40 +08:00
Steffen Lyngbaek
15ed114a49 Next steps in assoc item completion #3183
Allow trait autocompletions for unimplemented associated fn's, types,
and consts without using explicit keywords before hand (fn, type,
const).

The sequel to #3108.
2020-03-06 17:35:39 -08:00
Aleksey Kladov
9abf0d9659 Normalize waiting queries names 2020-03-07 00:18:04 +01:00
Florian Diebold
9ce30281f6 Don't reuse the Chalk solver
This slows down analysis-stats a bit (~5% in my measurement), but improves
incremental checking a lot because we can reuse trait solve results.
2020-03-06 23:04:14 +01:00
bors[bot]
26ae35c62e
Merge #3499
3499: Resolve `Self::AssocTy` in impls r=matklad a=flodiebold

To do this we need to carry around the original resolution a bit, because `Self`
gets resolved to the actual type immediately, but you're not allowed to write
the equivalent type in a projection. (I tried just comparing the projection base
type with the impl self type, but that seemed too dirty.) This is basically how
rustc does it as well.

Fixes #3249.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-03-06 19:50:55 +00:00
Aleksey Kladov
80909f7698 Don't creat public APIs with typos 2020-03-06 18:38:56 +01:00
Aleksey Kladov
95a2755aa8 Concise mode for parameter hints
This works around VS Code bug where it tries to cram everything in a
tiny popup, and brings experience closer to Intellij.
2020-03-06 18:35:30 +01:00
Fireassember
787043496a added fmt::Display as a supertrait for AstNode and changed generation. 2020-03-06 19:29:30 +02:00
Florian Diebold
d17c5416af Resolve Self::AssocTy in impls
To do this we need to carry around the original resolution a bit, because `Self`
gets resolved to the actual type immediately, but you're not allowed to write
the equivalent type in a projection. (I tried just comparing the projection base
type with the impl self type, but that seemed too dirty.) This is basically how
rustc does it as well.

Fixes #3249.
2020-03-06 18:14:39 +01:00
Aleksey Kladov
3ff170d658 Trigger parameter info automatically
See https://github.com/Microsoft/vscode/issues/64023
2020-03-06 18:00:06 +01:00
Aleksey Kladov
4e7f6c2354 Feature flag for arg snippets 2020-03-06 17:51:10 +01:00
Aleksey Kladov
21f40f2b8f Fix comment order 2020-03-06 17:44:30 +01:00
Aleksey Kladov
b33b843f40 Allow specifying additional info on call to profile 2020-03-06 17:36:51 +01:00
Aleksey Kladov
59f91f2f9b Less confusing profile names 2020-03-06 16:40:38 +01:00
bors[bot]
aa82b5915d
Merge #3494
3494: Implement include macro r=matklad a=edwin0cheng

This PR implement builtin `include` macro.

* It does not support include as expression yet.
* It doesn't consider `env!("OUT_DIR")` yet.


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-06 15:08:41 +00:00
Edwin Cheng
0a06c7e6e6 Implment include macro 2020-03-06 22:58:45 +08:00
bors[bot]
4173645a71
Merge #3493
3493: make::use_item r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-06 14:56:52 +00:00
Aleksey Kladov
1f84c3b18f make::use_item 2020-03-06 15:56:25 +01:00
bors[bot]
995a92814f
Merge #3490
3490: Support aliases and Self in struct literals r=matklad a=flodiebold

Fixes #3306.

Co-authored-by: Florian Diebold <florian.diebold@freiheit.com>
2020-03-06 14:46:03 +00:00
Florian Diebold
073a1ef834 Support aliases and Self in struct literals
Fixes #3306.
2020-03-06 15:43:14 +01:00
bors[bot]
13879afdd5
Merge #3492
3492: Simplify creation of `T[,]` r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-06 14:39:20 +00:00
Aleksey Kladov
85e2346b74 Simplify creation of T[,] 2020-03-06 15:38:48 +01:00
Aleksey Kladov
57da3df99a Explicitly remember desugard pats 2020-03-06 15:17:48 +01:00
Aleksey Kladov
5ffddc4b92 Explicitly remember desugard exprs 2020-03-06 15:11:05 +01:00
Aleksey Kladov
fb5891c433 Source map returns a result
cc #2236
2020-03-06 14:44:44 +01:00
Aleksey Kladov
ea0c124219 Rerail split_import API onto AST
The code is more verbose and less efficient now, but should be
reusable in add_import context as well
2020-03-06 14:08:43 +01:00
bors[bot]
d75577fcee
Merge #3483
3483: Unfold groups with single assists into plain assists r=matklad a=SomeoneToIgnore

A follow-up of https://github.com/rust-analyzer/rust-analyzer/pull/3120/files#r378788698 , made to show more detailed label when the assist group contains a single element

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-03-06 10:10:16 +00:00
bors[bot]
670895a49c
Merge #3482
3482: Fix regression from #3451 r=matklad a=edwin0cheng

There is a regression from #3451 such that the following code has failed to parse in raw item collecting phase:

```rust
macro_rules! with_std { 
 	($($i:item)*) => ($(#[cfg(feature = "std")]$i)*) 
}

with_std! {
	mod macros;
	mod others;
}
```

### Rationale

We always assume the last token of an statement will not end with a whitespace, which is true. It is because in parsing phase,  we always emit `SyntaxNode` before any whitespace. Such that in various parts of RA code, we solely check the semi-colon by using `SyntaxNode::last_child_token() == ";"` . 

However, in #3451, we insert some whitespaces between puncts such that we broke above assumption. This PR fixed this bug by make sure we don't add any whitespace if it is a semicolon.


Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-06 10:03:54 +00:00
Kirill Bulatov
0ff8c55246 Unfold groups with single assists into plain assists 2020-03-06 00:17:26 +02:00
Edwin Cheng
0563cc8291 fix regression from #3451 2020-03-06 04:32:08 +08:00
Aleksey Kladov
381ace587e Add with_use_tree 2020-03-05 18:38:52 +01:00
Aleksey Kladov
b96da48809 Add profiling calls 2020-03-05 14:22:31 +01:00
bors[bot]
f3f39b4327
Merge #3475
3475: Fix options for analysis-bench r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-05 12:58:41 +00:00
Aleksey Kladov
17876d79e4 Fix options for analysis-bench 2020-03-05 13:58:11 +01:00
Aleksey Kladov
fc970d188e Prime open files on load 2020-03-05 13:40:53 +01:00
Aleksey Kladov
b6819c2595
Merge pull request #3451 from edwin0cheng/fix-mbe-composited
Fix mbe composited token bug
2020-03-05 11:16:45 +01:00
Aleksey Kladov
7d873fcfa1 Move PathResolution 2020-03-05 11:08:31 +01:00
Aleksey Kladov
7b6716e50e Remove dead code 2020-03-05 11:06:23 +01:00
Edwin Cheng
0c79e1d304 Add comment for parents logging 2020-03-05 03:02:51 +08:00
Edwin Cheng
c7b0c72dd7 Fix whitespace in tests 2020-03-05 00:12:39 +08:00
Edwin Cheng
6794d50a9b Fixed whitespace bug 2020-03-04 23:41:14 +08:00
Edwin Cheng
028595548b Fix #3436 2020-03-04 23:41:14 +08:00
Edwin Cheng
e76dddd610 Add more log 2020-03-04 23:41:04 +08:00
Aleksey Kladov
c21babc58b Minor cleanup 2020-03-04 14:39:51 +01:00
Aleksey Kladov
f57682c0b3 Remove old find refs infra 2020-03-04 14:25:22 +01:00
bors[bot]
94189d0a1c
Merge #3442
3442: Skip self param when completing methods r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-04 12:02:06 +00:00
Aleksey Kladov
7d2ddfd3c8 Skip self param when completing methods 2020-03-04 13:01:16 +01:00
Aleksey Kladov
4f50a37187 Fix docs 2020-03-04 12:48:50 +01:00
Aleksey Kladov
98d68fa6be Cleanup API 2020-03-04 12:46:40 +01:00
Aleksey Kladov
072ec1a8ae Fix tests 2020-03-04 12:24:28 +01:00
Aleksey Kladov
994000b5dd Use method instead of a free function 2020-03-04 12:22:47 +01:00
Aleksey Kladov
e839d793ae Drop one once_cell dep 2020-03-04 12:22:47 +01:00
Aleksey Kladov
f79719b8ae Move find_refs_to_def 2020-03-04 12:22:47 +01:00
Aleksey Kladov
2638bec66c Merge refs_to_def and process_def 2020-03-04 12:22:06 +01:00
Aleksey Kladov
1874b6738a Move ReferenceKind 2020-03-04 12:22:06 +01:00
Aleksey Kladov
a549da7e3e Move SearchScope 2020-03-04 12:22:06 +01:00
bors[bot]
66ec6bdfb0
Merge #3432
3432: Feature/snippet completions r=matklad a=iTZAvishay

This PR implements #1705 and is based on #3430 to avoid future conflicts.

The completions are placing default values with the names of the parameters, demo: 
![call_me_demo](https://user-images.githubusercontent.com/5567310/75828341-461ca400-5db4-11ea-88d8-88e59ac1a197.gif)


Co-authored-by: Avishay Matayev <me@avishay.dev>
2020-03-04 11:05:14 +00:00
Aleksey Kladov
5095573139 Remove stray FIXME 2020-03-04 11:55:25 +01:00
Aleksey Kladov
19115e9fab Support cross-crate marks 2020-03-04 11:55:25 +01:00
Avishay Matayev
fb34a5ba06 Support function's completion snippet
Note that `detail` was replced with `function_signature` to avoid
calling `from` on FunctionSignature twice.

I didn't add new tests because the current ones seem enough.
2020-03-04 11:03:32 +02:00
bors[bot]
437329d3f5
Merge #3429
3429: Fix panic on eager expansion r=matklad a=edwin0cheng

When lazy expanding inside an eager macro, its *parent* file of that lazy macro call must be already exists such that a panic is occurred because that parent file is the eager macro we are processing.

This PR fix this bug by store the argument syntax node as another eager macro id for that purpose.

Personally I don't know if it is a good answer for this bug. 




Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-04 00:05:10 +00:00
Florian Diebold
e55fc286fc Fix completion snippet for reexported functions
Fixes #3356.
2020-03-03 20:49:50 +01:00
Edwin Cheng
5ea83fee01 Fixed a typo in comment 2020-03-04 02:57:54 +08:00
Edwin Cheng
e04c0f4222 Fix panic on eager expansion 2020-03-04 02:41:33 +08:00
bors[bot]
5abc45982b
Merge #3428
3428: Move reference classification to ra_ide_db r=matklad a=matklad

Lost some marks along the way :-(



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-03 17:55:25 +00:00
Aleksey Kladov
53cab1cd21 Fix imports 2020-03-03 18:54:39 +01:00
Aleksey Kladov
177229bfde Move reference classification to ra_ide_db
Lost some marks along the way :-(
2020-03-03 18:50:15 +01:00
bors[bot]
074474fe00
Merge #3427
3427: Rename NameDefinition -> Definition r=matklad a=matklad



bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-03-03 17:41:25 +00:00
Aleksey Kladov
d49a4d1863 Rename NameDefinition -> Definition 2020-03-03 18:40:27 +01:00
bors[bot]
7a322f9aff
Merge #3392
3392: Implement concat eager macro  r=matklad a=edwin0cheng

This PR implements the following things:

1. Add basic eager macro infrastructure by introducing `EagerCallId` such that the new `MacroCallId` is defined as :

```
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum MacroCallId {
    LazyMacro(LazyMacroId),
    EagerMacro(EagerMacroId),
}
```

2. Add `concat!` builtin macro.




Co-authored-by: Edwin Cheng <edwin0cheng@gmail.com>
2020-03-03 17:30:08 +00:00
Edwin Cheng
4d5e80c6c8 Fix for rebasing 2020-03-04 01:24:33 +08:00