Commit Graph

8430 Commits

Author SHA1 Message Date
bors[bot]
e6a05e6566
Merge #5651
5651: Add track_env_var to the proc macro server r=kjeremy a=lnicola

See https://github.com/rust-lang/rust/pull/74653.

Fixes #6054.
Fixes #5640, maybe.

Should be merged when 1.47 is released.

Proc macros still don't work for me, but it no longer crashes.



Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2020-10-08 14:27:30 +00:00
Laurențiu Nicola
3d169bd3f4 Add track_env_var to the proc macro server 2020-10-08 17:06:20 +03:00
bors[bot]
e95e666b10
Merge #6161
6161: Bump chalk to use latest git to get upstream fix r=jonas-schievink a=Ameobea

 * Chalk very recently (like an hour ago) merged a fix that prevents rust analyzer from panicking.  This allows it to be usable again for code that hits those situations.  See #6134, #6145, Probably #6120

Co-authored-by: Casey Primozic <me@ameo.link>
2020-10-07 20:46:33 +00:00
Casey Primozic
37df2138ec
Switch from git to latest tagged release of chalk deps 2020-10-07 12:11:22 -07:00
bors[bot]
83a651b123
Merge #6154
6154: Shorten type hints for std::iter Iterators r=SomeoneToIgnore a=Veykril

Fixes #3750.

This re-exports the `hir_expand::name::known` module to be able to fetch the `Iterator` and `iter` names.
I'm not sure if there is anything to do with `Solution::Ambig` in `normalize_trait_assoc_type` or whether discarding those results is always wanted.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-07 11:52:05 +00:00
Lukas Wirth
783af171f7 Clean up inlay_hints 2020-10-07 13:18:12 +02:00
Aleksey Kladov
6219142c96 Better progress API
Percentage is a UI concern, the physical fact here is fraction. It's
sad that percentage bleeds into the protocol level, we even duplicated
this bad API ourselves!
2020-10-07 12:15:37 +02:00
Lukas Wirth
e106857e80 Shorten iterator hints for std::iter iterators behind references 2020-10-07 12:14:08 +02:00
Aleksey Kladov
fd8622e1ec Cleanup 2020-10-07 11:55:20 +02:00
bors[bot]
faddea9353
Merge #6158
6158: Fix for negative literals in macros r=matklad a=cutsoy

_This pull request fixes #6028._

When writing `-42.0f32` in Rust, it is usually parsed as two different tokens (a minus operator and a float literal).

But a procedural macro can also generate new tokens, including negative [float literals](https://doc.rust-lang.org/stable/proc_macro/struct.Literal.html#method.f32_suffixed):

```rust
#[proc_macro]
fn example_verbose(input: TokenStream) -> TokenStream {
    let literal = Literal::f32_suffixed(-42.0);
    quote! { #literal }
}
```

or even shorter

```rust
#[proc_macro]
fn example(input: TokenStream) -> TokenStream {
    let literal = -42.0f32;
    quote! { #literal }
}
```

Unfortunately, these currently cause RA to crash:

```
thread '<unnamed>' panicked at 'Fail to convert given literal Literal {
    text: "-42.0f32",
    id: TokenId(
        4294967295,
    ),
}', crates/mbe/src/subtree_source.rs:161:28
```

This pull request contains both a fix 8cf9362 and a unit test 27798ee. In addition, I installed the patched server with `cargo xtask install --server` and verified in VSCode that it no longer crashes when a procedural macro returns a negative number literal.

Co-authored-by: Tim <tim@glacyr.com>
2020-10-07 09:32:47 +00:00
Lukas Wirth
209e9b9926 Shorten iterator chain hints 2020-10-07 11:30:42 +02:00
bors[bot]
a184c83535
Merge #6160
6160: Add validation check for ambiguous trait objects r=matklad a=Veykril

Fixes #285.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2020-10-07 09:12:09 +00:00
Lukas Wirth
c133651e0a Move IntoIterator into FamousDefs 2020-10-07 10:14:42 +02:00
Casey Primozic
13bdadb515
Make unimplemented match variants explicit 2020-10-06 23:56:31 -07:00
Casey Primozic
f40e86e141
todo!() -> unimplemented!() // FIXME for CI 2020-10-06 15:19:34 -07:00
Casey Primozic
56a8a7645f
Bump chalk to use latest git to get fix
* Chalk very recently (like an hour ago) merged a fix that prevents rust analyzer from panicking.  This allows it to be usable again for code that hits those situations.  See #6134, #6145, Probably #6120
2020-10-06 15:05:20 -07:00
Lukas Wirth
6f38552edb Add validation check for ambiguous trait objects 2020-10-06 23:52:00 +02:00
Tim
27798ee575
Added unit test for negative number literals in macros. 2020-10-06 22:28:13 +02:00
Tim
8cf9362984
Fixed parsing of negative number literals in macros. 2020-10-06 22:28:13 +02:00
Lukas Wirth
c6f1de6ac5 Use FamousDefs for shorten_iterator hint 2020-10-06 21:25:39 +02:00
bors[bot]
bf1043cac2
Merge #6128
6128: Trim all trailing whitespace in onEnter r=matklad a=repnop

Fixes #5848

Co-authored-by: Wesley Norris <repnop@outlook.com>
2020-10-06 18:17:49 +00:00
Aleksey Kladov
d7991f5f21 Document privacy invariant of SyntaxPtr 2020-10-06 20:06:14 +02:00
bors[bot]
57735f2a32
Merge #6140
6140: honour hover.content_format client capability r=lnicola a=robinvd

This removes all markdown when the client does not support the markdown MarkupKind.

Otherwise the output on the editor will have some markdown boilerplate, making it less readable.

For example kak_lsp does not currently support markdown.
![image](https://user-images.githubusercontent.com/22073483/95112949-ef0ff080-0741-11eb-82a7-0594fa2cd736.png)

after:
![image](https://user-images.githubusercontent.com/22073483/95113089-2bdbe780-0742-11eb-94fa-bcfec6d7347a.png)



Co-authored-by: Robin van Dijk <robin@robinjint.nl>
2020-10-06 17:51:20 +00:00
Aleksey Kladov
801e5b453c Add test makr 2020-10-06 19:20:56 +02:00
Lukas Wirth
aaa3905fdd Shorten type hints for std::iter Iterators 2020-10-06 19:20:42 +02:00
Aleksey Kladov
0d3bc38577 Constrain ImportMap to only store simple paths 2020-10-06 17:04:29 +02:00
Robin van Dijk
bd7bf4a276 add break after codeblocks 2020-10-06 16:34:38 +02:00
Robin van Dijk
bc890ed5b0 add doc describing limited capabilities 2020-10-06 16:34:26 +02:00
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
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
Kirill Bulatov
af4ae86e27 Do not leave braces for colons in dbg! 2020-10-06 14:21:22 +03: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
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
Aleksey Kladov
bff812ddfe Fix feature name 2020-10-05 20:25:11 +02:00
Robin van Dijk
81f61afa9f add docstring 2020-10-05 20:06:25 +02:00
Robin van Dijk
c3cc361294 honor content_format clientcap
This removes all markdown when the client does not support the markdown MarkupKind

Otherwise the output on the editor will have some markdown boilerplate, making it less readable
2020-10-05 19:27:29 +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
Wesley Norris
adb3c56ff0 Trim all trailing whitespace in onEnter
Fixes #5848
2020-10-03 14:17:21 -04: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
Aleksey Kladov
3290bb4112 Simplify ast_transform 2020-10-02 20:52:48 +02:00