diff options
| author | Daniel Gavin <danielgavin5@hotmail.com> | 2022-01-22 18:59:40 +0100 |
|---|---|---|
| committer | Daniel Gavin <danielgavin5@hotmail.com> | 2022-01-22 18:59:40 +0100 |
| commit | 165fdbc58c647f97dbdb3b5903b4826b022f02f9 (patch) | |
| tree | 89ff1ff9ec88f0d0c615067b5b32fb97ed39342b /src/server/document_links.odin | |
| parent | 989345d0438429ae719287f9c7343f87b558f7e3 (diff) | |
Move the std in reading to be async with it's own seperate thread.
Diffstat (limited to 'src/server/document_links.odin')
| -rw-r--r-- | src/server/document_links.odin | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/src/server/document_links.odin b/src/server/document_links.odin new file mode 100644 index 0000000..205e9bc --- /dev/null +++ b/src/server/document_links.odin @@ -0,0 +1,54 @@ +package server + +import "core:odin/parser" +import "core:odin/ast" +import "core:odin/tokenizer" +import "core:fmt" +import "core:log" +import "core:strings" +import path "core:path/slashpath" +import "core:mem" +import "core:strconv" +import "core:path/filepath" +import "core:sort" +import "core:slice" +import "core:os" + + +import "shared:common" +import "shared:index" +import "shared:analysis" + +get_document_links :: proc(document: ^common.Document) -> ([]DocumentLink, bool) { + using analysis; + + links := make([dynamic]DocumentLink, 0, context.temp_allocator); + + for imp in document.ast.imports { + //Temporarly assuming non unicode + node := ast.Node { + pos = { + offset = imp.relpath.pos.offset, + column = imp.relpath.pos.column, + line = imp.relpath.pos.line, + }, + end = { + offset = imp.relpath.pos.offset + len(imp.relpath.text) - 1, + column = imp.relpath.pos.column + len(imp.relpath.text) - 1, + line = imp.relpath.pos.line, + }, + } + + range := common.get_token_range(node, string(document.text)); + + link := DocumentLink { + range = range, + target = "https://code.visualstudio.com/docs/extensions/overview#frag", + tooltip = "Documentation", + }; + + append(&links, link); + } + + return links[:], true; +} |