Commit Graph

12881 Commits

Author SHA1 Message Date
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
bors[bot]
662ed41ebc
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>
2020-09-25 14:57:15 +00:00
bors[bot]
dc09f1597f
Merge #6076
6076: Update chalk to 0.28.0 r=matklad a=vandenheuvel



Co-authored-by: Bram van den Heuvel <bram@vandenheuvel.online>
2020-09-25 14:47:56 +00:00
Bram van den Heuvel
dff6895ce8 Update chalk to 0.28.0 2020-09-25 15:29:31 +02:00
Lukas Wirth
747f6f64d7 Remove partial import test in insert_use 2020-09-25 15:21:50 +02:00
Lukas Wirth
e1d6981f90 Don't unnecessarily unnest imports for import insertion 2020-09-25 15:19:22 +02:00
bors[bot]
cfe987bcdf
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>
2020-09-25 11:55:35 +00:00
bors[bot]
163ffb8803
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>
2020-09-25 11:49:12 +00:00
bors[bot]
277488b51e
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>
2020-09-24 15:07:35 +00:00
Jean SIMARD
875ad9b5c4
Bump smol_str from 0.1.16 to 0.1.17 2020-09-24 16:39:08 +02:00
bors[bot]
65592b41be
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>
2020-09-24 14:20:05 +00:00
Paul Daniel Faria
ed8968af49 Cleanup unintended unresolved reference in syntax higlighting test 2020-09-24 10:14:25 -04:00
bors[bot]
5d137f21f2
Merge #6056
6056: Add dbgr postfix completion r=matklad a=lnicola

Expanding to `dbg!(&e)`.

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-09-24 14:14:01 +00:00
bors[bot]
de4fb13806
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>
2020-09-24 14:08:46 +00:00
bors[bot]
9d3483a74d
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>
2020-09-24 12:23:28 +00:00
bors[bot]
4ddb8124b0
Merge #6068
6068: More compliant lsp-types 0.82 r=kjeremy a=kjeremy



Co-authored-by: kjeremy <kjeremy@gmail.com>
2020-09-23 19:56:32 +00:00
kjeremy
95d7e3ce49 lsp-types 0.82 2020-09-23 15:41:55 -04:00
Matthias Einwag
8eae893c76 Fix lint 2020-09-23 08:39:04 -07:00
Matthias Einwag
c7f4647749 Move unlink on download into download function
Since this is required by all callsites its easier to have it in the
function itself.
2020-09-23 08:37:02 -07:00
Matthias Einwag
df4d59512e Remane function 2020-09-23 08:27:25 -07:00
Matthias Einwag
d38f759c63 Use closure in trailing position and strongly type header map 2020-09-23 08:24:35 -07:00
Matthias Einwag
87933e15ce
Apply suggestions from code review
Co-authored-by: Veetaha <veetaha2@gmail.com>
2020-09-23 08:14:18 -07:00
Matthias Einwag
45de3e738c Remove stray newline 2020-09-23 01:06:10 -07:00
Matthias Einwag
145bd6f701 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.
2020-09-23 01:03:34 -07:00
Matthias Einwag
501b516db4 Add a command for updating the Github API token 2020-09-23 00:50:34 -07:00
Matthias Einwag
a0a7cd306e 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.
2020-09-23 00:28:38 -07:00
Matthias Einwag
1503d9de41 Fix tslint 2020-09-22 23:41:51 -07:00
Matthias Einwag
b93ced6f63 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
2020-09-22 23:12:51 -07:00
Laurențiu Nicola
eb0e710779 Add dbgr postfix completion 2020-09-22 08:54:57 +03:00
Russell Mull
197d1e1b05 Cargo fmt 2020-09-21 17:47:20 -07:00
Russell Mull
e3b19da8c1 Add ok postfix completion 2020-09-21 17:15:20 -07:00
Masaki Hara
5cca4c9214
VS Code + WSL: describe binary location
It looks like VS Code server chooses a different location for `globalStorage`.
2020-09-21 23:07:54 +09:00
bors[bot]
bcdedbb3d5
Merge #6048
6048: Code Docs r=matklad a=matklad



Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2020-09-21 12:36:05 +00:00
Aleksey Kladov
fcc3c49013
Apply suggestions from code review
Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
2020-09-21 15:35:42 +03:00
Aleksey Kladov
8e3082ff6e Document AstTransformation 2020-09-21 12:36:51 +02:00
Aleksey Kladov
2c916bbc18 Document SemanticScope 2020-09-21 12:30:55 +02:00
bors[bot]
3b52d3181a
Merge #6043
6043: Allow missing trait members assist without needing braces r=matklad a=M-J-Hooper

Assist to complete missing items when implementing a trait does not appear without impl def braces (see #5144 ).

The reason behind this was that this assist is based on `ast::AssocItemList` which only appears in the AST after the braces are added to the impl def.

Instead of relying on and replacing the item list, we now instead replace the entire `ast::Impl` and add the item list if its missing.

Co-authored-by: Matt Hooper <matthewjhooper94@gmail.com>
2020-09-21 09:06:24 +00:00
Matt Hooper
7d90bb1f47 Rename impl edit method to be more explicit 2020-09-21 10:01:50 +01:00
Matt Hooper
532be0e780 Added test for impl member assist when impl def is missing braces 2020-09-21 09:48:51 +01:00
Matt Hooper
9724af038b Replace entire impl def instead of only associated items for missing impl member assist (if braces are missing from an impl def then there is no associated item list in the AST) 2020-09-21 00:42:27 +01:00