1+ use  pgt_schema_cache:: SchemaCache ; 
2+ 
13use  crate :: { contextual_priority:: ContextualPriority ,  to_markdown:: ToHoverMarkdown } ; 
24
35mod  column; 
46mod  function; 
7+ mod  postgres_type; 
58mod  role; 
69mod  schema; 
710mod  table; 
@@ -16,6 +19,7 @@ pub enum Hoverable<'a> {
1619 Function ( & ' a  pgt_schema_cache:: Function ) , 
1720 Role ( & ' a  pgt_schema_cache:: Role ) , 
1821 Schema ( & ' a  pgt_schema_cache:: Schema ) , 
22+  PostgresType ( & ' a  pgt_schema_cache:: PostgresType ) , 
1923} 
2024
2125impl < ' a >  From < & ' a  pgt_schema_cache:: Schema >  for  Hoverable < ' a >  { 
@@ -48,6 +52,12 @@ impl<'a> From<&'a pgt_schema_cache::Role> for Hoverable<'a> {
4852 } 
4953} 
5054
55+ impl < ' a >  From < & ' a  pgt_schema_cache:: PostgresType >  for  Hoverable < ' a >  { 
56+  fn  from ( value :  & ' a  pgt_schema_cache:: PostgresType )  -> Self  { 
57+  Hoverable :: PostgresType ( value) 
58+  } 
59+ } 
60+ 
5161impl  ContextualPriority  for  Hoverable < ' _ >  { 
5262 fn  relevance_score ( & self ,  ctx :  & pgt_treesitter:: TreesitterContext )  -> f32  { 
5363 match  self  { 
@@ -56,38 +66,76 @@ impl ContextualPriority for Hoverable<'_> {
5666 Hoverable :: Function ( function)  => function. relevance_score ( ctx) , 
5767 Hoverable :: Role ( role)  => role. relevance_score ( ctx) , 
5868 Hoverable :: Schema ( schema)  => schema. relevance_score ( ctx) , 
69+  Hoverable :: PostgresType ( type_)  => type_. relevance_score ( ctx) , 
5970 } 
6071 } 
6172} 
6273
6374impl  ToHoverMarkdown  for  Hoverable < ' _ >  { 
64-  fn  hover_headline < W :  std:: fmt:: Write > ( & self ,  writer :  & mut  W )  -> Result < ( ) ,  std:: fmt:: Error >  { 
75+  fn  hover_headline < W :  std:: fmt:: Write > ( 
76+  & self , 
77+  writer :  & mut  W , 
78+  schema_cache :  & SchemaCache , 
79+  )  -> Result < ( ) ,  std:: fmt:: Error >  { 
6580 match  self  { 
66-  Hoverable :: Table ( table)  => ToHoverMarkdown :: hover_headline ( * table,  writer) , 
67-  Hoverable :: Column ( column)  => ToHoverMarkdown :: hover_headline ( * column,  writer) , 
68-  Hoverable :: Function ( function)  => ToHoverMarkdown :: hover_headline ( * function,  writer) , 
69-  Hoverable :: Role ( role)  => ToHoverMarkdown :: hover_headline ( * role,  writer) , 
70-  Hoverable :: Schema ( schema)  => ToHoverMarkdown :: hover_headline ( * schema,  writer) , 
81+  Hoverable :: Table ( table)  => { 
82+  ToHoverMarkdown :: hover_headline ( * table,  writer,  schema_cache) 
83+  } 
84+  Hoverable :: Column ( column)  => { 
85+  ToHoverMarkdown :: hover_headline ( * column,  writer,  schema_cache) 
86+  } 
87+  Hoverable :: Function ( function)  => { 
88+  ToHoverMarkdown :: hover_headline ( * function,  writer,  schema_cache) 
89+  } 
90+  Hoverable :: Role ( role)  => ToHoverMarkdown :: hover_headline ( * role,  writer,  schema_cache) , 
91+  Hoverable :: Schema ( schema)  => { 
92+  ToHoverMarkdown :: hover_headline ( * schema,  writer,  schema_cache) 
93+  } 
94+  Hoverable :: PostgresType ( type_)  => { 
95+  ToHoverMarkdown :: hover_headline ( * type_,  writer,  schema_cache) 
96+  } 
7197 } 
7298 } 
7399
74-  fn  hover_body < W :  std:: fmt:: Write > ( & self ,  writer :  & mut  W )  -> Result < bool ,  std:: fmt:: Error >  { 
100+  fn  hover_body < W :  std:: fmt:: Write > ( 
101+  & self , 
102+  writer :  & mut  W , 
103+  schema_cache :  & SchemaCache , 
104+  )  -> Result < bool ,  std:: fmt:: Error >  { 
75105 match  self  { 
76-  Hoverable :: Table ( table)  => ToHoverMarkdown :: hover_body ( * table,  writer) , 
77-  Hoverable :: Column ( column)  => ToHoverMarkdown :: hover_body ( * column,  writer) , 
78-  Hoverable :: Function ( function)  => ToHoverMarkdown :: hover_body ( * function,  writer) , 
79-  Hoverable :: Role ( role)  => ToHoverMarkdown :: hover_body ( * role,  writer) , 
80-  Hoverable :: Schema ( schema)  => ToHoverMarkdown :: hover_body ( * schema,  writer) , 
106+  Hoverable :: Table ( table)  => ToHoverMarkdown :: hover_body ( * table,  writer,  schema_cache) , 
107+  Hoverable :: Column ( column)  => ToHoverMarkdown :: hover_body ( * column,  writer,  schema_cache) , 
108+  Hoverable :: Function ( function)  => { 
109+  ToHoverMarkdown :: hover_body ( * function,  writer,  schema_cache) 
110+  } 
111+  Hoverable :: Role ( role)  => ToHoverMarkdown :: hover_body ( * role,  writer,  schema_cache) , 
112+  Hoverable :: Schema ( schema)  => ToHoverMarkdown :: hover_body ( * schema,  writer,  schema_cache) , 
113+  Hoverable :: PostgresType ( type_)  => { 
114+  ToHoverMarkdown :: hover_body ( * type_,  writer,  schema_cache) 
115+  } 
81116 } 
82117 } 
83118
84-  fn  hover_footer < W :  std:: fmt:: Write > ( & self ,  writer :  & mut  W )  -> Result < bool ,  std:: fmt:: Error >  { 
119+  fn  hover_footer < W :  std:: fmt:: Write > ( 
120+  & self , 
121+  writer :  & mut  W , 
122+  schema_cache :  & SchemaCache , 
123+  )  -> Result < bool ,  std:: fmt:: Error >  { 
85124 match  self  { 
86-  Hoverable :: Table ( table)  => ToHoverMarkdown :: hover_footer ( * table,  writer) , 
87-  Hoverable :: Column ( column)  => ToHoverMarkdown :: hover_footer ( * column,  writer) , 
88-  Hoverable :: Function ( function)  => ToHoverMarkdown :: hover_footer ( * function,  writer) , 
89-  Hoverable :: Role ( role)  => ToHoverMarkdown :: hover_footer ( * role,  writer) , 
90-  Hoverable :: Schema ( schema)  => ToHoverMarkdown :: hover_footer ( * schema,  writer) , 
125+  Hoverable :: Table ( table)  => ToHoverMarkdown :: hover_footer ( * table,  writer,  schema_cache) , 
126+  Hoverable :: Column ( column)  => { 
127+  ToHoverMarkdown :: hover_footer ( * column,  writer,  schema_cache) 
128+  } 
129+  Hoverable :: Function ( function)  => { 
130+  ToHoverMarkdown :: hover_footer ( * function,  writer,  schema_cache) 
131+  } 
132+  Hoverable :: Role ( role)  => ToHoverMarkdown :: hover_footer ( * role,  writer,  schema_cache) , 
133+  Hoverable :: Schema ( schema)  => { 
134+  ToHoverMarkdown :: hover_footer ( * schema,  writer,  schema_cache) 
135+  } 
136+  Hoverable :: PostgresType ( type_)  => { 
137+  ToHoverMarkdown :: hover_footer ( * type_,  writer,  schema_cache) 
138+  } 
91139 } 
92140 } 
93141
@@ -98,6 +146,7 @@ impl ToHoverMarkdown for Hoverable<'_> {
98146 Hoverable :: Function ( function)  => function. body_markdown_type ( ) , 
99147 Hoverable :: Role ( role)  => role. body_markdown_type ( ) , 
100148 Hoverable :: Schema ( schema)  => schema. body_markdown_type ( ) , 
149+  Hoverable :: PostgresType ( type_)  => type_. body_markdown_type ( ) , 
101150 } 
102151 } 
103152
@@ -108,6 +157,7 @@ impl ToHoverMarkdown for Hoverable<'_> {
108157 Hoverable :: Function ( function)  => function. footer_markdown_type ( ) , 
109158 Hoverable :: Role ( role)  => role. footer_markdown_type ( ) , 
110159 Hoverable :: Schema ( schema)  => schema. footer_markdown_type ( ) , 
160+  Hoverable :: PostgresType ( type_)  => type_. footer_markdown_type ( ) , 
111161 } 
112162 } 
113163} 
0 commit comments