Giga Bowser
c552f72f6a
minor: Use placeholders in unwrap_return_type
2025-01-08 18:12:06 -06:00
Giga Bowser
a5a79f5957
internal: Migrate unwrap_return_type
assist to use SyntaxEditor
...
Also changes `make::expr_empty_block()` to return `ast::BlockExpr` instead of `ast::Expr`
2025-01-08 18:12:06 -06:00
Giga Bowser
651b43e551
internal: Migrate wrap_return_type
assist to use SyntaxEditor
2025-01-08 15:19:10 -06:00
Giga Bowser
54d9b5a31a
internal: Migrate if let
<=> match
assists to SyntaxEditor
2025-01-06 15:58:39 -06:00
Giga Bowser
eb2ce57a3e
internal: Migrate replace_let_with_if_let
assist to SyntaxEditor
2025-01-06 15:58:39 -06:00
Giga Bowser
551f1d00dd
internal: make::expr_match
should return ast::MatchExpr
2025-01-06 15:58:39 -06:00
Giga Bowser
32ff06d51c
internal: Generally improve make::match_arm
...
`make::match_arm` should take a single `ast::Pat`, and callers can handle creating an `ast::OrPat` if need be. It should also take a proper `ast::MatchGuard`, instead of making one itself.
2025-01-06 15:58:39 -06:00
Giga Bowser
905e1e1fc0
internal: move make::expr_unit
to make::ext::expr_unit
...
`expr_unit` is just a shortcut for a common expression, so it belongs in `make::ext`
2025-01-06 15:58:39 -06:00
Giga Bowser
f388482119
internal: make::expr_tuple
should return ast::TupleExpr
2025-01-06 15:32:08 -06:00
Giga Bowser
c549be9ab6
internal: make::expr_if
should return ast::IfExpr
2025-01-06 15:32:08 -06:00
Giga Bowser
913d197a04
internal: make::expr_prefix
should return ast::PrefixExpr
2025-01-06 15:32:08 -06:00
Lukas Wirth
4b6007115a
minor: New clippy lints
2025-01-06 17:57:17 +01:00
Chayim Refael Friedman
ce323627c5
Support the new CoercePointee
derive
2025-01-04 18:35:53 +02:00
yanglsh
60c3fb12d3
Fix replace-if-let-with-match generates non-exhausive match
2024-12-31 07:40:45 -07:00
yanglsh
fc847323f9
Add test cases for #10583
2024-12-30 12:07:35 -07:00
Lukas Wirth
2e13684be1
Merge pull request #18790 from ChayimFriedman2/proper-make
...
internal: Create a quoting mechanism instead of textual AST make
2024-12-30 11:39:29 +00:00
Lukas Wirth
bd083d0cd9
Merge pull request #18794 from 1hakusai1/fix_fill_match_arm_in_tokio_main
...
Fix bug of "fill match arm" action in tokio::main macro
2024-12-30 11:30:32 +00:00
1hakusai1
9451d64315
Fix bug of "fill match arm" action in tokio::main macro
...
https://github.com/rust-lang/rust-analyzer/issues/18027
2024-12-30 20:06:17 +09:00
roife
f8c04166dc
fix: avoid generating colliding names in extract_variable
2024-12-30 15:30:05 +08:00
Chayim Refael Friedman
791a63255b
Move some more AST makers to the quote macro
...
And implement addons as necessary.
There are many more makers to be moved, and I'm not completely satisfied with this (due to the ease of making a mistake in the AST structure, and slightly less but also because of the need to remember whitespaces), but this is already enough to see how this will look like.
2024-12-30 05:46:06 +02:00
Lukas Wirth
e30ce42671
Merge pull request #18707 from ChayimFriedman2/subst
...
feat: Show substitution where hovering over generic things
2024-12-24 14:16:16 +00:00
Chayim Refael Friedman
b5486ffc42
Show substitution where hovering over generic things
...
There are few things to note in the implementation:
First, this is a best-effort implementation. Mainly, type aliases may not be shown (due to their eager nature it's harder) and partial pathes (aka. hovering over `Struct` in `Struct::method`) are not supported at all.
Second, we only need to show substitutions in expression and pattern position, because in type position all generic arguments always have to be written explicitly.
2024-12-20 11:30:19 +02:00
Lukas Wirth
0be03285f9
fix: Reduce applicability of unnecessary_async assist
2024-12-20 08:41:46 +01:00
Lukas Wirth
ada5f2059c
fix: Fix path qualified auto-importing completions not working with re-exports
...
Prior to this commit we used to generate import paths, then zipped them with the existing qualifier to check if they agree on the path to import.
This is brittle when re-exports come into play causing items to have multiple applicable paths that refer to them.
This commit instead rewrites this logic by generating the import path for the qualifier, verifying that the rest of the qualifier resolves and then doing a final lookup on that resolution result for the final segment instead.
2024-12-16 13:20:55 +01:00
Lukas Wirth
61c222e1af
Merge pull request #18690 from Giga-Bowser/extract-variable-string
...
feat: Use string literal contents as a name when extracting into variable
2024-12-16 10:29:05 +00:00
Lukas Wirth
0189a8937b
Merge pull request #18695 from roife/improve-tuple-destruction
...
minor: improve name suggestion for destructure_tuple_binding
2024-12-16 10:25:01 +00:00
roife
ad63e6957f
refactor: simplify edit_tuple_usages
in destructure_tuple_binding
2024-12-16 14:12:19 +08:00
Lukas Wirth
15239f612d
internal: Show mir eval errors on hover with debug env var set
2024-12-15 17:38:37 +01:00
Giga Bowser
620af0ef2f
feat: Use string literal contents as a name when extracting into variable
2024-12-14 13:36:57 -05:00
roife
cb1533f7e9
feat: improve name generation in destructure_tuple_binding
2024-12-13 23:34:03 +08:00
Laurențiu Nicola
dc978a976f
Bump typos
2024-12-13 11:45:44 +02:00
Lukas Wirth
a6c291ed07
Merge pull request #18652 from Giga-Bowser/extract-constant
...
feat: Add an assist to extract an expression into a constant
2024-12-12 13:22:05 +00:00
1hakusai1
fc2b70132f
Generate implementation with items even if snippet text edit is disabled
2024-12-12 18:55:14 +09:00
Giga Bowser
21782b9a8d
minor: Group extract_function
with other extraction assists
2024-12-11 14:11:20 -05:00
Giga Bowser
0cad614b3b
feat: Add an assist to extract an expression into a static
2024-12-11 14:04:54 -05:00
Giga Bowser
1979d3f9b5
feat: Add an assist to extract an expression into a constant
2024-12-11 09:52:03 -05:00
Giga Bowser
17e482b1a9
internal: Move is_body_const
to ide_assists::utils
2024-12-11 09:52:03 -05:00
Lukas Wirth
002fcea441
Merge pull request #18657 from Giga-Bowser/generate-enum-variant
...
minor: Migrate `generate_enum_variant` to `SyntaxEditor`
2024-12-11 07:07:22 +00:00
roife
78fb0e47ca
feat: preserve order of parameters in extract_functions
2024-12-11 02:26:58 +08:00
Giga Bowser
547f75a2ce
minor: Migrate generate_enum_variant
to SyntaxEditor
2024-12-10 13:11:33 -05:00
Giga Bowser
c70bf568bb
minor: Add item_enum
constructor to SyntaxFactory
...
I recursively added all constructors it depends on. I also changed the old `make::` constructors to support more of the grammar.
2024-12-10 11:12:44 -05:00
Lukas Wirth
956ff4d8c5
Rename test fixture crates to ra_test_fixture
2024-12-09 11:40:21 +01:00
Giga Bowser
e66b4f336d
fix: Map new replacement nodes to their mutable equivalents in SyntaxEditor
2024-12-08 15:55:34 -05:00
Giga Bowser
d329329b76
feat: Migrate flip_comma
assist to SyntaxEditor
2024-12-06 10:03:09 -05:00
Giga Bowser
d55879d1cb
feat: Migrate flip_trait_bound
assist to SyntaxEditor
2024-12-06 10:02:34 -05:00
Giga Bowser
09dee81412
feat: Migrate flip_binexpr
assist to SyntaxEditor
2024-12-06 10:02:34 -05:00
Lukas Wirth
4b350f2f11
Merge pull request #18551 from ShoyuVanilla/migrate-turbofish-assist
...
Migrate `add_turbo_fish` to `SyntaxEditor`
2024-12-06 13:44:54 +00:00
David Barsky
5d23772649
Merge pull request #18538 from tareknaser/syntax_factory_sort_items
...
Migrate `sort_items` Assist to Use `SyntaxFactory`
2024-12-05 19:21:51 +00:00
Tarek
8954a7f9e9
fix: rename syntax_editor_add_generic_param
to add_generic_param
...
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-05 13:50:43 +02:00
Tarek
b7e613c0dc
fix: update introduce_named_generic
to use type_param
directly
...
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 16:02:03 +02:00