summaryrefslogtreecommitdiff
path: root/ide-definitions.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2023-08-04 21:39:13 -0400
committerpommicket <pommicket@gmail.com>2023-08-04 21:42:53 -0400
commit49ab483be3e7af88a3932a43f222aa42cacd3515 (patch)
tree9ad0157a22ed6cd9c54458b6c75ffa7eaa2253e7 /ide-definitions.c
parentce199f9384f9f9376417110574a07cfd731e3a79 (diff)
document links seem to be working
Diffstat (limited to 'ide-definitions.c')
-rw-r--r--ide-definitions.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/ide-definitions.c b/ide-definitions.c
index 103d8c4..f5e37b6 100644
--- a/ide-definitions.c
+++ b/ide-definitions.c
@@ -176,7 +176,21 @@ void definitions_process_lsp_response(Ted *ted, LSP *lsp, const LSPResponse *res
const LSPResponseDefinition *response_def = &response->data.definition;
if (!arr_len(response_def->locations)) {
- // no definition. do the error cursor.
+ // no definition.
+ const char* link = NULL;
+
+ // check for document links
+ TextBuffer *buffer = ted->active_buffer;
+ if (buffer) {
+ BufferPos pos = buffer_pos_from_lsp(buffer, response->request.data.definition.position.pos);
+ link = document_link_at_buffer_pos(ted, pos);
+ if (link) {
+ open_with_default_application(link);
+ return;
+ }
+ }
+
+ // do the error cursor.
ted_flash_error_cursor(ted);
return;
}