aboutsummaryrefslogtreecommitdiff
path: root/src/server/hover.odin
diff options
context:
space:
mode:
authorBradley Lewis <22850972+BradLewis@users.noreply.github.com>2025-12-14 21:34:18 +1100
committerGitHub <noreply@github.com>2025-12-14 21:34:18 +1100
commit79dc7bb79998428a96ab25f6c122dfc4c1909ac1 (patch)
treeedcdfe7cbf58dfacd96311cd4bccaab196f0aa0b /src/server/hover.odin
parent70efaf21cac9358b1b50e194e3401b07901b8f47 (diff)
parent54a2a8e940018f8984e51e21fe94abf1ff0055fe (diff)
Merge pull request #1218 from BradLewis/feat/directive-docs
Add documentation for directives
Diffstat (limited to 'src/server/hover.odin')
-rw-r--r--src/server/hover.odin14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/server/hover.odin b/src/server/hover.odin
index 20651e4..ca791ef 100644
--- a/src/server/hover.odin
+++ b/src/server/hover.odin
@@ -66,6 +66,15 @@ get_hover_information :: proc(document: ^Document, position: common.Position) ->
}
}
+ if position_context.directive != nil && position_in_node(position_context.directive, position_context.position) {
+ if str, ok := directive_docs[position_context.directive.name]; ok {
+ hover.contents.kind = "markdown"
+ hover.contents.value = str
+ hover.range = common.get_token_range(position_context.directive, ast_context.file.src)
+ return hover, true, true
+ }
+ }
+
if position_context.identifier != nil {
if ident, ok := position_context.identifier.derived.(^ast.Ident); ok {
if str, ok := keywords_docs[ident.name]; ok {
@@ -323,7 +332,10 @@ get_hover_information :: proc(document: ^Document, position: common.Position) ->
}
}
- if resolved, ok := resolve_symbol_return(&ast_context, lookup(ident.name, selector.pkg, ast_context.fullpath)); ok {
+ if resolved, ok := resolve_symbol_return(
+ &ast_context,
+ lookup(ident.name, selector.pkg, ast_context.fullpath),
+ ); ok {
build_documentation(&ast_context, &resolved, false)
resolved.name = ident.name