Commit graph

5395 commits

Author SHA1 Message Date
Aleksey Kladov
9b0b59c5d2 Add a test for disabled argument snippets 2020-03-11 10:39:39 +01: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
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
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