aboutsummaryrefslogtreecommitdiff
path: root/src/server/documentation.odin
diff options
context:
space:
mode:
authorNathaniel Saxe <NathanielSaxophone@gmail.com>2026-02-03 13:36:26 -0500
committerGitHub <noreply@github.com>2026-02-03 13:36:26 -0500
commit358a0d4df11731e18231da055813e7e6301ce4db (patch)
tree3969d79743e1c1c2a3b5614a8579c040e31b6b5d /src/server/documentation.odin
parent1dddd343a6e2a70cba078379dcfde0d62cd28a7c (diff)
parent68f7e739157f84c70d368c55d55f4996a61008e9 (diff)
Merge branch 'master' into master
Diffstat (limited to 'src/server/documentation.odin')
-rw-r--r--src/server/documentation.odin19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/server/documentation.odin b/src/server/documentation.odin
index 2fe8842..7c26a37 100644
--- a/src/server/documentation.odin
+++ b/src/server/documentation.odin
@@ -6,6 +6,10 @@ import "core:odin/ast"
import path "core:path/slashpath"
import "core:strings"
+DOC_SECTION_DELIMITER :: "\n---\n" // The string separating each section of documentation
+DOC_FMT_ODIN :: "```odin\n%v\n```" // The format for wrapping odin code in a markdown codeblock
+DOC_FMT_MARKDOWN :: DOC_FMT_ODIN + DOC_SECTION_DELIMITER + "%v" // The format for presenting documentation on hover
+
// Adds signature and docs information to the provided symbol
// This should only be used for a symbol created with the temp allocator
build_documentation :: proc(ast_context: ^AstContext, symbol: ^Symbol, short_signature := true) {
@@ -20,21 +24,17 @@ build_documentation :: proc(ast_context: ^AstContext, symbol: ^Symbol, short_sig
}
}
-construct_symbol_docs :: proc(symbol: Symbol, markdown := true, allocator := context.temp_allocator) -> string {
+construct_symbol_docs :: proc(symbol: Symbol, allocator := context.temp_allocator) -> string {
sb := strings.builder_make(allocator = allocator)
if symbol.doc != "" {
strings.write_string(&sb, symbol.doc)
- if symbol.comment != "" {
- strings.write_string(&sb, "\n")
- }
}
if symbol.comment != "" {
- if markdown {
- fmt.sbprintf(&sb, "\n```odin\n%s\n```", symbol.comment)
- } else {
- fmt.sbprintf(&sb, "\n%s", symbol.comment)
+ if symbol.doc != "" {
+ strings.write_string(&sb, DOC_SECTION_DELIMITER)
}
+ strings.write_string(&sb, symbol.comment)
}
return strings.to_string(sb)
@@ -848,6 +848,9 @@ write_symbol_name :: proc(sb: ^strings.Builder, symbol: Symbol) {
} else if pkg != "" && pkg != "$builtin" {
fmt.sbprintf(sb, "%v.", pkg)
}
+ if .PolyType in symbol.flags {
+ strings.write_string(sb, "$")
+ }
strings.write_string(sb, symbol.name)
}