Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ignore buf without file path #271

Merged
merged 1 commit into from
Jan 5, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lua/codeium/source.lua
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@ function Source:complete(params, callback)
local line_ending = util.get_newline(bufnr)
local line_ending_len = utf8len(line_ending)
local editor_options = util.get_editor_options(bufnr)
local buf_name = vim.api.nvim_buf_get_name(bufnr)

if buf_name == "" then
callback(nil)
return
end

-- We need to calculate the number of bytes prior to the current character,
-- that starts with all the prior lines
Expand Down Expand Up @@ -163,7 +169,7 @@ function Source:complete(params, callback)
editor_language = filetype,
language = language,
cursor_position = { row = cursor.row - 1, col = cursor.col - 1 },
absolute_uri = util.get_uri(vim.api.nvim_buf_get_name(bufnr)),
absolute_uri = util.get_uri(buf_name),
workspace_uri = util.get_uri(util.get_project_root()),
line_ending = line_ending,
cursor_offset = cursor_offset,
Expand Down
Loading