]> git.lizzy.rs Git - rust.git/log
rust.git
22 months agoUpdate crates/ide/src/references.rs
Stanislav [Wed, 7 Sep 2022 00:01:06 +0000 (03:01 +0300)]
Update crates/ide/src/references.rs

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
22 months agofix
Stanislav [Sun, 4 Sep 2022 16:45:50 +0000 (19:45 +0300)]
fix

22 months agoUpdate crates/ide/src/references.rs
Stanislav [Sun, 4 Sep 2022 16:41:06 +0000 (19:41 +0300)]
Update crates/ide/src/references.rs

Co-authored-by: Laurențiu Nicola <lnicola@users.noreply.github.com>
22 months agoRetain imports on find-all-references
Stanislav [Sun, 4 Sep 2022 16:10:04 +0000 (19:10 +0300)]
Retain imports on find-all-references

22 months agoAuto merge of #13183 - Veykril:break-break, r=Veykril
bors [Sat, 3 Sep 2022 15:33:21 +0000 (15:33 +0000)]
Auto merge of #13183 - Veykril:break-break, r=Veykril

Fix nested break expressions, expecting unknown types

22 months agoFix nested break expressions, expecting unknown types
Lukas Wirth [Sat, 3 Sep 2022 15:08:18 +0000 (17:08 +0200)]
Fix nested break expressions, expecting unknown types

22 months agoAuto merge of #13175 - Veykril:resolver, r=Veykril
bors [Fri, 2 Sep 2022 17:38:26 +0000 (17:38 +0000)]
Auto merge of #13175 - Veykril:resolver, r=Veykril

Clarify the state of (extern) preludes for block def maps

22 months agoClarify the state of (extern) preludes for block def maps
Lukas Wirth [Fri, 2 Sep 2022 15:43:20 +0000 (17:43 +0200)]
Clarify the state of (extern) preludes for block def maps

22 months agoAuto merge of #13174 - Veykril:resolver, r=Veykril
bors [Fri, 2 Sep 2022 15:03:29 +0000 (15:03 +0000)]
Auto merge of #13174 - Veykril:resolver, r=Veykril

Lift out the module scope into a field in the Resolver

A Resolver *always* has a module scope at the end of its scope stack,
instead of encoding this as an invariant we can just lift this scope
out into a field, allowing us to skip going through the scope vec
indirection entirely.

22 months agoLift out the module scope into a field in the Resolver
Lukas Wirth [Fri, 2 Sep 2022 14:57:31 +0000 (16:57 +0200)]
Lift out the module scope into a field in the Resolver

A Resolver *always* has a module scope at the end of its scope stack,
instead of encoding this as an invariant we can just lift this scope
out into a field, allowing us to skip going through the scope vec
indirection entirely.

22 months agoAuto merge of #13173 - Veykril:synthetic, r=Veykril
bors [Fri, 2 Sep 2022 13:17:16 +0000 (13:17 +0000)]
Auto merge of #13173 - Veykril:synthetic, r=Veykril

Don't store SyntheticSyntax in the reverse maps in BodySourceMap

They are ZSTs which we can just create on missing access instead.

22 months agoDon't store SyntheticSyntax in the reverse maps in BodySourceMap
Lukas Wirth [Fri, 2 Sep 2022 13:08:48 +0000 (15:08 +0200)]
Don't store SyntheticSyntax in the reverse maps in BodySourceMap

They are ZSTs which we can just create on missing access instead.

22 months agoAuto merge of #13167 - iDawer:exhaustive_patterns, r=Veykril
bors [Fri, 2 Sep 2022 12:32:36 +0000 (12:32 +0000)]
Auto merge of #13167 - iDawer:exhaustive_patterns, r=Veykril

feat: Implement `feature(exhaustive_patterns)` from unstable Rust

Closes #12753

Recognize Rust's unstable `#![feature(exhaustive_patterns)]` (RFC 1872). Allow omitting visibly uninhabited variants from `match` expressions when the feature is on.

This adjusts match checking to the current implementation of the postponed RFC 1872 in rustc.

22 months agoAdd docs
iDawer [Fri, 2 Sep 2022 12:01:51 +0000 (17:01 +0500)]
Add docs

22 months agoRecord enabled unstable features into DefMap
iDawer [Fri, 2 Sep 2022 07:52:58 +0000 (12:52 +0500)]
Record enabled unstable features into DefMap

22 months agoAuto merge of #13171 - matklad:open-failure, r=lnicola
bors [Fri, 2 Sep 2022 10:53:49 +0000 (10:53 +0000)]
Auto merge of #13171 - matklad:open-failure, r=lnicola

internal: ignore failures when publishing to ovsx

This has been failing for a while

https://github.com/rust-lang/rust-analyzer/runs/8147683225?check_suite_focus=true#step:24:19

22 months agointernal: ignore failures when publishing to ovsx
Aleksey Kladov [Fri, 2 Sep 2022 10:48:58 +0000 (11:48 +0100)]
internal: ignore failures when publishing to ovsx

This has been failing for a while

https://github.com/rust-lang/rust-analyzer/runs/8147683225?check_suite_focus=true#step:24:19

22 months agoAuto merge of #13160 - ChayimFriedman2:parse-parenthesized-type-path-with-coloncolon...
bors [Thu, 1 Sep 2022 21:00:14 +0000 (21:00 +0000)]
Auto merge of #13160 - ChayimFriedman2:parse-parenthesized-type-path-with-coloncolon, r=jonas-schievink

fix: Parse TypePathFn with preceding `::`

e.g. `impl Fn::() -> ()`.

Fixes #13157. This was the problem, not that the path was not at the end.

I could unify the parsing of `::` of TypePathFn with that of generic arg list, but some code relies on the `::` of generic arg list to be inside it.

22 months agoAuto merge of #13161 - ChayimFriedman2:pi-is-zero, r=jonas-schievink
bors [Thu, 1 Sep 2022 20:51:22 +0000 (20:51 +0000)]
Auto merge of #13161 - ChayimFriedman2:pi-is-zero, r=jonas-schievink

fix: Lower float literals with underscores

Fixes #13155 (the problem was the `PI` is defined with `_f64` suffix). `PI` is still truncated, though, because `f64` cannot represent the value with full precision.

22 months agoAuto merge of #13165 - Veykril:breakables, r=Veykril
bors [Thu, 1 Sep 2022 13:07:26 +0000 (13:07 +0000)]
Auto merge of #13165 - Veykril:breakables, r=Veykril

Properly handle break resolution inside non-breakable expressions

We now diagnose invalid `continue` expressions and properly handle things like `async` blocks which prevent labels from resolving further. Cleaned this up since `label_break_value` is on the way to stabilization in rust (🎉 finally) and we weren't handling breaks for blocks properly yet.

22 months agoDon't run `rust-2021-compatibility` lints, our crates are already on 2021
Lukas Wirth [Thu, 1 Sep 2022 13:04:55 +0000 (15:04 +0200)]
Don't run `rust-2021-compatibility` lints, our crates are already on 2021

22 months agoProperly handle break resolution inside non-breakable expressions
Lukas Wirth [Thu, 1 Sep 2022 12:54:47 +0000 (14:54 +0200)]
Properly handle break resolution inside non-breakable expressions

22 months agoDiagnose incorrect continue expressions
Lukas Wirth [Thu, 1 Sep 2022 12:30:57 +0000 (14:30 +0200)]
Diagnose incorrect continue expressions

22 months agoSimplify breakables handling
Lukas Wirth [Thu, 1 Sep 2022 12:13:08 +0000 (14:13 +0200)]
Simplify breakables handling

23 months agoLower float literals with underscores
Chayim Refael Friedman [Thu, 1 Sep 2022 00:11:32 +0000 (00:11 +0000)]
Lower float literals with underscores

23 months agoParse TypePathFn with preceding `::`
Chayim Refael Friedman [Wed, 31 Aug 2022 23:19:09 +0000 (23:19 +0000)]
Parse TypePathFn with preceding `::`

e.g. `impl Fn::() -> ()`.

23 months agoAuto merge of #13134 - Veykril:proc-highlight, r=Veykril
bors [Wed, 31 Aug 2022 19:42:53 +0000 (19:42 +0000)]
Auto merge of #13134 - Veykril:proc-highlight, r=Veykril

Highlight namerefs by syntax until proc-macros have been loaded

Usually when loading up a project, once loading is done we start answering highlight requests while proc-macros haven't always been loaded yet, so we start out with showing a lot of unresolved name-refs. After this PR, we'll use syntax based highlighting for those unresolved namerefs until the proc-macros have been loaded.

23 months agoCorrect visibility check
iDawer [Wed, 31 Aug 2022 16:41:24 +0000 (21:41 +0500)]
Correct visibility check

23 months agoAuto merge of #13156 - Veykril:macro-stmts, r=Veykril
bors [Wed, 31 Aug 2022 16:09:17 +0000 (16:09 +0000)]
Auto merge of #13156 - Veykril:macro-stmts, r=Veykril

Remove hir::Expr::MacroStmts

This hir expression isn't needed and only existed as it was simpler to
deal with at first as it gave us a direct mapping for the ast version of
the same construct. This PR removes it, properly handling the statements
that are introduced by macro call expressions.

23 months agoRemove unnecessary allocations
Lukas Wirth [Wed, 31 Aug 2022 16:05:52 +0000 (18:05 +0200)]
Remove unnecessary allocations

23 months agoImplement unstable RFC 1872 `exhaustive_patterns`
iDawer [Wed, 31 Aug 2022 15:17:54 +0000 (20:17 +0500)]
Implement unstable RFC 1872 `exhaustive_patterns`

23 months agoRemove hir::Expr::MacroStmts
Lukas Wirth [Wed, 31 Aug 2022 14:58:11 +0000 (16:58 +0200)]
Remove hir::Expr::MacroStmts

This hir expression isn't needed and only existed as it was simpler to
deal with at first as it gave us a direct mapping for the ast version of
the same construct. This PR removes it, properly handling the statements
that are introduced by macro call expressions.

23 months agoAuto merge of #13120 - Austaras:master, r=jonas-schievink
bors [Wed, 31 Aug 2022 13:55:29 +0000 (13:55 +0000)]
Auto merge of #13120 - Austaras:master, r=jonas-schievink

turn `unwrap_or` into `unwrap_or_else` and vice versa

closes #12983

23 months agoAuto merge of #13005 - pocket7878:convert-two-arm-bool-match-to-matches-macro, r...
bors [Wed, 31 Aug 2022 13:47:40 +0000 (13:47 +0000)]
Auto merge of #13005 - pocket7878:convert-two-arm-bool-match-to-matches-macro, r=jonas-schievink

feature: Assist to turn match into matches! invocation

Resolves #12510

This PR adds an assist, which convert 2-arm match that evaluates to a boolean into the equivalent matches! invocation.

23 months agoAuto merge of #13051 - DropDemBits:attrs-and-comments-on-enum-variant, r=jonas-schievink
bors [Wed, 31 Aug 2022 13:34:43 +0000 (13:34 +0000)]
Auto merge of #13051 - DropDemBits:attrs-and-comments-on-enum-variant, r=jonas-schievink

fix: Only move comments when extracting a struct from an enum variant

Motivating example:

```rs
#[derive(Debug, thiserror::Error)]
enum Error {
    /// Some explanation for this error
    #[error("message")]
    $0Woops {
        code: u32
    }
}
```
now becomes
```rs
/// Some explanation for this error
#[derive(Debug, thiserror::Error)]
struct Woops{
    code: u32
}

#[derive(Debug, thiserror::Error)]
enum Error {
    #[error("message")]
    Woops(Woops)
}
```
(the `thiserror::Error` derive being copied and the struct formatting aren't ideal, though those are issues for another day)

23 months agofeature: Check if first_arm bool and second_arm bool is inverted or not.
Pocket7878 [Wed, 31 Aug 2022 09:38:20 +0000 (18:38 +0900)]
feature: Check if first_arm bool and second_arm bool is inverted or not.

23 months agofeature: Simplfy branch check logics
Masato Sogame [Wed, 31 Aug 2022 09:29:58 +0000 (18:29 +0900)]
feature: Simplfy branch check logics

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
23 months agofix: Simplify logics to allow two-arm enum match.
Pocket7878 [Fri, 12 Aug 2022 15:29:18 +0000 (00:29 +0900)]
fix: Simplify logics to allow two-arm enum match.

23 months agoAdd convert_two_arm_bool_match_to_matches_macro ide-assists
Pocket7878 [Fri, 12 Aug 2022 07:11:04 +0000 (16:11 +0900)]
Add convert_two_arm_bool_match_to_matches_macro ide-assists

23 months agochange title
austaras [Wed, 31 Aug 2022 09:31:23 +0000 (17:31 +0800)]
change title

23 months agoAuto merge of #12963 - DesmondWillowbrook:clippy-matches-sourcegen, r=Veykril
bors [Wed, 31 Aug 2022 08:37:14 +0000 (08:37 +0000)]
Auto merge of #12963 - DesmondWillowbrook:clippy-matches-sourcegen, r=Veykril

clippy: make generated code nice to read

Feel free to close if this is too minor.

(For context, I _have_ read the clippy policy in `dev/style.md`)

23 months agoAuto merge of #12793 - lowr:fix/12739, r=Veykril
bors [Wed, 31 Aug 2022 08:28:12 +0000 (08:28 +0000)]
Auto merge of #12793 - lowr:fix/12739, r=Veykril

fix: sort and deduplicate auto traits in trait object types

Fixes #12739

Chalk solver doesn't sort and deduplicate auto traits in trait object types, so we need to handle them ourselves in the lowering phase, just like [`rustc`](https://github.com/rust-lang/rust/blob/880416180b0a9ee1141c07d4d17667edb77daebd/compiler/rustc_typeck/src/astconv/mod.rs#L1487-L1488) and [`chalk-integration`](https://github.com/rust-lang/chalk/blob/master/chalk-integration/src/lowering.rs#L575) do.

Quoting from [the Chalk book](https://rust-lang.github.io/chalk/book/types/rust_types.html#dyn-types):

> Note that -- for this purpose -- ordering of bounds is significant. That means that if you create a `dyn Foo + Send` and a `dyn Send + Foo`, chalk would consider them distinct types. The assumption is that bounds are ordered in some canonical fashion somewhere else.

Also, trait object types with more than one non-auto traits were previously allowed, but are now disallowed with this patch.

23 months agoAuto merge of #13149 - lowr:fix/unescape-raw-ident-module-path, r=Veykril
bors [Wed, 31 Aug 2022 08:15:31 +0000 (08:15 +0000)]
Auto merge of #13149 - lowr:fix/unescape-raw-ident-module-path, r=Veykril

fix: unescape all occurrences of module name in module resolution

Fixes #13141

23 months agoAuto merge of #13154 - Veykril:ty-mac-expander, r=Veykril
bors [Wed, 31 Aug 2022 08:07:26 +0000 (08:07 +0000)]
Auto merge of #13154 - Veykril:ty-mac-expander, r=Veykril

Drop the expander borrow in all control flow paths

The change in https://github.com/rust-lang/rust-analyzer/pull/13123
actually re-uses the RefMut borrow instead of dropping it so we need to
drop it manually where required.

Fixes https://github.com/rust-lang/rust-analyzer/issues/13153

23 months agoDrop the expander borrow in all control flow paths
Lukas Wirth [Wed, 31 Aug 2022 08:04:01 +0000 (10:04 +0200)]
Drop the expander borrow in all control flow paths

The change in https://github.com/rust-lang/rust-analyzer/pull/13123
actually re-uses the RefMut borrow instead of dropping it so we need to
drop it manually where required.

23 months agoAuto merge of #13151 - ChayimFriedman2:replace-turbofish-other-type, r=Veykril
bors [Wed, 31 Aug 2022 07:47:53 +0000 (07:47 +0000)]
Auto merge of #13151 - ChayimFriedman2:replace-turbofish-other-type, r=Veykril

Use correct type in "Replace turbofish with type"

And support `?` and `.await` expressions.

Fixes #13148.

The assist can still show up even if the turbofish's type is not used at all, e.g.:
```rust
fn foo<T>() {}
let v = foo::<i32>();
```

23 months agoSupport `?` and `.await` in "Replace turbofish with explicit type"
Chayim Refael Friedman [Wed, 31 Aug 2022 01:24:36 +0000 (01:24 +0000)]
Support `?` and `.await` in "Replace turbofish with explicit type"

Now that we use type information this is easy.

23 months agoUse type information to deduce the correct type for "Replace turbofish with explicit...
Chayim Refael Friedman [Wed, 31 Aug 2022 01:07:41 +0000 (01:07 +0000)]
Use type information to deduce the correct type for "Replace turbofish with explicit type", even when it is not exactly the same as the turbofish type

I implemented that by checking the expressions' type.
This could probably be implemented better by taking the function's return type and substituting the generic parameter with the provided turbofish, but this is more complicated.

23 months agofix: unescape all occurrences of module name in module resolution
Ryo Yoshida [Tue, 30 Aug 2022 18:43:28 +0000 (03:43 +0900)]
fix: unescape all occurrences of module name in module resolution

23 months agoMove comments to the extracted struct
DropDemBits [Tue, 30 Aug 2022 18:47:08 +0000 (14:47 -0400)]
Move comments to the extracted struct

23 months agoAuto merge of #13145 - ChayimFriedman2:unmerge-match-arm, r=jonas-schievink
bors [Tue, 30 Aug 2022 13:31:37 +0000 (13:31 +0000)]
Auto merge of #13145 - ChayimFriedman2:unmerge-match-arm, r=jonas-schievink

feat: Add a "Unmerge match arm" assist to split or-patterns inside match expressions

Fixes #13072.

The way I implemented it it leaves the `OrPat` in place even if there is only one pattern now but I don't think something will break because of that, and when more code will be typed we'll parse it again anyway. Removing it (but keeping the child pattern) is hard, I don't know how to do that.

23 months agofix: sort and deduplicate auto traits in trait object types
Ryo Yoshida [Mon, 18 Jul 2022 10:49:14 +0000 (19:49 +0900)]
fix: sort and deduplicate auto traits in trait object types

23 months agofeat: Add a "Unmerge match arm" assist to split or-patterns inside match expressions
Chayim Refael Friedman [Tue, 30 Aug 2022 09:42:12 +0000 (09:42 +0000)]
feat: Add a "Unmerge match arm" assist to split or-patterns inside match expressions

23 months agoHighlight namerefs by syntax until proc-macros have been loaded
Lukas Wirth [Sun, 28 Aug 2022 10:31:31 +0000 (12:31 +0200)]
Highlight namerefs by syntax until proc-macros have been loaded

23 months agoAuto merge of #13056 - DropDemBits:make-refactors, r=Veykril
bors [Mon, 29 Aug 2022 16:34:33 +0000 (16:34 +0000)]
Auto merge of #13056 - DropDemBits:make-refactors, r=Veykril

internal: Migrate to using format arg captures in `syntax::make`

23 months agochange as requested
austaras [Sat, 27 Aug 2022 01:12:19 +0000 (09:12 +0800)]
change as requested

23 months agoupdate tests
austaras [Fri, 26 Aug 2022 10:12:38 +0000 (18:12 +0800)]
update tests

23 months agoadd type check
austaras [Fri, 26 Aug 2022 10:09:34 +0000 (18:09 +0800)]
add type check

23 months agoturn `unwrap_or` into `unwrap_or_else` and vice versa
austaras [Fri, 26 Aug 2022 08:52:45 +0000 (16:52 +0800)]
turn `unwrap_or` into `unwrap_or_else` and vice versa

23 months agoAuto merge of #13133 - Veykril:diag-hack, r=Veykril
bors [Sun, 28 Aug 2022 09:56:06 +0000 (09:56 +0000)]
Auto merge of #13133 - Veykril:diag-hack, r=Veykril

Move empty diagnostics workaround back into the server

This only touches on the diagnostics in one place instead of multiple as was previously done, since all published diagnostics will go through this code path anyways.

Closes https://github.com/rust-lang/rust-analyzer/issues/13130

23 months agoMove empty diagnostics workaround back into the server
Lukas Wirth [Sun, 28 Aug 2022 09:54:46 +0000 (11:54 +0200)]
Move empty diagnostics workaround back into the server

23 months agoAuto merge of #13095 - jonas-schievink:avoid-liveshare-error, r=jonas-schievink
bors [Fri, 26 Aug 2022 18:39:53 +0000 (18:39 +0000)]
Auto merge of #13095 - jonas-schievink:avoid-liveshare-error, r=jonas-schievink

fix: Avoid error popup when using in Live Share

cc https://github.com/rust-lang/rust-analyzer/issues/8844

Not sure if there's a better way to do this, feedback appreciated!

23 months agoAuto merge of #13123 - Veykril:simplify, r=Veykril
bors [Fri, 26 Aug 2022 17:40:56 +0000 (17:40 +0000)]
Auto merge of #13123 - Veykril:simplify, r=Veykril

minor: Simplify

23 months agominor: Simplify
Lukas Wirth [Fri, 26 Aug 2022 17:40:01 +0000 (19:40 +0200)]
minor: Simplify

23 months agoAuto merge of #13087 - Veykril:config-update, r=Veykril
bors [Fri, 26 Aug 2022 16:22:57 +0000 (16:22 +0000)]
Auto merge of #13087 - Veykril:config-update, r=Veykril

Remove auto-config patching from the VSCode client

This was introduced 4 months ago when we drastically changed the config keys. I'd like to remove this given I always felt uneasy doing edits to a users config from within r-a, and by now most if not all users should've swapped to a new enough version of r-a that should've updated their configs.

The extension will continue to work fine even with the outdated keys afterwards since we still do patching server side as well, and that one we'll have to support for quite some more time (if not until a proper 1.0 release where I assume we can allow ourselves some more user facing breakage)

(There also might've been a small bug in here that prevented users with certain outdated keys to prevent them from enabling certain keys for some reason)

23 months agoAuto merge of #13110 - DesmondWillowbrook:issue-11197, r=jonas-schievink
bors [Fri, 26 Aug 2022 13:35:13 +0000 (13:35 +0000)]
Auto merge of #13110 - DesmondWillowbrook:issue-11197, r=jonas-schievink

fix: make "Extract type as type alias" assist work with const generics in array

fixes #11197

23 months agoAuto merge of #13116 - Veykril:nohash, r=Veykril
bors [Thu, 25 Aug 2022 19:08:57 +0000 (19:08 +0000)]
Auto merge of #13116 - Veykril:nohash, r=Veykril

Make use of NoHash hashing for FileId and CrateId

Both of these are mere integers so there is nothing to hash here.

Ideally we would use this for `la_arena::Idx` too, but that doesn't work due to the orphan rule, and `la_arena` is unfortunately a public library so we can't really do much here... Unless we remove the trait restriction but I'd like not to

23 months agoUpdate test fixtures
Lukas Wirth [Thu, 25 Aug 2022 19:06:35 +0000 (21:06 +0200)]
Update test fixtures

23 months agoAuto merge of #13118 - lnicola:cleanup, r=lnicola
bors [Thu, 25 Aug 2022 19:00:07 +0000 (19:00 +0000)]
Auto merge of #13118 - lnicola:cleanup, r=lnicola

minor: Remove unused UpdatesChannel type

23 months agoRemove u/i128 hashing overloads from NoHashHasher::Hasher impl
Lukas Wirth [Thu, 25 Aug 2022 18:43:53 +0000 (20:43 +0200)]
Remove u/i128 hashing overloads from NoHashHasher::Hasher impl

23 months agoMake use of NoHash hashing for FileId and CrateId
Lukas Wirth [Thu, 25 Aug 2022 18:31:02 +0000 (20:31 +0200)]
Make use of NoHash hashing for FileId and CrateId

23 months agoRemove unused UpdatesChannel type
Laurențiu Nicola [Thu, 25 Aug 2022 18:33:42 +0000 (21:33 +0300)]
Remove unused UpdatesChannel type

23 months agostyle: run tidy tests
Kartavya Vashishtha [Thu, 25 Aug 2022 07:47:50 +0000 (13:17 +0530)]
style: run tidy tests

23 months agoextract const generic in ArrayType
Kartavya Vashishtha [Thu, 25 Aug 2022 07:41:51 +0000 (13:11 +0530)]
extract const generic in ArrayType

23 months agoadd test
Kartavya Vashishtha [Thu, 25 Aug 2022 07:41:14 +0000 (13:11 +0530)]
add test

23 months agoAuto merge of #13101 - Veykril:sem-tokens, r=jonas-schievink
bors [Tue, 23 Aug 2022 16:24:39 +0000 (16:24 +0000)]
Auto merge of #13101 - Veykril:sem-tokens, r=jonas-schievink

internal: Re-export standard semantic token types and mods

Should help in preventing future occurences of #13099 by having all token types and mods come through the same place

23 months agoRe-export standard semantic token types and mods
Lukas Wirth [Tue, 23 Aug 2022 16:06:32 +0000 (18:06 +0200)]
Re-export standard semantic token types and mods

23 months agoAuto merge of #13100 - jonas-schievink:doc-links-on-impl, r=jonas-schievink
bors [Tue, 23 Aug 2022 15:57:12 +0000 (15:57 +0000)]
Auto merge of #13100 - jonas-schievink:doc-links-on-impl, r=jonas-schievink

fix: Resolve doc links on impl blocks

Fixes https://github.com/rust-lang/rust-analyzer/issues/13089

23 months agoResolve doc links on impl blocks
Jonas Schievink [Tue, 23 Aug 2022 15:50:45 +0000 (17:50 +0200)]
Resolve doc links on impl blocks

23 months agoAuto merge of #13099 - jonas-schievink:add-decorator-token, r=jonas-schievink
bors [Tue, 23 Aug 2022 15:47:21 +0000 (15:47 +0000)]
Auto merge of #13099 - jonas-schievink:add-decorator-token, r=jonas-schievink

fix: Register decorator token type to avoid panic

Followup to https://github.com/rust-lang/rust-analyzer/pull/13084

23 months agoRegister decorator token type to avoid panic
Jonas Schievink [Tue, 23 Aug 2022 15:46:29 +0000 (17:46 +0200)]
Register decorator token type to avoid panic

23 months agoAuto merge of #13097 - jonas-schievink:liveshare-docs, r=jonas-schievink
bors [Tue, 23 Aug 2022 14:48:28 +0000 (14:48 +0000)]
Auto merge of #13097 - jonas-schievink:liveshare-docs, r=jonas-schievink

minor: Add a short blurb about VS Code Live Share to the manual

23 months agoAdd a short blurb about VS Code Live Share to the manual
Jonas Schievink [Tue, 23 Aug 2022 14:47:26 +0000 (16:47 +0200)]
Add a short blurb about VS Code Live Share to the manual

23 months agoAuto merge of #13096 - jonas-schievink:parse-more-or-pats, r=jonas-schievink
bors [Tue, 23 Aug 2022 14:35:03 +0000 (14:35 +0000)]
Auto merge of #13096 - jonas-schievink:parse-more-or-pats, r=jonas-schievink

fix: Allow leading `|` in more pattern positions

fixes https://github.com/rust-lang/rust-analyzer/issues/12894, fixes https://github.com/rust-lang/rust-analyzer/issues/13094

Oddly, the leading `|` token does not end up inside the `OR_PAT` node, since `pattern_top_r` consumes it first. This is a preexisting issue in match arms though, so I didn't fix it here.

23 months agoAllow leading `|` in more pattern positions
Jonas Schievink [Tue, 23 Aug 2022 14:31:59 +0000 (16:31 +0200)]
Allow leading `|` in more pattern positions

23 months agoForGoT tO RuN prEttIeR¿
Jonas Schievink [Tue, 23 Aug 2022 13:56:02 +0000 (15:56 +0200)]
ForGoT tO RuN prEttIeR¿

23 months agoAvoid error popup when using in Live Share
Jonas Schievink [Tue, 23 Aug 2022 13:45:02 +0000 (15:45 +0200)]
Avoid error popup when using in Live Share

23 months agoAuto merge of #13084 - Veykril:highlight-config, r=Veykril
bors [Tue, 23 Aug 2022 12:39:57 +0000 (12:39 +0000)]
Auto merge of #13084 - Veykril:highlight-config, r=Veykril

Add some more highlighting configurations

The following can be enabled/disabled now in terms of highlighting:
- doc comment injection (enabled by default)
- punctuation highlighting (disabled by default)
- operator highlighting (enabled by default)
- punctuation specialized highlighting (disabled by default)
- operator specialized highlighting (disabled by default)
- macro call bang highlighting (disabled by default)

This PR also changes our `attribute` semantic token type to the `decorator` type which landed upstream (but not yet in lsp-types).

Specialized highlighting is disabled by default, as all clients will have to ship something to map these back to the standard punctuation/operator token (we do this in VSCode via the inheritance mapping for example). This is a lot of maintenance work, and not something every client wants to do, pushing that need to use the user. As this is a rather niche use in the first place this will just be disabled by default.

Punctuation highlighting is disabled by default, punctuation is usually something that can be done by the native syntactic highlighting of the client, so there is no loss in quality. The main reason for this though is that punctuation adds a lot of extra token data that we sent over, a lot of clients struggle with applying this, so disabling this improves the UX for a lot of people. Note that we still highlight punctuations with special meaning as that special entity, (the never type `!` will still be tagged as a builtin type if it occurs as such)

Separate highlighting of the macro call bang `!` is disabled by default, as I think people actually didn't like that change that much, though at the same time I feel like not many people even noticed that change (I prefer it be separate, but that's not enough reason for it to be enabled by default I believe :^) )

cc https://github.com/rust-lang/rust-analyzer/issues/12783 https://github.com/rust-lang/rust-analyzer/issues/13066

23 months agoAuto merge of #13092 - Veykril:ref-match-completion, r=Veykril
bors [Tue, 23 Aug 2022 12:30:50 +0000 (12:30 +0000)]
Auto merge of #13092 - Veykril:ref-match-completion, r=Veykril

fix: Fix reference autocompletions using incorrect offsets in macro inputs

Fixes https://github.com/rust-lang/rust-analyzer/issues/13035

23 months agofix: Fix reference autocompletions using incorrect offsets in macro inputs
Lukas Wirth [Tue, 23 Aug 2022 12:29:59 +0000 (14:29 +0200)]
fix: Fix reference autocompletions using incorrect offsets in macro inputs

Fixes https://github.com/rust-lang/rust-analyzer/issues/13035

23 months agoUse lsp-types DECORATOR token type
Lukas Wirth [Tue, 23 Aug 2022 12:00:29 +0000 (14:00 +0200)]
Use lsp-types DECORATOR token type

23 months agoRemove unused default semantic modifiers
Lukas Wirth [Mon, 22 Aug 2022 12:53:05 +0000 (14:53 +0200)]
Remove unused default semantic modifiers

23 months agoRegen docs
Lukas Wirth [Mon, 22 Aug 2022 12:15:09 +0000 (14:15 +0200)]
Regen docs

23 months agoAdd config for macro bang token highlighting, disable by default
Lukas Wirth [Mon, 22 Aug 2022 12:09:38 +0000 (14:09 +0200)]
Add config for macro bang token highlighting, disable by default

23 months agoChange attribute semantic token type to decorator
Lukas Wirth [Mon, 22 Aug 2022 11:55:44 +0000 (13:55 +0200)]
Change attribute semantic token type to decorator

23 months agoMake doc comment highlight injection configurable
Lukas Wirth [Mon, 22 Aug 2022 11:44:07 +0000 (13:44 +0200)]
Make doc comment highlight injection configurable

23 months agoMove highlight configuration from protocol into the feature
Lukas Wirth [Mon, 22 Aug 2022 11:38:35 +0000 (13:38 +0200)]
Move highlight configuration from protocol into the feature

23 months agoMake operator highlighting configurable, disable it by default
Lukas Wirth [Mon, 22 Aug 2022 11:21:30 +0000 (13:21 +0200)]
Make operator highlighting configurable, disable it by default

23 months agoMake punctuation highlighting configurable, disable it by default
Lukas Wirth [Mon, 22 Aug 2022 11:15:42 +0000 (13:15 +0200)]
Make punctuation highlighting configurable, disable it by default

23 months agoAuto merge of #13090 - ice1k:master, r=Veykril
bors [Tue, 23 Aug 2022 08:08:45 +0000 (08:08 +0000)]
Auto merge of #13090 - ice1k:master, r=Veykril

Do not substitute `Self` when in same impl block

Fix #13076