Commit Graph

12947 Commits

Author SHA1 Message Date
Kirill Bulatov
99952f3be2 Fix the hover dash issues 2020-10-02 21:16:22 +03:00
Kirill Bulatov
cae2e859ff Add a dash test 2020-10-02 20:59:32 +03:00
bors[bot]
673e1ddb9a
Merge #6123
6123: Reduce duplication in fixtures r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-02 15:50:20 +00:00
Aleksey Kladov
b06259673f rename mock_analysis -> fixture 2020-10-02 17:49:44 +02:00
Aleksey Kladov
09348b2474 Get rid of MockAnalysis 2020-10-02 17:31:20 +02:00
Aleksey Kladov
eeb27f95f1 Rewrite fixtures on top of Change 2020-10-02 16:45:08 +02:00
Aleksey Kladov
8716c4cec3 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.
2020-10-02 16:45:08 +02:00
bors[bot]
a360832c95
Merge #6122
6122: Expectify find_references tests r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-02 14:44:01 +00:00
Aleksey Kladov
700c9bc019 Expectify find_references tests 2020-10-02 16:42:48 +02:00
bors[bot]
5a0e3f6d67
Merge #6121
6121: Reduce visibiity r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-02 12:27:08 +00:00
Aleksey Kladov
763b13a74e Reduce visibiity 2020-10-02 14:26:40 +02:00
bors[bot]
6574a6f448
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>
2020-10-02 12:13:53 +00:00
Igor Aleksanov
97f2905dec Use expect_test to make format_str_parser test more data-driven 2020-10-02 14:51:20 +03:00
Igor Aleksanov
76d0546ac7 Use lookup table instead of enum for postfix completion kinds 2020-10-02 13:33:27 +03:00
Igor Aleksanov
b7ac540f15 Use ast::String for extracting string literal contents 2020-10-02 13:23:49 +03:00
Igor Aleksanov
2557cb8518 Improve format-like completions code appearance 2020-10-02 12:49:33 +03:00
Igor Aleksanov
777ccb58f0 Add missing entry to doc-comment 2020-10-02 12:42:39 +03:00
Igor Aleksanov
cd3d654f60 Simplify is_string_literal function 2020-10-02 12:42:39 +03:00
Igor Aleksanov
e447b3a4a2 Improve checks for postfix suggestions 2020-10-02 12:42:39 +03:00
Igor Aleksanov
ea320141c6 Add postfix completion for format-like string literals 2020-10-02 12:42:39 +03:00
bors[bot]
d8e5265309
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>
2020-10-02 09:42:03 +00:00
Igor Aleksanov
4ebacf9024 Fix failing test 2020-10-02 12:35:25 +03:00
Igor Aleksanov
5b26629a4d Support 'runnables' options in the vs code extension 2020-10-02 12:35:22 +03:00
Igor Aleksanov
4a1b4b23bb Replace 'cargo_prefix' option with 'override_cargo' 2020-10-02 12:34:27 +03:00
Igor Aleksanov
2c125f3c63 Add support of runnables arguments in Rust Analyzer 2020-10-02 12:34:27 +03:00
bors[bot]
40a028c9a8
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 2d90d3937d~~



Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-02 09:30:25 +00:00
bors[bot]
c01cd6e3ed
Merge #6118
6118: Document Clippy strategy r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-02 08:14:38 +00:00
Aleksey Kladov
0599e64bb2 Document Clippy strategy 2020-10-02 10:13:58 +02:00
bors[bot]
e535489f03
Merge #6104
6104: Minor clippy performance suggestions r=matklad a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-10-02 08:07:42 +00:00
bors[bot]
c3bf7659b1
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>
2020-10-02 07:59:28 +00:00
bors[bot]
505ff4070a
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>
2020-10-01 19:36:33 +00:00
kjeremy
ff678e1349 Up rustc-ap-rustc_lexer to 681
cargo update as well
2020-10-01 15:21:13 -04:00
Laurențiu Nicola
2233749692 Improve grammar and fix code example in style guide 2020-10-01 21:02:39 +03:00
Lukas Wirth
95ea23cdef Fix path comparison not comparing paths correctly with unequal lengths 2020-10-01 17:18:34 +02:00
bors[bot]
3f4e9914ff
Merge #6101
6101: cargo update r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-10-01 12:19:15 +00:00
bors[bot]
43253c508d
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>
2020-09-30 22:06:16 +00:00
kjeremy
82d6cfd495 Minor clippy performance suggestions 2020-09-30 15:22:49 -04:00
Lukas Wirth
0671bf2d73 Fix MergingBehaviour::Last not working properly 2020-09-30 19:09:17 +02:00
kjeremy
9b2e38f009 cargo update 2020-09-30 09:49:40 -04:00
vlakreeh
b2bfadb52c Add tests for convert integer literal assist 2020-09-29 19:05:17 -04:00
vlakreeh
91b4746c01 Add ability to specify ResolvedAssist by label 2020-09-29 18:22:09 -04:00
bors[bot]
7c9ae771bc
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>
2020-09-29 20:13:53 +00:00
Aleksey Kladov
af8063fe37 Extend **Status** command to also show dep info for the file
This should help with troubleshooting wrong project configuration
2020-09-29 22:13:23 +02:00
bors[bot]
80b0b0ea03
Merge #6095
6095: Remove periodic gc stub r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-09-29 19:23:15 +00:00
Aleksey Kladov
e7df0ad2fb Remove periodic gc stub 2020-09-29 21:22:48 +02:00
bors[bot]
7283783b98
Merge #6094
6094: More panic_context r=matklad a=matklad

bors r+\n🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-09-29 18:50:46 +00:00
Aleksey Kladov
8e34c0fb73 More panic_context 2020-09-29 20:49:48 +02:00
vlakreeh
c84fdb8b3e Add convert integer literal assist 2020-09-29 14:48:43 -04:00
bors[bot]
4ecab09cbc
Merge #6093
6093: Add panic_context module for better panic messages r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-09-29 18:36:01 +00:00
Aleksey Kladov
d3a2b21a8c Add panic_context module for better panic messages 2020-09-29 20:20:47 +02:00