Commit graph

23000 commits

Author SHA1 Message Date
Lukas Wirth
66ec636fec Highlight namerefs by syntax until proc-macros have been loaded 2022-08-29 18:44:55 +02:00
bors
f02cd0a41d Auto merge of #13056 - DropDemBits:make-refactors, r=Veykril
internal: Migrate to using format arg captures in `syntax::make`
2022-08-29 16:34:33 +00:00
austaras
42486b6e94 change as requested 2022-08-29 00:24:56 +08:00
austaras
f9c180ffd1 update tests 2022-08-29 00:24:56 +08:00
austaras
0dd9eef1b9 add type check 2022-08-29 00:24:56 +08:00
austaras
dbaf2ce76e turn unwrap_or into unwrap_or_else and vice versa 2022-08-29 00:24:56 +08:00
bors
e8e598f641 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
2022-08-28 09:56:06 +00:00
Lukas Wirth
9ad0a8c467 Move empty diagnostics workaround back into the server 2022-08-28 11:54:46 +02:00
bors
6bea872edd 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!
2022-08-26 18:39:53 +00:00
bors
ca4e10b7fc Auto merge of #13123 - Veykril:simplify, r=Veykril
minor: Simplify
2022-08-26 17:40:56 +00:00
Lukas Wirth
78a7a816bf minor: Simplify 2022-08-26 19:40:01 +02:00
bors
55bf51df41 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)
2022-08-26 16:22:57 +00:00
bors
5c52e05498 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
2022-08-26 13:35:13 +00:00
bors
ca8093e282 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
2022-08-25 19:08:57 +00:00
Lukas Wirth
5b6aefe565 Update test fixtures 2022-08-25 21:07:24 +02:00
bors
6eb7689921 Auto merge of #13118 - lnicola:cleanup, r=lnicola
minor: Remove unused UpdatesChannel type
2022-08-25 19:00:07 +00:00
Lukas Wirth
0c9375b829 Remove u/i128 hashing overloads from NoHashHasher::Hasher impl 2022-08-25 20:45:35 +02:00
Lukas Wirth
d025c5d8d6 Make use of NoHash hashing for FileId and CrateId 2022-08-25 20:41:49 +02:00
Laurențiu Nicola
10617938b1 Remove unused UpdatesChannel type 2022-08-25 21:33:42 +03:00
Kartavya Vashishtha
0d7ba13b72
style: run tidy tests 2022-08-25 13:17:50 +05:30
Kartavya Vashishtha
9480b38189
extract const generic in ArrayType 2022-08-25 13:11:51 +05:30
Kartavya Vashishtha
71c15f2a44
add test 2022-08-25 13:11:14 +05:30
bors
e3dc5a588f 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
2022-08-23 16:24:39 +00:00
Lukas Wirth
715e3fc119 Re-export standard semantic token types and mods 2022-08-23 18:06:32 +02:00
bors
1456b80167 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
2022-08-23 15:57:12 +00:00
Jonas Schievink
322e7060de Resolve doc links on impl blocks 2022-08-23 17:50:45 +02:00
bors
8dcf4c70c4 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
2022-08-23 15:47:21 +00:00
Jonas Schievink
5804412869 Register decorator token type to avoid panic 2022-08-23 17:46:29 +02:00
bors
27e17ffd27 Auto merge of #13097 - jonas-schievink:liveshare-docs, r=jonas-schievink
minor: Add a short blurb about VS Code Live Share to the manual
2022-08-23 14:48:28 +00:00
Jonas Schievink
0cc1a89e08 Add a short blurb about VS Code Live Share to the manual 2022-08-23 16:47:26 +02:00
bors
e73b7a9ec7 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.
2022-08-23 14:35:03 +00:00
Jonas Schievink
8969655ed6 Allow leading | in more pattern positions 2022-08-23 16:31:59 +02:00
Jonas Schievink
dcbbb7f211 ForGoT tO RuN prEttIeR¿ 2022-08-23 15:56:02 +02:00
Jonas Schievink
16a0eb1829 Avoid error popup when using in Live Share 2022-08-23 15:45:02 +02:00
bors
f045f14626 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
2022-08-23 12:39:57 +00:00
bors
631ed2a518 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
2022-08-23 12:30:50 +00:00
Lukas Wirth
6c5d15800e fix: Fix reference autocompletions using incorrect offsets in macro inputs
Fixes https://github.com/rust-lang/rust-analyzer/issues/13035
2022-08-23 14:29:59 +02:00
Lukas Wirth
2a26b054b7 Use lsp-types DECORATOR token type 2022-08-23 14:06:19 +02:00
Lukas Wirth
31fb917d8d Remove unused default semantic modifiers 2022-08-23 14:05:56 +02:00
Lukas Wirth
eadc2673c0 Regen docs 2022-08-23 14:05:56 +02:00
Lukas Wirth
f6f0516603 Add config for macro bang token highlighting, disable by default 2022-08-23 14:05:56 +02:00
Lukas Wirth
b26733f8a0 Change attribute semantic token type to decorator 2022-08-23 14:05:56 +02:00
Lukas Wirth
9700c95ced Make doc comment highlight injection configurable 2022-08-23 14:05:55 +02:00
Lukas Wirth
9a201873b8 Move highlight configuration from protocol into the feature 2022-08-23 14:05:55 +02:00
Lukas Wirth
afc8cfb4d1 Make operator highlighting configurable, disable it by default 2022-08-23 14:05:55 +02:00
Lukas Wirth
16315edaee Make punctuation highlighting configurable, disable it by default 2022-08-23 14:05:55 +02:00
bors
6627b473e2 Auto merge of #13090 - ice1k:master, r=Veykril
Do not substitute `Self` when in same impl block

Fix #13076
2022-08-23 08:08:45 +00:00
bors
b2bf37cdde Auto merge of #12976 - tjdevries:scip, r=Veykril
feat: emit SCIP from rust-analyzer

hi rust-analyzer team

I'm one of the engineers at Sourcegraph (and have done a few small changes related to the LSIF work done in rust-analyzer). Recently, we've moved to a new protocol as the primary way to interact with Sourcegraph (LSIF is still possible to upload, so existing jobs will not stop working any time soon). This new protocol is SCIP (I linked a blog post below with more information).

I've implemented SCIP support (based largely on the existing LSIF support). In addition to supporting the existing features that `rust-analyzer`'s LSIF support does, this PR adds the ability to move between crates on sourcegraph.com. So if both your project and a dependency are indexed, you would be able to hop to the particular version and view the source code. I'd be happy to record a demo of that on my local instance if you're interested.

There are a few TODO's left in the code (some that you might have insights on) which I'm happy to fix in this PR, but I just wanted to open this up for discussion first.

Thanks for your time :)

TJ

- [announcing scip](https://about.sourcegraph.com/blog/announcing-scip)
2022-08-23 07:53:36 +00:00
ice1000
148bdf85f2 Do not substitute Self when in same impl block 2022-08-23 01:52:47 -04:00
TJ DeVries
50ecb09da4 feat: emit SCIP via rust-analyzer 2022-08-22 15:13:46 -04:00