summaryrefslogtreecommitdiff
path: root/buffer.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-12-29 18:44:37 -0500
committerpommicket <pommicket@gmail.com>2022-12-29 18:44:37 -0500
commitd77782564bf0a090a4e7fa4f4c4bb685383275dc (patch)
treea4bc3c0bf142c663ea7f293b4381927adc896f1c /buffer.c
parent5f7af06a9085835a3d1ad3a51374c245859d7d97 (diff)
textDocument/definition for ctrl+click
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/buffer.c b/buffer.c
index 4562219..679da65 100644
--- a/buffer.c
+++ b/buffer.c
@@ -2489,12 +2489,14 @@ bool buffer_handle_click(Ted *ted, TextBuffer *buffer, v2 click, u8 times) {
break;
case KEY_MODIFIER_CTRL:
if (!buffer->is_line_buffer) {
+ // go to definition
buffer_cursor_move_to_pos(buffer, buffer_pos);
String32 word = buffer_word_at_cursor(buffer);
if (word.len) {
char *tag = str32_to_utf8_cstr(word);
if (tag) {
- tag_goto(buffer->ted, tag);
+ LSPDocumentPosition pos = buffer_pos_to_lsp_document_position(buffer, buffer_pos);
+ definition_goto(buffer->ted, buffer_lsp(buffer), tag, pos);
free(tag);
}
}