monkoose / neocodeium

free AI completion plugin for neovim
MIT License
205 stars 8 forks source link

could you please add an option to disable all filetypes except the few I enable in the filetypes table #13

Closed gaven140 closed 4 weeks ago

gaven140 commented 3 months ago

Problem

An option to disable for all filetypes except the ones I explicitly enable in the filetypes table.

Expected behavior

filetypes = {
  all = false,
  lua = true,
  python = true,
  ...
}

-- OR
filetypes_disable_all = true,
filetypes = {
  -- filetypes to enable
}
monkoose commented 4 weeks ago

@gaven140 I have implemented possibility for enabled option to be a function. So you can implement whatever logic you want to disable in specific buffer or another required situations (like for whole privacy required projects etc).

For your request it would be something like

local filetyps = { 'lua', 'python' }
neocodeium.setup({
   -- function accepts one argument `bufnr`
   enabled = function(bufnr)
      if vim.tbl_contains(filetypes, vim.api.nvim_get_option_value('filetype',  { buf = bufnr})) then
         return true
      end
      return false
   end
})

I had some RL issues, so it has taken that much time.