@@ -2,6 +2,7 @@ use crate::{contextual_priority::ContextualPriority, to_markdown::ToHoverMarkdow
22
33mod column;
44mod function;
5+ mod postgres_type;
56mod role;
67mod schema;
78mod table;
@@ -16,6 +17,7 @@ pub enum Hoverable<'a> {
1617 Function ( & ' a pgt_schema_cache:: Function ) ,
1718 Role ( & ' a pgt_schema_cache:: Role ) ,
1819 Schema ( & ' a pgt_schema_cache:: Schema ) ,
20+ PostgresType ( & ' a pgt_schema_cache:: PostgresType ) ,
1921}
2022
2123impl < ' a > From < & ' a pgt_schema_cache:: Schema > for Hoverable < ' a > {
@@ -48,6 +50,12 @@ impl<'a> From<&'a pgt_schema_cache::Role> for Hoverable<'a> {
4850 }
4951}
5052
53+ impl < ' a > From < & ' a pgt_schema_cache:: PostgresType > for Hoverable < ' a > {
54+ fn from ( value : & ' a pgt_schema_cache:: PostgresType ) -> Self {
55+ Hoverable :: PostgresType ( value)
56+ }
57+ }
58+
5159impl ContextualPriority for Hoverable < ' _ > {
5260 fn relevance_score ( & self , ctx : & pgt_treesitter:: TreesitterContext ) -> f32 {
5361 match self {
@@ -56,6 +64,7 @@ impl ContextualPriority for Hoverable<'_> {
5664 Hoverable :: Function ( function) => function. relevance_score ( ctx) ,
5765 Hoverable :: Role ( role) => role. relevance_score ( ctx) ,
5866 Hoverable :: Schema ( schema) => schema. relevance_score ( ctx) ,
67+ Hoverable :: PostgresType ( type_) => type_. relevance_score ( ctx) ,
5968 }
6069 }
6170}
@@ -68,6 +77,7 @@ impl ToHoverMarkdown for Hoverable<'_> {
6877 Hoverable :: Function ( function) => ToHoverMarkdown :: hover_headline ( * function, writer) ,
6978 Hoverable :: Role ( role) => ToHoverMarkdown :: hover_headline ( * role, writer) ,
7079 Hoverable :: Schema ( schema) => ToHoverMarkdown :: hover_headline ( * schema, writer) ,
80+ Hoverable :: PostgresType ( type_) => ToHoverMarkdown :: hover_headline ( * type_, writer) ,
7181 }
7282 }
7383
@@ -78,6 +88,7 @@ impl ToHoverMarkdown for Hoverable<'_> {
7888 Hoverable :: Function ( function) => ToHoverMarkdown :: hover_body ( * function, writer) ,
7989 Hoverable :: Role ( role) => ToHoverMarkdown :: hover_body ( * role, writer) ,
8090 Hoverable :: Schema ( schema) => ToHoverMarkdown :: hover_body ( * schema, writer) ,
91+ Hoverable :: PostgresType ( type_) => ToHoverMarkdown :: hover_body ( * type_, writer) ,
8192 }
8293 }
8394
@@ -88,6 +99,7 @@ impl ToHoverMarkdown for Hoverable<'_> {
8899 Hoverable :: Function ( function) => ToHoverMarkdown :: hover_footer ( * function, writer) ,
89100 Hoverable :: Role ( role) => ToHoverMarkdown :: hover_footer ( * role, writer) ,
90101 Hoverable :: Schema ( schema) => ToHoverMarkdown :: hover_footer ( * schema, writer) ,
102+ Hoverable :: PostgresType ( type_) => ToHoverMarkdown :: hover_footer ( * type_, writer) ,
91103 }
92104 }
93105
@@ -98,6 +110,7 @@ impl ToHoverMarkdown for Hoverable<'_> {
98110 Hoverable :: Function ( function) => function. body_markdown_type ( ) ,
99111 Hoverable :: Role ( role) => role. body_markdown_type ( ) ,
100112 Hoverable :: Schema ( schema) => schema. body_markdown_type ( ) ,
113+ Hoverable :: PostgresType ( type_) => type_. body_markdown_type ( ) ,
101114 }
102115 }
103116
@@ -108,6 +121,7 @@ impl ToHoverMarkdown for Hoverable<'_> {
108121 Hoverable :: Function ( function) => function. footer_markdown_type ( ) ,
109122 Hoverable :: Role ( role) => role. footer_markdown_type ( ) ,
110123 Hoverable :: Schema ( schema) => schema. footer_markdown_type ( ) ,
124+ Hoverable :: PostgresType ( type_) => type_. footer_markdown_type ( ) ,
111125 }
112126 }
113127}
0 commit comments