From e638b9356bd6e71cb9609f40ebcb7fdec7b543c3 Mon Sep 17 00:00:00 2001 From: Aliaksandr Trush Date: Wed, 25 Sep 2024 21:27:57 +0200 Subject: [PATCH] fix: update cursor position calculation (#229) Lua arrays start from 1, but server requires indexes starting from 0 --- lua/codeium/source.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lua/codeium/source.lua b/lua/codeium/source.lua index e82d129..82fba43 100644 --- a/lua/codeium/source.lua +++ b/lua/codeium/source.lua @@ -185,7 +185,7 @@ function Source:complete(params, callback) text = text, editor_language = filetype, language = language, - cursor_position = { row = cursor.row, col = cursor.col }, + cursor_position = { row = cursor.row - 1, col = cursor.col - 1 }, absolute_uri = 'file://' .. vim.api.nvim_buf_get_name(bufnr), workspace_uri = 'file://' .. util.get_relative_path(bufnr), line_ending = line_ending, @@ -205,6 +205,7 @@ function Source:complete(params, callback) end end ) + end return Source