l1nxy
b6a14ce5b8
fix doc test.
2024-01-01 22:11:45 +08:00
l1nxy
edb9ad21bd
apply to only has nested if.
2024-01-01 21:53:57 +08:00
Yu Zeng
7fee0881db
complete merge_nested_if with bugs.
2023-12-29 18:32:37 +08:00
Young-Flash
6c9d2ad1d5
test: add test case for remove comma
2023-12-22 21:04:53 +08:00
bors
65ed198819
Auto merge of #16066 - Young-Flash:auto_remove_brace, r=lnicola
...
fix: auto remove unnecessary braces after remove unused imports
before
![before](https://github.com/rust-lang/rust-analyzer/assets/71162630/8d44f955-f84f-4a92-b13f-5a2dee2ded36 )
after
![after](https://github.com/rust-lang/rust-analyzer/assets/71162630/1eab23c8-39bd-4711-97c1-d483ce400a18 )
2023-12-20 13:22:00 +00:00
Young-Flash
4cd939ad08
chore: add test case for nested use tree
2023-12-20 19:44:57 +08:00
Lukas Wirth
002e611d09
fix: Deduplicate annotations
2023-12-19 08:49:00 +01:00
Lukas Wirth
f49a2fed3f
internal: Move out WithFixture
into dev-dep only crate
2023-12-18 15:24:08 +01:00
Lukas Wirth
35620306a6
internal: Move proc-macro knowledge out of base-db
2023-12-18 12:37:18 +01:00
bors
dd07f1f2fb
Auto merge of #15887 - jinohkang-theori:fix/ide-assists/convert_tuple_struct_to_named_struct/handle_refs_inside_macro_invocations, r=Veykril
...
Fix incorrectly replacing references in macro invocation in "Convert to named struct" assist
Fixes #15630 .
Complements #13647 (same assist but missed this one), #14920 (inverse action assist).
2023-12-13 21:30:18 +00:00
bors
6bbb2ac304
Auto merge of #15705 - rmehri01:14485_fix_delegate_self_references, r=Veykril
...
fix: resolve Self type references in delegate method assist
This PR makes the delegate method assist resolve any `Self` type references in the parameters or return type. It also works across macros such as the `uint_impl!` macro used for `saturating_mul` in the issue example.
Closes #14485
2023-12-08 11:31:34 +00:00
Ryan Mehri
7e768cbe70
fix: prefer keeping Self if it is in the same impl def
2023-12-08 12:30:14 +01:00
Ryan Mehri
f4349ff26e
fix: preserve where clause in delegate method
2023-12-08 12:29:34 +01:00
Ryan Mehri
934358e95c
fix: resolve Self type references in delegate method assist
2023-12-08 12:29:34 +01:00
Matheus Cardoso
3d9221291f
flip binexpr works for lhs cmp
2023-12-08 11:36:30 +01:00
Matheus Cardoso
e18b89452e
Flip binexpr works for lhs binexpr
2023-12-08 11:36:30 +01:00
bors
49dd3804c0
Auto merge of #16009 - werifu:fix-extract-function, r=Veykril
...
fix: bug in extract_function.rs
There is a little bug in extract_function: It appends `use path::to::ControlFlow;` if the function created contains string "ControlFlow".
A case below (also in the test named `does_not_import_control_flow` which will fail in the original code)
<img width="322" alt="image" src="https://github.com/rust-lang/rust-analyzer/assets/53432474/4b80bb58-0cfd-4d56-b64c-d9649eed336e ">
<img width="391" alt="image" src="https://github.com/rust-lang/rust-analyzer/assets/53432474/3d7262f4-8a4c-44ea-822d-304b8b23fe28 ">
Now I have changed the condition determining whether adding import statement. Only when the new function body contains ControlFlow::Break or ControlFlow::Continue can the import statement be added.
Last related PR: https://github.com/rust-lang/rust-analyzer/pull/10309
2023-12-07 17:28:41 +00:00
Lukas Wirth
634d588fd7
Simplify
2023-12-06 14:36:39 +01:00
Lukas Wirth
d2cd30007c
Implicit format args support
2023-12-05 17:07:00 +01:00
Lukas Wirth
5b8e386bae
Improve macro descension API
2023-12-05 17:06:57 +01:00
Igor Matuszewski
a7224c998d
Don't explicitly warn against semicolon_in_expressions_from_macros
...
This has been warn-by-default for two years now and has already been
added to the future-incompat lints in 1.68.
2023-12-05 11:35:09 +01:00
werifu
05e8b926e6
fix: bug in extract_function: should not import ControlFlow in some cases
2023-12-04 16:23:18 +08:00
Lukas Wirth
81410ab500
Cleanup FileId stuff
2023-12-02 19:32:53 +01:00
Lukas Wirth
c43078f99d
Re-implement InFile wrappers as type aliases over generic InFileWrapper
2023-11-28 10:55:40 +01:00
Lukas Wirth
890eb17b4e
Replace ID based TokenMap with proper relative text-ranges / spans
2023-11-28 10:55:39 +01:00
bors
4ab67291fa
Auto merge of #15857 - Young-Flash:fix, r=Veykril
...
fix: remove parenthesis should ensure space
close https://github.com/rust-lang/rust-analyzer/issues/15844
2023-11-27 16:14:31 +00:00
David Tolnay
b68f5311b5
Replace option.map(cond) == Some(true)
with option.is_some_and(cond)
2023-11-24 09:06:44 -08:00
Young-Flash
bd5a63b208
move parentheses judge logic into builder
2023-11-22 14:11:00 +08:00
Young-Flash
1cbda612bc
chore: add use case for PathSegment::qualifying_trait
2023-11-17 21:31:33 +08:00
bors
535eb0da9d
Auto merge of #15874 - DropDemBits:structured-snippet-migrate-4, r=Veykril
...
internal: Migrate assists to the structured snippet API, part 4
Continuing from #15260
Migrates the following assists:
- `add_turbo_fish`
- `add_type_ascription`
- `destructure_tuple_binding`
- `destructure_tuple_binding_in_subpattern`
I did this a while ago, but forgot to make a PR for the changes until now. 😅
2023-11-15 09:54:45 +00:00
DropDemBits
3f99a56fae
Fix panic in add_type_ascription
...
Assist wasn't applicable when the let statement was missing a pattern
before, so we should do the same now.
2023-11-14 18:43:48 -05:00
Jinoh Kang
0beba7cfc4
fix: Fix incorrectly replacing references in macro invocation in "Convert to named struct" assist
2023-11-14 16:01:59 +09:00
DropDemBits
787ca888e3
Add IdentPat::set_pat
...
Needed so that the `tuple_pat` node gets added to the syntax tree,
which is required as we're using structured snippets.
2023-11-13 20:41:06 -05:00
DropDemBits
6f68cd3394
Remove unwraps from destructure_tuple_binding
2023-11-13 18:42:58 -05:00
DropDemBits
4aaa592a9a
Migrate destructure_tuple_binding
to mutable ast
...
Due to the way the current tree mutation api works, we need to collect
changes before we can apply them to the real syntax tree, and also can only
switch to a file once.
`destructure_tuple_binding_in_sub_pattern` also gets migrated even
though can't be used.
2023-11-11 21:07:19 -05:00
DropDemBits
f3dcc67dfa
Migrate add_type_ascription
2023-11-11 21:05:27 -05:00
DropDemBits
cc4e06f04b
Migrate add_turbo_fish
to mutable ast
...
`add_type_ascription` is still left as-is since it's a different assist
2023-11-11 21:05:26 -05:00
Lukas Wirth
ba61766217
Add config for preferring / ignoring prelude modules in find_path
2023-11-11 14:56:38 +01:00
Young-Flash
be62e0bf08
fix: remove parenthesis should ensure space
2023-11-09 18:33:49 +08:00
Ali Bektas
b0101da116
Ignore doc(hidden) attr if no body is present
2023-11-09 02:12:53 +01:00
Young-Flash
b84940b199
make generate_mut_trait_impl assist trigged for std trait only
2023-11-05 12:27:10 +08:00
Young-Flash
8d8d12120d
feat: add generate_mut_trait_impl assist
2023-11-05 12:27:10 +08:00
bors
99e94d2938
Auto merge of #15788 - Young-Flash:import_anonymously, r=lnicola
...
feat: import trait with alias
![import_trait_with_alias](https://github.com/rust-lang/rust-analyzer/assets/71162630/81601160-fe55-46e3-ab8d-b2705e1aa696 )
cc `@Veykril`
close https://github.com/rust-lang/rust-analyzer/issues/15684
2023-10-31 14:33:00 +00:00
Young-Flash
929544ef28
use check_assist_by_label
to pick assist
2023-10-31 22:13:07 +08:00
Young-Flash
7186a28717
chore: add unapplicable test for extract_variable without select
2023-10-28 10:06:09 +08:00
Young-Flash
00cdbe6c96
feat: make extract_variable assist in place
2023-10-27 21:16:34 +08:00
bors
2f6961aaaf
Auto merge of #15780 - Young-Flash:auto_import, r=lnicola
...
fix: import trait if needed for `unqualify_method_call` assist
before:
![before](https://github.com/rust-lang/rust-analyzer/assets/71162630/66fda67d-afcb-453f-91a9-7e85993c3d2a )
after:
![after](https://github.com/rust-lang/rust-analyzer/assets/71162630/72ffbda4-1615-4413-836e-480eb52e9728 )
follow up https://github.com/rust-lang/rust-analyzer/pull/13825
2023-10-23 16:56:22 +00:00
Young-Flash
45ee88f9cb
fix: remove unwrap
2023-10-23 23:12:07 +08:00
Young-Flash
4f5f7e2800
feat: import trait with alias
2023-10-22 21:39:00 +08:00
Young-Flash
a7f77d89a9
fix: auto import trait if needed
2023-10-19 17:34:17 +08:00