Commit Graph

12820 Commits

Author SHA1 Message Date
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
bors[bot]
e315fd9bb0
Merge #6090
6090: More style advice r=matklad a=matklad

bors r+\n🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-09-29 13:00:36 +00:00
Aleksey Kladov
b069c1c69a More style advice 2020-09-29 14:42:09 +02:00
bors[bot]
bdc1f76cbd
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>
2020-09-29 12:36:11 +00:00
vsrs
91da41b3b1 Replace "No references" with "0 references". 2020-09-29 15:29:20 +03:00
vsrs
cd5eeb904e Add tests 2020-09-29 15:29:20 +03:00
vsrs
1895716c88 Do not show references CodeLens for tests. 2020-09-29 15:29:20 +03:00
vsrs
06fbd69050 Make method references CodeLens lazy. 2020-09-29 15:29:20 +03:00
vsrs
b7fda5f936 Make method references CodeLens off by default. 2020-09-29 15:29:20 +03:00
vsrs
eeb40dbece Add method references CodeLens 2020-09-29 15:29:20 +03:00
bors[bot]
e813de6cdd
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>
2020-09-29 12:10:47 +00:00
flw
e73ee9dfa2
Add hover config linksInHover to suppress links 2020-09-29 19:47:18 +08:00
bors[bot]
18c62c8a39
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>
2020-09-29 10:29:33 +00:00
bors[bot]
7b674f9ab4
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>
2020-09-28 18:30:50 +00:00
Nathan Whitaker
f50458deaf Update chalk to 0.30.0 2020-09-28 14:24:11 -04:00
bors[bot]
5507091750
Merge #6087
6087: Microoptimize
 r=matklad a=matklad

bors r+
🤖

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-09-28 17:07:58 +00:00
Aleksey Kladov
6ff78962b3 Microoptimize 2020-09-28 19:06:51 +02:00
bors[bot]
eb79c2094f
Merge #6086
6086: chalk 0.29.0 r=kjeremy a=kjeremy



Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-09-28 11:45:34 +00:00
Jeremy Kolb
76dfac7894 chalk 0.29.0 2020-09-28 07:44:27 -04:00
bors[bot]
0fb5d9d87a
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>
2020-09-28 11:03:47 +00:00
Jonas Schievink
e88e4fbb7b Add more comments about proc macro resolution 2020-09-28 13:02:28 +02:00
Jonas Schievink
e799dbe5d7 Simplify iterator chain 2020-09-28 12:51:40 +02:00
bors[bot]
000046cfa0
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>
2020-09-28 10:47:33 +00:00
Jonas Schievink
f0b5832cb8 Mark unresolved imports diagnostic as experimental 2020-09-28 12:45:20 +02:00
bors[bot]
2edf15aede
Merge #6084
6084: Update deps r=kjeremy a=kjeremy

cargo update

Co-authored-by: Jeremy Kolb <kjeremy@gmail.com>
2020-09-27 22:16:55 +00:00
Jeremy Kolb
89ac5995e9 Update deps 2020-09-27 18:14:50 -04:00
bors[bot]
ca48c4534b
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>
2020-09-27 17:43:28 +00:00
Jonas Schievink
1a28f30ba4 Spawn a flycheck instance per workspace 2020-09-27 19:41:54 +02:00