about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorLines
2022-03-12more clippy fixes:Matthias Krüger-24/+15
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
2022-03-12more clippy fixes:Matthias Krüger-25/+18
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
2022-03-12fix clippy::needless_returnMatthias Krüger-17/+14
2022-03-12fix clippy::redundant_cloneMatthias Krüger-10/+6
2022-03-12fix clippy::map_flattenMatthias Krüger-8/+6
2022-03-12fix clippy::useless_conversionMatthias Krüger-29/+25
2022-03-12fix clippy::redundant_closureMatthias Krüger-25/+17
2022-03-12fix clippy::single_char_patternMatthias Krüger-22/+22
2022-03-12fix clippy::needless_borrowMatthias Krüger-77/+74
2022-03-12Merge #11691bors[bot]-28/+179
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>
2022-03-12- clean up match in ide_completion::completions::record::complete_record_literalMorgan Thomas-55/+50
- 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
2022-03-12Merge #11693bors[bot]-170/+166
11693: internal: Remove ide_completion::render::build_ext module r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-12internal: Remove ide_completion::render::build_ext moduleLukas Wirth-170/+166
2022-03-12Suggest union literals, suggest union fields within an empty union literalMorgan Thomas-10/+166
2022-03-12feat: Add an assist for inlining type aliasesSteven Joruk-0/+746
This intends to lead to a more useful assist to replace all users of an alias with its definition.
2022-03-12chore: fill_match_arms was renamed - update its usage in a commentSteven Joruk-1/+1
2022-03-12Merge #11687 #11689bors[bot]-28/+54
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>
2022-03-12minor: Pad type inlay hints if no colons are requestedLukas Wirth-1/+2
2022-03-12Optimize importsyipinliu-7/+3
2022-03-12Merge #11686bors[bot]-160/+186
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>
2022-03-12Reduce intermediate string allocations in render::compound::render_record ↵Morgan Thomas-32/+24
and ::render_tuple
2022-03-12Extract the code for formatting struct and enum-variant literal labels out ↵Morgan Thomas-12/+17
into a common function
2022-03-12Fixed code style issuesyipinliu-71/+21
2022-03-12Fixed tidy testyipinliu-1/+1
2022-03-12Highlight escape sequences in byte stringsyipinliu-18/+97
2022-03-11make the doc comment on render::compound::visible_fields a little betterMorgan Thomas-2/+2
2022-03-11visibility tweak for CIMorgan Thomas-2/+2
2022-03-11Complete enum variants identically to structures.Morgan Thomas-90/+69
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).
2022-03-11- Break out functionality related to rendering struct completions into ↵Morgan Thomas-70/+120
`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`)
2022-03-12Merge #11685bors[bot]-94/+52
11685: internal: Simplify CompletionContext r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-12Remove no_completions_required from CompletionContextLukas Wirth-94/+52
2022-03-12Merge #11684bors[bot]-14/+62
11684: fix: Allow configuration of colons in inlay-hints r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
2022-03-12minor: add missing definitions of lsp_ext::InlayHintLabelLukas Wirth-4/+22
2022-03-11Merge #11683bors[bot]-29/+69
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>
2022-03-11refactor: Rename and move const_arg_pathSteven Joruk-33/+41
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.
2022-03-11refactor: Rename const_arg_content to const_arg_exprSteven Joruk-3/+3
2022-03-11fix: Allow configuration of colons in inlay-hintsLukas Wirth-10/+40
2022-03-11fix: Stop wrapping ConstParam's default values in ConstArgSteven Joruk-50/+82
This was causing ConstParam::default_val to always return None for block expressions. CONST_ARG@24..29 BLOCK_EXPR@24..29 ...
2022-03-11Merge #11680bors[bot]-59/+133
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>
2022-03-11fix: Show what file paths were expected for unresolved modulesLukas Wirth-59/+133
2022-03-10Merge #11676bors[bot]-384/+478
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>
2022-03-10Don't parse source files to generate macro completion detailsLukas Wirth-204/+157
2022-03-10Enable qualifier completions for derivesLukas Wirth-83/+123
2022-03-10Don't offer qualified path completions for buitlin derivesLukas Wirth-82/+42
2022-03-10Expand into pseudo-derive attribute expansions in completionsLukas Wirth-56/+197
2022-03-10Merge #11672bors[bot]-8/+47
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>
2022-03-10Add support for new `where` clause location in associated types.Dario Nieuwenhuis-8/+47
A recent Rust nightly changed it: https://github.com/rust-lang/rust/issues/89122 This allows both the old and new location.
2022-03-10Merge #11671bors[bot]-5/+6
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>
2022-03-10minor: Access parser internals through ide_db for ide cratesLukas Wirth-5/+6
2022-03-10Merge #11662bors[bot]-14/+167
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>