]> git.lizzy.rs Git - rust.git/log
rust.git
2 years agoSimplify
Lukas Wirth [Sun, 20 Mar 2022 18:13:50 +0000 (19:13 +0100)]
Simplify

2 years agofeat: Tag macro calls as unsafe if they expand to unsafe expressions
Lukas Wirth [Sun, 20 Mar 2022 18:07:44 +0000 (19:07 +0100)]
feat: Tag macro calls as unsafe if they expand to unsafe expressions

2 years agoUpdate inlay hint feature docs
Lukas Wirth [Sun, 20 Mar 2022 13:41:27 +0000 (14:41 +0100)]
Update inlay hint feature docs

2 years agofeat: Visualize compiler inserted reborrows via inlay hints
Lukas Wirth [Sun, 20 Mar 2022 13:38:16 +0000 (14:38 +0100)]
feat: Visualize compiler inserted reborrows via inlay hints

2 years agofix: Fix closure hints using macro ranges
Lukas Wirth [Sat, 19 Mar 2022 19:24:09 +0000 (20:24 +0100)]
fix: Fix closure hints using macro ranges

2 years agoChange skip trivial behaviour
Lukas Wirth [Sat, 19 Mar 2022 19:12:14 +0000 (20:12 +0100)]
Change skip trivial behaviour

2 years agoAdd option to skip trivial cases
Lukas Wirth [Sat, 19 Mar 2022 18:01:19 +0000 (19:01 +0100)]
Add option to skip trivial cases

2 years agoUse numbers for lifetimes by default, add setting to prefer using parameter names
Lukas Wirth [Sat, 19 Mar 2022 17:11:56 +0000 (18:11 +0100)]
Use numbers for lifetimes by default, add setting to prefer using parameter names

2 years agoFix test fixtures
Lukas Wirth [Fri, 18 Mar 2022 17:57:11 +0000 (18:57 +0100)]
Fix test fixtures

2 years agoGive the lifetimes better names
Lukas Wirth [Fri, 18 Mar 2022 17:55:03 +0000 (18:55 +0100)]
Give the lifetimes better names

2 years agofeat: Implement lifetime elision hints
Lukas Wirth [Fri, 18 Mar 2022 17:11:16 +0000 (18:11 +0100)]
feat: Implement lifetime elision hints

2 years agointernal: Allow explicitly specifying end of fixture annotation
Lukas Wirth [Fri, 18 Mar 2022 14:30:58 +0000 (15:30 +0100)]
internal: Allow explicitly specifying end of fixture annotation

2 years agofix: Fix runnables trying to add doc tests in the crate root from #[macro_export...
Lukas Wirth [Fri, 18 Mar 2022 10:55:53 +0000 (11:55 +0100)]
fix: Fix runnables trying to add doc tests in the crate root from #[macro_export] macros

2 years agofeat: Add return type hints for closures with block bodies
Lukas Wirth [Wed, 16 Mar 2022 20:16:55 +0000 (21:16 +0100)]
feat: Add return type hints for closures with block bodies

2 years agoRevert omitting field completions
Lukas Wirth [Wed, 16 Mar 2022 15:41:35 +0000 (16:41 +0100)]
Revert omitting field completions

2 years agoRemove code duplication
Lukas Wirth [Wed, 16 Mar 2022 15:32:36 +0000 (16:32 +0100)]
Remove code duplication

2 years agoSimplify completion render functionality
Lukas Wirth [Wed, 16 Mar 2022 15:27:55 +0000 (16:27 +0100)]
Simplify completion render functionality

2 years agoRename compound things to variant things
Lukas Wirth [Wed, 16 Mar 2022 12:41:35 +0000 (13:41 +0100)]
Rename compound things to variant things

2 years agominor: unblock metrics
Lukas Wirth [Wed, 16 Mar 2022 11:11:21 +0000 (12:11 +0100)]
minor: unblock metrics

2 years agoMerge #11720
bors[bot] [Wed, 16 Mar 2022 06:32:33 +0000 (06:32 +0000)]
Merge #11720

11720: fix: Mark chaining hints as types r=SomeoneToIgnore a=lnicola

CC https://github.com/rust-analyzer/rust-analyzer/pull/11445#discussion_r826863321

Co-authored-by: Laurențiu Nicola <lnicola@dend.ro>
2 years agoMark chaining hints as types, since that's what they are
Laurențiu Nicola [Wed, 16 Mar 2022 05:46:09 +0000 (07:46 +0200)]
Mark chaining hints as types, since that's what they are

2 years agoMerge #11718
bors[bot] [Tue, 15 Mar 2022 20:27:51 +0000 (20:27 +0000)]
Merge #11718

11718: Fix const generic panic r=lnicola a=HKalbasi

fix https://github.com/rust-analyzer/rust-analyzer/pull/11688#issuecomment-1066824954

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2 years agofix const generic panic
hkalbasi [Tue, 15 Mar 2022 19:04:05 +0000 (22:34 +0330)]
fix const generic panic

2 years agoMerge #11708
bors[bot] [Tue, 15 Mar 2022 18:05:27 +0000 (18:05 +0000)]
Merge #11708

11708: Update manual for inlay hint customization r=Veykril a=ian-h-chamberlain

Related to #6405, #6883 but not sure if they should be closed or not as this is just a documentation update.

This functionality was changed as of #11445 and now can be customized using native VSCode settings instead of `rust-analyzer`-specific ones.

Co-authored-by: Ian Chamberlain <ian-h-chamberlain@users.noreply.github.com>
2 years agoMerge #11714
bors[bot] [Tue, 15 Mar 2022 17:58:21 +0000 (17:58 +0000)]
Merge #11714

11714: fix: Fix completions not always working in for-loop patterns r=Veykril a=Veykril

Fixes https://github.com/rust-analyzer/rust-analyzer/issues/11205
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Fix completions not always working in for-loop patterns
Lukas Wirth [Tue, 15 Mar 2022 17:06:34 +0000 (18:06 +0100)]
fix: Fix completions not always working in for-loop patterns

2 years agoMerge #11710
bors[bot] [Tue, 15 Mar 2022 07:27:05 +0000 (07:27 +0000)]
Merge #11710

11710:  editors/code: fix crash due to missing ID= field r=lnicola a=cab404

Assuming ID=linux by default.
Also removed toLowerCase — it really shouldn't be needed.
Fixes #11709

Co-authored-by: Vladimir Serov <me@cab404.ru>
2 years agoeditors/code: fix crash due to missing ID= field
Vladimir Serov [Tue, 15 Mar 2022 03:52:03 +0000 (06:52 +0300)]
editors/code: fix crash due to missing ID= field

Assuming ID=linux in isNixOs by default. You can get away with
default "", but why do that if there's a default value in spec?)

Also removed toLowerCase — it really shouldn't be needed.
Fixes #11709

2 years agoUpdate manual for inlay hint customization
Ian Chamberlain [Mon, 14 Mar 2022 21:21:36 +0000 (17:21 -0400)]
Update manual for inlay hint customization

Closes #6883

This functionality was changed as of #11445 and now can be customized using native VSCode settings instead of `rust-analyzer`-specific ones.

2 years agoMerge #11707
bors[bot] [Mon, 14 Mar 2022 20:05:46 +0000 (20:05 +0000)]
Merge #11707

11707: minor: Simplify r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Mon, 14 Mar 2022 19:36:35 +0000 (20:36 +0100)]
Simplify

2 years agoMerge #11700
bors[bot] [Mon, 14 Mar 2022 15:02:34 +0000 (15:02 +0000)]
Merge #11700

11700: :arrow_up: xshell r=matklad a=matklad

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
2 years ago:arrow_up: xshell
Aleksey Kladov [Sun, 13 Mar 2022 21:20:51 +0000 (21:20 +0000)]
:arrow_up: xshell

2 years agoMerge #11688
bors[bot] [Mon, 14 Mar 2022 11:15:00 +0000 (11:15 +0000)]
Merge #11688

11688: Add const generics r=HKalbasi a=HKalbasi

#7434 is not in this PR, so there is no evaluation of constants and no default const argument. But the rest (type inference and method resolution with chalk) should work.

Chalk is pedantic about kind of generic arguments, and will panic in case of mixing type and const arguments. I tried to add test that, but I'm not sure if it covers all cases.

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2 years agoAdd const generics
hkalbasi [Wed, 9 Mar 2022 18:50:24 +0000 (22:20 +0330)]
Add const generics

2 years agoMerge #11696
bors[bot] [Sun, 13 Mar 2022 09:25:55 +0000 (09:25 +0000)]
Merge #11696

11696: editors/code: fix nixos detection r=lnicola a=cab404

Problem: NixOS started using quotes around it's id field in /etc/os-release
Solution: Parially parsing os-release, and detecting, whether `nixos` appears anywhere in "ID=" field\
See https://github.com/rust-analyzer/rust-analyzer/issues/11695

Closes #11695

Co-authored-by: Vladimir Serov <me@cab404.ru>
2 years agoeditors/code: fix nixos detection
Vladimir Serov [Sat, 12 Mar 2022 21:26:36 +0000 (00:26 +0300)]
editors/code: fix nixos detection

Problem: NixOS started using quotes around it's id field in /etc/os-release
Solution: Parially parsing os-release, and detecting, whether `nixos` appears anywhere in "ID=" field\
See https://github.com/rust-analyzer/rust-analyzer/issues/11695
Closes #11695

2 years agoMerge #11692
bors[bot] [Sat, 12 Mar 2022 15:53:05 +0000 (15:53 +0000)]
Merge #11692

11692: round of clippy fixes. r=Veykril a=matthiaskrgr

Split these up into smaller chunks so I can easily revert parts of it if needed.

Co-authored-by: Matthias Krüger <matthias.krueger@famsik.de>
2 years agofix clippy::needless_late_init
Matthias Krüger [Sat, 12 Mar 2022 15:17:53 +0000 (16:17 +0100)]
fix clippy::needless_late_init

2 years agomore clippy fixes:
Matthias Krüger [Sat, 12 Mar 2022 14:57:57 +0000 (15:57 +0100)]
more clippy fixes:

clippy::search_is_some
clippy::redundant_static_lifetimes
clippy::match_single_binding
clippy::match_ref_pats
clippy::map_entry
clippy::manual_map
clippy::iter_overeager_cloned
clippy::into_iter_on_ref
clippy::extra_unused_lifetimes

2 years agomore clippy fixes:
Matthias Krüger [Sat, 12 Mar 2022 14:30:07 +0000 (15:30 +0100)]
more clippy fixes:

clippy::match_like_matches_macro
clippy::to_string_in_format_args
clippy::single_char_add_str
clippy::filter_map_identity
clippy::clone_on_copy
clippy::useless_format
clippy::unused_unit

2 years agofix clippy::needless_return
Matthias Krüger [Sat, 12 Mar 2022 13:56:26 +0000 (14:56 +0100)]
fix clippy::needless_return

2 years agofix clippy::redundant_clone
Matthias Krüger [Sat, 12 Mar 2022 13:35:25 +0000 (14:35 +0100)]
fix clippy::redundant_clone

2 years agofix clippy::map_flatten
Matthias Krüger [Sat, 12 Mar 2022 13:26:16 +0000 (14:26 +0100)]
fix clippy::map_flatten

2 years agofix clippy::useless_conversion
Matthias Krüger [Sat, 12 Mar 2022 12:43:53 +0000 (13:43 +0100)]
fix clippy::useless_conversion

2 years agofix clippy::redundant_closure
Matthias Krüger [Sat, 12 Mar 2022 12:35:31 +0000 (13:35 +0100)]
fix clippy::redundant_closure

2 years agofix clippy::single_char_pattern
Matthias Krüger [Sat, 12 Mar 2022 12:22:12 +0000 (13:22 +0100)]
fix clippy::single_char_pattern

2 years agofix clippy::needless_borrow
Matthias Krüger [Sat, 12 Mar 2022 12:04:13 +0000 (13:04 +0100)]
fix clippy::needless_borrow

2 years agoMerge #11691
bors[bot] [Sat, 12 Mar 2022 15:44:51 +0000 (15:44 +0000)]
Merge #11691

11691: feat: Suggest union literals, suggest union fields within an empty union literal r=Veykril a=m0rg-dev

Adds a `Union {…}` completion in contexts where a union is expected, expanding to a choice of available fields (if snippets are supported):

![image](https://user-images.githubusercontent.com/38578268/158023335-84c03e39-daf0-4a52-b969-f40b01501cc8.png)
![image](https://user-images.githubusercontent.com/38578268/158023354-db49d0bb-034c-49d3-bc02-07414179cb61.png)

Also, adds support for listing possible fields in an empty union literal.

![image](https://user-images.githubusercontent.com/38578268/158023398-4695ae34-ce64-4f40-8494-68731a3030c6.png)
![image](https://user-images.githubusercontent.com/38578268/158023406-be96dd95-125a-47ac-9628-0bce634ca2eb.png)

Closes #11568.

Co-authored-by: Morgan Thomas <corp@m0rg.dev>
2 years ago- clean up match in ide_completion::completions::record::complete_record_literal
Morgan Thomas [Sat, 12 Mar 2022 15:35:13 +0000 (07:35 -0800)]
- clean up match in ide_completion::completions::record::complete_record_literal
- use original instead of adjusted type in ide_completion::completions::record::complete_record
- don't even bother checking if we can complete union literals to Default or to struct update syntax

2 years agoMerge #11693
bors[bot] [Sat, 12 Mar 2022 15:28:33 +0000 (15:28 +0000)]
Merge #11693

11693: internal: Remove ide_completion::render::build_ext module r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agointernal: Remove ide_completion::render::build_ext module
Lukas Wirth [Sat, 12 Mar 2022 15:10:30 +0000 (16:10 +0100)]
internal: Remove ide_completion::render::build_ext module

2 years agoSuggest union literals, suggest union fields within an empty union literal
Morgan Thomas [Sat, 12 Mar 2022 14:58:43 +0000 (06:58 -0800)]
Suggest union literals, suggest union fields within an empty union literal

2 years agoMerge #11687 #11689
bors[bot] [Sat, 12 Mar 2022 13:14:31 +0000 (13:14 +0000)]
Merge #11687 #11689

11687: Highlight escape sequences in byte strings r=Veykril a=yipinliu

#11605

11689: minor: Pad type inlay hints if no colons are requested r=Veykril a=Veykril

bors r+

Co-authored-by: yipinliu <ypliu18@gmail.com>
Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agominor: Pad type inlay hints if no colons are requested
Lukas Wirth [Sat, 12 Mar 2022 13:08:39 +0000 (14:08 +0100)]
minor: Pad type inlay hints if no colons are requested

2 years agoOptimize imports
yipinliu [Sat, 12 Mar 2022 13:06:33 +0000 (21:06 +0800)]
Optimize imports

2 years agoMerge #11686
bors[bot] [Sat, 12 Mar 2022 13:05:45 +0000 (13:05 +0000)]
Merge #11686

11686: feat: Enum variant field completion, enum variant / struct consistency r=Veykril a=m0rg-dev

This addresses several related inconsistencies:
 - tuple structs use tab stops instead of placeholders
 - tuple structs display in the completion menu as `Struct {…}` instead of `Struct(…)`
 - enum variants don't receive field completions at all
 - enum variants display differently from structs in the completion menu

Also, structs now display their type in the completion detail rather than the raw snippet text to be inserted.

As far as what's user-visible, that looks like this:

| | Menu | Completion | Detail |
|-|-|-|-|
| Record struct (old) | `Struct {…}` | `Struct { x: ${1:()}, y: ${2:()} }$0` | `Struct { x: ${1:()}, y: ${2:()} }$0` |
| Record struct (new) | `Struct {…}` | `Struct { x: ${1:()}, y: ${2:()} }$0` | `Struct { x: i32, y: i32 }` |
| Tuple struct (old) | `Struct {…}`  | `Struct($1, $2)$0` | `Struct($1, $2)` |
| Tuple struct (new) | `Struct(…)` | `Struct(${1:()}, ${2:()})$0` | `Struct(i32, i32)` |
| Unit variant (old) | `Variant` | `Variant` | `()` |
| Unit variant (new) | `Variant` | `Variant$0` | `Variant` |
| Record variant (old) | `Variant` | `Variant` | `{x: i32, y: i32}` |
| Record variant (new) | `Variant {…}` | `Variant { x: ${1:()}, y: ${2:()} }$0` | `Variant { x: i32, y: i32 }` |
| Tuple variant (old) | `Variant(…)` | `Variant($0)` | `(i32, i32)` |
| Tuple variant (new) | `Variant(…)` | `Variant(${1:()}, ${2:()})$0` | `Variant(i32, i32)` |

Additionally, tuple variants no longer set `triggers_call_info` because it conflicts with placeholder generation, and tuple variants that require a qualified path should now use the qualified path.

Internally, this also lets us break the general "format an item with fields on it" code out into a shared module, so that means it'll be a lot easier to implement features like #11568.

Co-authored-by: Morgan Thomas <corp@m0rg.dev>
2 years agoReduce intermediate string allocations in render::compound::render_record and ::rende...
Morgan Thomas [Sat, 12 Mar 2022 13:01:25 +0000 (05:01 -0800)]
Reduce intermediate string allocations in render::compound::render_record and ::render_tuple

2 years agoExtract the code for formatting struct and enum-variant literal labels out into a...
Morgan Thomas [Sat, 12 Mar 2022 12:40:05 +0000 (04:40 -0800)]
Extract the code for formatting struct and enum-variant literal labels out into a common function

2 years agoFixed code style issues
yipinliu [Sat, 12 Mar 2022 12:36:56 +0000 (20:36 +0800)]
Fixed code style issues

2 years agoFixed tidy test
yipinliu [Sat, 12 Mar 2022 12:04:14 +0000 (20:04 +0800)]
Fixed tidy test

2 years agoHighlight escape sequences in byte strings
yipinliu [Sat, 12 Mar 2022 11:00:17 +0000 (19:00 +0800)]
Highlight escape sequences in byte strings

2 years agomake the doc comment on render::compound::visible_fields a little better
Morgan Thomas [Sat, 12 Mar 2022 03:23:04 +0000 (19:23 -0800)]
make the doc comment on render::compound::visible_fields a little better

2 years agovisibility tweak for CI
Morgan Thomas [Sat, 12 Mar 2022 03:10:43 +0000 (19:10 -0800)]
visibility tweak for CI

2 years agoComplete enum variants identically to structures.
Morgan Thomas [Sat, 12 Mar 2022 02:26:01 +0000 (18:26 -0800)]
Complete enum variants identically to structures.

In particular:
 - unit variants now display in the menu as "Variant", complete to "Variant", and display a detail of "Variant" (was "()")
 - tuple variants now display in the menu as "Variant(…)", complete to "Variant(${1:()})$0" (was "Variant($0)"), and display a detail of "Variant(type)" (was "(type)")
 - record variants now display in the menu as "Variant {…}", complete to "Variant { x: ${1:()} }$0" (was "Variant"), and display a detail of "Variant { x: type }" (was "{x: type}")

This behavior is identical to that of struct completions. In addition, tuple variants no longer set triggers_call_info, as to my understanding it's unnecessary now that we're emitting placeholders.

Tests have been updated to match, and the render::enum_variant::tests::inserts_parens_for_tuple_enums test has been removed entirely as it's covered by other tests (render::enum_detail_includes_{record, tuple}_fields, render::enum_detail_just_name_for_unit, render::pattern::enum_qualified).

2 years ago- Break out functionality related to rendering struct completions into `crates/ide_co...
Morgan Thomas [Sat, 12 Mar 2022 01:17:01 +0000 (17:17 -0800)]
- Break out functionality related to rendering struct completions into `crates/ide_completion/src/render/compound.rs`
- Add support for placeholder completions in tuple structs
- Denote tuple struct completions with `(…)` instead of ` {…}`
- Show struct completions as their type (`Struct { field: Type }`) in the completion menu instead of raw snippet text (`Struct { field: ${1:()} }$0`)

2 years agoMerge #11685
bors[bot] [Sat, 12 Mar 2022 01:15:21 +0000 (01:15 +0000)]
Merge #11685

11685: internal: Simplify CompletionContext r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoRemove no_completions_required from CompletionContext
Lukas Wirth [Sat, 12 Mar 2022 00:59:01 +0000 (01:59 +0100)]
Remove no_completions_required from CompletionContext

2 years agoMerge #11684
bors[bot] [Sat, 12 Mar 2022 00:44:39 +0000 (00:44 +0000)]
Merge #11684

11684: fix: Allow configuration of colons in inlay-hints r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agominor: add missing definitions of lsp_ext::InlayHintLabel
Lukas Wirth [Fri, 11 Mar 2022 21:36:58 +0000 (22:36 +0100)]
minor: add missing definitions of lsp_ext::InlayHintLabel

2 years agoMerge #11683
bors[bot] [Fri, 11 Mar 2022 23:31:24 +0000 (23:31 +0000)]
Merge #11683

11683: fix: Stop wrapping ConstParam's default values in ConstArg r=Veykril a=steven-joruk

I came across this problem while implementing the assist for inlining type aliases. This was causing `ConstParam::default_val` to always return `None` for block expressions. The `const_arg_path` test was actually testing const params so I've updated that.

The only code that uses `default_val` right now is  the `extract_function` assist. I couldn't figure out how to hit the affected code path, if someone can give me hint I'll add a test.

This test in my WIP branch fails without this:
```rust
    #[test]
    fn param_expression() {
        check_assist(
            inline_type_alias,
            r#"
type A<const N: usize = { 1 }> = [u32; N];
fn main() {
    let a: $0A;
}
"#,
            r#"
type A<const N: usize = { 1 }> = [u32; N];
fn main() {
    let a: [u32; { 1 }];
}
"#,
        );
    }
```

Co-authored-by: Steven Joruk <steven@joruk.com>
2 years agorefactor: Rename and move const_arg_path
Steven Joruk [Fri, 11 Mar 2022 21:44:18 +0000 (21:44 +0000)]
refactor: Rename and move const_arg_path

It wasn't testing the `const_arg` code path, it was actually hitting
const_param's default value code path, so move it to the right place
and rename it.

2 years agorefactor: Rename const_arg_content to const_arg_expr
Steven Joruk [Fri, 11 Mar 2022 20:38:03 +0000 (20:38 +0000)]
refactor: Rename const_arg_content to const_arg_expr

2 years agofix: Allow configuration of colons in inlay-hints
Lukas Wirth [Fri, 11 Mar 2022 20:06:26 +0000 (21:06 +0100)]
fix: Allow configuration of colons in inlay-hints

2 years agofix: Stop wrapping ConstParam's default values in ConstArg
Steven Joruk [Fri, 11 Mar 2022 19:22:49 +0000 (19:22 +0000)]
fix: Stop wrapping ConstParam's default values in ConstArg

This was causing ConstParam::default_val to always return None for block
expressions.

CONST_ARG@24..29
  BLOCK_EXPR@24..29
    ...

2 years agoMerge #11680
bors[bot] [Fri, 11 Mar 2022 16:17:59 +0000 (16:17 +0000)]
Merge #11680

11680: fix: Show what file paths were expected for unresolved modules r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agofix: Show what file paths were expected for unresolved modules
Lukas Wirth [Fri, 11 Mar 2022 15:49:41 +0000 (16:49 +0100)]
fix: Show what file paths were expected for unresolved modules

2 years agoMerge #11676
bors[bot] [Thu, 10 Mar 2022 21:24:11 +0000 (21:24 +0000)]
Merge #11676

11676: internal: Expand into pseudo-derive attribute expansions in completions r=Veykril a=Veykril

With this we now properly handle qualified path completions in derives
bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoDon't parse source files to generate macro completion details
Lukas Wirth [Thu, 10 Mar 2022 21:21:58 +0000 (22:21 +0100)]
Don't parse source files to generate macro completion details

2 years agoEnable qualifier completions for derives
Lukas Wirth [Thu, 10 Mar 2022 20:56:19 +0000 (21:56 +0100)]
Enable qualifier completions for derives

2 years agoDon't offer qualified path completions for buitlin derives
Lukas Wirth [Thu, 10 Mar 2022 20:22:13 +0000 (21:22 +0100)]
Don't offer qualified path completions for buitlin derives

2 years agoExpand into pseudo-derive attribute expansions in completions
Lukas Wirth [Thu, 10 Mar 2022 19:53:50 +0000 (20:53 +0100)]
Expand into pseudo-derive attribute expansions in completions

2 years agoMerge #11672
bors[bot] [Thu, 10 Mar 2022 17:24:36 +0000 (17:24 +0000)]
Merge #11672

11672: Add support for new `where` clause location in associated types. r=Veykril a=Dirbaio

A recent Rust nightly changed it: https://github.com/rust-lang/rust/issues/89122

This allows both the old and new location.

Fixes #11651

Co-authored-by: Dario Nieuwenhuis <dirbaio@dirbaio.net>
2 years agoAdd support for new `where` clause location in associated types.
Dario Nieuwenhuis [Thu, 10 Mar 2022 17:10:03 +0000 (18:10 +0100)]
Add support for new `where` clause location in associated types.

A recent Rust nightly changed it: https://github.com/rust-lang/rust/issues/89122

This allows both the old and new location.

2 years agoMerge #11671
bors[bot] [Thu, 10 Mar 2022 16:15:12 +0000 (16:15 +0000)]
Merge #11671

11671: minor: Access parser internals through ide_db for ide crates r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agominor: Access parser internals through ide_db for ide crates
Lukas Wirth [Thu, 10 Mar 2022 16:07:11 +0000 (17:07 +0100)]
minor: Access parser internals through ide_db for ide crates

2 years agoMerge #11662
bors[bot] [Thu, 10 Mar 2022 15:49:03 +0000 (15:49 +0000)]
Merge #11662

11662: fix: extract_module selection inside impl r=Veykril a=feniljain

Should close: #11508

From issue:
Concern 1: Seems to be fixed in latest `rust-analyzer` build
Concern 2 and 3: Should be fixed by this PR
Concern 4: Got fixed in #11472

Points to note:

- Here I have seperated use items and other items, this is becuase the new `impl` block which we will be creating cannot contain use items as immediate children. As they are the only one item that can be generated by our assist, so seperating them helps in handling their inclusion in new `impl` block inside new `module`

- There's also a new method added which helps in removing remaning left over indentation after removing `impl` or other `item`

Co-authored-by: vi_mi <fkjainco@gmail.com>
2 years agoMerge #11664
bors[bot] [Wed, 9 Mar 2022 21:45:42 +0000 (21:45 +0000)]
Merge #11664

11664: fix: Properly handle proc-macro crate types for nameres r=Veykril a=Veykril

bors r+

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoUpdate project_model test outputs
Lukas Wirth [Wed, 9 Mar 2022 21:34:42 +0000 (22:34 +0100)]
Update project_model test outputs

2 years agoSpecific proc-macro crate type for other test fixture where needed
Lukas Wirth [Wed, 9 Mar 2022 21:18:09 +0000 (22:18 +0100)]
Specific proc-macro crate type for other test fixture where needed

2 years agoMerge #11660
bors[bot] [Wed, 9 Mar 2022 17:18:03 +0000 (17:18 +0000)]
Merge #11660

11660: Insert dummy values for const generics in subst r=flodiebold a=HKalbasi

fix #11659

This is a band-aid until proper const generic support.

Co-authored-by: hkalbasi <hamidrezakalbasi@protonmail.com>
2 years agoSpecify proc-macro crate type for proc-macro hir_def test fixtures
Lukas Wirth [Wed, 9 Mar 2022 14:36:05 +0000 (15:36 +0100)]
Specify proc-macro crate type for proc-macro hir_def test fixtures

2 years agofix: Properly handle proc-macro crate types for nameres
Lukas Wirth [Wed, 9 Mar 2022 13:33:39 +0000 (14:33 +0100)]
fix: Properly handle proc-macro crate types for nameres

2 years agoMerge #11663
bors[bot] [Wed, 9 Mar 2022 10:26:34 +0000 (10:26 +0000)]
Merge #11663

11663: Internal: Add hir_def::MacroId, add Macro{Id} to ModuleDef{Id} r=Veykril a=Veykril

With this we can now handle macros like we handle ModuleDefs making them work more like other definitions and allowing us to remove a bunch of special cases. This also enables us to track the modules these macros are defined in, instead of only recording the crate they come from.

Introduces a new class of `MacroId`s (for each of the 3 macro kinds) into `hir_def`. We can't reuse `MacroDefId` as that is defined in `hir_expand` which doesn't know of modules, so now we have two different macro ids, this unfortunately requires some back and forth mapping between the two via database accesses which I hope won't be too expensive.

Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2 years agoSimplify
Lukas Wirth [Wed, 9 Mar 2022 10:26:06 +0000 (11:26 +0100)]
Simplify

2 years agoDisable one of the failing SSR test cases
Lukas Wirth [Wed, 9 Mar 2022 01:08:44 +0000 (02:08 +0100)]
Disable one of the failing SSR test cases

2 years agofix symbol index collection not collecting legacy macros
Lukas Wirth [Wed, 9 Mar 2022 00:44:20 +0000 (01:44 +0100)]
fix symbol index collection not collecting legacy macros

2 years agoFix ProcMacroData recording wrong name for derives
Lukas Wirth [Wed, 9 Mar 2022 00:13:38 +0000 (01:13 +0100)]
Fix ProcMacroData recording wrong name for derives

2 years agoAdd data queries for macros
Lukas Wirth [Tue, 8 Mar 2022 23:41:54 +0000 (00:41 +0100)]
Add data queries for macros

2 years agoRemove unnecessary macro_declarations from ItemScope
Lukas Wirth [Tue, 8 Mar 2022 23:19:53 +0000 (00:19 +0100)]
Remove unnecessary macro_declarations from ItemScope