]> git.lizzy.rs Git - rust.git/log
rust.git
3 years agorename mock_analysis -> fixture
Aleksey Kladov [Fri, 2 Oct 2020 15:34:31 +0000 (17:34 +0200)]
rename mock_analysis -> fixture

3 years agoGet rid of MockAnalysis
Aleksey Kladov [Fri, 2 Oct 2020 14:13:48 +0000 (16:13 +0200)]
Get rid of MockAnalysis

3 years agoRewrite fixtures on top of Change
Aleksey Kladov [Fri, 2 Oct 2020 14:07:33 +0000 (16:07 +0200)]
Rewrite fixtures on top of Change

3 years agoMove ide::AnalysisChange -> base_db::Change
Aleksey Kladov [Fri, 2 Oct 2020 13:45:09 +0000 (15:45 +0200)]
Move ide::AnalysisChange -> base_db::Change

This seems like a better factoring logically; ideally, clients shouldn't touch
`set_` methods of the database directly. Additionally, I think this
should remove the unfortunate duplication in fixture code.

3 years agoExpectify find_references tests
Aleksey Kladov [Fri, 2 Oct 2020 14:42:48 +0000 (16:42 +0200)]
Expectify find_references tests

3 years agoMerge #6121
bors[bot] [Fri, 2 Oct 2020 12:27:08 +0000 (12:27 +0000)]
Merge #6121

6121: Reduce visibiity r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoReduce visibiity
Aleksey Kladov [Fri, 2 Oct 2020 12:26:40 +0000 (14:26 +0200)]
Reduce visibiity

3 years agoMerge #5988
bors[bot] [Fri, 2 Oct 2020 12:13:53 +0000 (12:13 +0000)]
Merge #5988

5988: Postfix completions for fmt-like string literals r=matklad a=popzxc

This pull request adds a bunch of new postfix completions for `format`-like string literls.

For example, `"{32} {some_var:?}".println` will expand to `println!("{} {:?}", 32, some_var)`.

Postfix completions were added for most common format-like macros:

- `println` -> `println!(...)`
- `fmt` -> `format!(...)`
- `panic` -> `panic!(...)`
- `log` macros:
  + `logi` -> `log::info!(...)`
  + `logw` -> `log::warn!(...)`
  + `loge` -> `log::error!(...)`
  + `logt` -> `log::trace!(...)`
  + `logd` -> `log::debug!(...)`

![fmt_postfix](https://user-images.githubusercontent.com/12111581/92998650-a048af80-f523-11ea-8fd8-410146de8caa.gif)

Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
3 years agoUse expect_test to make format_str_parser test more data-driven
Igor Aleksanov [Fri, 2 Oct 2020 11:51:20 +0000 (14:51 +0300)]
Use expect_test to make format_str_parser test more data-driven

3 years agoUse lookup table instead of enum for postfix completion kinds
Igor Aleksanov [Fri, 2 Oct 2020 10:33:27 +0000 (13:33 +0300)]
Use lookup table instead of enum for postfix completion kinds

3 years agoUse ast::String for extracting string literal contents
Igor Aleksanov [Fri, 2 Oct 2020 10:23:49 +0000 (13:23 +0300)]
Use ast::String for extracting string literal contents

3 years agoImprove format-like completions code appearance
Igor Aleksanov [Fri, 2 Oct 2020 09:49:24 +0000 (12:49 +0300)]
Improve format-like completions code appearance

3 years agoAdd missing entry to doc-comment
Igor Aleksanov [Sat, 12 Sep 2020 15:15:11 +0000 (18:15 +0300)]
Add missing entry to doc-comment

3 years agoSimplify is_string_literal function
Igor Aleksanov [Sat, 12 Sep 2020 15:09:00 +0000 (18:09 +0300)]
Simplify is_string_literal function

3 years agoImprove checks for postfix suggestions
Igor Aleksanov [Sat, 12 Sep 2020 14:32:19 +0000 (17:32 +0300)]
Improve checks for postfix suggestions

3 years agoAdd postfix completion for format-like string literals
Igor Aleksanov [Sat, 12 Sep 2020 14:14:17 +0000 (17:14 +0300)]
Add postfix completion for format-like string literals

3 years agoMerge #5954
bors[bot] [Fri, 2 Oct 2020 09:42:03 +0000 (09:42 +0000)]
Merge #5954

5954: Add flexible configuration for runnables r=popzxc a=popzxc

This PR introduces two new configuration options for runnables: `overrideCargo` and `cargoExtraArgs`.
These options are applied to all the "run" tasks of rust analyzer, such as binaries and tests.

Overall motivation is that rust-analyzer provides similar options, for example, for `rustfmt`, but not for runnables.

## `overrideCargo`

This option allows user to replace `cargo` command with something else (well, something that is compatible with the cargo arguments).

Motivation is that some projects may have wrappers around cargo (or even whole alternatives to cargo), which do something related to the project, and only then run `cargo`. With this feature, such users will be able to use lens and run tests directly from the IDE rather than from terminal.

![cargo_override](https://user-images.githubusercontent.com/12111581/92306622-2f404f80-ef99-11ea-9bb7-6c6192a2c54a.gif)

## `cargoExtraArgs`

This option allows user to add any additional arguments for `cargo`, such as `--release`.

It may be useful, for example, if project has big integration tests which take too long in debug mode, or if any other `cargo` flag has to be passed.

![cargo_extra_args](https://user-images.githubusercontent.com/12111581/92306658-821a0700-ef99-11ea-8be9-bf0aff78e154.gif)

Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
3 years agoFix failing test
Igor Aleksanov [Sat, 5 Sep 2020 14:16:32 +0000 (17:16 +0300)]
Fix failing test

3 years agoSupport 'runnables' options in the vs code extension
Igor Aleksanov [Sat, 5 Sep 2020 13:21:14 +0000 (16:21 +0300)]
Support 'runnables' options in the vs code extension

3 years agoReplace 'cargo_prefix' option with 'override_cargo'
Igor Aleksanov [Sat, 5 Sep 2020 13:20:33 +0000 (16:20 +0300)]
Replace 'cargo_prefix' option with 'override_cargo'

3 years agoAdd support of runnables arguments in Rust Analyzer
Igor Aleksanov [Sat, 5 Sep 2020 09:52:27 +0000 (12:52 +0300)]
Add support of runnables arguments in Rust Analyzer

3 years agoMerge #6105
bors[bot] [Fri, 2 Oct 2020 09:30:25 +0000 (09:30 +0000)]
Merge #6105

6105: Fix path comparison not comparing paths correctly with unequal lengths r=matklad a=Veykril

~~This PR includes the commit from #6102 there as I found a bug while writing that(so either merging this or both in order works) so I included a test there already which was just ignored.~~ This PR fixes that, basically inserting imports didn't consider path length for equality, so depending on the order it might insert the path before or after another import if they only differ in segment length.

~~Diff without the commit of #6102 https://github.com/rust-analyzer/rust-analyzer/commit/2d90d3937d71f9a00f3d44c15b20679215311637~~

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #6118
bors[bot] [Fri, 2 Oct 2020 08:14:38 +0000 (08:14 +0000)]
Merge #6118

6118: Document Clippy strategy r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoDocument Clippy strategy
Aleksey Kladov [Fri, 2 Oct 2020 08:13:58 +0000 (10:13 +0200)]
Document Clippy strategy

3 years agoMerge #6104
bors[bot] [Fri, 2 Oct 2020 08:07:42 +0000 (08:07 +0000)]
Merge #6104

6104: Minor clippy performance suggestions r=matklad a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoMerge #6116
bors[bot] [Fri, 2 Oct 2020 07:59:28 +0000 (07:59 +0000)]
Merge #6116

6116: Up rustc-ap-rustc_lexer to 681 r=matklad a=kjeremy

cargo update as well

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoMerge #6114
bors[bot] [Thu, 1 Oct 2020 19:36:33 +0000 (19:36 +0000)]
Merge #6114

6114: Improve grammar and fix code example in style guide r=kjeremy a=lnicola

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoUp rustc-ap-rustc_lexer to 681
kjeremy [Thu, 1 Oct 2020 19:20:18 +0000 (15:20 -0400)]
Up rustc-ap-rustc_lexer to 681

cargo update as well

3 years agoImprove grammar and fix code example in style guide
Laurențiu Nicola [Thu, 1 Oct 2020 18:02:39 +0000 (21:02 +0300)]
Improve grammar and fix code example in style guide

3 years agoFix path comparison not comparing paths correctly with unequal lengths
Lukas Wirth [Wed, 30 Sep 2020 19:10:42 +0000 (21:10 +0200)]
Fix path comparison not comparing paths correctly with unequal lengths

3 years agoMerge #6101
bors[bot] [Thu, 1 Oct 2020 12:19:15 +0000 (12:19 +0000)]
Merge #6101

6101: cargo update r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agoMerge #6102
bors[bot] [Wed, 30 Sep 2020 22:06:16 +0000 (22:06 +0000)]
Merge #6102

6102: Fix MergingBehaviour::Last creating unintuitive import trees r=jonas-schievink a=Veykril

The way this behaviour currently works is actually a bit weird. Imagine the following three imports get requested for insertion in the given order:
- `winapi::um::d3d11::ID3D11Device`
- `winapi::shared::dxgiformat::DXGI_FORMAT`
- `winapi::um::d3d11::D3D11_FILTER`

After the first two you will have the following tree:
```rust
use winapi::{shared::dxgiformat::DXGI_FORMAT, um::d3d11::ID3D11Device};
```
which is to be expected as they arent nested this kind of merging is allowed, but now importing the third one will result in:
```rust
use winapi::{shared::dxgiformat::DXGI_FORMAT, um::d3d11::ID3D11Device, um::d3d11::D3D11_FILTER};
```
which is still fine according to the rules, but it looks weird(at least in my eyes) due to the long paths that are quite similar. The changes in this PR will change the criteria for when to reject `Last` merging, it still disallows multiple nesting but it also only allows single segment paths inside of the `UseTreeList`. With this change you get the following tree after the first two imports:
```rust
use winapi::um::d3d11::ID3D11Device;
use winapi::shared::dxgiformat::DXGI_FORMAT;
```
and after the third:
```rust
use winapi::shared::dxgiformat::DXGI_FORMAT;
use winapi::um::d3d11::{ID3D11Device, D3D11_FILTER};
```
Which I believe looks more like what you would expect.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMinor clippy performance suggestions
kjeremy [Wed, 30 Sep 2020 19:22:49 +0000 (15:22 -0400)]
Minor clippy performance suggestions

3 years agoFix MergingBehaviour::Last not working properly
Lukas Wirth [Wed, 30 Sep 2020 16:11:46 +0000 (18:11 +0200)]
Fix MergingBehaviour::Last not working properly

3 years agocargo update
kjeremy [Wed, 30 Sep 2020 13:49:40 +0000 (09:49 -0400)]
cargo update

3 years agoMerge #6096
bors[bot] [Tue, 29 Sep 2020 20:13:53 +0000 (20:13 +0000)]
Merge #6096

6096: Extend **Status** command to also show dep info for the file r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoExtend **Status** command to also show dep info for the file
Aleksey Kladov [Tue, 29 Sep 2020 20:05:18 +0000 (22:05 +0200)]
Extend **Status** command to also show dep info for the file

This should help with troubleshooting wrong project configuration

3 years agoMerge #6095
bors[bot] [Tue, 29 Sep 2020 19:23:15 +0000 (19:23 +0000)]
Merge #6095

6095: Remove periodic gc stub r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoRemove periodic gc stub
Aleksey Kladov [Tue, 29 Sep 2020 19:13:58 +0000 (21:13 +0200)]
Remove periodic gc stub

3 years agoMerge #6094
bors[bot] [Tue, 29 Sep 2020 18:50:46 +0000 (18:50 +0000)]
Merge #6094

6094: More panic_context r=matklad a=matklad

bors r+\n🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMore panic_context
Aleksey Kladov [Tue, 29 Sep 2020 18:46:36 +0000 (20:46 +0200)]
More panic_context

3 years agoMerge #6093
bors[bot] [Tue, 29 Sep 2020 18:36:01 +0000 (18:36 +0000)]
Merge #6093

6093: Add panic_context module for better panic messages r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoAdd panic_context module for better panic messages
Aleksey Kladov [Tue, 29 Sep 2020 18:08:27 +0000 (20:08 +0200)]
Add panic_context module for better panic messages

3 years agoMerge #6090
bors[bot] [Tue, 29 Sep 2020 13:00:36 +0000 (13:00 +0000)]
Merge #6090

6090: More style advice r=matklad a=matklad

bors r+\n🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMore style advice
Aleksey Kladov [Tue, 29 Sep 2020 12:42:09 +0000 (14:42 +0200)]
More style advice

3 years agoMerge #5928
bors[bot] [Tue, 29 Sep 2020 12:36:11 +0000 (12:36 +0000)]
Merge #5928

5928: Add method references CodeLens r=vsrs a=vsrs

The PR adds CodeLens for methods and  free-standing functions:

![method_refs](https://user-images.githubusercontent.com/62505555/91858244-95fbfb00-ec71-11ea-90c7-5b3ee067e305.png)

Relates to #5836

Co-authored-by: vsrs <vit@conrlab.com>
3 years agoReplace "No references" with "0 references".
vsrs [Tue, 29 Sep 2020 12:20:07 +0000 (15:20 +0300)]
Replace "No references" with "0 references".

3 years agoAdd tests
vsrs [Wed, 2 Sep 2020 15:21:20 +0000 (18:21 +0300)]
Add tests

3 years agoDo not show references CodeLens for tests.
vsrs [Wed, 2 Sep 2020 14:27:57 +0000 (17:27 +0300)]
Do not show references CodeLens for tests.

3 years agoMake method references CodeLens lazy.
vsrs [Wed, 2 Sep 2020 13:03:05 +0000 (16:03 +0300)]
Make method references CodeLens lazy.

3 years agoMake method references CodeLens off by default.
vsrs [Wed, 2 Sep 2020 10:25:33 +0000 (13:25 +0300)]
Make method references CodeLens off by default.

3 years agoAdd method references CodeLens
vsrs [Tue, 1 Sep 2020 13:33:02 +0000 (16:33 +0300)]
Add method references CodeLens

3 years agoMerge #6080
bors[bot] [Tue, 29 Sep 2020 12:10:47 +0000 (12:10 +0000)]
Merge #6080

6080: Add hover config `linksInHover` to suppress links r=flw-cn a=flw-cn

This PR solves the problem of using RA under vim8. It should close #6014.

Since vim8's popup-window doesn't capture focus, the URL given by RA is effectively useless. links are neither displayed correctly nor can they be clicked. This makes the hover window ugly and inefficient.

I'm providing this patch so that people who share my confusion (which I'm almost certain vim8 users do) will have a way to remove links from markdown.

I noticed that [gopls has an option](https://github.com/golang/tools/blob/master/gopls/doc/settings.md#linksinhover-bool) for a similar purpose. So I added an option `linksInHover` to enable this behavior. This is a bool value and defaults to `true` to keep the behavior consistent with the master version. But you can suppress the links in the hover text by setting it to `false`.

The name of my option, `linksInHover`, is borrowed from gopls.

Before applying this patch:

<img width="1280" alt="image" src="https://user-images.githubusercontent.com/5546718/93285021-85698a00-f806-11ea-911d-e77fea4a47f0.png">

After applying this patch(with `"rust-analyzer.hoverActions.linksInHover": false,`):
<img width="1280" alt="image" src="https://user-images.githubusercontent.com/5546718/94332256-2e359780-0006-11eb-9724-1aed14130d0d.png">

This is the full test cases:
```
fn main() {
    let args: Vec<String> = std::env::args().collect();
    test();
    println!("args: {:?}", args);
}

/// Test cases:
/// case 1.  bare URL: https://rust-lang.org/
/// case 2.  inline URL with title: [foo](https://rust-lang.org/)
/// case 3.  code refrence: [`Result`]
/// case 4.  code refrence but miss footnote: [`String`]
/// case 5.  autolink: <http://rust-lang.org/>
/// case 6.  email address: <test@example.com>
/// case 7.  refrence: [bing][google]
/// case 8.  collapsed link: [bing][]
/// case 9.  shortcut link: [bing]
/// case 10. inline without URL: [bing]()
/// case 11. refrence: [foo][foo]
/// case 12. refrence: [foo][bar]
/// case 13. collapsed link: [foo][]
/// case 14. shortcut link: [foo]
/// case 15. inline without URL: [foo]()
/// case 16. just escaped text: \[hello]
/// case 17. inline link: [Foo](foo::Foo)
///
/// [`Result`]: ../../std/result/enum.Result.html
/// [^bing]: https://www.bing.com/
/// [^google]: https://www.google.com/
pub fn test() {
    println!("Hello");
}
```

screenshot:
<img width="1278" alt="image" src="https://user-images.githubusercontent.com/5546718/94332055-45738580-0004-11eb-9153-707f508d0c4b.png">

Co-authored-by: flw <flw@cpan.org>
3 years agoAdd hover config `linksInHover` to suppress links
flw [Sat, 26 Sep 2020 05:02:09 +0000 (13:02 +0800)]
Add hover config `linksInHover` to suppress links

3 years agoMerge #6019
bors[bot] [Tue, 29 Sep 2020 10:29:33 +0000 (10:29 +0000)]
Merge #6019

6019: Remove make::path_from_text r=matklad a=Veykril

This removes the `make::path_from_text` function, which according to a note should've been private. I removed it since it didn't really serve a purpose as it was simply wrapping `make::ast_from_text`.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #6088
bors[bot] [Mon, 28 Sep 2020 18:30:50 +0000 (18:30 +0000)]
Merge #6088

6088: Update chalk to 0.30.0 r=flodiebold a=nathanwhit

Fixes #6078 and CI failures.

Co-authored-by: Nathan Whitaker <nathan.whitaker01@gmail.com>
3 years agoUpdate chalk to 0.30.0
Nathan Whitaker [Mon, 28 Sep 2020 18:24:11 +0000 (14:24 -0400)]
Update chalk to 0.30.0

3 years agoMerge #6087
bors[bot] [Mon, 28 Sep 2020 17:07:58 +0000 (17:07 +0000)]
Merge #6087

6087: Microoptimize
 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
3 years agoMicrooptimize
Aleksey Kladov [Mon, 28 Sep 2020 17:06:51 +0000 (19:06 +0200)]
Microoptimize

3 years agoMerge #6086
bors[bot] [Mon, 28 Sep 2020 11:45:34 +0000 (11:45 +0000)]
Merge #6086

6086: chalk 0.29.0 r=kjeremy a=kjeremy

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
3 years agochalk 0.29.0
Jeremy Kolb [Mon, 28 Sep 2020 11:44:27 +0000 (07:44 -0400)]
chalk 0.29.0

3 years agoMerge #6033
bors[bot] [Mon, 28 Sep 2020 11:03:47 +0000 (11:03 +0000)]
Merge #6033

6033: Make name resolution resolve proc macros instead of relying purely on the build system r=matklad a=jonas-schievink

This makes name resolution look at proc-macro declaration attributes like `#[proc_macro_derive]` and defines the right proc macro in the macro namespace, fixing unresolved custom derives like `thiserror::Error` (which can cause false positives, now that we emit diagnostics for unresolved imports).

This works even when proc-macro support is turned off, in which case we fall back to a dummy expander that always returns an error. IMO this is the right way to handle at least the name resolution part of proc. macros, while the *expansion* itself should rely on the build system to build and provide the macro DLL. It does mean that they may go out of sync, but we can provide diagnostics if that happens (something like "could not find macro X in crate Y – ensure that all files of crate Y are saved").

I think it is valuable to be able to reason about proc macros even when we can't expand them, since proc macro expansion can break between Rust releases or users might not want to turn it on for performance reasons. It allows us to provide better diagnostics on any proc macro invocation we're not expanding (like a weak warning that informs the user that proc macro support is turned off, or that it has been disabled because the server crashed).

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/5763

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
3 years agoAdd more comments about proc macro resolution
Jonas Schievink [Mon, 28 Sep 2020 11:02:28 +0000 (13:02 +0200)]
Add more comments about proc macro resolution

3 years agoSimplify iterator chain
Jonas Schievink [Mon, 28 Sep 2020 10:51:40 +0000 (12:51 +0200)]
Simplify iterator chain

3 years agoMerge #6085
bors[bot] [Mon, 28 Sep 2020 10:47:33 +0000 (10:47 +0000)]
Merge #6085

6085: Mark unresolved imports diagnostic as experimental r=jonas-schievink a=jonas-schievink

It causes a lot of false positives for people. We collected all of the known ones during the last week.

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
3 years agoMark unresolved imports diagnostic as experimental
Jonas Schievink [Mon, 28 Sep 2020 10:45:20 +0000 (12:45 +0200)]
Mark unresolved imports diagnostic as experimental

3 years agoMerge #6084
bors[bot] [Sun, 27 Sep 2020 22:16:55 +0000 (22:16 +0000)]
Merge #6084

6084: Update deps r=kjeremy a=kjeremy

cargo update

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
3 years agoUpdate deps
Jeremy Kolb [Sun, 27 Sep 2020 22:14:50 +0000 (18:14 -0400)]
Update deps

3 years agoMerge #6027
bors[bot] [Sun, 27 Sep 2020 17:43:28 +0000 (17:43 +0000)]
Merge #6027

6027: Spawn a flycheck instance per workspace r=matklad a=jonas-schievink

Limitations:

- All instances are restarted on every file change
- There's only one configuration used for all of them

Co-authored-by: Jonas Schievink <jonas.schievink@ferrous-systems.com>
3 years agoSpawn a flycheck instance per workspace
Jonas Schievink [Thu, 17 Sep 2020 16:50:30 +0000 (18:50 +0200)]
Spawn a flycheck instance per workspace

3 years agoMerge #6073
bors[bot] [Fri, 25 Sep 2020 14:57:15 +0000 (14:57 +0000)]
Merge #6073

6073: Dont unnecessarily unnest imports r=matklad a=Veykril

Fixes #6071

This has the side effect that paths that refer to items inside of the current module get prefixed with `self`. Changing this behavior is unfortunately not straightforward should it be unwanted, though I don't see a problem with this as prefixing imports like this with `self` is what I do personally anyways 😅. You can see what I mean with this in one of the tests which had to be changed in `crates/ssr/src/tests.rs`.

There is one test that i still have to look at though, ~~which I by accident pushed with `#[ignore]` on it~~, which is `different_crate_renamed`, for some reason this now doesn't use the crate alias. This also makes me believe that aliases in general will break with this. So maybe this is not as straight forwards as I'd hoped for, but I don't really know how aliases work here.

Edit: The failing test should work now

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
3 years agoMerge #6076
bors[bot] [Fri, 25 Sep 2020 14:47:56 +0000 (14:47 +0000)]
Merge #6076

6076: Update chalk to 0.28.0 r=matklad a=vandenheuvel

Co-authored-by: Bram van den Heuvel <bram@vandenheuvel.online>
3 years agoUpdate chalk to 0.28.0
Bram van den Heuvel [Fri, 25 Sep 2020 11:59:18 +0000 (13:59 +0200)]
Update chalk to 0.28.0

3 years agoRemove partial import test in insert_use
Lukas Wirth [Fri, 25 Sep 2020 13:21:50 +0000 (15:21 +0200)]
Remove partial import test in insert_use

3 years agoDon't unnecessarily unnest imports for import insertion
Lukas Wirth [Fri, 25 Sep 2020 13:19:22 +0000 (15:19 +0200)]
Don't unnecessarily unnest imports for import insertion

3 years agoMerge #6055
bors[bot] [Fri, 25 Sep 2020 11:55:35 +0000 (11:55 +0000)]
Merge #6055

6055: Add ok postfix completion r=matklad a=mullr

Wrapping values in `Ok(...)` is so pervasive that it seems reasonable for it to
have its own postfix completion.

Co-authored-by: Russell Mull <russell.mull@gmail.com>
3 years agoMerge #6072
bors[bot] [Fri, 25 Sep 2020 11:49:12 +0000 (11:49 +0000)]
Merge #6072

6072: Cleanup unintended unresolved reference in syntax higlighting test r=matklad a=Nashenas88

Fixes the issue brought up here https://github.com/rust-analyzer/rust-analyzer/pull/5957#discussion_r486625707

cc @jonas-schievink

Co-authored-by: Paul Daniel Faria <Nashenas88@users.noreply.github.com>
3 years agoMerge #6062
bors[bot] [Thu, 24 Sep 2020 15:07:35 +0000 (15:07 +0000)]
Merge #6062

6062: Bump smol_str from 0.1.16 to 0.1.17 r=matklad a=woshilapin

When I built `rust-analyzer` today, I noticed the following warnings.

```
warning: use of deprecated item 'syntax::SmolStr::new_inline_from_ascii': Use `new_inline` instead
   --> crates/mbe/src/syntax_bridge.rs:639:30
    |
639 | ...                   (SmolStr::new_inline_from_ascii(1, &[punct.char as u8]), punct.id)
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: `#[warn(deprecated)]` on by default

warning: 1 warning emitted
```

So I thought it would be a nice small PR.

Co-authored-by: Jean SIMARD <woshilapin@tuziwo.info>
3 years agoBump smol_str from 0.1.16 to 0.1.17
Jean SIMARD [Wed, 23 Sep 2020 06:45:35 +0000 (08:45 +0200)]
Bump smol_str from 0.1.16 to 0.1.17

3 years agoMerge #6050
bors[bot] [Thu, 24 Sep 2020 14:20:05 +0000 (14:20 +0000)]
Merge #6050

6050: VS Code + WSL: describe binary location r=matklad a=qnighy

It looks like VS Code server chooses a different location for `globalStorage`.

Co-authored-by: Masaki Hara <ackie.h.gmai@gmail.com>
3 years agoCleanup unintended unresolved reference in syntax higlighting test
Paul Daniel Faria [Thu, 24 Sep 2020 14:14:25 +0000 (10:14 -0400)]
Cleanup unintended unresolved reference in syntax higlighting test

3 years agoMerge #6056
bors[bot] [Thu, 24 Sep 2020 14:14:01 +0000 (14:14 +0000)]
Merge #6056

6056: Add dbgr postfix completion r=matklad a=lnicola

Expanding to `dbg!(&e)`.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
3 years agoMerge #6061
bors[bot] [Thu, 24 Sep 2020 14:08:46 +0000 (14:08 +0000)]
Merge #6061

6061: Allow to use a Github Auth token for fetching releases r=matklad a=Matthias247

This change allows to use a authorization token provided by Github in
order to fetch metadata for a RA release. Using an authorization token
prevents to get rate-limited in environments where lots of RA users use
a shared client IP (e.g. behind a company NAT).

The auth token is stored in `ExtensionContext.globalState`.
As far as I could observe through testing with a local WSL2 environment
that state is synced between an extension installed locally and a remote
version.

The change provides no explicit command to query for an auth token.
However in case a download fails it will provide a retry option as well
as an option to enter the auth token. This should be more discoverable
for most users.

Closes #3688

Co-authored-by: Matthias Einwag <matthias.einwag@live.com>
3 years agoMerge #5846
bors[bot] [Thu, 24 Sep 2020 12:23:28 +0000 (12:23 +0000)]
Merge #5846

5846: Add references to fn args during completion r=matklad a=adamrk

When completing a function call, if there is an argument taken as a ref or mut ref which matches the name and type of a variable in scope, we will insert a `&` or `&mut` when filling in the function arguments. This addresses https://github.com/rust-analyzer/rust-analyzer/issues/5449.

E.g.
```rust
fn foo(x: &i32) {}
fn main() {
  let x = 5;
  foo # completing foo here generates `foo(&x)` now instead of `foo(x)`
}
```

Co-authored-by: adamrk <ark.email@gmail.com>
3 years agoMerge #6068
bors[bot] [Wed, 23 Sep 2020 19:56:32 +0000 (19:56 +0000)]
Merge #6068

6068: More compliant lsp-types 0.82 r=kjeremy a=kjeremy

Co-authored-by: kjeremy <kjeremy@gmail.com>
3 years agolsp-types 0.82
kjeremy [Wed, 23 Sep 2020 19:41:55 +0000 (15:41 -0400)]
lsp-types 0.82

3 years agoFix lint
Matthias Einwag [Wed, 23 Sep 2020 15:39:04 +0000 (08:39 -0700)]
Fix lint

3 years agoMove unlink on download into download function
Matthias Einwag [Wed, 23 Sep 2020 15:37:02 +0000 (08:37 -0700)]
Move unlink on download into download function

Since this is required by all callsites its easier to have it in the
function itself.

3 years agoRemane function
Matthias Einwag [Wed, 23 Sep 2020 15:27:25 +0000 (08:27 -0700)]
Remane function

3 years agoUse closure in trailing position and strongly type header map
Matthias Einwag [Wed, 23 Sep 2020 15:24:35 +0000 (08:24 -0700)]
Use closure in trailing position and strongly type header map

3 years agoApply suggestions from code review
Matthias Einwag [Wed, 23 Sep 2020 15:14:18 +0000 (08:14 -0700)]
Apply suggestions from code review

Co-authored-by: Veetaha <veetaha2@gmail.com>
3 years agoRemove stray newline
Matthias Einwag [Wed, 23 Sep 2020 08:06:10 +0000 (01:06 -0700)]
Remove stray newline

3 years agoFix clearing the token
Matthias Einwag [Wed, 23 Sep 2020 08:03:34 +0000 (01:03 -0700)]
Fix clearing the token

The previous version would have interpreted an empty token as
an abort of the dialog and would have not properly cleared the token.
This is now fixed by checking for `undefined` for a an abort and
by setting the token to `undefined` in order to clear it.

3 years agoAdd a command for updating the Github API token
Matthias Einwag [Wed, 23 Sep 2020 07:50:34 +0000 (00:50 -0700)]
Add a command for updating the Github API token

3 years agoUse retry dialog also for downloads
Matthias Einwag [Wed, 23 Sep 2020 07:28:38 +0000 (00:28 -0700)]
Use retry dialog also for downloads

Since the change already implements a retry dialog for
network operations, let's also use it for allowing to retry the
actual file.

3 years agoFix tslint
Matthias Einwag [Wed, 23 Sep 2020 06:41:51 +0000 (23:41 -0700)]
Fix tslint

3 years agoAllow to use a Github Auth token for fetching releases
Matthias Einwag [Wed, 23 Sep 2020 06:12:51 +0000 (23:12 -0700)]
Allow to use a Github Auth token for fetching releases

This change allows to use a authorization token provided by Github in
order to fetch metadata for a RA release. Using an authorization token
prevents to get rate-limited in environments where lots of RA users use
a shared client IP (e.g. behind a company NAT).

The auth token is stored in `ExtensionContext.globalState`.
As far as I could observe through testing with a local WSL2 environment
that state is synced between an extension installed locally and a remote
version.

The change provides no explicit command to query for an auth token.
However in case a download fails it will provide a retry option as well
as an option to enter the auth token. This should be more discoverable
for most users.

Closes #3688

3 years agoAdd dbgr postfix completion
Laurențiu Nicola [Tue, 22 Sep 2020 05:52:05 +0000 (08:52 +0300)]
Add dbgr postfix completion

3 years agoCargo fmt
Russell Mull [Tue, 22 Sep 2020 00:47:20 +0000 (17:47 -0700)]
Cargo fmt

3 years agoAdd ok postfix completion
Russell Mull [Tue, 22 Sep 2020 00:15:20 +0000 (17:15 -0700)]
Add ok postfix completion