]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #11830 - nemethf:on-type-formatting, r=nemethf
bors [Sun, 22 May 2022 08:59:04 +0000 (08:59 +0000)]
Auto merge of #11830 - nemethf:on-type-formatting, r=nemethf

On typing handler for angle brackets(<) with snippets

I implemented my idea in #11398 in "cargo cult programming"-style without actually know what I'm doing, so feedback is welcome.  The PR is split into two commits to ease the review.  I used `@unexge's` original prototype, which forms the basis of the PR.

2 years agoonTypeFormatting: don't insert > if another > is there
Felicián Németh [Tue, 5 Apr 2022 16:35:03 +0000 (18:35 +0200)]
onTypeFormatting: don't insert > if another > is there

2 years agofeat: Add on-typing handler for left angle
Felicián Németh [Sun, 27 Mar 2022 08:49:00 +0000 (10:49 +0200)]
feat: Add on-typing handler for left angle

Only advertise this feature in the server capabilities when the client
supports SnippetTextEdit.

Close #11398.

Co-authored-by: unexge <unexge@gmail.com>
2 years agointernal: Allow OnTypeFormatting to send SnippetTextEdit
Felicián Németh [Sun, 27 Mar 2022 08:45:57 +0000 (10:45 +0200)]
internal: Allow OnTypeFormatting to send SnippetTextEdit

But continue to send TextEdit only.

2 years agoAuto merge of #12342 - lnicola:fix-join-lines, r=lnicola
bors [Sat, 21 May 2022 15:39:16 +0000 (15:39 +0000)]
Auto merge of #12342 - lnicola:fix-join-lines, r=lnicola

fix: Fix broken async callback in join lines

Fixes #12338.

2 years agoFix broken async callback in join lines
Laurențiu Nicola [Sat, 21 May 2022 15:38:10 +0000 (18:38 +0300)]
Fix broken async callback in join lines

2 years agoAuto merge of #12339 - matklad:dead, r=matklad
bors [Sat, 21 May 2022 12:40:29 +0000 (12:40 +0000)]
Auto merge of #12339 - matklad:dead, r=matklad

dead code

2 years agodead code
Aleksey Kladov [Sat, 21 May 2022 12:39:59 +0000 (13:39 +0100)]
dead code

2 years agoAuto merge of #12337 - matklad:docz, r=matklad
bors [Sat, 21 May 2022 12:12:23 +0000 (12:12 +0000)]
Auto merge of #12337 - matklad:docz, r=matklad

internal: document overall approach to reload

2 years agointernal: document overall approach to reload
Aleksey Kladov [Sat, 21 May 2022 12:11:05 +0000 (13:11 +0100)]
internal: document overall approach to reload

2 years agoAuto merge of #12329 - jonas-schievink:build-script-errors, r=jonas-schievink
bors [Fri, 20 May 2022 15:29:12 +0000 (15:29 +0000)]
Auto merge of #12329 - jonas-schievink:build-script-errors, r=jonas-schievink

fix: Don't swallow build script errors

2 years agoDon't swallow build script errors
Jonas Schievink [Fri, 20 May 2022 15:28:39 +0000 (17:28 +0200)]
Don't swallow build script errors

2 years agoAuto merge of #12328 - Veykril:simplify, r=Veykril
bors [Fri, 20 May 2022 15:03:59 +0000 (15:03 +0000)]
Auto merge of #12328 - Veykril:simplify, r=Veykril

minor: Simplify

2 years agominor: Simplify
Lukas Wirth [Fri, 20 May 2022 14:42:28 +0000 (16:42 +0200)]
minor: Simplify

2 years agoAuto merge of #12327 - jonas-schievink:lambda-to-closure, r=jonas-schievink
bors [Fri, 20 May 2022 13:45:21 +0000 (13:45 +0000)]
Auto merge of #12327 - jonas-schievink:lambda-to-closure, r=jonas-schievink

internal: Rename `Expr::Lambda` to `Expr::Closure`

They're never really called "Lambda"s in Rust, so let's call them "Closures" consistently.

2 years agoRename `Expr::Lambda` to `Expr::Closure`
Jonas Schievink [Fri, 20 May 2022 13:40:32 +0000 (15:40 +0200)]
Rename `Expr::Lambda` to `Expr::Closure`

2 years agoAuto merge of #12326 - jonas-schievink:add-clippy-task-preset, r=jonas-schievink
bors [Fri, 20 May 2022 13:36:59 +0000 (13:36 +0000)]
Auto merge of #12326 - jonas-schievink:add-clippy-task-preset, r=jonas-schievink

feat: Add "cargo clippy" task preset

We've had a couple of common presets in `Tasks: Run Task -> cargo -> cargo [check,build,test,...]` before. This PR adds `cargo clippy` to that list, which makes for a convenient way of occasionally running Clippy on your code without having to reconfigure the Check on Save command to clippy.

These presets all use the `cargo` task type that we provide, so diagnostics will show up in the editor. However, they don't go through the server-side parsing logic, so it's not possible to apply suggestions, and diagnostics are fairly "low-fidelity". It would be cool if we could somehow pass Cargo's JSON output through the LSP server and render it properly, for arbitrary tasks.

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

2 years agoAdd "cargo clippy" task preset
Jonas Schievink [Fri, 20 May 2022 13:25:37 +0000 (15:25 +0200)]
Add "cargo clippy" task preset

2 years agoAuto merge of #12325 - jonas-schievink:clear-check-diags, r=jonas-schievink
bors [Fri, 20 May 2022 13:10:49 +0000 (13:10 +0000)]
Auto merge of #12325 - jonas-schievink:clear-check-diags, r=jonas-schievink

fix: Clear `cargo check` diagnostics when flycheck is turned off

Previously stale diagnostics were left over indefinitely when turning off "Check on Save" while diagnostics are present.

2 years agoClear `cargo check` diagnostics when flycheck is turned off
Jonas Schievink [Fri, 20 May 2022 13:07:55 +0000 (15:07 +0200)]
Clear `cargo check` diagnostics when flycheck is turned off

2 years agoAuto merge of #12324 - jonas-schievink:rm-attribute, r=jonas-schievink
bors [Fri, 20 May 2022 12:57:08 +0000 (12:57 +0000)]
Auto merge of #12324 - jonas-schievink:rm-attribute, r=jonas-schievink

feat: Revert the "Add attribute" assist

Reverts https://github.com/rust-lang/rust-analyzer/pull/12296, as the added indirection and "assist noise" (the assist has to trigger inside the body of an item to match what the "Add `#[derive]`" does) makes this not really pull its weight over just using attribute completions.

Keeps the changes to "Add getter". `#[must_use]` can be applied using the attribute completions.

2 years agoAuto merge of #12315 - matklad:update, r=Veykril
bors [Fri, 20 May 2022 12:44:15 +0000 (12:44 +0000)]
Auto merge of #12315 - matklad:update, r=Veykril

:arrow_up: deps

2 years agoRevert the "Add attribute" assist
Jonas Schievink [Fri, 20 May 2022 12:39:22 +0000 (14:39 +0200)]
Revert the "Add attribute" assist

2 years agoAuto merge of #12263 - andylizi:hide-type-hint-closure, r=Veykril
bors [Fri, 20 May 2022 12:35:36 +0000 (12:35 +0000)]
Auto merge of #12263 - andylizi:hide-type-hint-closure, r=Veykril

feat: hide type inlay hints for initializations of closures

![hide_closure_initialization](https://user-images.githubusercontent.com/12008103/168470158-6cb77b18-068e-4431-a8b5-e2b22d50d263.gif)

This PR adds an option to hide the inlay hints for `let IDENT_PAT = CLOSURE_EXPR;`, which is a somewhat common coding pattern. Currently the inlay hints for the assigned variable and the closure expression itself are both displayed, making it rather repetitive.

In order to be consistent with closure return type hints, only closures with block bodies will be hid by this option.

Personally I'd feel comfortable making it always enabled (or at least when closure return type hints are enabled), but considering the precedent set in #10761, I introduced an off-by-default option for this.

changelog feature: option to hide type inlay hints for initializations of closures

2 years agoAuto merge of #12301 - harpsword:fix_for_crlf_cargo_range_map, r=jonas-schievink
bors [Fri, 20 May 2022 12:15:22 +0000 (12:15 +0000)]
Auto merge of #12301 - harpsword:fix_for_crlf_cargo_range_map, r=jonas-schievink

fix: calculate correct postion for Dos line ending in mapping rustc range to ls…

fix #12293

2 years agofeat: hide type inlay hints for initializations of closures
andylizi [Sun, 15 May 2022 11:17:52 +0000 (19:17 +0800)]
feat: hide type inlay hints for initializations of closures

2 years agoAuto merge of #12320 - NotWearingPants:patch-1, r=Veykril
bors [Thu, 19 May 2022 23:57:37 +0000 (23:57 +0000)]
Auto merge of #12320 - NotWearingPants:patch-1, r=Veykril

Hide closure ret hints if ret type is specified

Fixes #12319

2 years agohide closure ret hints if ret type is specified
NotWearingPants [Thu, 19 May 2022 23:35:37 +0000 (02:35 +0300)]
hide closure ret hints if ret type is specified

fixes #12319

2 years agoAuto merge of #12316 - jonas-schievink:closure-param-hints, r=jonas-schievink
bors [Thu, 19 May 2022 16:54:09 +0000 (16:54 +0000)]
Auto merge of #12316 - jonas-schievink:closure-param-hints, r=jonas-schievink

feat: Show parameter inlay hints for closure invocations

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

2 years agoTeach `Callable` about closures properly
Jonas Schievink [Thu, 19 May 2022 16:53:08 +0000 (18:53 +0200)]
Teach `Callable` about closures properly

2 years ago:arrow_up: deps
Aleksey Kladov [Thu, 19 May 2022 15:51:19 +0000 (16:51 +0100)]
:arrow_up: deps

2 years agoAuto merge of #12314 - jonas-schievink:proc-macro-load, r=jonas-schievink
bors [Thu, 19 May 2022 14:50:08 +0000 (14:50 +0000)]
Auto merge of #12314 - jonas-schievink:proc-macro-load, r=jonas-schievink

minor: simplify

2 years agoAuto merge of #12313 - equinox:typo-fix, r=lnicola
bors [Thu, 19 May 2022 14:22:09 +0000 (14:22 +0000)]
Auto merge of #12313 - equinox:typo-fix, r=lnicola

Removed duplicate 'to' in `cachePriming.numThreads` option description

One 'to' too many!

2 years agoremove duplicate 'to' in `cachePriming.numThreads` option description
Equinox [Thu, 19 May 2022 14:04:02 +0000 (02:04 +1200)]
remove duplicate 'to' in `cachePriming.numThreads` option description

2 years agoAuto merge of #12311 - Veykril:inlay-hints-tips, r=Veykril
bors [Thu, 19 May 2022 13:45:05 +0000 (13:45 +0000)]
Auto merge of #12311 - Veykril:inlay-hints-tips, r=Veykril

internal: Improve inlay hint tooltips

2 years agoHide more unnecessary parameter hints for constructors
Lukas Wirth [Thu, 19 May 2022 13:33:04 +0000 (15:33 +0200)]
Hide more unnecessary parameter hints for constructors

2 years agosimplify
Jonas Schievink [Thu, 19 May 2022 13:29:35 +0000 (15:29 +0200)]
simplify

2 years agoUpdate test fixtures
Lukas Wirth [Thu, 19 May 2022 13:20:45 +0000 (15:20 +0200)]
Update test fixtures

2 years agoEnable hovering function parameter inlay hints
Lukas Wirth [Thu, 19 May 2022 12:32:09 +0000 (14:32 +0200)]
Enable hovering function parameter inlay hints

2 years agointernal: Improve inlay hint tooltips
Lukas Wirth [Thu, 19 May 2022 11:38:37 +0000 (13:38 +0200)]
internal: Improve inlay hint tooltips

2 years agoAuto merge of #12309 - Veykril:completion, r=Veykril
bors [Thu, 19 May 2022 10:34:36 +0000 (10:34 +0000)]
Auto merge of #12309 - Veykril:completion, r=Veykril

fix: Fix incorrect expected type in completions for trailing match arms

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

2 years agofix: Fix incorrect expected type in completions for match arms
Lukas Wirth [Thu, 19 May 2022 10:27:43 +0000 (12:27 +0200)]
fix: Fix incorrect expected type in completions for match arms

2 years agoAuto merge of #12304 - jonas-schievink:more-doc-gen-improvements, r=jonas-schievink
bors [Wed, 18 May 2022 17:22:20 +0000 (17:22 +0000)]
Auto merge of #12304 - jonas-schievink:more-doc-gen-improvements, r=jonas-schievink

minor: Include self type in generated getter/setter docs

2 years agoInclude self type in generated getter/setter docs
Jonas Schievink [Wed, 18 May 2022 16:38:41 +0000 (18:38 +0200)]
Include self type in generated getter/setter docs

2 years agoAuto merge of #12303 - jonas-schievink:improve-generate-docs-assist, r=jonas-schievink
bors [Wed, 18 May 2022 16:09:02 +0000 (16:09 +0000)]
Auto merge of #12303 - jonas-schievink:improve-generate-docs-assist, r=jonas-schievink

feat: Improve docs generation assist

- Split into 2 assists: one generates basic docs structure, but no example, one generates an example
- Fix section ordering (the example comes last)
- Allow generating docs for private functions
- Expand `len` to `length` when generating an intro sentence

2 years agoImprove docs generation assist
Jonas Schievink [Wed, 18 May 2022 16:05:21 +0000 (18:05 +0200)]
Improve docs generation assist

2 years agoAuto merge of #12277 - listochkin:show-implementations-display-error, r=listochkin
bors [Wed, 18 May 2022 13:13:09 +0000 (13:13 +0000)]
Auto merge of #12277 - listochkin:show-implementations-display-error, r=listochkin

"Show implementations" link display error fix

While VSCode [uses it's own implementation for URIs](https://github.com/microsoft/vscode-uri)
which notably doesn't have any limits of URI size, the renderer itself
relies on Web platform engine, that limits the length of the URLs and
bails out when the attribute length of an `href` inside `a` tag is too
long.

Command URIs have a form of `command:command-name?arguments`, where
`arguments` is a percent-encoded array of data we want to pass along to
the command function. For "Show References" this is a list of all file
URIs with locations of every reference, and it can get quite long.

This PR introduces another intermediary `linkToCommand` command. When
we render a command link, a reference to a command with all its arguments
is stored in a map, and instead a `linkToCommand` link is rendered
with the key to that map.

For now the map is cleaned up periodically (I've set it to every
10 minutes). In general case we'll probably need to introduce TTLs or
flags to denote ephemeral links (like these in hover popups) and
persistent links and clean those separately. But for now simply keeping
the last few links in the map should be good enough. Likewise, we could
add code to remove a target command from the map after the link is
clicked, but assuming most links in hover sheets won't be clicked anyway
this code won't change the overall memory use much.

Closes #9926

2 years ago"Show implementations" link display error fix
Andrei Listochkin [Mon, 16 May 2022 18:53:00 +0000 (19:53 +0100)]
"Show implementations" link display error fix

While VSCode [uses it's own implementation for URIs](https://github.com/microsoft/vscode-uri)
which notably doesn't have any limits of URI size, the renderer itself
relies on Web platform engine, that limits the length of the URLs and
bails out when the attribute length of an `href` inside `a` tag is too
long.

Command URIs have a form of `command:command-name?arguments`, where
`arguments` is a percent-encoded array of data we want to pass along to
the command function. For "Show References" this is a list of all file
URIs with locations of every reference, and it can get quite long.

This PR introduces another intermediary `linkToCommand` command. When
we render a command link, a reference to a command with all its arguments
is stored in a map, and instead a `linkToCommand` link is rendered
with the key to that map.

For now the map is cleaned up periodically (I've set it to every
10 minutes). In general case we'll probably need to introduce TTLs or
flags to denote ephemeral links (like these in hover popups) and
persistent links and clean those separately. But for now simply keeping
the last few links in the map should be good enough. Likewise, we could
add code to remove a target command from the map after the link is
clicked, but assuming most links in hover sheets won't be clicked anyway
this code won't change the overall memory use much.

Closes #9926

2 years agofix: calculate right range for Dos line ending in mapping rustc range to lsp range
harpsword [Wed, 18 May 2022 10:35:51 +0000 (18:35 +0800)]
fix: calculate right range for Dos line ending in mapping rustc range to lsp range

2 years agoAuto merge of #12130 - weirane:let-else-let-match, r=weirane
bors [Tue, 17 May 2022 19:01:18 +0000 (19:01 +0000)]
Auto merge of #12130 - weirane:let-else-let-match, r=weirane

Turn let-else statements into let and match

Fixes #11906.

2 years agoAuto merge of #12294 - listochkin:prettier, r=Veykril
bors [Tue, 17 May 2022 18:50:00 +0000 (18:50 +0000)]
Auto merge of #12294 - listochkin:prettier, r=Veykril

Switch to Prettier for TypeScript Code formatting

## Summary of changes:

 1. Added [`.editorconfig` file](https://editorconfig.org) to dictate general hygienic stuff like character encoding, no trailing whitespace, new line symbols etc. for all files (e.g. Markdown). Install an editor plugin to get this rudimentary formatting assistance automatically. Prettier can read this file and, for example, use it for indentation style and size.
 2. Added a minimal prettier config file. All options are default except line width, which per [Veykril](https://github.com/Veykril) suggestion is set to 100 instead of 80, because [that's what `Rustfmt` uses](https://rust-lang.github.io/rustfmt/?version=v1.4.38&search=#max_width).
 3. Change `package.json` to use Prettier instead of `tsfmt` for code formatting.
 4. Performed initial formatting in a separate commit, per [bjorn3](https://github.com/bjorn3) suggestion added its hash to a `.git-blame-ignore-revs` file. For it to work you need to add a configuration to your git installation:
    ```Shell
    git config --global blame.ignoreRevsFile .git-blame-ignore-revs
    ```
 5. Finally, removed `typescript-formatter` from the list of dependencies.

----
What follows below is summary of the discussion we had on Zulip about the formatter switch:

## Background

For the context, there are three reasons why we went with `tsfmt` originally:
* stick to vscode default/built-in
* don't add extra deps to package.json.lock
* follow upstream (language server node I think still uses `tsfmt`)

And the meta reason here was that we didn't have anyone familiar with frontend, so went for the simplest option, at the expense of features and convenience.

Meanwhile, [**Prettier**](https://prettier.io) became a formatter project that JS community consolidated on a few years ago. It's similar to `go fmt` / `cargo fmt` in spirit: minimal to no configuration to promote general uniformity in the ecosystem. There are some options, that were needed early on to make sure the project gained momentum, but by no means it's a customizable formatter that is easy to adjust to reduce the number of changes for adoption.

## Overview of changes performed by Prettier

Some of the changes are acceptable. Prettier dictates a unified string quoting style, and as a result half of our imports at the top are changed. No one would mind that. Some one-line changes are due to string quotes, too, and although these a re numerous, the surrounding lines aren't changed, and git blame / GitLens will still show relevant context.

Some are toss ups. `trailingComma` option - set it to `none`, and get a bunch of meaningless changes in half of the code. set it to `all` and get a bunch of changes in the other half of the code. Same with using parentheses around single parameters in arrow functions: `x => x + 1` vs `(x) => x + 1`. Perrier forces one style or the other, but we use both in our code.

Like I said, the changes above are Ok - they take a single line, don't disrupt GitLens / git blame much. **The big one is line width**. Prettier wants you to choose one and stick to it. The default is 80 and it forces some reformatting to squish deeply nested code or long function type declarations. If I set it to 100-120, then Prettier finds other parts of code where a multi-line expression can be smashed into a single long line. The problem is that in both cases some of the lines that get changed are interesting, they contain somewhat non-trivial logic, and if I were to work on them in future I would love to see the commit annotations that tell me something relevant. Alas, we use some of that.

## Project impact

Though Prettier is a mainstream JS project it has no dependencies. We add another package so that it and ESLint work together nicely, and that's it.

2 years agoSimplify const reference check
weirane [Tue, 17 May 2022 18:38:50 +0000 (02:38 +0800)]
Simplify const reference check

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoAuto merge of #12296 - jonas-schievink:add-attribute-assist, r=jonas-schievink
bors [Tue, 17 May 2022 18:30:26 +0000 (18:30 +0000)]
Auto merge of #12296 - jonas-schievink:add-attribute-assist, r=jonas-schievink

feat: add a "Add attribute" assist

This generalizes the "Add `#[derive]`" assist and supports adding `#[must_use]` and `#[inline]`.

Removes `#[must_use]` from the "Generate getter/setter" assist, addressing the last point in https://github.com/rust-lang/rust-analyzer/issues/12273. Closes https://github.com/rust-lang/rust-analyzer/issues/12273.

2 years agoAdd a "Add attribute" assist
Jonas Schievink [Tue, 17 May 2022 18:28:25 +0000 (20:28 +0200)]
Add a "Add attribute" assist

2 years agoautomate braceless return substitution for long lines
Andrei Listochkin [Tue, 17 May 2022 17:31:51 +0000 (18:31 +0100)]
automate braceless return substitution for long lines

Per [bjorn3][https://github.com/bjorn3] suggestion resolves cases where
an early return is moved to a separate line due to line width formatting.

This setting changes
```
if (a very long condition) return;
```
to
```
if (a very long
    condition) {
  return;
}
```
while keeping
```
if (short) return;
```
as is.

In pathological cases this may cause `npm run fix` not to fix formatting
in one go and may require running it twice.

2 years agoremove tsfmt from dependencies
Andrei Listochkin [Tue, 17 May 2022 15:33:58 +0000 (16:33 +0100)]
remove tsfmt from dependencies

2 years agoadd prettier format commit to ignored revisions
Andrei Listochkin [Tue, 17 May 2022 15:29:01 +0000 (16:29 +0100)]
add prettier format commit to ignored revisions

2 years agoprettier run
Andrei Listochkin [Tue, 17 May 2022 17:15:06 +0000 (18:15 +0100)]
prettier run

2 years agouse prettier to format the code
Andrei Listochkin [Tue, 17 May 2022 15:07:30 +0000 (16:07 +0100)]
use prettier to format the code

2 years agoprettier config
Andrei Listochkin [Wed, 11 May 2022 17:19:45 +0000 (18:19 +0100)]
prettier config

[Prettier][1] is an up-to date code formatter for JavaScript ecosystem.

For settings we rely on [EditorConfig][2] for things like tab style and
size (with added bonus that the code editor with an EditorConfig plugin
does some automated code formatting on file save for you). Unfortunately,
Prettier's Glob handling isn't great:
 1. `*.{ts,js,json}` has no effect
 2. Similarly, in a list of globs `*.ts,*.js,*.json` only the first glob
has an effect, the rest are ignored.
That's why the file looks the way it does.

The only other setting we change is line width. [Lukas][3] suggested we
use 100 instead of 80, because that's what Rustfmt is using.

[1]: https://prettier.io
[2]: https://editorconfig.org
[3]: https://github.com/Veykril

2 years agoAuto merge of #12292 - jonas-schievink:bump-extension-version, r=jonas-schievink
bors [Tue, 17 May 2022 14:03:08 +0000 (14:03 +0000)]
Auto merge of #12292 - jonas-schievink:bump-extension-version, r=jonas-schievink

internal: Bump extension version

2 years agoBump extension version
Jonas Schievink [Tue, 17 May 2022 14:02:07 +0000 (16:02 +0200)]
Bump extension version

2 years agoAuto merge of #12285 - Veykril:inlay-hints, r=Veykril
bors [Tue, 17 May 2022 13:11:40 +0000 (13:11 +0000)]
Auto merge of #12285 - Veykril:inlay-hints, r=Veykril

feat: Implement inlay hint tooltips

Currently this just delegates to hover request for some things, and otherwise fallsback to the label.
![image](https://user-images.githubusercontent.com/3757771/168816520-e015726f-53e1-4dac-a76e-8f1312f145d7.png)
![image](https://user-images.githubusercontent.com/3757771/168802753-43749b75-866c-40db-b106-aeaa542b87a3.png)
![image](https://user-images.githubusercontent.com/3757771/168816579-da2050f0-f198-4b3a-a9a1-53199fcaab61.png)
![image](https://user-images.githubusercontent.com/3757771/168818804-d4400ffe-0e6c-48a0-a872-f054e5f550fa.png)

2 years agoUpdate test output
Lukas Wirth [Tue, 17 May 2022 12:58:26 +0000 (14:58 +0200)]
Update test output

2 years agoAuto merge of #12289 - rust-lang:Veykril-patch-1, r=Veykril
bors [Tue, 17 May 2022 12:56:25 +0000 (12:56 +0000)]
Auto merge of #12289 - rust-lang:Veykril-patch-1, r=Veykril

fix: Fix incorrect config key in client config update

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

2 years agoFix incorrect config key in client config update
Lukas Wirth [Tue, 17 May 2022 12:56:08 +0000 (14:56 +0200)]
Fix incorrect config key in client config update

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

2 years agoUpdate lsp-extensions hash
Lukas Wirth [Tue, 17 May 2022 12:48:28 +0000 (14:48 +0200)]
Update lsp-extensions hash

2 years agoAllow inlay hint tooltips to trigger hovers
Lukas Wirth [Tue, 17 May 2022 12:46:43 +0000 (14:46 +0200)]
Allow inlay hint tooltips to trigger hovers

2 years agoTrigger hover requests on closing brace hints
Lukas Wirth [Tue, 17 May 2022 11:39:45 +0000 (13:39 +0200)]
Trigger hover requests on closing brace hints

2 years agoReplace some SmolStr usages with String as the conversion happens anyways
Lukas Wirth [Tue, 17 May 2022 10:56:14 +0000 (12:56 +0200)]
Replace some SmolStr usages with String as the conversion happens anyways

2 years agofeat: Implement inlay hint tooltips
Lukas Wirth [Tue, 17 May 2022 10:49:51 +0000 (12:49 +0200)]
feat: Implement inlay hint tooltips

2 years agoAuto merge of #12284 - Veykril:inlay-hints, r=Veykril
bors [Tue, 17 May 2022 10:19:14 +0000 (10:19 +0000)]
Auto merge of #12284 - Veykril:inlay-hints, r=Veykril

internal: Cleanup lifetime elision hints

2 years agointernal: Cleanup lifetime elision hints
Lukas Wirth [Tue, 17 May 2022 10:18:07 +0000 (12:18 +0200)]
internal: Cleanup lifetime elision hints

2 years agoAuto merge of #12276 - jonas-schievink:improve-generate-deref-impl, r=jonas-schievink
bors [Mon, 16 May 2022 18:12:53 +0000 (18:12 +0000)]
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.

2 years agoImprove "Generate `Deref` impl" assist
Jonas Schievink [Mon, 16 May 2022 18:10:46 +0000 (20:10 +0200)]
Improve "Generate `Deref` impl" assist

2 years agoAuto merge of #12275 - jonas-schievink:remove-setter-doc-gen, r=jonas-schievink
bors [Mon, 16 May 2022 17:28:01 +0000 (17:28 +0000)]
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

2 years agoDon't generate documentation in `generate_setter`
Jonas Schievink [Mon, 16 May 2022 17:27:27 +0000 (19:27 +0200)]
Don't generate documentation in `generate_setter`

2 years agoAuto merge of #12274 - jonas-schievink:move-getter-docs-generation, r=jonas-schievink
bors [Mon, 16 May 2022 17:14:16 +0000 (17:14 +0000)]
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

2 years agoHandle getters and setters in documentation template assist
Jonas Schievink [Mon, 16 May 2022 17:10:38 +0000 (19:10 +0200)]
Handle getters and setters in documentation template assist

2 years agoAuto merge of #12271 - bitgaoshu:box_with_expec, r=flodiebold
bors [Mon, 16 May 2022 15:00:36 +0000 (15:00 +0000)]
Auto merge of #12271 - bitgaoshu:box_with_expec, r=flodiebold

fix #12227 Type mismatch error shown

add box expectation hint

2 years agoAuto merge of #12272 - jonas-schievink:fix-signature-help-offsets, r=jonas-schievink
bors [Mon, 16 May 2022 13:50:00 +0000 (13:50 +0000)]
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.

2 years agoFix signature help LSP offset conversion
Jonas Schievink [Mon, 16 May 2022 13:48:38 +0000 (15:48 +0200)]
Fix signature help LSP offset conversion

2 years agoAuto merge of #12244 - jonas-schievink:closing-brace-hints, r=jonas-schievink
bors [Mon, 16 May 2022 13:25:04 +0000 (13:25 +0000)]
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)

2 years agoAdd closing brace hints for macros
Jonas Schievink [Mon, 16 May 2022 13:23:25 +0000 (15:23 +0200)]
Add closing brace hints for macros

2 years agoadd box expection hint
bitgaoshu [Sun, 15 May 2022 13:14:11 +0000 (21:14 +0800)]
add box expection hint

2 years agoShow inlay hints after a `}` to indicate the closed item
Jonas Schievink [Fri, 13 May 2022 17:42:59 +0000 (19:42 +0200)]
Show inlay hints after a `}` to indicate the closed item

2 years agoAuto merge of #12256 - matklad:m, r=matklad
bors [Mon, 16 May 2022 11:44:00 +0000 (11:44 +0000)]
Auto merge of #12256 - matklad:m, r=matklad

minor: rename

2 years agominor: rename
Aleksey Kladov [Sat, 14 May 2022 21:08:16 +0000 (22:08 +0100)]
minor: rename

2 years agoAuto merge of #12253 - Veykril:bm, r=Veykril
bors [Mon, 16 May 2022 11:16:22 +0000 (11:16 +0000)]
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)

2 years agoAuto merge of #12242 - flodiebold:extension-description, r=flodiebold
bors [Sun, 15 May 2022 18:11:32 +0000 (18:11 +0000)]
Auto merge of #12242 - flodiebold:extension-description, r=flodiebold

Improve extension description and README

2 years agoAuto merge of #12262 - jhgg:fix-whitespace-between-mut-self-in-macro-expansion, r...
bors [Sun, 15 May 2022 12:47:38 +0000 (12:47 +0000)]
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

2 years agoAuto merge of #12190 - harpsword:fix_diagostics_map_incorrectly, r=harpsword
bors [Sun, 15 May 2022 09:48:51 +0000 (09:48 +0000)]
Auto merge of #12190 - harpsword:fix_diagostics_map_incorrectly, r=harpsword

fix cargo check diagnostics are mapped incorrectly with non-BMP codepoints

fix #11945

2 years agoide: insert whitespace between 'mut' and 'self' in macro expansion
Jake Heinz [Sun, 15 May 2022 07:55:13 +0000 (07:55 +0000)]
ide: insert whitespace between 'mut' and 'self' in macro expansion

2 years agoAuto merge of #12251 - matklad:lsp-server, r=matklad
bors [Sat, 14 May 2022 20:20:01 +0000 (20:20 +0000)]
Auto merge of #12251 - matklad:lsp-server, r=matklad

internal: vendor lsp-server

2 years agointernal: vendor lsp-server
Aleksey Kladov [Sat, 14 May 2022 10:33:48 +0000 (11:33 +0100)]
internal: vendor lsp-server

2 years agoUpdate package.json
Lukas Wirth [Sat, 14 May 2022 13:18:18 +0000 (15:18 +0200)]
Update package.json

2 years agoEnable reborrow hints in attribute calls
Lukas Wirth [Sat, 14 May 2022 13:00:14 +0000 (15:00 +0200)]
Enable reborrow hints in attribute calls

2 years agofeat: Add binding mode inlay hints
Lukas Wirth [Sat, 14 May 2022 12:26:08 +0000 (14:26 +0200)]
feat: Add binding mode inlay hints

2 years agoAuto merge of #12252 - Veykril:config, r=Veykril
bors [Sat, 14 May 2022 11:56:11 +0000 (11:56 +0000)]
Auto merge of #12252 - Veykril:config, r=Veykril

internal: Make VSCode config more GUI edit friendly

2 years agointernal: Make VSCode config more GUI edit friendly
Lukas Wirth [Sat, 14 May 2022 11:53:41 +0000 (13:53 +0200)]
internal: Make VSCode config more GUI edit friendly