Skip to content

Commit

Permalink
Set disable_completion_within_the_line
Browse files Browse the repository at this point in the history
  • Loading branch information
luozhiya committed Jun 7, 2024
1 parent 850ea92 commit c1c13ef
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
10 changes: 3 additions & 7 deletions lua/fittencode/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,6 @@ local defaults = {
},
}

-- Private options
M.internal = {
virtual_text = {
inline = vim.fn.has('nvim-0.10') == 1,
},
}

---@param opts? FittenCodeOptions
function M.setup(opts)
---@class FittenCodeOptions
Expand All @@ -159,6 +152,9 @@ function M.setup(opts)
M.options.keymaps.inline = {}
M.options.keymaps.chat = {}
end
if vim.fn.has('nvim-0.10') ~= 1 then
M.options.inline_completion.disable_completion_within_the_line = true
end
end

return M
2 changes: 1 addition & 1 deletion lua/fittencode/sessions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ local function make_generate_one_stage_params(opts)
if prompt == nil then
return
end
if prompt.within_the_line and (not Config.internal.virtual_text.inline or Config.options.inline_completion.disable_completion_within_the_line) then
if prompt.within_the_line and Config.options.inline_completion.disable_completion_within_the_line then
return
end
local fc_prompt = '!FCPREFIX!' .. prompt.prefix .. '!FCSUFFIX!' .. prompt.suffix .. '!FCMIDDLE!'
Expand Down
2 changes: 1 addition & 1 deletion lua/fittencode/views/lines.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ local function set_extmark(virt_text, hl_mode)
local row, col = Base.get_cursor()
local ids = {}

if Config.internal.virtual_text.inline then
if vim.fn.has('nvim-0.10') == 1 then
ids[#ids + 1] = api.nvim_buf_set_extmark(0, namespace, row, col, {
virt_text = virt_text[1],
virt_text_pos = 'inline',
Expand Down

0 comments on commit c1c13ef

Please sign in to comment.