Commit Graph

21984 Commits

Author SHA1 Message Date
Lukas Wirth
12d5343993 internal: Cleanup lifetime elision hints 2022-05-17 12:18:07 +02:00
bors
ce9b174f8a Auto merge of #12276 - jonas-schievink:improve-generate-deref-impl, r=jonas-schievink
feat: Improve "Generate `Deref` impl" assist

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

The assist will now generate a `DerefMut` impl if a `Deref` impl is already present.
2022-05-16 18:12:53 +00:00
Jonas Schievink
1df6560fd8 Improve "Generate Deref impl" assist 2022-05-16 20:10:46 +02:00
bors
8bc6a8fe6d Auto merge of #12275 - jonas-schievink:remove-setter-doc-gen, r=jonas-schievink
fix: Don't generate documentation in `generate_setter`

Followup to https://github.com/rust-lang/rust-analyzer/pull/12274
2022-05-16 17:28:01 +00:00
Jonas Schievink
54c8c39da0 Don't generate documentation in generate_setter 2022-05-16 19:27:27 +02:00
bors
da503b6a13 Auto merge of #12274 - jonas-schievink:move-getter-docs-generation, r=jonas-schievink
feat: Handle getters and setters in documentation template assist

The assist can now turn this:

```rust
pub struct S;
impl S {
    pub fn data_mut$0(&mut self) -> &mut [u8] { &mut [] }
}
```

into

```rust
pub struct S;
impl S {
    /// Returns a mutable reference to the data.
    ///
    /// # Examples
    ///
    /// ```
    /// use test::S;
    ///
    /// let mut s = ;
    /// assert_eq!(s.data_mut(), );
    /// assert_eq!(s, );
    /// ```
    pub fn data_mut(&mut self) -> &mut [u8] { &mut [] }
}
```

And similarly for by-value or immutable getters, and for setters. Previously the intro line would be empty.

This PR also removes the documentation generation function from the "Generate getter/setter" assist, since that is better handled by applying the 2 assists in sequence. cc https://github.com/rust-lang/rust-analyzer/issues/12273
2022-05-16 17:14:16 +00:00
Jonas Schievink
f1b6e45fba Handle getters and setters in documentation template assist 2022-05-16 19:10:38 +02:00
bors
825ce48180 Auto merge of #12271 - bitgaoshu:box_with_expec, r=flodiebold
fix #12227 Type mismatch error shown

add box expectation hint
2022-05-16 15:00:36 +00:00
bors
795930717b Auto merge of #12272 - jonas-schievink:fix-signature-help-offsets, r=jonas-schievink
fix: Fix signature help LSP offset conversion

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

I don't think we really handle this correctly anywhere (eg. surrogates probably aren't counted right), but this at least fixes the immediately visible bug.
2022-05-16 13:50:00 +00:00
Jonas Schievink
5ee028bbb8 Fix signature help LSP offset conversion 2022-05-16 15:48:38 +02:00
bors
ee2cbe0ae8 Auto merge of #12244 - jonas-schievink:closing-brace-hints, r=jonas-schievink
feat: Show inlay hints after a `}` to indicate the closed item

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

![screenshot-2022-05-13-19:42:00](https://user-images.githubusercontent.com/1786438/168338713-4cedef50-3611-4667-aa6a-49e154ec16a7.png)
2022-05-16 13:25:04 +00:00
Jonas Schievink
fccc12982e Add closing brace hints for macros 2022-05-16 15:23:25 +02:00
bitgaoshu
e362929fa1 add box expection hint 2022-05-16 21:17:00 +08:00
Jonas Schievink
867a7dc7a0 Show inlay hints after a } to indicate the closed item 2022-05-16 14:55:47 +02:00
bors
58234c64da Auto merge of #12256 - matklad:m, r=matklad
minor: rename
2022-05-16 11:44:00 +00:00
Aleksey Kladov
2f3453994a minor: rename 2022-05-16 12:42:48 +01:00
bors
1dc25e51a0 Auto merge of #12253 - Veykril:bm, r=Veykril
feat: Add binding mode inlay hints

![image](https://user-images.githubusercontent.com/3757771/168427387-2f299438-a0cc-496b-a9a5-d689ef6a2b55.png)
2022-05-16 11:16:22 +00:00
bors
ac4ce4259b Auto merge of #12242 - flodiebold:extension-description, r=flodiebold
Improve extension description and README
2022-05-15 18:11:32 +00:00
bors
5ae9847dea Auto merge of #12262 - jhgg:fix-whitespace-between-mut-self-in-macro-expansion, r=lnicola
ide: insert whitespace between 'mut' and 'self' in macro expansion

fixes #12260
2022-05-15 12:47:38 +00:00
bors
fa133d065b Auto merge of #12190 - harpsword:fix_diagostics_map_incorrectly, r=harpsword
fix cargo check diagnostics are mapped incorrectly with non-BMP codepoints

fix #11945
2022-05-15 09:48:51 +00:00
Jake Heinz
4efc2a9df2 ide: insert whitespace between 'mut' and 'self' in macro expansion 2022-05-15 07:55:13 +00:00
bors
1ff5b2cab4 Auto merge of #12251 - matklad:lsp-server, r=matklad
internal: vendor lsp-server
2022-05-14 20:20:01 +00:00
Aleksey Kladov
57cb65bb7a internal: vendor lsp-server 2022-05-14 21:15:43 +01:00
Lukas Wirth
977f0ba968 Update package.json 2022-05-14 15:18:18 +02:00
Lukas Wirth
7cbde1b3a5 Enable reborrow hints in attribute calls 2022-05-14 15:00:14 +02:00
Lukas Wirth
6b696fced8 feat: Add binding mode inlay hints 2022-05-14 14:58:35 +02:00
bors
50ed1a507e Auto merge of #12252 - Veykril:config, r=Veykril
internal: Make VSCode config more GUI edit friendly
2022-05-14 11:56:11 +00:00
Lukas Wirth
622defb373 internal: Make VSCode config more GUI edit friendly 2022-05-14 13:53:41 +02:00
harpsword
7bd4c11e13 fix diagnostics location map incorrectly from rustc span to lsp position for non-BMP char 2022-05-14 19:19:55 +08:00
Florian Diebold
3dcf9e0f2e Change description 2022-05-13 22:13:23 +02:00
bors
06448c5548 Auto merge of #12246 - Veykril:config, r=Veykril
fix: Fix incorrect hover actions config keys
2022-05-13 19:36:32 +00:00
Lukas Wirth
8496633c87 Don't make r-a fail to initialize if updating the config fails 2022-05-13 21:20:37 +02:00
Lukas Wirth
8ac429dad9 fix: Fix incorrect hover actions config keys 2022-05-13 21:17:03 +02:00
bors
a123f8dd66 Auto merge of #12245 - Veykril:compl-snip, r=Veykril
fix: Fix fill-arguments completions not working

Fixes https://github.com/rust-lang/rust-analyzer/issues/12243
2022-05-13 17:53:23 +00:00
Lukas Wirth
3577c44dee fix: Fix fill-arguments completions not working 2022-05-13 19:52:44 +02:00
Florian Diebold
85fe9391d3 Improve extension description and README 2022-05-13 18:15:33 +02:00
bors
4f6b2a20fd Auto merge of #12241 - jonas-schievink:does-not-float-my-boat, r=jonas-schievink
fix: revert float parsing "fix" to avoid macro-related panics

Reverts https://github.com/rust-lang/rust-analyzer/pull/12149 and the follow-up fixes, while keeping their tests.

https://github.com/rust-lang/rust-analyzer/pull/12149 has caused many unexpected panics related to macros, and the fixes for those are not straightforward and further complicate the MBE token conversion logic, which was already fairly hard to follow before these fixes.
2022-05-13 15:02:00 +00:00
Jonas Schievink
0831f3123b Fix tests 2022-05-13 15:54:46 +02:00
Jonas Schievink
9bd11459ba Revert "Auto merge of #12149 - jonas-schievink:literally-just-a-literal, r=jonas-schievink"
This reverts commit cc9ae2b89e, reversing
changes made to 7dfd1cb572.
2022-05-13 15:08:14 +02:00
Jonas Schievink
2287ae22c6 Revert "Skip only the tt::Literal when consuming float tokens"
This reverts commit 7db55313a1.
2022-05-13 15:06:16 +02:00
Jonas Schievink
bde036b74e Revert "Fix conversion of float literals in TtTreeSink"
This reverts commit 43a066c5a8.
2022-05-13 15:05:34 +02:00
Jonas Schievink
4fcdb96789 Revert "fix: Remap float parts as integers when parsed as indices"
This reverts commit dbb066b99e.
2022-05-13 15:05:03 +02:00
Jonas Schievink
73e0e17b52 Revert "Don't remap float tokens to INT_NUMBER"
This reverts commit cb5e8da88a.
2022-05-13 15:04:36 +02:00
bors
0f9ffb5e35 Auto merge of #12239 - Veykril:publisher, r=Veykril
minor: Fix typo in publisher field
2022-05-13 12:38:08 +00:00
Lukas Wirth
99a51dfe9b Update package description 2022-05-13 14:11:09 +02:00
Lukas Wirth
a8133680af fix: Fix typo in publisher field 2022-05-13 14:10:37 +02:00
bors
da969635a4 Auto merge of #12238 - Veykril:publisher, r=Veykril
feat: Change VSCode extension publisher to `rust-lang`
2022-05-13 11:26:43 +00:00
Lukas Wirth
e47f4597d4 feat: Change VSCode extension publisher to rust-lang 2022-05-13 13:21:52 +02:00
bors
0c881e882e Auto merge of #12231 - jonas-schievink:fix-float-macro-panic, r=jonas-schievink
fix: fix "X is not a valid punct" panic with floats in macros

Should fix https://github.com/rust-lang/rust-analyzer/issues/12211
2022-05-12 17:03:22 +00:00
Jonas Schievink
cb5e8da88a Don't remap float tokens to INT_NUMBER 2022-05-12 19:01:09 +02:00