]> git.lizzy.rs Git - rust.git/log
rust.git
4 years agoMerge pull request #3562 from FireofGods/display_for_node
Aleksey Kladov [Thu, 12 Mar 2020 14:40:53 +0000 (15:40 +0100)]
Merge pull request #3562 from FireofGods/display_for_node

Add `std::fmt::Display` as a supertrait for `AstNode`

4 years agoimplementing Display for enums too.
Fireassember [Wed, 11 Mar 2020 20:54:24 +0000 (22:54 +0200)]
implementing Display for enums too.

4 years agoMerge #3558
bors[bot] [Wed, 11 Mar 2020 13:29:36 +0000 (13:29 +0000)]
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>
4 years agoFix parsing of stement-ish binary expressions
Aleksey Kladov [Wed, 11 Mar 2020 11:40:38 +0000 (12:40 +0100)]
Fix parsing of stement-ish binary expressions

closes #3512

4 years agoMerge #3557
bors[bot] [Wed, 11 Mar 2020 11:58:55 +0000 (11:58 +0000)]
Merge #3557

3557: Continue multiline non-doc comment blocks r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoContinue multiline non-doc comment blocks
Aleksey Kladov [Wed, 11 Mar 2020 11:56:12 +0000 (12:56 +0100)]
Continue multiline non-doc comment blocks

4 years agoSplit on enter tests
Aleksey Kladov [Wed, 11 Mar 2020 11:49:17 +0000 (12:49 +0100)]
Split on enter tests

4 years agoMove on enter to a separate module
Aleksey Kladov [Wed, 11 Mar 2020 11:46:36 +0000 (12:46 +0100)]
Move on enter to a separate module

4 years agoMerge #3549
bors[bot] [Wed, 11 Mar 2020 10:51:07 +0000 (10:51 +0000)]
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>
4 years agoMerge #3555
bors[bot] [Wed, 11 Mar 2020 10:10:49 +0000 (10:10 +0000)]
Merge #3555

3555: Introduce completion test utils r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoIntroduce completion test utils
Aleksey Kladov [Wed, 11 Mar 2020 09:46:43 +0000 (10:46 +0100)]
Introduce completion test utils

4 years agoAdd a test for disabled argument snippets
Aleksey Kladov [Wed, 11 Mar 2020 09:39:39 +0000 (10:39 +0100)]
Add a test for disabled argument snippets

4 years agoMerge #3542
bors[bot] [Wed, 11 Mar 2020 09:22:09 +0000 (09:22 +0000)]
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>
4 years agofind_usages limited to actual usages again
Matt Niemeir [Wed, 11 Mar 2020 03:27:38 +0000 (22:27 -0500)]
find_usages limited to actual usages again

4 years agoAdd extern source
Edwin Cheng [Wed, 11 Mar 2020 03:04:02 +0000 (11:04 +0800)]
Add extern source

4 years agoMerge #3552
bors[bot] [Tue, 10 Mar 2020 20:35:45 +0000 (20:35 +0000)]
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>
4 years agoFix completion with a partially unknown type
Florian Diebold [Tue, 10 Mar 2020 19:56:26 +0000 (20:56 +0100)]
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.

4 years agoMerge #3551
bors[bot] [Tue, 10 Mar 2020 17:56:44 +0000 (17:56 +0000)]
Merge #3551

3551: Move FeatureFlags r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoMove FeatureFlags
Aleksey Kladov [Tue, 10 Mar 2020 17:56:15 +0000 (18:56 +0100)]
Move FeatureFlags

4 years agoPull completion options up to the rust-analyzer
Aleksey Kladov [Tue, 10 Mar 2020 17:47:09 +0000 (18:47 +0100)]
Pull completion options up to the rust-analyzer

4 years agoIntroduce CompletionOptions
Aleksey Kladov [Tue, 10 Mar 2020 17:39:17 +0000 (18:39 +0100)]
Introduce CompletionOptions

4 years agoMerge #3550
bors[bot] [Tue, 10 Mar 2020 17:34:37 +0000 (17:34 +0000)]
Merge #3550

3550: Force latest stable r=matklad a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
4 years agoForce latest stable
kjeremy [Tue, 10 Mar 2020 17:31:13 +0000 (13:31 -0400)]
Force latest stable

4 years agoAdd and fix tests
Edwin Cheng [Tue, 10 Mar 2020 14:01:08 +0000 (22:01 +0800)]
Add and fix tests

4 years agoSetup Env in world
Edwin Cheng [Tue, 10 Mar 2020 14:00:58 +0000 (22:00 +0800)]
Setup Env in world

4 years agoAdd resolve_extern_path in DB
Edwin Cheng [Tue, 10 Mar 2020 14:00:31 +0000 (22:00 +0800)]
Add resolve_extern_path in DB

4 years agoAdd ExternSourceId and env functions
Edwin Cheng [Tue, 10 Mar 2020 13:59:12 +0000 (21:59 +0800)]
Add ExternSourceId and env functions

4 years agoAdd additional_outdirs in config
Edwin Cheng [Tue, 10 Mar 2020 13:58:15 +0000 (21:58 +0800)]
Add additional_outdirs in config

4 years agoMerge #3536
bors[bot] [Tue, 10 Mar 2020 16:46:21 +0000 (16:46 +0000)]
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>
4 years agoMerge pull request #3506 from slyngbaek/3183
Aleksey Kladov [Tue, 10 Mar 2020 16:45:57 +0000 (17:45 +0100)]
Merge pull request #3506 from slyngbaek/3183

Next steps in assoc item completion #3183

4 years agoCheck only one fixture
Edwin Cheng [Tue, 10 Mar 2020 14:52:43 +0000 (22:52 +0800)]
Check only one fixture

4 years agoAdd fixture meta for single file fixture
Edwin Cheng [Mon, 9 Mar 2020 18:02:43 +0000 (02:02 +0800)]
Add fixture meta for single file fixture

4 years agoMerge #3546
bors[bot] [Tue, 10 Mar 2020 14:04:02 +0000 (14:04 +0000)]
Merge #3546

3546: :arrow_up: fst r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years ago:arrow_up: fst
Aleksey Kladov [Tue, 10 Mar 2020 13:55:23 +0000 (14:55 +0100)]
:arrow_up: fst

4 years agoMerge #3545
bors[bot] [Tue, 10 Mar 2020 13:52:39 +0000 (13:52 +0000)]
Merge #3545

3545: Remove c2-chacha dependency r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
4 years agoRemove c2-chaha dependency
kjeremy [Tue, 10 Mar 2020 13:51:27 +0000 (09:51 -0400)]
Remove c2-chaha dependency

4 years agoRenaming a local renames struct field shorthand
Matt Niemeir [Tue, 10 Mar 2020 02:34:33 +0000 (21:34 -0500)]
Renaming a local renames struct field shorthand

4 years agoStruct field rename renames field in constructor field shorthand
Matt Niemeir [Tue, 10 Mar 2020 02:18:55 +0000 (21:18 -0500)]
Struct field rename renames field in constructor field shorthand

4 years agoSwitch to explicit offsets for impl_def
Steffen Lyngbaek [Mon, 9 Mar 2020 20:01:40 +0000 (13:01 -0700)]
Switch to explicit offsets for impl_def

Blacklists are prone to more errors

4 years agoMerge #3533
bors[bot] [Mon, 9 Mar 2020 14:38:20 +0000 (14:38 +0000)]
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>
4 years agoMerge #3532
bors[bot] [Mon, 9 Mar 2020 14:29:59 +0000 (14:29 +0000)]
Merge #3532

3532: Fix SelectionRange return type r=matklad a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
4 years agoUpdates insta to 0.15.0 and bumps console to 0.10.0
kjeremy [Mon, 9 Mar 2020 14:28:30 +0000 (10:28 -0400)]
Updates insta to 0.15.0 and bumps console to 0.10.0

4 years agoFix SelectionRange return type
kjeremy [Mon, 9 Mar 2020 14:17:16 +0000 (10:17 -0400)]
Fix SelectionRange return type

4 years agoSet extension version during release
Aleksey Kladov [Mon, 9 Mar 2020 13:20:40 +0000 (14:20 +0100)]
Set extension version during release

4 years agoDisable jemalloc, it doesn't work out of the box with musl
Aleksey Kladov [Mon, 9 Mar 2020 12:55:14 +0000 (13:55 +0100)]
Disable jemalloc, it doesn't work out of the box with musl

4 years agoMerge #3531
bors[bot] [Mon, 9 Mar 2020 11:38:43 +0000 (11:38 +0000)]
Merge #3531

3531: Use jemalloc for linux builds r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoUse jemalloc for linux builds
Aleksey Kladov [Mon, 9 Mar 2020 11:35:31 +0000 (12:35 +0100)]
Use jemalloc for linux builds

4 years agoMerge #3530
bors[bot] [Mon, 9 Mar 2020 11:31:59 +0000 (11:31 +0000)]
Merge #3530

3530: Fix quotes r=matklad a=matklad

closes #3501

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoFix quotes
Aleksey Kladov [Mon, 9 Mar 2020 11:31:23 +0000 (12:31 +0100)]
Fix quotes

closes #3501

4 years agoMerge #3528
bors[bot] [Mon, 9 Mar 2020 10:56:06 +0000 (10:56 +0000)]
Merge #3528

3528: Print crate name in profil r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoPrint crate name in profil
Aleksey Kladov [Mon, 9 Mar 2020 10:55:43 +0000 (11:55 +0100)]
Print crate name in profil

4 years agoMerge #3527
bors[bot] [Mon, 9 Mar 2020 10:19:26 +0000 (10:19 +0000)]
Merge #3527

3527: Simplify r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoSimplify
Aleksey Kladov [Mon, 9 Mar 2020 10:18:41 +0000 (11:18 +0100)]
Simplify

4 years agoSimplify
Aleksey Kladov [Mon, 9 Mar 2020 10:17:39 +0000 (11:17 +0100)]
Simplify

4 years agoMinimize API
Aleksey Kladov [Mon, 9 Mar 2020 10:14:51 +0000 (11:14 +0100)]
Minimize API

4 years agoUse `Index` for CrateGraph
Aleksey Kladov [Mon, 9 Mar 2020 10:11:59 +0000 (11:11 +0100)]
Use `Index` for CrateGraph

4 years agoMerge #3526
bors[bot] [Mon, 9 Mar 2020 09:59:02 +0000 (09:59 +0000)]
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>
4 years agoSilence "file out of workspace" errors
Aleksey Kladov [Mon, 9 Mar 2020 09:54:14 +0000 (10:54 +0100)]
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.

4 years agoMerge #3519
bors[bot] [Mon, 9 Mar 2020 09:33:46 +0000 (09:33 +0000)]
Merge #3519

3519: Show mod path on hover r=matklad a=SomeoneToIgnore

Closes #1064

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
4 years agoLess abstract CrateData api
Kirill Bulatov [Mon, 9 Mar 2020 09:26:46 +0000 (11:26 +0200)]
Less abstract CrateData api

4 years agoMerge pull request #3525 from matklad/ci
Aleksey Kladov [Mon, 9 Mar 2020 09:16:58 +0000 (10:16 +0100)]
Merge pull request #3525 from matklad/ci

Install Node only for Linux

4 years agoInstall Node only for Linux
Aleksey Kladov [Mon, 9 Mar 2020 09:06:17 +0000 (10:06 +0100)]
Install Node only for Linux

Hopefully, this will lead to fewer errors like

https://github.com/rust-analyzer/rust-analyzer/runs/493983317?check_suite_focus=true#step:5:10

4 years agoMerge #3514
bors[bot] [Mon, 9 Mar 2020 09:05:45 +0000 (09:05 +0000)]
Merge #3514

3514: vscode: askBeforeDownload option r=matklad a=Veetaha

This is a small step towards #3402, also implements my proposal stated in #3403

Also renamed `BinarySource` to `ArtifactSource` in anticipation of nightlies installation that requires downloading not a binary itself but `.vsix` package, thus generalized to `artifact` term.

@matklad @lnicola

Co-authored-by: Veetaha <gerzoh1@gmail.com>
4 years agovscode: groupd updates-related config under `updates` section as per @matklad
Veetaha [Mon, 9 Mar 2020 08:59:36 +0000 (10:59 +0200)]
vscode: groupd updates-related config under `updates` section as per @matklad

4 years agoMerge #3513
bors[bot] [Mon, 9 Mar 2020 08:56:58 +0000 (08:56 +0000)]
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>
4 years agoMerge #3516
bors[bot] [Mon, 9 Mar 2020 08:50:19 +0000 (08:50 +0000)]
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>
4 years agoMerge #3518
bors[bot] [Mon, 9 Mar 2020 08:43:07 +0000 (08:43 +0000)]
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>
4 years agoMerge #3524
bors[bot] [Mon, 9 Mar 2020 08:27:31 +0000 (08:27 +0000)]
Merge #3524

3524: Ignore client-specific notifications r=matklad a=matklad

closes #3523

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
4 years agoIgnore client-specific notifications
Aleksey Kladov [Mon, 9 Mar 2020 08:26:41 +0000 (09:26 +0100)]
Ignore client-specific notifications

closes #3523

4 years agoMerge #3520
bors[bot] [Mon, 9 Mar 2020 08:08:23 +0000 (08:08 +0000)]
Merge #3520

3520: Omit unit struct hints r=matklad a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/3488

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
4 years agoClean up completion matching.
Steffen Lyngbaek [Mon, 9 Mar 2020 00:50:41 +0000 (17:50 -0700)]
Clean up completion matching.

- Add test to ensure nested completions don't happen

4 years agoMerge #3521
bors[bot] [Sun, 8 Mar 2020 22:11:22 +0000 (22:11 +0000)]
Merge #3521

3521: Use markdown description in vscode r=matklad a=vbfox

By using `markdownDescription` the markdown in the description is parsed and displayed.

Before:

![image](https://user-images.githubusercontent.com/131878/76171725-cb2a0380-618e-11ea-956f-7668a746946f.png)

After:

![image](https://user-images.githubusercontent.com/131878/76171743-00365600-618f-11ea-8847-f4ab09639bb5.png)

Co-authored-by: Julien Roncaglia <julien@roncaglia.fr>
4 years agoUse markdown description in vscode
Julien Roncaglia [Sun, 8 Mar 2020 21:46:42 +0000 (22:46 +0100)]
Use markdown description in vscode

4 years agoOmit unit struct hints
Kirill Bulatov [Sun, 8 Mar 2020 21:21:08 +0000 (23:21 +0200)]
Omit unit struct hints

4 years agoConsider crate declaration names
Kirill Bulatov [Sun, 8 Mar 2020 13:26:57 +0000 (15:26 +0200)]
Consider crate declaration names

4 years agovscode: fix inversion of askBeforeDownload
Veetaha [Sun, 8 Mar 2020 19:47:35 +0000 (21:47 +0200)]
vscode: fix inversion of askBeforeDownload

4 years agodocs: change formatting
Veetaha [Sun, 8 Mar 2020 17:01:31 +0000 (19:01 +0200)]
docs: change formatting

4 years agovscode: rename alwaysDownloadServer -> askBeforeDownload
Veetaha [Sun, 8 Mar 2020 16:58:02 +0000 (18:58 +0200)]
vscode: rename alwaysDownloadServer -> askBeforeDownload

The new name seems much simpler and it doesn't limit
this config value only to downloading the server binary.
Thus we wouldn't need to create another config
properties to handle other downloads whatsoever.
Anyway, I believe (heuristically) that most of the users
would want to set "askBeforeDownload": false once
and never bother clicking on the notification again
(because otherwise there is no big point in installing rust-analyzer if it cannot install the server)

4 years agovscode: add docs on alwaysDownloadServer
Veetaha [Sun, 8 Mar 2020 16:51:21 +0000 (18:51 +0200)]
vscode: add docs on alwaysDownloadServer

4 years agoAdd parse_to_token_tree
Edwin Cheng [Sun, 8 Mar 2020 16:13:04 +0000 (00:13 +0800)]
Add parse_to_token_tree

4 years agoHandle visibility for assoc item path completion as well
Florian Diebold [Sun, 8 Mar 2020 14:11:57 +0000 (15:11 +0100)]
Handle visibility for assoc item path completion as well

4 years agoDon't allow nested completions
Steffen Lyngbaek [Sun, 8 Mar 2020 10:24:34 +0000 (03:24 -0700)]
Don't allow nested completions

4 years agoMove hypothetical expansion to hir_expand
Florian Diebold [Sun, 8 Mar 2020 10:02:14 +0000 (11:02 +0100)]
Move hypothetical expansion to hir_expand

4 years agoHandle visibility for path completion (not in all cases yet)
Florian Diebold [Sun, 8 Mar 2020 09:51:40 +0000 (10:51 +0100)]
Handle visibility for path completion (not in all cases yet)

4 years agoHandle visibility in method call completion
Florian Diebold [Sat, 7 Mar 2020 22:03:56 +0000 (23:03 +0100)]
Handle visibility in method call completion

4 years agovscode: care about alwaysDownloadServer option before asking
Veetaha [Sat, 7 Mar 2020 22:01:48 +0000 (00:01 +0200)]
vscode: care about alwaysDownloadServer option before asking

Also renamed BinarySource to ArtifactSource in anticipation of
nightlies installation that requires downloading
not a binary itself but .vsix package, thus generalized
to `artifact` term

4 years agovscode: contribute "alwaysDownloadServer" option to config
Veetaha [Sat, 7 Mar 2020 21:59:33 +0000 (23:59 +0200)]
vscode: contribute "alwaysDownloadServer" option to config

4 years agoShow mod path in hover tooltip
Kirill Bulatov [Thu, 5 Mar 2020 23:02:14 +0000 (01:02 +0200)]
Show mod path in hover tooltip

4 years agoRemove TODOs
Florian Diebold [Sat, 7 Mar 2020 18:58:18 +0000 (19:58 +0100)]
Remove TODOs

4 years agoFix CompletionContext module field (by removing it)
Florian Diebold [Sat, 7 Mar 2020 16:53:22 +0000 (17:53 +0100)]
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.

4 years agoAdd some sanity checks
Florian Diebold [Sat, 7 Mar 2020 16:47:49 +0000 (17:47 +0100)]
Add some sanity checks

4 years agoFix record pattern completion
Florian Diebold [Sat, 7 Mar 2020 15:50:30 +0000 (16:50 +0100)]
Fix record pattern completion

4 years agoFix record literal completion
Florian Diebold [Sat, 7 Mar 2020 15:48:39 +0000 (16:48 +0100)]
Fix record literal completion

4 years agoFix range for postfix snippets
Florian Diebold [Sat, 7 Mar 2020 15:44:51 +0000 (16:44 +0100)]
Fix range for postfix snippets

4 years agoAdd more tests
Florian Diebold [Sat, 7 Mar 2020 14:47:10 +0000 (15:47 +0100)]
Add more tests

4 years agoTry to complete within macros
Florian Diebold [Sat, 7 Mar 2020 14:27:03 +0000 (15:27 +0100)]
Try to complete within macros

4 years agoMerge #3378
bors[bot] [Sat, 7 Mar 2020 12:44:18 +0000 (12:44 +0000)]
Merge #3378

3378: vscode: redesign inlay hints to be capable of handling multiple editors for one source file r=Veetaha a=Veetaha

Fixes: #3008 (inlay corruption with multiple editors for one file).
Fixes: #3319 (unnecessary requests for inlay hints when switching unrelated source files or output/log/console windows)
Also, I don't know how, but the problem described in #3057 doesn't appear for me anymore (maybe it was some fix on the server-side, idk), the inlay hints are displaying right away. Though the last time I checked this it was caused by the server returning an empty array of hints and responding with a very big latency, I am not sure that this redesign actually fixed #3057....

We didn't handle the case when one rust source file is open in multiple editors in vscode (e.g. by manually adding another editor for the same file or by opening an inline git diff view or just any kind of preview within the same file).

The git diff preview is actually quite special because it causes memory leaks in vscode (https://github.com/microsoft/vscode/issues/91782). It is not removed from `visibleEditors` once it is closed. However, this bug doesn't affect the inlay hints anymore, because we don't issue a request and set inlay hints for each editor in isolation. Editors are grouped by their respective files and we issue requests only for files and then update all duplicate editors using the results (so we just update the decorations for already closed git diff preview read-only editors).

Also, note on a hack I had to use. `vscode.TextEdtior` identity is not actually public, its `id` field is not exposed to us. I created a dedicated upstream issue for this (https://github.com/microsoft/vscode/issues/91788).

Regarding #3319: the newly designed hints client doesn't issue requests for type hints when switching the visible editors if it has them already cached (though it does rerender things anyway, but this could be optimized in future if so wanted).

<details>
<summary>Before</summary>

![bug_demo](https://user-images.githubusercontent.com/36276403/75613171-3cd0d480-5b33-11ea-9066-954fb2fb18a5.gif)

</details>

<details>
<summary> After </summary>

![multi-cursor-replace](https://user-images.githubusercontent.com/36276403/75612710-d5b12100-5b2e-11ea-99ba-214b4219e6d3.gif)

</details>

Co-authored-by: Veetaha <gerzoh1@gmail.com>
4 years agovscode: post refactor HintsUpdater (simplify create() -> constructor call)
Veetaha [Sat, 7 Mar 2020 12:39:42 +0000 (14:39 +0200)]
vscode: post refactor HintsUpdater (simplify create() -> constructor call)

4 years agovscode: more privacy for HintsUpdater
Veetaha [Sat, 7 Mar 2020 12:37:15 +0000 (14:37 +0200)]
vscode: more privacy for HintsUpdater

4 years agovscode: remove logging from inlays, run fix lint issues
Veetaha [Sat, 7 Mar 2020 12:34:09 +0000 (14:34 +0200)]
vscode: remove logging from inlays, run fix lint issues