diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2022-01-27 13:53:35 +0100 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2022-01-27 13:53:35 +0100 |
| commit | f72c31da801b526e2c0f15e84afee0fdb21ce381 (patch) | |
| tree | d9f00d827e4c05ddc8440f5bee66266ef1491221 /src/server/document_links.odin | |
| parent | 7e39136c69e8d29b2f1f3f804aa72c6e655a5691 (diff) | |
document links work
Diffstat (limited to 'src/server/document_links.odin')
| -rw-r--r-- | src/server/document_links.odin | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/server/document_links.odin b/src/server/document_links.odin index 205e9bc..9295c33 100644 --- a/src/server/document_links.odin +++ b/src/server/document_links.odin @@ -25,6 +25,20 @@ get_document_links :: proc(document: ^common.Document) -> ([]DocumentLink, bool) links := make([dynamic]DocumentLink, 0, context.temp_allocator); for imp in document.ast.imports { + if len(imp.relpath.text) <= 1 { + continue; + } + + e := strings.split(imp.relpath.text[1:len(imp.relpath.text)-1], ":", context.temp_allocator); + + if len(e) != 2 { + continue; + } + + if e[0] != "core" { + continue; + } + //Temporarly assuming non unicode node := ast.Node { pos = { @@ -43,7 +57,7 @@ get_document_links :: proc(document: ^common.Document) -> ([]DocumentLink, bool) link := DocumentLink { range = range, - target = "https://code.visualstudio.com/docs/extensions/overview#frag", + target = fmt.tprintf("https://pkg.odin-lang.org/%v/%v", e[0], e[1]), tooltip = "Documentation", }; |