File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -323,7 +323,23 @@ impl Backend {
323323 range : Some ( Range { start, end } ) ,
324324 } )
325325 }
326- _ => None ,
326+ other => {
327+ let template = completion:: builtin:: match_callname ( other. to_owned ( ) ) ?;
328+ let description = format ! (
329+ "```simplicityhl\n fn {}({}) -> {}\n ```\n {}" ,
330+ template. display_name,
331+ template. args. join( ", " ) ,
332+ template. return_type,
333+ template. description
334+ ) ;
335+ Some ( Hover {
336+ contents : tower_lsp_server:: lsp_types:: HoverContents :: Markup ( MarkupContent {
337+ kind : MarkupKind :: Markdown ,
338+ value : description,
339+ } ) ,
340+ range : Some ( Range { start, end } ) ,
341+ } )
342+ }
327343 }
328344 }
329345}
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ pub fn get_builtin_functions() -> Vec<FunctionTemplate> {
5050 . collect ( )
5151}
5252
53- fn match_callname ( call : CallName ) -> Option < FunctionTemplate > {
53+ pub fn match_callname ( call : CallName ) -> Option < FunctionTemplate > {
5454 match call {
5555 CallName :: UnwrapLeft ( aliased_type) => {
5656 let ty = aliased_type. to_string ( ) ;
@@ -94,13 +94,13 @@ fn match_callname(call: CallName) -> Option<FunctionTemplate> {
9494 CallName :: Assert => Some ( FunctionTemplate :: simple (
9595 "assert!" ,
9696 str_vec ! [ "bool" ] ,
97- "" ,
97+ "() " ,
9898 "Fails program if argument is 'false'" ,
9999 ) ) ,
100100 CallName :: Panic => Some ( FunctionTemplate :: simple (
101101 "panic!" ,
102102 str_vec ! [ ] ,
103- "" ,
103+ "() " ,
104104 "Fails program" ,
105105 ) ) ,
106106 CallName :: Debug => Some ( FunctionTemplate :: simple (
You can’t perform that action at this time.
0 commit comments