Commit graph

1029 commits

Author SHA1 Message Date
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
15239f612d internal: Show mir eval errors on hover with debug env var set 2024-12-15 17:38:37 +01: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
Tarek
9157761f5d
refactor: move editing for ast using SyntaxEditor to a separate file
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:51:48 +02:00
Tarek
2fb563f192 fix: refactor introduce_named_generic assist
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Tarek
70ef2f23c2 fix: refactor syntax_editor_add_generic_param
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Tarek
54f7ed13f5 fix: refactor syntax_editor_add_generic_param to handle adding new generic parameters
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Tarek
0990d5956d fix: implement syntax_editor_create_generic_param_list
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Tarek
642d4f3385 define syntax_editor_add_generic_param
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Tarek
4af3d6f598 fix: remove make_mut from introduce_named_generic assist
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Tarek
1400aec433 feat: migrate introduce_named_generic assist to use SyntaxFactory
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 14:50:03 +02:00
Tarek
c43d565def refactor: change target parameter to a reference in add_rewrite method
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 12:42:27 +02:00
Tarek
7149c4dab9 feat: migrate sort_items assist to use SyntaxFactory
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-12-04 12:42:26 +02:00
Lukas Wirth
e6276c8b64
Merge pull request #18555 from ChayimFriedman2/issue-17321
fix: Fix a bug when synthetic AST node were searched in the AST ID map and caused panics
2024-12-03 15:39:52 +00:00
Shoyu Vanilla
6aa5ea5411 Migrate add_turbo_fish to SyntaxEditor 2024-11-26 01:47:15 +09:00
Chayim Refael Friedman
b66bc91b4b Fix a bug when synthetic AST node were searched in the AST ID map and caused panics 2024-11-25 14:52:58 +02:00
David Barsky
c0bbbb3e5d
Merge pull request #18485 from davidkurilla/feat-migrate-add_braces-to-use-SyntaxFactory
feat: convert add_braces to SyntaxFactory SyntaxEditor abstraction
2024-11-19 21:05:17 +00:00
David Barsky
84078238c1
Merge pull request #18521 from tareknaser/syntax_factory_reorder_impl_items
Migrate `reorder_impl_items` Assist to Use `SyntaxFactory`
2024-11-19 20:38:57 +00:00
Laurențiu Nicola
a9aaa90d45
Merge pull request #18529 from cmrschwarz/allow_leading_whitespace_in_merge_match_arms
Improve selection handling for the `merge_match_arms` assist
2024-11-19 17:45:52 +00:00
Laurențiu Nicola
e761618aa4
Merge pull request #18459 from Giga-Bowser/match-placeholders
feat: Use snippet placeholders for generated match arms
2024-11-19 17:12:16 +00:00
Christian Schwarz
f12d5e3f20
improve selection handling for merge_match_arms 2024-11-19 08:22:13 +01:00
Tarek
05c2c162a5
feat: migrate reorder_impl_items assist to use SyntaxFactory
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-11-17 12:17:44 +02:00
David Kurilla
888f9606d1 style: remove needless borrow 2024-11-15 19:08:01 +00:00
David Kurilla
b68ae2b150 style: cargo fmt 2024-11-15 18:02:16 +00:00
Tarek
5c41c20c11
feat: migrate reorder_fields assist to use SyntaxFactory
Signed-off-by: Tarek <tareknaser360@gmail.com>
2024-11-13 15:02:08 +02:00
David Kurilla
c768a24673 fix: remove unused imports 2024-11-13 00:06:12 +00:00
David Kurilla
f3715c1d22 fix: fix indentation error 2024-11-12 23:58:24 +00:00
David Kurilla
9a805a2abd fix: fix immutable tree error 2024-11-12 22:43:48 +00:00
David Kurilla
9f87bdc08a feat: convert add_braces to SyntaxFactory SyntaxEditor abstraction 2024-11-06 14:45:00 +00:00
Giga Bowser
494bde3c13 Properly use final tabstop when adding missing match arms 2024-11-05 12:19:20 -05:00
Lukas Wirth
78f3112626 Allow interpreting consts and statics with interpret function command 2024-11-03 15:35:45 +01:00