@@ -6,10 +6,14 @@ mod hover_humanize;
6
6
mod keyword_hover;
7
7
mod std_hover;
8
8
9
+ use super :: RegisterCapabilities ;
10
+ use crate :: context:: ServerContextSnapshot ;
11
+ use crate :: util:: { find_ref_at, resolve_ref_single} ;
9
12
pub use build_hover:: build_hover_content_for_completion;
10
13
use build_hover:: build_semantic_info_hover;
11
14
use emmylua_code_analysis:: { EmmyLuaAnalysis , FileId , WorkspaceId } ;
12
- use emmylua_parser:: { LuaAstNode , LuaDocDescription , LuaKind , LuaTokenKind } ;
15
+ use emmylua_parser:: { LuaAstNode , LuaDocDescription , LuaTokenKind } ;
16
+ use emmylua_parser_desc:: parse_ref_target;
13
17
pub use find_origin:: { find_all_same_named_members, find_member_origin_owner} ;
14
18
pub use hover_builder:: HoverBuilder ;
15
19
pub use hover_humanize:: infer_prefix_global_name;
@@ -22,10 +26,6 @@ use rowan::TokenAtOffset;
22
26
pub use std_hover:: { hover_std_description, is_std} ;
23
27
use tokio_util:: sync:: CancellationToken ;
24
28
25
- use super :: RegisterCapabilities ;
26
- use crate :: context:: ServerContextSnapshot ;
27
- use crate :: util:: { find_ref_at, resolve_ref_single} ;
28
-
29
29
pub async fn on_hover (
30
30
context : ServerContextSnapshot ,
31
31
params : HoverParams ,
@@ -82,7 +82,7 @@ pub fn hover(analysis: &EmmyLuaAnalysis, file_id: FileId, position: Position) ->
82
82
range : document. to_lsp_range ( keywords. text_range ( ) ) ,
83
83
} ) ;
84
84
}
85
- detail if detail. kind ( ) == LuaKind :: Token ( LuaTokenKind :: TkDocDetail ) => {
85
+ detail if detail. kind ( ) == LuaTokenKind :: TkDocDetail . into ( ) => {
86
86
let parent = detail. parent ( ) ?;
87
87
let description = LuaDocDescription :: cast ( parent) ?;
88
88
let document = semantic_model. get_document ( ) ;
@@ -111,6 +111,25 @@ pub fn hover(analysis: &EmmyLuaAnalysis, file_id: FileId, position: Position) ->
111
111
path. last ( ) ?. 1 ,
112
112
)
113
113
}
114
+ doc_see if doc_see. kind ( ) == LuaTokenKind :: TkDocSeeContent . into ( ) => {
115
+ let document = semantic_model. get_document ( ) ;
116
+
117
+ let path =
118
+ parse_ref_target ( document. get_text ( ) , doc_see. text_range ( ) , position_offset) ?;
119
+
120
+ let db = analysis. compilation . get_db ( ) ;
121
+ let semantic_info = resolve_ref_single ( db, file_id, & path, & doc_see) ?;
122
+
123
+ build_semantic_info_hover (
124
+ & analysis. compilation ,
125
+ & semantic_model,
126
+ db,
127
+ & document,
128
+ doc_see,
129
+ semantic_info,
130
+ path. last ( ) ?. 1 ,
131
+ )
132
+ }
114
133
_ => {
115
134
let semantic_info = semantic_model. get_semantic_info ( token. clone ( ) . into ( ) ) ?;
116
135
let db = semantic_model. get_db ( ) ;
0 commit comments