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 | |
| parent | 7e39136c69e8d29b2f1f3f804aa72c6e655a5691 (diff) | |
document links work
Diffstat (limited to 'src/server')
| -rw-r--r-- | src/server/document_links.odin | 16 | ||||
| -rw-r--r-- | src/server/requests.odin | 4 |
2 files changed, 17 insertions, 3 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", }; diff --git a/src/server/requests.odin b/src/server/requests.odin index 361c0cb..f2e481d 100644 --- a/src/server/requests.odin +++ b/src/server/requests.odin @@ -515,7 +515,7 @@ request_initialize :: proc (params: json.Value, id: RequestId, config: ^common.C tokenModifiers = token_modifiers, }, }, - inlayHintsProvider = true, + inlayHintsProvider = config.enable_inlay_hints, documentSymbolProvider = config.enable_document_symbols, hoverProvider = config.enable_hover, documentFormattingProvider = config.enable_format, @@ -989,7 +989,7 @@ request_inlay_hint :: proc (params: json.Value, id: RequestId, config: ^common.C hints: []InlayHint; - if cache_symbols, ok := file_resolve_cache.files[document.uri.uri]; ok && config.enable_inlay_hints { + if cache_symbols, ok := file_resolve_cache.files[document.uri.uri]; ok { hints, ok = get_inlay_hints(document, cache_symbols); } |