File tree Expand file tree Collapse file tree 3 files changed +23
-2
lines changed
compiler-core/src/language_server Expand file tree Collapse file tree 3 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 96
96
97
97
([ Giacomo Cavalieri] ( https://github.com/giacomocavalieri ) )
98
98
99
+ - The "inline variable" code action is now only suggested when hovering over the
100
+ relevant variable.
101
+ ([ Giacomo Cavalieri] ( https://github.com/giacomocavalieri ) )
102
+
99
103
### Formatter
100
104
101
105
### Bug fixes
Original file line number Diff line number Diff line change @@ -5983,7 +5983,7 @@ impl<'ast> ast::visit::Visit<'ast> for InlineVariable<'ast> {
5983
5983
) {
5984
5984
let range = self . edits . src_span_to_lsp_range ( * location) ;
5985
5985
5986
- if !overlaps ( self . params . range , range) {
5986
+ if !within ( self . params . range , range) {
5987
5987
return ;
5988
5988
}
5989
5989
@@ -6025,7 +6025,7 @@ impl<'ast> ast::visit::Visit<'ast> for InlineVariable<'ast> {
6025
6025
6026
6026
let range = self . edits . src_span_to_lsp_range ( * location) ;
6027
6027
6028
- if !overlaps ( self . params . range , range) {
6028
+ if !within ( self . params . range , range) {
6029
6029
return ;
6030
6030
}
6031
6031
Original file line number Diff line number Diff line change @@ -8933,6 +8933,23 @@ pub fn main() {
8933
8933
) ;
8934
8934
}
8935
8935
8936
+ #[ test]
8937
+ fn no_inline_variable_action_when_spanning_multiple_items ( ) {
8938
+ assert_no_code_actions ! (
8939
+ INLINE_VARIABLE ,
8940
+ "
8941
+ pub fn main(x: Int, y: Int) {
8942
+ let a = 1
8943
+ let b = 2
8944
+ main(a, b)
8945
+ }
8946
+ " ,
8947
+ find_position_of( "main" )
8948
+ . nth_occurrence( 2 )
8949
+ . select_until( find_position_of( ")" ) . nth_occurrence( 2 ) )
8950
+ ) ;
8951
+ }
8952
+
8936
8953
#[ test]
8937
8954
fn no_inline_variable_action_for_use_pattern ( ) {
8938
8955
assert_no_code_actions ! (
You can’t perform that action at this time.
0 commit comments