]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoAuto merge of #12057 - harpsword:fix_validata_visibility, r=jonas-schievink
bors [Wed, 27 Apr 2022 13:09:31 +0000 (13:09 +0000)]
Auto merge of #12057 - harpsword:fix_validata_visibility, r=jonas-schievink

fix visibility token validation in trait impl with proc-macro

fix #11828

2 years agoAuto merge of #12089 - lowr:fix/move-raw-ident-module-to-file, r=jonas-schievink
bors [Wed, 27 Apr 2022 12:59:52 +0000 (12:59 +0000)]
Auto merge of #12089 - lowr:fix/move-raw-ident-module-to-file, r=jonas-schievink

fix: handle raw identifiers in move_module_to_file

Fixes #12045

Note that I special case'd mod named `r#mod` as commented in the code. Although it's very unlikely that one would use such name, I included it in this fix for the sake of completeness.

2 years agofix visibility token validation in trait impl with proc-macro
harpsword [Fri, 22 Apr 2022 14:16:41 +0000 (22:16 +0800)]
fix visibility token validation in trait impl with proc-macro

2 years agoAuto merge of #12098 - jonas-schievink:macro-rules-snippet, r=jonas-schievink
bors [Wed, 27 Apr 2022 12:41:29 +0000 (12:41 +0000)]
Auto merge of #12098 - jonas-schievink:macro-rules-snippet, r=jonas-schievink

fix: show `macro_rules` snippet in blocks

fixes https://github.com/rust-lang/rust-analyzer/issues/12092

2 years agoShow `macro_rules` snippet in blocks
Jonas Schievink [Wed, 27 Apr 2022 12:40:09 +0000 (14:40 +0200)]
Show `macro_rules` snippet in blocks

2 years agoAuto merge of #12097 - lnicola:revert-11490, r=lnicola
bors [Wed, 27 Apr 2022 12:32:35 +0000 (12:32 +0000)]
Auto merge of #12097 - lnicola:revert-11490, r=lnicola

Revert #11490

Closes #11725

#11490 was a little misguided. Quoting the test name should be a client concern, since it's the client that actually runs `cargo`.

2 years agoRevert "Correctly fix formatting doc tests with generics"
Laurențiu Nicola [Wed, 27 Apr 2022 12:27:50 +0000 (15:27 +0300)]
Revert "Correctly fix formatting doc tests with generics"

This reverts commit 5f3327a6b8925791ecdd9dbecb1bf1537c3ef9fc.

2 years agoRevert "Update crates/ide/src/runnables.rs"
Laurențiu Nicola [Wed, 27 Apr 2022 12:27:48 +0000 (15:27 +0300)]
Revert "Update crates/ide/src/runnables.rs"

This reverts commit bf47acf1d3451eb281ea56a6ad8f5e1834ce6a8f.

2 years agoAuto merge of #12085 - rainy-me:fix_fn_param, r=Veykril
bors [Wed, 27 Apr 2022 10:43:43 +0000 (10:43 +0000)]
Auto merge of #12085 - rainy-me:fix_fn_param, r=Veykril

fix: fn_param completion lookup

close #12073 caused by #12040

2 years agofix: remove lookup and handle mut kw case
rainy-me [Wed, 27 Apr 2022 09:54:57 +0000 (18:54 +0900)]
fix: remove lookup and handle mut kw case

2 years agofix: handle raw identifiers in move_module_to_file
LowR [Tue, 26 Apr 2022 18:34:32 +0000 (03:34 +0900)]
fix: handle raw identifiers in move_module_to_file

2 years agoAuto merge of #12083 - Veykril:inlays, r=Veykril
bors [Tue, 26 Apr 2022 09:53:26 +0000 (09:53 +0000)]
Auto merge of #12083 - Veykril:inlays, r=Veykril

minor: Add test for parameter and reborrow hint order

2 years agominor: Add test for parameter and reborrow hint order
Lukas Wirth [Tue, 26 Apr 2022 09:46:03 +0000 (11:46 +0200)]
minor: Add test for parameter and reborrow hint order

2 years agoAuto merge of #12082 - iDawer:ide.signature_help, r=lnicola
bors [Tue, 26 Apr 2022 07:34:00 +0000 (07:34 +0000)]
Auto merge of #12082 - iDawer:ide.signature_help, r=lnicola

fix: `signature_help`: use corresponding param list for methods

Close #12079

2 years ago`signature_help`: use corresponding param list for methods
iDawer [Tue, 26 Apr 2022 06:50:28 +0000 (11:50 +0500)]
`signature_help`: use corresponding param list for methods

2 years agoAuto merge of #12078 - Veykril:neither, r=Veykril
bors [Mon, 25 Apr 2022 17:01:44 +0000 (17:01 +0000)]
Auto merge of #12078 - Veykril:neither, r=Veykril

minor: Re-export `FxHashMap` and `FxHashSet` from `ide_db`

2 years agoRe-export `FxHashMap` and `FxHashSet` from `ide_db`
Lukas Wirth [Mon, 25 Apr 2022 16:51:59 +0000 (18:51 +0200)]
Re-export `FxHashMap` and `FxHashSet` from `ide_db`

2 years agoAuto merge of #12077 - Veykril:neither, r=Veykril
bors [Mon, 25 Apr 2022 16:48:42 +0000 (16:48 +0000)]
Auto merge of #12077 - Veykril:neither, r=Veykril

minor: Remove `either` dependency from `ide_completion`

bors r+

2 years agominor: Remove either dependency from `ide_completion`
Lukas Wirth [Mon, 25 Apr 2022 16:40:38 +0000 (18:40 +0200)]
minor: Remove either dependency from `ide_completion`

2 years agoAuto merge of #12075 - jonas-schievink:less-aggressive-quickfixes, r=jonas-schievink
bors [Mon, 25 Apr 2022 13:22:41 +0000 (13:22 +0000)]
Auto merge of #12075 - jonas-schievink:less-aggressive-quickfixes, r=jonas-schievink

fix: Don't emit a quickfix for placeholder suggestions from rustc/clippy

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

2 years agoDon't emit a quickfix for placeholder suggestions
Jonas Schievink [Mon, 25 Apr 2022 13:21:30 +0000 (15:21 +0200)]
Don't emit a quickfix for placeholder suggestions

2 years agoAuto merge of #12007 - edwin0cheng:restart-proc-macro-reload, r=jonas-schievink
bors [Mon, 25 Apr 2022 12:56:57 +0000 (12:56 +0000)]
Auto merge of #12007 - edwin0cheng:restart-proc-macro-reload, r=jonas-schievink

Restart proc-macro client when server reload

Fix #10719

2 years agoAuto merge of #12071 - Ma124:fix-tabs-snippet, r=jonas-schievink
bors [Mon, 25 Apr 2022 12:44:49 +0000 (12:44 +0000)]
Auto merge of #12071 - Ma124:fix-tabs-snippet, r=jonas-schievink

Change tabs to spacs in macro_rules snippet

This PR changes the `macro_rules!` snippet to use spaces instead of tabs.
The other snippets like [this one][test-snippet] already use spaces.

The snippet was introduced in 5575588 where no reason is provided to use tabs.

[test-snippet]: https://github.com/rust-lang/rust-analyzer/blob/master/crates/ide_completion/src/completions/snippet.rs#L70=

2 years agoAuto merge of #12074 - jonas-schievink:deprioritize-flyimport, r=jonas-schievink
bors [Mon, 25 Apr 2022 12:35:39 +0000 (12:35 +0000)]
Auto merge of #12074 - jonas-schievink:deprioritize-flyimport, r=jonas-schievink

Reduce priority of flyimport completions

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

2 years agoReduce priority of flyimport completions
Jonas Schievink [Mon, 25 Apr 2022 12:34:54 +0000 (14:34 +0200)]
Reduce priority of flyimport completions

2 years agoAuto merge of #12072 - bitgaoshu:master, r=jonas-schievink
bors [Mon, 25 Apr 2022 11:07:09 +0000 (11:07 +0000)]
Auto merge of #12072 - bitgaoshu:master, r=jonas-schievink

fix #11973 associated type is unresolved

2 years agoChange tabs to spacs in macro_rules snippet
Ma_124 [Sun, 24 Apr 2022 12:24:59 +0000 (14:24 +0200)]
Change tabs to spacs in macro_rules snippet

2 years ago#11973 associated type is unresolved
bitgaoshu [Sun, 24 Apr 2022 12:51:48 +0000 (20:51 +0800)]
#11973 associated type is unresolved

2 years agoAuto merge of #12070 - rust-lang:message, r=matklad
bors [Sun, 24 Apr 2022 12:41:16 +0000 (12:41 +0000)]
Auto merge of #12070 - rust-lang:message, r=matklad

minor: clarify error message

Clarify that the server is a whole is OK, and that it's only a single
requests that's dead

2 years agominor: clarify error message
Aleksey Kladov [Sun, 24 Apr 2022 12:39:33 +0000 (13:39 +0100)]
minor: clarify error message

Clarify that the server is a whole is OK, and that it's only a single
requests that's dead

2 years agoFix Reload Workspace command
Edwin Cheng [Sun, 24 Apr 2022 03:59:08 +0000 (11:59 +0800)]
Fix Reload Workspace command

2 years agoAuto merge of #12064 - Veykril:attr-range, r=Veykril
bors [Sat, 23 Apr 2022 14:37:35 +0000 (14:37 +0000)]
Auto merge of #12064 - Veykril:attr-range, r=Veykril

fix: Fix `ide_db::search` not searching bodies of attributed items

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

2 years agofix: Fix ide_db::search not searching bodies of attributed items
Lukas Wirth [Sat, 23 Apr 2022 14:36:11 +0000 (16:36 +0200)]
fix: Fix ide_db::search not searching bodies of attributed items

2 years agoAuto merge of #12063 - iDawer:ide.signature_help, r=Veykril
bors [Sat, 23 Apr 2022 14:23:30 +0000 (14:23 +0000)]
Auto merge of #12063 - iDawer:ide.signature_help, r=Veykril

fix: Fall back to parameter definitions on error types in signature help

Fixes  #10432

2 years agoAdd fallback for return type
iDawer [Sat, 23 Apr 2022 11:45:47 +0000 (16:45 +0500)]
Add fallback for return type

2 years agoFall back to parameter definitions on error types in signature help
iDawer [Sat, 23 Apr 2022 10:10:10 +0000 (15:10 +0500)]
Fall back to parameter definitions on error types in signature help

2 years agoAuto merge of #12060 - Veykril:completion-ctx, r=Veykril
bors [Sat, 23 Apr 2022 00:29:18 +0000 (00:29 +0000)]
Auto merge of #12060 - Veykril:completion-ctx, r=Veykril

minor: Simplify

bors r+

2 years agoSimplify
Lukas Wirth [Sat, 23 Apr 2022 00:21:27 +0000 (02:21 +0200)]
Simplify

2 years agoAuto merge of #12058 - jonas-schievink:one-thread-with-extra-stack-please, r=jonas...
bors [Fri, 22 Apr 2022 15:46:30 +0000 (15:46 +0000)]
Auto merge of #12058 - jonas-schievink:one-thread-with-extra-stack-please, r=jonas-schievink

fix: Spawn a new thread with a larger stack for the LSP and proc-macro server

This runs the server and proc-macro process in dedicated threads with 8 MB of stack space to paper over OS differences and fix occasional stack overflows.

This hopefully resolves https://github.com/rust-lang/rust-analyzer/issues/11669

2 years agoSpawn a new thread with a larger stack for the server
Jonas Schievink [Fri, 22 Apr 2022 15:30:18 +0000 (17:30 +0200)]
Spawn a new thread with a larger stack for the server

2 years agoAuto merge of #12054 - HKalbasi:const_generic, r=flodiebold
bors [Fri, 22 Apr 2022 15:22:49 +0000 (15:22 +0000)]
Auto merge of #12054 - HKalbasi:const_generic, r=flodiebold

Fix const generic panic in dyn trait

fix #12048

2 years agoremove trailing space
hkalbasi [Fri, 22 Apr 2022 14:59:10 +0000 (19:29 +0430)]
remove trailing space

2 years agoAdd some comments about why never!() never happens
hkalbasi [Fri, 22 Apr 2022 14:52:18 +0000 (19:22 +0430)]
Add some comments about why never!() never happens

2 years agoAuto merge of #12053 - willcrichton:master, r=jonas-schievink
bors [Fri, 22 Apr 2022 14:42:25 +0000 (14:42 +0000)]
Auto merge of #12053 - willcrichton:master, r=jonas-schievink

Export lc.LanguageClient from VSCode extension

As described in [this Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Use.20Rust.20Analyzer.20in.20another.20VSCode.20extension), I would like to experiment with using Rust Analyzer's language server inside another VSCode extension, [Flowistry](https://github.com/willcrichton/flowistry). My current use case is to use one of Rust Analyzer's assists (extract function).

This PR would enable that experimentation by exporting the `lc.LanguageClient` from the `activate` function, which [allows other extensions to access it](https://code.visualstudio.com/api/references/vscode-api#extensions). This PR does **not** commit RA to any stability guarantees about the language client, similar to how rustc exports an unstable API.

2 years agofix const generic panic in dyn trait
hkalbasi [Thu, 21 Apr 2022 21:05:28 +0000 (01:35 +0430)]
fix const generic panic in dyn trait

2 years agoExport lc.LanguageClient from VSCode extension
Will Crichton [Thu, 21 Apr 2022 20:39:53 +0000 (13:39 -0700)]
Export lc.LanguageClient from VSCode extension

2 years agoAuto merge of #12052 - lnicola:cargo-config, r=lnicola
bors [Thu, 21 Apr 2022 18:10:37 +0000 (18:10 +0000)]
Auto merge of #12052 - lnicola:cargo-config, r=lnicola

minor: drop `install-ra` cargo alias

2 years agoRename cargo config to config.toml
Laurențiu Nicola [Thu, 21 Apr 2022 18:08:07 +0000 (21:08 +0300)]
Rename cargo config to config.toml

2 years agoRemove old install-ra cargo alias
Laurențiu Nicola [Thu, 21 Apr 2022 18:06:28 +0000 (21:06 +0300)]
Remove old install-ra cargo alias

2 years agoAuto merge of #12015 - arjo129:master, r=jonas-schievink
bors [Thu, 21 Apr 2022 16:52:10 +0000 (16:52 +0000)]
Auto merge of #12015 - arjo129:master, r=jonas-schievink

[Documentation]: Update developer documentation link.

Just noticed the docs links broken. The current doc link was broken. replaced with the updated version as found on the front page. Should the rest of the links be updated?

2 years agoAuto merge of #12051 - jonas-schievink:triagebot, r=jonas-schievink
bors [Thu, 21 Apr 2022 15:48:42 +0000 (15:48 +0000)]
Auto merge of #12051 - jonas-schievink:triagebot, r=jonas-schievink

Add triagebot.toml

Allow people to claim issues

2 years agoAdd triagebot.toml
Jonas Schievink [Thu, 21 Apr 2022 15:43:12 +0000 (17:43 +0200)]
Add triagebot.toml

2 years agoAuto merge of #12040 - rainy-me:improve-parameter-completion, r=jonas-schievink
bors [Thu, 21 Apr 2022 15:39:10 +0000 (15:39 +0000)]
Auto merge of #12040 - rainy-me:improve-parameter-completion, r=jonas-schievink

fix: Improve parameter completion

fix https://github.com/rust-lang/rust-analyzer/issues/12016 and handles some extra cases.

2 years agofix: lookup
rainy-me [Thu, 21 Apr 2022 15:07:42 +0000 (00:07 +0900)]
fix: lookup

2 years agoAuto merge of #12044 - tedinski:fix_rustc_workspace, r=jonas-schievink
bors [Thu, 21 Apr 2022 14:03:37 +0000 (14:03 +0000)]
Auto merge of #12044 - tedinski:fix_rustc_workspace, r=jonas-schievink

fix: index the correct CargoWorkspace with rustc_private

I believe this fixes #12043, but I'm not sufficiently setup/familiar with working on rust-analyzer to test it locally. :/

This section of code is iterating on `rustc_workspace.packages()` but then indexes `cargo[pkg]`, which is likely the source of the bug.

2 years agofix: index the correct CargoWorkspace with rustc_private
Ted Kaminski [Wed, 20 Apr 2022 17:16:04 +0000 (17:16 +0000)]
fix: index the correct CargoWorkspace with rustc_private

2 years agoAuto merge of #12042 - jonas-schievink:remove-angle-brackets-from-lang-config, r...
bors [Wed, 20 Apr 2022 14:54:24 +0000 (14:54 +0000)]
Auto merge of #12042 - jonas-schievink:remove-angle-brackets-from-lang-config, r=jonas-schievink

fix: remove angle brackets from language configuration

This should fix https://github.com/rust-lang/rust-analyzer/issues/12034

It looks like we shouldn't add any characters here that can be ambiguous, because it can make the editor highlight unrelated characters. This needs a parser to be correct, so the language server is the right place, not the editor. Upstream LSP feature request: https://github.com/microsoft/language-server-protocol/issues/672 (but it might be possible to implement this as an extension today, as long as that doesn't conflict with the built-in highlighting).

2 years agofix: remove angle brackets from language configuration
Jonas Schievink [Wed, 20 Apr 2022 14:43:24 +0000 (16:43 +0200)]
fix: remove angle brackets from language configuration

2 years agoAuto merge of #12041 - jonas-schievink:prefer-core-cfg-attr-no-std, r=jonas-schievink
bors [Wed, 20 Apr 2022 12:11:09 +0000 (12:11 +0000)]
Auto merge of #12041 - jonas-schievink:prefer-core-cfg-attr-no-std, r=jonas-schievink

feat: prefer core/alloc over std in auto-imports if `#[no_std]` is conditional

We already did this if `#![no_std]` was present, this PR makes it work with `#![cfg_attr(not(test), no_std)]` too, which is very common in libraries.

Fixes https://github.com/rust-lang/rust-analyzer/issues/12035
cc https://github.com/rust-lang/rust-analyzer/issues/10718

2 years agoPrefer core/alloc over std if no_std is conditional
Jonas Schievink [Wed, 20 Apr 2022 12:07:40 +0000 (14:07 +0200)]
Prefer core/alloc over std if no_std is conditional

2 years agofix: improve parameter completion
rainy-me [Wed, 20 Apr 2022 08:56:20 +0000 (17:56 +0900)]
fix: improve parameter completion

2 years agoAuto merge of #12037 - lnicola:inlay-hint-config, r=lnicola
bors [Wed, 20 Apr 2022 04:38:22 +0000 (04:38 +0000)]
Auto merge of #12037 - lnicola:inlay-hint-config, r=lnicola

fix: Remove `rust-analyzer.inlayHints.enable` and set language scope

Closes #12036
CC https://github.com/rust-lang/rust-analyzer/issues/12027#issuecomment-1102990324

The key was left there by mistake in #12006.

Setting the configuration scope only works if you already have it created, which is fine, but unfortunately not quite discoverable.

2 years agoPass the language id when toggling inlay hints
Laurențiu Nicola [Wed, 20 Apr 2022 04:34:00 +0000 (07:34 +0300)]
Pass the language id when toggling inlay hints

2 years agoActually remove rust-analyzer.inlayHints.enable
Laurențiu Nicola [Wed, 20 Apr 2022 04:33:26 +0000 (07:33 +0300)]
Actually remove rust-analyzer.inlayHints.enable

2 years agoAuto merge of #12032 - jonas-schievink:code-action-commands, r=jonas-schievink
bors [Tue, 19 Apr 2022 16:46:33 +0000 (16:46 +0000)]
Auto merge of #12032 - jonas-schievink:code-action-commands, r=jonas-schievink

feat: display signature help when applying "Add `::<>`" assist

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

2 years agoAllows triggering commands after an assist edit
Jonas Schievink [Tue, 19 Apr 2022 16:37:18 +0000 (18:37 +0200)]
Allows triggering commands after an assist edit

2 years agoAuto merge of #12029 - xuhongxu96:master, r=lnicola
bors [Tue, 19 Apr 2022 07:57:12 +0000 (07:57 +0000)]
Auto merge of #12029 - xuhongxu96:master, r=lnicola

Fix typo "GreeNode" in syntax.md

2 years agoFix typo "GreeNode" in syntax.md
Hongxu Xu [Tue, 19 Apr 2022 07:45:03 +0000 (15:45 +0800)]
Fix typo "GreeNode" in syntax.md

2 years agoAuto merge of #12028 - lnicola:fix-changelog, r=lnicola
bors [Tue, 19 Apr 2022 06:09:32 +0000 (06:09 +0000)]
Auto merge of #12028 - lnicola:fix-changelog, r=lnicola

internal: Fix changelog generation after repo move

2 years agoFix changelog generation after repo move
Laurențiu Nicola [Tue, 19 Apr 2022 06:07:10 +0000 (09:07 +0300)]
Fix changelog generation after repo move

2 years agoAuto merge of #12025 - Veykril:completion-ctx, r=Veykril
bors [Mon, 18 Apr 2022 14:55:31 +0000 (14:55 +0000)]
Auto merge of #12025 - Veykril:completion-ctx, r=Veykril

minor: Document completion context some more

2 years agominor: Document completion context some more
Lukas Wirth [Mon, 18 Apr 2022 14:54:13 +0000 (16:54 +0200)]
minor: Document completion context some more

2 years agoAuto merge of #12021 - Veykril:completion-ctx, r=Veykril
bors [Mon, 18 Apr 2022 14:00:56 +0000 (14:00 +0000)]
Auto merge of #12021 - Veykril:completion-ctx, r=Veykril

internal: Add a `NameContext` to `CompletionContext`, move out some ImmediateLocation variants

Continues the completion rewrite I started some time ago
(will merge tomorrow after stable since our completion tests still let a lot through)

2 years agoAuto merge of #12024 - XFFXFF:derive_completion, r=Veykril
bors [Mon, 18 Apr 2022 13:40:18 +0000 (13:40 +0000)]
Auto merge of #12024 - XFFXFF:derive_completion, r=Veykril

derive completions take existing derives into count

fixes #12019

The immediate reason is that when we are doing derive completion, [`ctx.existing_derives`](https://github.com/rust-lang/rust-analyzer/blob/d1f6b4e2a0ab1a1343ab4a381c89b186a76fd001/crates/ide_completion/src/completions/attribute/derive.rs#L82) is empty, this is because we expand the macro when looking for the ancestors of the token to be completed. Take the following code as an example, we find the first `SyntaxNode` with kind `Attr` based on the ancestors of the token, but the parent of `Attr` is not a `Struct` as we [expect](https://github.com/rust-lang/rust-analyzer/blob/d1f6b4e2a0ab1a1343ab4a381c89b186a76fd001/crates/hir/src/semantics.rs#L518).
```rust
#[derive(PartialEq, Eq, Or$0)]
struct S;
```
The ancestors of the token to be completed above.
```
    NAME_REF@24..26
      IDENT@24..26 "Or"
    ,
    PATH_SEGMENT@24..26
      NAME_REF@24..26
        IDENT@24..26 "Or"
    ,
    PATH@24..26
      PATH_SEGMENT@24..26
        NAME_REF@24..26
          IDENT@24..26 "Or"
    ,
    META@24..26
      PATH@24..26
        PATH_SEGMENT@24..26
          NAME_REF@24..26
            IDENT@24..26 "Or"
    ,
    ATTR@21..28
      POUND@21..22 "#"
      WHITESPACE@22..23 " "
      L_BRACK@23..24 "["
      META@24..26
        PATH@24..26
          PATH_SEGMENT@24..26
            NAME_REF@24..26
              IDENT@24..26 "Or"
      R_BRACK@26..27 "]"
      WHITESPACE@27..28 " "
    ,
    TUPLE_EXPR@0..32
      ATTR@0..14
        POUND@0..1 "#"
        WHITESPACE@1..2 " "
        L_BRACK@2..3 "["
        META@3..12
          PATH@3..12
            PATH_SEGMENT@3..12
              NAME_REF@3..12
                IDENT@3..12 "PartialEq"
        R_BRACK@12..13 "]"
        WHITESPACE@13..14 " "
      ATTR@14..21
        POUND@14..15 "#"
        WHITESPACE@15..16 " "
        L_BRACK@16..17 "["
        META@17..19
          PATH@17..19
            PATH_SEGMENT@17..19
              NAME_REF@17..19
                IDENT@17..19 "Eq"
        R_BRACK@19..20 "]"
        WHITESPACE@20..21 " "
      ATTR@21..28
        POUND@21..22 "#"
        WHITESPACE@22..23 " "
        L_BRACK@23..24 "["
        META@24..26
          PATH@24..26
            PATH_SEGMENT@24..26
              NAME_REF@24..26
                IDENT@24..26 "Or"
        R_BRACK@26..27 "]"
        WHITESPACE@27..28 " "
      L_PAREN@28..29 "("
      WHITESPACE@29..30 " "
      R_PAREN@30..31 ")"
      WHITESPACE@31..32 " "
...
```

I make a small change to not do macro expansion when looking up the ancestors of the token.

What I don't understand is that `self.sema.token_ancestors_with_macros(self.token.clone())` doesn't seem to expand the macro if the derive completion triggered without any prefix, like `#[derive(PartialEq, Eq, $0)]`.

The ancestors of the token with  `#[derive(PartialEq, Eq, $0)]`.
```
    TOKEN_TREE@8..25
      L_PAREN@8..9 "("
      IDENT@9..18 "PartialEq"
      COMMA@18..19 ","
      WHITESPACE@19..20 " "
      IDENT@20..22 "Eq"
      COMMA@22..23 ","
      WHITESPACE@23..24 " "
      R_PAREN@24..25 ")"
    ,
    META@2..25
      PATH@2..8
        PATH_SEGMENT@2..8
          NAME_REF@2..8
            IDENT@2..8 "derive"
      TOKEN_TREE@8..25
        L_PAREN@8..9 "("
        IDENT@9..18 "PartialEq"
        COMMA@18..19 ","
        WHITESPACE@19..20 " "
        IDENT@20..22 "Eq"
        COMMA@22..23 ","
        WHITESPACE@23..24 " "
        R_PAREN@24..25 ")"
    ,
    ATTR@0..26
      POUND@0..1 "#"
      L_BRACK@1..2 "["
      META@2..25
        PATH@2..8
          PATH_SEGMENT@2..8
            NAME_REF@2..8
              IDENT@2..8 "derive"
        TOKEN_TREE@8..25
          L_PAREN@8..9 "("
          IDENT@9..18 "PartialEq"
          COMMA@18..19 ","
          WHITESPACE@19..20 " "
          IDENT@20..22 "Eq"
          COMMA@22..23 ","
          WHITESPACE@23..24 " "
          R_PAREN@24..25 ")"
      R_BRACK@25..26 "]"
    ,
    STRUCT@0..39
      ATTR@0..26
        POUND@0..1 "#"
        L_BRACK@1..2 "["
        META@2..25
          PATH@2..8
            PATH_SEGMENT@2..8
              NAME_REF@2..8
                IDENT@2..8 "derive"
          TOKEN_TREE@8..25
            L_PAREN@8..9 "("
            IDENT@9..18 "PartialEq"
            COMMA@18..19 ","
            WHITESPACE@19..20 " "
            IDENT@20..22 "Eq"
            COMMA@22..23 ","
            WHITESPACE@23..24 " "
            R_PAREN@24..25 ")"
        R_BRACK@25..26 "]"
      WHITESPACE@26..27 " "
      STRUCT_KW@27..33 "struct"
      WHITESPACE@33..34 " "
      NAME@34..38
        IDENT@34..38 "Test"
      SEMICOLON@38..39 ";"
...
```

2 years agoderive completions take existing derives into count
XFFXFF [Mon, 18 Apr 2022 13:34:36 +0000 (21:34 +0800)]
derive completions take existing derives into count

2 years agoAuto merge of #12023 - edwin0cheng:add-more-log, r=edwin0cheng
bors [Mon, 18 Apr 2022 07:13:30 +0000 (07:13 +0000)]
Auto merge of #12023 - edwin0cheng:add-more-log, r=edwin0cheng

internal: more visibility for switch workspaces and its states

2 years agoMore visibility for switch workspaces and its states
Edwin Cheng [Mon, 18 Apr 2022 06:26:00 +0000 (14:26 +0800)]
More visibility for switch workspaces and its states

2 years agointernal: Add a `NameContext` to `CompletionContext`, move out some ImmediateLocation...
Lukas Wirth [Sun, 17 Apr 2022 19:53:58 +0000 (21:53 +0200)]
internal: Add a `NameContext` to `CompletionContext`, move out some ImmediateLocation variants

2 years agoAuto merge of #12017 - lnicola:bump-deps, r=lnicola
bors [Sun, 17 Apr 2022 16:36:36 +0000 (16:36 +0000)]
Auto merge of #12017 - lnicola:bump-deps, r=lnicola

minor: Bump deps

2 years agoBump deps
Laurențiu Nicola [Sun, 17 Apr 2022 16:36:08 +0000 (19:36 +0300)]
Bump deps

2 years agoAuto merge of #12013 - XFFXFF:associated_const_equality, r=Veykril
bors [Sun, 17 Apr 2022 13:05:47 +0000 (13:05 +0000)]
Auto merge of #12013 - XFFXFF:associated_const_equality, r=Veykril

fix: support `associated_const_equality` in parser

This pr fixes #11965.  The parser now allows eq constraints on associated constants.

I've added tests for `HasCount<Count = {N}>` and `HasCount<Count = 0>`

2 years agoUpdate docs link
Arjo Chakravarty [Sun, 17 Apr 2022 12:32:06 +0000 (20:32 +0800)]
Update docs link

The current doc link was broken. replaced with the updated version as found on the front page.

2 years agoupdate parser to support associated const equality
XFFXFF [Sun, 17 Apr 2022 12:26:06 +0000 (20:26 +0800)]
update parser to support associated const equality

2 years agoAuto merge of #12014 - Veykril:expmacfmt, r=Veykril
bors [Sun, 17 Apr 2022 12:03:27 +0000 (12:03 +0000)]
Auto merge of #12014 - Veykril:expmacfmt, r=Veykril

feat: Attempt to format expand_macro output with rustfmt if possible

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

2 years agoDisable rustfmt for expand_macro on wasm platforms
Lukas Wirth [Sun, 17 Apr 2022 12:00:19 +0000 (14:00 +0200)]
Disable rustfmt for expand_macro on wasm platforms

2 years agoFix macro patterns not getting formatted properly
Lukas Wirth [Sun, 17 Apr 2022 11:46:00 +0000 (13:46 +0200)]
Fix macro patterns not getting formatted properly

2 years agofeat: Attempt to format expand_macro output with rustfmt if possible
Lukas Wirth [Sun, 17 Apr 2022 11:33:39 +0000 (13:33 +0200)]
feat: Attempt to format expand_macro output with rustfmt if possible

2 years agoupdate grammer to support associated const equality
XFFXFF [Sun, 17 Apr 2022 04:03:52 +0000 (12:03 +0800)]
update grammer to support associated const equality

2 years agoAuto merge of #12011 - iDawer:completion_detail.impl_trait, r=Veykril
bors [Sat, 16 Apr 2022 21:13:07 +0000 (21:13 +0000)]
Auto merge of #12011 - iDawer:completion_detail.impl_trait, r=Veykril

fix: Show `impl Trait` in argument positon in completion details

Follow up for #11991

`hir`: Use `db.callable_item_signature` query more.

2 years agoShow `impl Trait` in argument positon in completion details
iDawer [Sat, 16 Apr 2022 14:18:42 +0000 (19:18 +0500)]
Show `impl Trait` in argument positon in completion details

`hir`: Use `db.callable_item_signature` query more.

2 years agoAuto merge of #12009 - matklad:debug-reloads, r=matklad
bors [Sat, 16 Apr 2022 12:18:00 +0000 (12:18 +0000)]
Auto merge of #12009 - matklad:debug-reloads, r=matklad

internal: more visibility into why things happen

2 years agointernal: more visibility into why things happen
Aleksey Kladov [Sat, 16 Apr 2022 12:16:58 +0000 (13:16 +0100)]
internal: more visibility into why things happen

2 years agoAuto merge of #12008 - Veykril:patch-1, r=Veykril
bors [Sat, 16 Apr 2022 10:37:28 +0000 (10:37 +0000)]
Auto merge of #12008 - Veykril:patch-1, r=Veykril

fix: Fix proc-macro change check being inverted

2 years agofix: Fix proc-macro change check being inverted
Lukas Wirth [Sat, 16 Apr 2022 10:36:31 +0000 (12:36 +0200)]
fix: Fix proc-macro change check being inverted

2 years agoAuto merge of #11991 - iDawer:completion_detail.impl_trait, r=iDawer
bors [Sat, 16 Apr 2022 09:26:09 +0000 (09:26 +0000)]
Auto merge of #11991 - iDawer:completion_detail.impl_trait, r=iDawer

fix: completion detail shows `{unknown}` for async functions and for RPITs

Fix: completion detail shows `{unknown}` for `impl Trait` in return position.
Fix #11438 : completion detail shows `{unknown}` for return types in async functions.

#### API changes
Add `hir::Function::async_ret_type` method

2 years agominor: address nit
iDawer [Thu, 14 Apr 2022 16:16:25 +0000 (21:16 +0500)]
minor: address nit

2 years ago`extract_function`: use appropriate return type for async fns
iDawer [Thu, 14 Apr 2022 16:12:26 +0000 (21:12 +0500)]
`extract_function`: use appropriate return type for async fns

2 years agoAdd `hir::Function::async_ret_type` method
iDawer [Thu, 14 Apr 2022 12:44:17 +0000 (17:44 +0500)]
Add `hir::Function::async_ret_type` method

Adjust completion detail for `async fn` return types

2 years agofix: comletion detail shows `{unknown}` for `impl Trait` in return position
iDawer [Tue, 12 Apr 2022 15:40:31 +0000 (20:40 +0500)]
fix: comletion detail shows `{unknown}` for `impl Trait` in return position

2 years agoAuto merge of #12006 - lnicola:toggle-inlay-hints, r=lnicola
bors [Sat, 16 Apr 2022 05:10:17 +0000 (05:10 +0000)]
Auto merge of #12006 - lnicola:toggle-inlay-hints, r=lnicola

fix: Remove old inlay hints settings

Closes #11998