Skip to content

Commit 4abba49

Browse files
authored
chore: use nvim_get_option_value (#2422)
1 parent 723ca0e commit 4abba49

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

lua/codecompanion/providers/slash_commands/default.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function Default:buffers()
5252
local buffers = vim
5353
.iter(api.nvim_list_bufs())
5454
:filter(function(bufnr)
55-
return vim.fn.buflisted(bufnr) == 1 and api.nvim_buf_get_option(bufnr, "filetype") ~= "codecompanion"
55+
return vim.fn.buflisted(bufnr) == 1 and api.nvim_get_option_value("filetype", { buf = bufnr }) ~= "codecompanion"
5656
end)
5757
:map(function(bufnr)
5858
return buf_utils.get_info(bufnr)

lua/codecompanion/utils/buffers.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function M.get_info(bufnr)
5151

5252
return {
5353
bufnr = bufnr,
54-
filetype = api.nvim_buf_get_option(bufnr, "filetype"),
54+
filetype = api.nvim_get_option_value("filetype", { buf = bufnr }),
5555
number = bufnr,
5656
name = vim.fn.fnamemodify(bufname, ":t"),
5757
path = bufname,

lua/codecompanion/utils/context.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ local M = {}
66
---@return string
77
M.get_filetype = function(bufnr)
88
bufnr = bufnr or 0
9-
local ft = api.nvim_buf_get_option(bufnr, "filetype")
9+
local ft = api.nvim_get_option_value("filetype", { buf = bufnr })
1010

1111
if ft == "cpp" then
1212
return "C++"
@@ -122,7 +122,7 @@ function M.get(bufnr, args)
122122
mode = mode,
123123
is_visual = is_visual,
124124
is_normal = is_normal,
125-
buftype = api.nvim_buf_get_option(bufnr, "buftype") or "",
125+
buftype = api.nvim_get_option_value("buftype", { buf = bufnr }) or "",
126126
filetype = M.get_filetype(bufnr),
127127
filename = api.nvim_buf_get_name(bufnr),
128128
cursor_pos = cursor_pos,

0 commit comments

Comments
 (0)