Commit Graph

12826 Commits

Author SHA1 Message Date
bors[bot]
81d6816f17
Merge #6150
6150: Move ModPath->ast::Path function to IDE layer r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-06 14:21:05 +00:00
Aleksey Kladov
2090b534fc Move ModPath->ast::Path function to IDE layer
closes #6092
2020-10-06 16:19:18 +02:00
bors[bot]
8bf13292f0
Merge #6148
6148: Fix trait object hir formatting behind pointer and references r=matklad a=Veykril

Fixes #6064

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-06 13:28:03 +00:00
bors[bot]
9507a01e9e
Merge #6149
6149: Smoke test docs generation r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-06 13:18:37 +00:00
Aleksey Kladov
c32fb96c33 Smoke test docs generation 2020-10-06 15:17:16 +02:00
Lukas Wirth
643bbf15a2 Fix trait object hir formatting behind pointer and references 2020-10-06 14:40:27 +02:00
bors[bot]
87cb840a4e
Merge #6124
6124: Better normalized crate name usage r=jonas-schievink a=SomeoneToIgnore

Closes https://github.com/rust-analyzer/rust-analyzer/issues/5343 
Closes https://github.com/rust-analyzer/rust-analyzer/issues/5932

Uses normalized name for code snippets (to be able to test the fix), hover messages and documentation rewrite links (are there any tests for those?).
Also renamed the field to better resemble the semantics.

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-10-06 11:51:15 +00:00
bors[bot]
af0e54a566
Merge #6139
6139: Make find_path_prefixed configurable r=matklad a=Veykril

This makes `find_path_prefixed` more configurable allowing one to choose whether it always returns absolute paths, self-prefixed paths or to ignore local imports when building the path. 

The config names are just thrown in here, taking better names if they exist :)

This should fix #6131 as well?

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-06 11:43:08 +00:00
bors[bot]
69512dae26
Merge #6147
6147: Do not leave braces for colons in dbg! r=matklad a=SomeoneToIgnore

Tweak remove dbg heuristics a bit to remove braces when colons (`:`) are used in the non-leaf dbg expressions.

Before:
`dbg!(Foo::foo_test()).bar()` -> `(Foo::foo_test()).bar()`

After:
`dbg!(Foo::foo_test()).bar()` -> `Foo::foo_test().bar()`

Co-authored-by: Kirill Bulatov <mail4score@gmail.com>
2020-10-06 11:36:25 +00:00
Kirill Bulatov
af4ae86e27 Do not leave braces for colons in dbg! 2020-10-06 14:21:22 +03:00
bors[bot]
cb78c40b0e
Merge #6133
6133: Add some notes related to privacy and network access r=SomeoneToIgnore a=lnicola

Closes #5551.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-10-05 22:09:28 +00:00
bors[bot]
dd6a352e64
Merge #6111
6111: Add assist for converting the base of integer literals. r=SomeoneToIgnore a=vlakreeh

This PR adds an assist similar to Intellij's [convert number to](https://i.imgur.com/JH6wstP.png). It also does a small refactor to [assists/src/tests.rs](fc34403018/crates/assists/src/tests.rs) to add the ability to specify the resolved assist for a specific action within an assist group.

## Demo
![Demo of the assist in action](https://i.imgur.com/MBhdPFH.gif)

Co-authored-by: vlakreeh <zeb@zebulon.dev>
2020-10-05 22:00:40 +00:00
bors[bot]
3fc7338dcb
Merge #6143
6143: Account for proc macro helpers when parsing attr r=jonas-schievink a=jonas-schievink

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

Co-authored-by: Jonas Schievink <jonasschievink@gmail.com>
2020-10-05 21:42:06 +00:00
Jonas Schievink
8ab7696acd Account for proc macro helpers when parsing attr 2020-10-05 23:41:16 +02:00
bors[bot]
44587d1bfc
Merge #6127
6127: Correctly complete items with leading underscore r=SomeoneToIgnore a=fmease

Fixes #6091. Let me know if the test is placed into the right file or if it is even desired.

Co-authored-by: León Orell Valerian Liehr <liehr.exchange@gmx.net>
2020-10-05 21:27:18 +00:00
bors[bot]
aa76ce36e1
Merge #6142
6142: Fix feature name r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-05 18:25:35 +00:00
Aleksey Kladov
bff812ddfe Fix feature name 2020-10-05 20:25:11 +02:00
Lukas Wirth
8699331014 Make ImportPrefix a configuration option 2020-10-05 17:41:49 +02:00
Lukas Wirth
67e71619b9 Make find_path_prefixed configurable 2020-10-05 17:12:37 +02:00
Laurențiu Nicola
33b51e70bb Add notes concerning privacy and network access 2020-10-04 20:16:53 +03:00
bors[bot]
e5f252ade7
Merge #5997
5997: Better inlay hints in 'for' loops r=popzxc a=popzxc

For #5206 (one part of the fix).

This PR refines the logic of spawning an inlay hints in `for` loops. We only must provide a hint if the following criteria are met:

- User already typed `in` keyword.
- Type of expression is known and it's not unit.

**However:** I don't know why, but I was unable to make `complete_for_hint` test work. Either without or with my changes, I was always getting this test failed because no hint was spawned for the loop variable.

This change works locally, so I would really appreciate an explanation why this test isn't working now and how to fix it.

![image](https://user-images.githubusercontent.com/12111581/93024580-41a53380-f600-11ea-9bb1-1f8ac141be95.png)

Co-authored-by: Igor Aleksanov <popzxc@yandex.ru>
2020-10-03 11:00:30 +00:00
Igor Aleksanov
3cadba4956 Improve readability in inlay_hints.rs 2020-10-03 13:44:43 +03:00
Igor Aleksanov
91a09f50f4 Remove 'for_expr' test from inlay_hints.rs 2020-10-03 08:58:17 +03:00
Igor Aleksanov
a58441ad1b Make the tests for complete/incomplete for inlay hints work 2020-10-03 08:37:58 +03:00
Igor Aleksanov
8ca214fbfb Better inlay hints in 'for' loops 2020-10-03 08:30:25 +03:00
León Orell Valerian Liehr
32864e3b49 Correctly complete items with leading underscore 2020-10-03 03:00:09 +02:00
bors[bot]
03dcf5111a
Merge #6125
6125: Simplify ast_transform r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-10-02 19:02:03 +00:00
Aleksey Kladov
3290bb4112 Simplify ast_transform 2020-10-02 20:52:48 +02:00
Kirill Bulatov
9d19e5b962 Properly name the field 2020-10-02 21:38:22 +03:00
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