@@ -6,12 +6,20 @@ use pgt_treesitter::TreesitterContext;
66use crate :: { contextual_priority:: ContextualPriority , to_markdown:: ToHoverMarkdown } ;
77
88impl ToHoverMarkdown for PostgresType {
9- fn hover_headline < W : Write > ( & self , writer : & mut W , _schema_cache : & SchemaCache ) -> Result < ( ) , std:: fmt:: Error > {
9+ fn hover_headline < W : Write > (
10+ & self ,
11+ writer : & mut W ,
12+ _schema_cache : & SchemaCache ,
13+ ) -> Result < ( ) , std:: fmt:: Error > {
1014 write ! ( writer, "`{}.{}` (Custom Type)" , self . schema, self . name) ?;
1115 Ok ( ( ) )
1216 }
1317
14- fn hover_body < W : Write > ( & self , writer : & mut W , schema_cache : & SchemaCache ) -> Result < bool , std:: fmt:: Error > {
18+ fn hover_body < W : Write > (
19+ & self ,
20+ writer : & mut W ,
21+ schema_cache : & SchemaCache ,
22+ ) -> Result < bool , std:: fmt:: Error > {
1523 if let Some ( comment) = & self . comment {
1624 write ! ( writer, "Comment: '{}'" , comment) ?;
1725 writeln ! ( writer) ?;
@@ -26,7 +34,13 @@ impl ToHoverMarkdown for PostgresType {
2634 write ! ( writer, "- {}" , attribute. name) ?;
2735
2836 if let Some ( type_info) = schema_cache. find_type_by_id ( attribute. type_id ) {
29- write ! ( writer, ": {}.{}" , type_info. schema, type_info. name) ?;
37+ write ! ( writer, ": " ) ?;
38+
39+ if type_info. schema != "pg_catalog" {
40+ write ! ( writer, "{}." , type_info. schema) ?;
41+ }
42+
43+ write ! ( writer, "{}" , type_info. name) ?;
3044 } else {
3145 write ! ( writer, " (type_id: {})" , attribute. type_id) ?;
3246 }
@@ -52,7 +66,11 @@ impl ToHoverMarkdown for PostgresType {
5266 Ok ( true )
5367 }
5468
55- fn hover_footer < W : Write > ( & self , writer : & mut W , _schema_cache : & SchemaCache ) -> Result < bool , std:: fmt:: Error > {
69+ fn hover_footer < W : Write > (
70+ & self ,
71+ writer : & mut W ,
72+ _schema_cache : & SchemaCache ,
73+ ) -> Result < bool , std:: fmt:: Error > {
5674 writeln ! ( writer) ?;
5775 Ok ( true )
5876 }
0 commit comments