@@ -4,8 +4,8 @@ use super::{
44use crate :: context:: ClientId ;
55use crate :: util:: parse_desc;
66use emmylua_code_analysis:: {
7- LuaDecl , LuaDeclExtra , LuaMemberId , LuaMemberOwner , LuaSemanticDeclId , LuaType , LuaTypeDeclId ,
8- SemanticDeclLevel , SemanticModel , WorkspaceId , check_export_visibility,
7+ Emmyrc , LuaDecl , LuaDeclExtra , LuaMemberId , LuaMemberOwner , LuaSemanticDeclId , LuaType ,
8+ LuaTypeDeclId , SemanticDeclLevel , SemanticModel , WorkspaceId , check_export_visibility,
99 parse_require_module_info,
1010} ;
1111use emmylua_parser:: {
@@ -21,6 +21,7 @@ pub fn build_semantic_tokens(
2121 semantic_model : & mut SemanticModel ,
2222 support_muliline_token : bool ,
2323 client_id : ClientId ,
24+ emmyrc : & Emmyrc ,
2425) -> Option < Vec < SemanticToken > > {
2526 let root = semantic_model. get_root ( ) ;
2627 let document = semantic_model. get_document ( ) ;
@@ -34,10 +35,16 @@ pub fn build_semantic_tokens(
3435 for node_or_token in root. syntax ( ) . descendants_with_tokens ( ) {
3536 match node_or_token {
3637 NodeOrToken :: Node ( node) => {
37- build_node_semantic_token ( semantic_model, & mut builder, node) ;
38+ build_node_semantic_token ( semantic_model, & mut builder, node, emmyrc ) ;
3839 }
3940 NodeOrToken :: Token ( token) => {
40- build_tokens_semantic_token ( semantic_model, & mut builder, & token, client_id) ;
41+ build_tokens_semantic_token (
42+ semantic_model,
43+ & mut builder,
44+ & token,
45+ client_id,
46+ emmyrc,
47+ ) ;
4148 }
4249 }
4350 }
@@ -50,6 +57,7 @@ fn build_tokens_semantic_token(
5057 builder : & mut SemanticBuilder ,
5158 token : & LuaSyntaxToken ,
5259 client_id : ClientId ,
60+ emmyrc : & Emmyrc ,
5361) {
5462 match token. kind ( ) . into ( ) {
5563 LuaTokenKind :: TkLongString | LuaTokenKind :: TkString => {
@@ -164,10 +172,7 @@ fn build_tokens_semantic_token(
164172 let rendering_description = token
165173 . parent ( )
166174 . is_some_and ( |parent| parent. kind ( ) == LuaSyntaxKind :: DocDescription . into ( ) ) ;
167- let description_parsing_is_enabled = semantic_model
168- . get_emmyrc ( )
169- . semantic_tokens
170- . render_documentation_markup ;
175+ let description_parsing_is_enabled = emmrc. semantic_tokens . render_documentation_markup ;
171176
172177 if !( rendering_description && description_parsing_is_enabled) {
173178 builder. push ( token, SemanticTokenType :: COMMENT ) ;
@@ -232,6 +237,7 @@ fn build_node_semantic_token(
232237 semantic_model : & SemanticModel ,
233238 builder : & mut SemanticBuilder ,
234239 node : LuaSyntaxNode ,
240+ emmyrc : & Emmyrc ,
235241) -> Option < ( ) > {
236242 match LuaAst :: cast ( node) ? {
237243 LuaAst :: LuaDocTagClass ( doc_class) => {
@@ -590,11 +596,7 @@ fn build_node_semantic_token(
590596 _ => { }
591597 } ,
592598 LuaAst :: LuaDocDescription ( description) => {
593- if !semantic_model
594- . get_emmyrc ( )
595- . semantic_tokens
596- . render_documentation_markup
597- {
599+ if !emmyrc. semantic_tokens . render_documentation_markup {
598600 for token in description. tokens :: < LuaGeneralToken > ( ) {
599601 if matches ! (
600602 token. get_token_kind( ) ,
@@ -614,7 +616,7 @@ fn build_node_semantic_token(
614616 . get_module ( )
615617 . map ( |m| m. workspace_id )
616618 . unwrap_or ( WorkspaceId :: MAIN ) ,
617- semantic_model . get_emmyrc ( ) ,
619+ emmyrc ,
618620 text,
619621 description,
620622 None ,
0 commit comments