File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
crates/emmylua_ls/src/handlers/semantic_token Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -614,6 +614,11 @@ fn handle_name_node(
614
614
615
615
LuaSemanticDeclId :: LuaDecl ( decl_id) => {
616
616
let decl_type = semantic_model. get_type ( decl_id. into ( ) ) ;
617
+ let decl = semantic_model
618
+ . get_db ( )
619
+ . get_decl_index ( )
620
+ . get_decl ( & decl_id) ?;
621
+
617
622
let ( token_type, modifier) = match decl_type {
618
623
LuaType :: Signature ( signature) => {
619
624
let is_meta = semantic_model
@@ -626,11 +631,18 @@ fn handle_name_node(
626
631
)
627
632
}
628
633
LuaType :: DocFunction ( _) => ( SemanticTokenType :: FUNCTION , None ) ,
634
+ LuaType :: Union ( union) => {
635
+ if union. get_types ( ) . iter ( ) . any ( |typ| typ. is_function ( ) ) {
636
+ ( SemanticTokenType :: FUNCTION , None )
637
+ } else {
638
+ if decl. is_param ( ) {
639
+ ( SemanticTokenType :: PARAMETER , None )
640
+ } else {
641
+ ( SemanticTokenType :: VARIABLE , None )
642
+ }
643
+ }
644
+ }
629
645
_ => {
630
- let decl = semantic_model
631
- . get_db ( )
632
- . get_decl_index ( )
633
- . get_decl ( & decl_id) ?;
634
646
if decl. is_param ( ) {
635
647
( SemanticTokenType :: PARAMETER , None )
636
648
} else {
You can’t perform that action at this time.
0 commit comments