Commit Graph

24419 Commits

Author SHA1 Message Date
Laurențiu Nicola
8f617b55ce Update some old checkOnSave references 2023-02-12 11:35:44 +02:00
Laurențiu Nicola
cfeec8a705 Add clippy configuration section to the manual 2023-02-12 11:34:52 +02:00
Lukas Wirth
33cacde04b Fix active parameter analysis 2023-02-12 10:26:19 +01:00
bors
a14a1520a3 Auto merge of #14135 - lnicola:manual-lapce, r=lnicola
feat: Add Lapce section to the manual
2023-02-12 09:12:48 +00:00
Laurențiu Nicola
9d85161f30 Add Lapce section to the manual 2023-02-12 11:12:05 +02:00
bors
5ef76da835 Auto merge of #14133 - lnicola:changelog-version, r=lnicola
minor: Add version placeholder to changelog template

Closes #13967

This isn't great because we need to fill it in manually, but getting the version number from GitHub Actions is a bit annoying.
2023-02-12 08:57:08 +00:00
Laurențiu Nicola
240b6f7f8d Add version placeholder to changelog template 2023-02-12 10:55:49 +02:00
Lukas Wirth
1be24e0899 internal: Improve parser recovery a bunch 2023-02-11 20:28:36 +01:00
bors
c29a00457a Auto merge of #14127 - lnicola:windows-x86, r=lnicola
feat: Build `i686-pc-windows-msvc` binaries

These have been requested a couple of times, so let's build them.
2023-02-11 16:23:56 +00:00
Laurențiu Nicola
87d6107f19 Build i686-pc-windows-msvc binaries 2023-02-11 17:50:48 +02:00
bors
d78a0be9b0 Auto merge of #14125 - Veykril:inlay-fix, r=Veykril
fix: Fix bind pat inlay hints rendering for constant patterns

Fixes https://github.com/rust-lang/rust-analyzer/issues/14124
2023-02-11 15:30:46 +00:00
Lukas Wirth
5fdf640fb3 fix: Fix bind pat inlay hints rendering for constant patterns 2023-02-11 16:29:54 +01:00
Duong Quoc Khanh
e1396bde73
Don't trigger postfix completion if block which has an else block
Discard postfix completion if the next_non_trivia_sibling of dot_token
is an ELSE_KW.
2023-02-11 21:26:00 +09:00
Ryo Yoshida
ae7e62c50f
Don't expand macros in the same expansion tree after overflow 2023-02-11 18:19:08 +09:00
bors
8011029d3a Auto merge of #13975 - DropDemBits:on-enter-after-dot-chains, r=DropDemBits
fix: Suppress extra indent after the end of field and function chains

(spurred on by <https://github.com/rust-lang/rust-analyzer/issues/4182#issuecomment-671275652>)

Caveat that this doesn't work for after tail expressions, although there shouldn't be anything after those anyways.

This also complicates when to reload the language configuration by nature of now always having a language configuration applicable.

Examples of indentation fixes:

```rs
fn main() {
    println!("Hello!"); // < enter here!
    // ... indents down here

    fs::read_to_string("soup") // < enter here!
    // ... still indents down here :(
        .map(|_| ())
        .map(|_| ()) // < enter here!
        // ... still indents down here :D
        .map_err(|_| ())
        .unwrap(); // < enter here!
    // ... indents down here :D

    // ... and subsequent enters stay at the same indent

    0.0f64
        .to_radians()
        .to_radians()
        .to_radians() // force semi on a new line
        ; // < enter here!
    // ... indents down here :D
}

fn tail_end() -> i32 {
    0i32.wrapping_abs()
        .wrapping_abs()
        .wrapping_abs()
        .wrapping_abs() // < enter here!
        // ... still indents here 🤷
}
```
2023-02-10 20:10:54 +00:00
DropDemBits
c7bd3c682f
Always reload onEnter configuration
Configuration reload doesn't happen often anyway,
and there will always be a set of onEnter rules to load
2023-02-10 14:55:17 -05:00
bors
d9c020d426 Auto merge of #14120 - Veykril:castable, r=Veykril
internal: Revert castable expectation and simplify

Unfixes https://github.com/rust-lang/rust-analyzer/issues/11571, the PR for that introduced some regressions (tried fixing them but doing what rustc does there specifically does not help, probably because something else affects it as well there)
2023-02-10 15:44:04 +00:00
Lukas Wirth
7677f41f41 Preallocate some vecs 2023-02-10 16:42:09 +01:00
bors
a28f53646d Auto merge of #14119 - Veykril:miniopt, r=Veykril
internal: Remove a few allocations in hir-ty::utils
2023-02-10 15:18:46 +00:00
Lukas Wirth
79492cb8ae internal: Revert castable expectation and simplify 2023-02-10 16:08:47 +01:00
Lukas Wirth
8f5deb4ff2 Remove a few allocations in hir-ty::utils 2023-02-10 14:57:03 +01:00
bors
f11cff8976 Auto merge of #14116 - Veykril:inlay-hints-disc, r=Veykril
Render discriminant inlay hints for mixed variants if at least one discriminant is specified
2023-02-10 08:59:17 +00:00
Lukas Wirth
557aa1e378 Render discriminant inlay hints for mixed variants if at least one discriminant is specified 2023-02-10 09:57:03 +01:00
bors
e2b868c534 Auto merge of #14114 - lh123:insert-ws-when-inline-macro, r=lnicola
fix: Insert spaces when inlining macros

Fixes https://github.com/rust-lang/rust-analyzer/issues/14108
2023-02-10 07:14:50 +00:00
lh123
626dc651ff fix: Insert spaces when inlining macros 2023-02-10 14:22:56 +08:00
bors
c468e39b5a Auto merge of #14112 - Veykril:vscode-untrusted, r=lnicola
minor: Explicitly disable the rust-analyzer extension in untrusted workspaces

This is the default, but its always better to be explicit here + we can add a small note as to why.
2023-02-09 18:46:11 +00:00
Lukas Wirth
7fc0f8985d Explicitly disable the rust-analyzer extension in unstrusted workspaces 2023-02-09 17:34:21 +01:00
bors
7e17b98d17 Auto merge of #14111 - lnicola:squash-proc-macro-server-warning, r=Veykril
fix: Hide proc macro server version detection errors

These are harmless, but users tend to blame other things on them.
2023-02-09 10:29:28 +00:00
Laurențiu Nicola
8828f3494e Hide proc macro server version detection errors 2023-02-09 10:46:36 +02:00
bors
313a48057a Auto merge of #14110 - dqkqd:auto-completion-for-missing-body, r=Veykril
Add completion for function without body

Fix #13802
2023-02-09 08:45:18 +00:00
Duong Quoc Khanh
74cd8ecc7e
Add completion without body.
Add completion for Fn, Const, TypeAlias without body.
2023-02-09 17:37:11 +09:00
Duong Quoc Khanh
58136b01ba
Add more tests for completion without body.
Add tests for Fn, Const, TypeAlias without body inside Trait.
2023-02-09 17:32:55 +09:00
bors
eaed19c539 Auto merge of #14104 - Veykril:castable-expect, r=Veykril
fix: Implement Expactation::Castable and add a test case for it

Fixes https://github.com/rust-lang/rust-analyzer/issues/11571
2023-02-08 12:08:15 +00:00
Lukas Wirth
f8f1cb93e0 fix: Implement Expactation::Castable and add a test case for it 2023-02-08 13:07:59 +01:00
bors
5341a6fa7f Auto merge of #14103 - Veykril:typing-semi, r=Veykril
fix: Don't insert a semicolon when typing = if parse errors are encountered

Fixes https://github.com/rust-lang/rust-analyzer/issues/11005
2023-02-08 11:14:58 +00:00
Lukas Wirth
5e6208b1df fix: Don't insert a semicolon when typing = if parse errors are encountered 2023-02-08 12:06:35 +01:00
bors
885c1ad578 Auto merge of #14102 - Veykril:bump-lexer, r=Veykril
minor: Bump `rustc-ap-rustc_lexer`

Closes https://github.com/rust-lang/rust-analyzer/issues/9554
2023-02-08 11:01:32 +00:00
Lukas Wirth
4788c7a056 Bump rustc-ap-rustc_lexer 2023-02-08 11:42:14 +01:00
bors
512a93ac94 Auto merge of #14100 - Veykril:load_cargo-proc-macro-srv-config, r=Veykril
Allow specifying what proc-macro server to run in rust_analyzer::load_cargo API

Closes https://github.com/rust-lang/rust-analyzer/issues/10516
2023-02-08 10:12:31 +00:00
Lukas Wirth
f03fb262f7 Allow specifying what proc-macro server to run in rust_analyzer::load_cargo API 2023-02-08 11:05:34 +01:00
bors
6effb26062 Auto merge of #14095 - dqkqd:master, r=Veykril
Add postfix completion for `unsafe`.

Fix #13779.

Hi, this is my first PR. Please tell me if there is anything I should do.
2023-02-08 09:44:22 +00:00
bors
a05ce5a3e7 Auto merge of #13986 - MariaSolOs:limit-completions, r=Veykril
Add setting for limiting number of completions

For #13911.
2023-02-08 09:31:35 +00:00
bors
3c89945e78 Auto merge of #14098 - pascalkuthe:did_change_workspace_folder, r=Veykril
Support DidChangeWorkspaceFolders notifications

This PR enables the `WorkspaceFoldersServerCapabilities` capability for rust-analyzer and implemented support for the associated [`DidChangeWorkspaceFolders`](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#workspace_didChangeWorkspaceFolders) notification to allow clients to update the list of `workspaceFolders` sent during initialization.

## Motivation

This allows clients which lazily autodiscover their workspace roots (like the [helix editor](https://github.com/helix-editor/helix) once [my PR](https://github.com/helix-editor/helix/pull/5748) lands) avoid spawning multiple instances of RA. Right now such clients are forced to either:

* greedily discover all LSP roots in the workspace (precludes the ability to respond to new workspace roots)
* spawn multiple instance of rust-analyzer (one for each root)
* restart rust-analyzer whenever a new workspace is added

Some example use-cases are shown [here](https://github.com/helix-editor/helix/pull/5748#issuecomment-1421012523).

This PR will also improve support for VSCode (and Atom) multi workspaces.

## Implementation

The implementation was fairly straightforward as `rust-analyzer` already supports dynamically reloading workspaces, for example on configuration changes. Furthermore, rust-analyzer also already supports auto-discovering internal workspace from the `workspaceFolders` key in the initialization request. Therefore, the necessary logic just needed to be moved to a central place and reused.
2023-02-08 09:14:01 +00:00
bors
b7836e44d3 Auto merge of #14099 - Veykril:inlay-hint-loc, r=Veykril
Properly use location links for type hints of impl Future and its assoc type
2023-02-08 08:43:10 +00:00
Maria José Solano
064fcfa016 Sort and truncate final response 2023-02-07 18:41:28 -08:00
Lukas Wirth
2b4a5374ee Properly use location links for type hints of impl Future and its assoc type 2023-02-07 22:42:03 +01:00
Pascal Kuthe
c7010eda1b
Support DidChangeWorkspaceFolders capability 2023-02-07 22:40:40 +01:00
Duong Quoc Khanh
2666e6eda8
Add test for LetElse case.
Postfix completion is not triggered.
2023-02-08 04:04:10 +09:00
Duong Quoc Khanh
8535f2bb1b
Handle edge cases.
Handle case when BlockExpr is child of IfExpr, WhileExpr, LoopExpr,
ForExpr.
An additional { } will be added when:
- It is not a BlockExpr
- It is a BlockExpr and a child of IfExpr, WhileExpr, LoopExpr, ForExpr.
2023-02-08 03:37:20 +09:00
bors
7f1234492e Auto merge of #14084 - Veykril:float-parse, r=Veykril
fix: Fix parsing of nested tuple field accesses in a cursed way

This is absolutely terrible but seems to work. Macro fragment parsing comes next.
2023-02-07 17:25:31 +00:00