diff options
Diffstat (limited to 'src/server/hover.odin')
| -rw-r--r-- | src/server/hover.odin | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/server/hover.odin b/src/server/hover.odin index 25975c0..39b9a33 100644 --- a/src/server/hover.odin +++ b/src/server/hover.odin @@ -43,6 +43,10 @@ write_hover_content :: proc(ast_context: ^AstContext, symbol: Symbol) -> MarkupC return content } +builtin_identifier_hover: map[string]string = { + "context" = fmt.aprintf("```odin\n %v\n```\n%v", "runtime.context: Context", "This context variable is local to each scope and is implicitly passed by pointer to any procedure call in that scope (if the procedure has the Odin calling convention)."), +} + get_hover_information :: proc(document: ^common.Document, position: common.Position) -> (Hover, bool) { hover := Hover { @@ -68,6 +72,22 @@ get_hover_information :: proc(document: ^common.Document, position: common.Posit hover.range = common.get_token_range(position_context.identifier^, ast_context.file.src) return hover, true } + + if str, ok := builtin_identifier_hover[ident.name]; ok { + hover.contents.kind = "markdown" + hover.contents.value = str + hover.range = common.get_token_range(position_context.identifier^, ast_context.file.src) + return hover, true + } + } + } + + if position_context.implicit_context != nil { + if str, ok := builtin_identifier_hover[position_context.implicit_context.tok.text]; ok { + hover.contents.kind = "markdown" + hover.contents.value = str + hover.range = common.get_token_range(position_context.implicit_context^, ast_context.file.src) + return hover, true } } |