Commit graph

15790 commits

Author SHA1 Message Date
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
Jonas Schievink
5804412869 Register decorator token type to avoid panic 2022-08-23 17:46:29 +02:00
Jonas Schievink
8969655ed6 Allow leading | in more pattern positions 2022-08-23 16:31:59 +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
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
bors
6711ded5cd Auto merge of #13088 - Veykril:flycheck-failure, r=Veykril
Pop an error notification when flycheck can't be restarted
2022-08-22 15:43:13 +00:00
Lukas Wirth
2abb78d06d Pop an error notification when flycheck can't be restarted 2022-08-22 17:42:33 +02:00
bors
fdc28b4333 Auto merge of #13021 - N3xed:fix-gat-panics, r=flodiebold
fix: Fix panics on GATs involving const generics

This workaround avoids constant crashing of rust analyzer when using GATs with const generics,
even when the const generics are only on the `impl` block.

The workaround treats GATs as non-existing if either itself or the parent has const generics and
removes relevant panicking code-paths.

Fixes #11989, fixes #12193
2022-08-22 14:00:23 +00:00
Lukas Wirth
f9d1b26a96 Replace crossbeam with std's scoped threads 2022-08-22 14:55:13 +02:00
bors
dea163970a Auto merge of #12965 - DesmondWillowbrook:assoc-method-dimming, r=Veykril
feat: make trait assoc items become inactive due to cfg

fixes #12394
2022-08-22 07:20:56 +00:00
Dominik Gschwind
ac8cb8ce3b
Expect the test to panic by catching the unwind 2022-08-21 22:48:53 +02:00
Ryo Yoshida
dd22aa48ba
Consider bounds on inherent impl in method resolution 2022-08-21 18:41:46 +09:00
Kartavya Vashishtha
23c00ed50d
fix: formatting 2022-08-20 13:44:01 +05:30
Kartavya Vashishtha
8f87fcb179
remove push_diagnostic methods
weren't used in the end
2022-08-20 13:30:25 +05:30
Kartavya Vashishtha
87b779756c
make impl and trait inactive diagnostics work 2022-08-20 13:28:43 +05:30
Laurențiu Nicola
e5d3ac58b3 Bump notify 2022-08-19 21:37:05 +03:00
Laurențiu Nicola
c3bb7bfc28 Bump chalk 2022-08-19 21:33:28 +03:00
Ralf Jung
c5455d1af3 explain how to re-generate the package.json 2022-08-19 08:58:08 -04:00
Ralf Jung
4af9829dcf document interaction of checkOnSave.overrideCommand and multiple linked projects 2022-08-19 08:57:22 -04:00
bors
2f02ea03b0 Auto merge of #13041 - DorianListens:dscheidt/gen-fn-self-assoc-2, r=Veykril
feat: Generate static method using Self::assoc() syntax

This change improves the `generate_function` assist to support generating static methods/associated functions using the `Self::assoc()` syntax. Previously, one could generate a static method, but only when specifying the type name directly (like `Foo::assoc()`). After this change, `Self` is supported as well as the type name.

Fixes #13012
2022-08-19 10:57:02 +00:00
bors
62c3107065 Auto merge of #13061 - ice1k:master, r=Veykril
feat: Improved inline_call to replace `Self`

Fixes #13060
2022-08-19 10:47:15 +00:00
bors
a2ad3d0669 Auto merge of #13064 - Veykril:rustfmt-err, r=Veykril
Log rustfmt parsing errors as warnings

We unconditionally pass an edition parameter to rustfmt, for some crates
this might fail rustfmt so instead of swallowing the error, at least Log
it on a level that is logged by default so users won't be completely
confused about it.
See for context https://github.com/rust-lang/rust-analyzer/issues/10209

Closes https://github.com/rust-lang/rust-analyzer/issues/10209
2022-08-19 07:23:01 +00:00
Lukas Wirth
638755a771 Log rustfmt parsing errors as warnings
We unconditionally pass an edition parameter to rustfmt, for some crates
this might fail rustfmt so instead of swallowing the error, at least Log
it on a level that is logged by default so users won't be completely
confused about it.
See for context https://github.com/rust-lang/rust-analyzer/issues/10209

Closes https://github.com/rust-lang/rust-analyzer/issues/10209
2022-08-19 09:22:34 +02:00
Lukas Wirth
45b7b6a60a Implement lsp extension for cancelling running flychecks 2022-08-19 08:54:53 +02:00
ice1000
5a6c51ebb8 fix: use functional programming 2022-08-19 01:22:43 +00:00
ice1000
b6fe46055b feat: Improved inline_call to replace Self 2022-08-19 01:06:00 +00:00
Dorian Scheidt
48ea3825b8 Introduce and use get_fn_target_info 2022-08-18 18:39:42 -05:00
Dorian Scheidt
d8e7419c64 Generate and use TargetInfo::new 2022-08-18 18:32:35 -05:00
Dorian Scheidt
2e4a4f1a9c Cleanup inline 2022-08-18 18:28:43 -05:00
Dorian Scheidt
96c04c5e1c inline assoc_fn_target 2022-08-18 18:28:14 -05:00
Dorian Scheidt
2086c48cff Remove mut out params via assoc_fn_target_info 2022-08-18 18:26:54 -05:00
Dorian Scheidt
e27af5fae3 Reorder args with flip_comma 2022-08-18 18:21:58 -05:00
Dorian Scheidt
e513d7b504 Replace tuple with TargetInfo struct 2022-08-18 18:20:06 -05:00
Dorian Scheidt
30eabeb95d extract fn_target_info 2022-08-18 18:14:51 -05:00