Skip to content

Commit ebed4f7

Browse files
authored
fix: ignore buf without file path (#271)
1 parent 27d2b1c commit ebed4f7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lua/codeium/source.lua

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,12 @@ function Source:complete(params, callback)
123123
local line_ending = util.get_newline(bufnr)
124124
local line_ending_len = utf8len(line_ending)
125125
local editor_options = util.get_editor_options(bufnr)
126+
local buf_name = vim.api.nvim_buf_get_name(bufnr)
127+
128+
if buf_name == "" then
129+
callback(nil)
130+
return
131+
end
126132

127133
-- We need to calculate the number of bytes prior to the current character,
128134
-- that starts with all the prior lines
@@ -163,7 +169,7 @@ function Source:complete(params, callback)
163169
editor_language = filetype,
164170
language = language,
165171
cursor_position = { row = cursor.row - 1, col = cursor.col - 1 },
166-
absolute_uri = util.get_uri(vim.api.nvim_buf_get_name(bufnr)),
172+
absolute_uri = util.get_uri(buf_name),
167173
workspace_uri = util.get_uri(util.get_project_root()),
168174
line_ending = line_ending,
169175
cursor_offset = cursor_offset,

0 commit comments

Comments
 (0)