File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
compiler-core/src/language_server Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -1387,8 +1387,8 @@ impl<'a> AnnotateTopLevelDefinitions<'a> {
13871387 pub fn code_actions ( mut self ) -> Vec < CodeAction > {
13881388 self . visit_typed_module ( & self . module . ast ) ;
13891389
1390- // We only want to trigger the action if we're over one of the definition in
1391- // the module
1390+ // We only want to trigger the action if we're over one of the definition
1391+ // which is lacking some annotations in the module
13921392 if !self . is_hovering_definition || self . edits . edits . is_empty ( ) {
13931393 return vec ! [ ] ;
13941394 } ;
@@ -1407,15 +1407,16 @@ impl<'ast> ast::visit::Visit<'ast> for AnnotateTopLevelDefinitions<'_> {
14071407 fn visit_typed_module_constant ( & mut self , constant : & ' ast TypedModuleConstant ) {
14081408 let code_action_range = self . edits . src_span_to_lsp_range ( constant. location ) ;
14091409
1410- if overlaps ( code_action_range, self . params . range ) {
1411- self . is_hovering_definition = true ;
1412- }
1413-
14141410 // We don't need to add an annotation if there already is one
14151411 if constant. annotation . is_some ( ) {
14161412 return ;
14171413 }
14181414
1415+ // We're hovering definition which needs some annotations
1416+ if overlaps ( code_action_range, self . params . range ) {
1417+ self . is_hovering_definition = true ;
1418+ }
1419+
14191420 self . edits . insert (
14201421 constant. name_location . end ,
14211422 format ! (
You can’t perform that action at this time.
0 commit comments