Check that the goto definition cursor is within bounds

This commit is contained in:
Alexandros Naskos 2020-05-21 20:51:03 +03:00
parent 44f33c631b
commit 2eab5e036d

View File

@ -283,6 +283,7 @@ fn nodeToCompletion(list: *std.ArrayList(types.CompletionItem), analysis_ctx: *D
} }
fn identifierFromPosition(pos_index: usize, handle: DocumentStore.Handle) []const u8 { fn identifierFromPosition(pos_index: usize, handle: DocumentStore.Handle) []const u8 {
if (pos_index + 1 >= handle.document.text.len) return &[0]u8{};
var start_idx = pos_index; var start_idx = pos_index;
while (start_idx > 0 and while (start_idx > 0 and