@@ -25,6 +25,12 @@ use super::{
2525} ;
2626
2727pub fn analyze_type ( analyzer : & mut DocAnalyzer , tag : LuaDocTagType ) -> Option < ( ) > {
28+ let description = if let Some ( des) = tag. get_description ( ) {
29+ Some ( preprocess_description ( & des. get_description_text ( ) , None ) )
30+ } else {
31+ None
32+ } ;
33+
2834 let mut type_list = Vec :: new ( ) ;
2935 for lua_doc_type in tag. get_type_list ( ) {
3036 let type_ref = infer_type ( analyzer, lua_doc_type) ;
@@ -50,6 +56,17 @@ pub fn analyze_type(analyzer: &mut DocAnalyzer, tag: LuaDocTagType) -> Option<()
5056 . db
5157 . get_type_index_mut ( )
5258 . bind_type ( decl_id. into ( ) , LuaTypeCache :: DocType ( type_ref. clone ( ) ) ) ;
59+
60+ // bind description
61+ if let Some ( ref desc) = description {
62+ if !desc. is_empty ( ) {
63+ analyzer. db . get_property_index_mut ( ) . add_description (
64+ analyzer. file_id ,
65+ LuaSemanticDeclId :: LuaDecl ( decl_id) ,
66+ desc. clone ( ) ,
67+ ) ;
68+ }
69+ }
5370 }
5471 LuaVarExpr :: IndexExpr ( index_expr) => {
5572 let member_id =
@@ -58,6 +75,17 @@ pub fn analyze_type(analyzer: &mut DocAnalyzer, tag: LuaDocTagType) -> Option<()
5875 . db
5976 . get_type_index_mut ( )
6077 . bind_type ( member_id. into ( ) , LuaTypeCache :: DocType ( type_ref. clone ( ) ) ) ;
78+
79+ // bind description
80+ if let Some ( ref desc) = description {
81+ if !desc. is_empty ( ) {
82+ analyzer. db . get_property_index_mut ( ) . add_description (
83+ analyzer. file_id ,
84+ LuaSemanticDeclId :: Member ( member_id) ,
85+ desc. clone ( ) ,
86+ ) ;
87+ }
88+ }
6189 }
6290 }
6391 }
@@ -77,6 +105,17 @@ pub fn analyze_type(analyzer: &mut DocAnalyzer, tag: LuaDocTagType) -> Option<()
77105 . db
78106 . get_type_index_mut ( )
79107 . bind_type ( decl_id. into ( ) , LuaTypeCache :: DocType ( type_ref. clone ( ) ) ) ;
108+
109+ // bind description
110+ if let Some ( ref desc) = description {
111+ if !desc. is_empty ( ) {
112+ analyzer. db . get_property_index_mut ( ) . add_description (
113+ analyzer. file_id ,
114+ LuaSemanticDeclId :: LuaDecl ( decl_id) ,
115+ desc. clone ( ) ,
116+ ) ;
117+ }
118+ }
80119 }
81120 }
82121 LuaAst :: LuaTableField ( table_field) => {
@@ -87,6 +126,17 @@ pub fn analyze_type(analyzer: &mut DocAnalyzer, tag: LuaDocTagType) -> Option<()
87126 . db
88127 . get_type_index_mut ( )
89128 . bind_type ( member_id. into ( ) , LuaTypeCache :: DocType ( first_type. clone ( ) ) ) ;
129+
130+ // bind description
131+ if let Some ( ref desc) = description {
132+ if !desc. is_empty ( ) {
133+ analyzer. db . get_property_index_mut ( ) . add_description (
134+ analyzer. file_id ,
135+ LuaSemanticDeclId :: Member ( member_id) ,
136+ desc. clone ( ) ,
137+ ) ;
138+ }
139+ }
90140 }
91141 }
92142 _ => { }
0 commit comments