feat: allow excluding filetypes from selector autolaunch. (#1937)
Co-authored-by: doodleEsc <cokie@foxmail.com> Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
This commit is contained in:
@@ -522,6 +522,7 @@ M._defaults = {
|
|||||||
---@alias avante.SelectorProvider "native" | "fzf_lua" | "mini_pick" | "snacks" | "telescope" | fun(selector: avante.ui.Selector): nil
|
---@alias avante.SelectorProvider "native" | "fzf_lua" | "mini_pick" | "snacks" | "telescope" | fun(selector: avante.ui.Selector): nil
|
||||||
provider = "native",
|
provider = "native",
|
||||||
provider_opts = {},
|
provider_opts = {},
|
||||||
|
exclude_auto_select = {}, -- List of items to exclude from auto selection
|
||||||
},
|
},
|
||||||
suggestion = {
|
suggestion = {
|
||||||
debounce = 600,
|
debounce = 600,
|
||||||
|
|||||||
@@ -1548,6 +1548,10 @@ function Sidebar:initialize()
|
|||||||
|
|
||||||
if not self.code.bufnr or not api.nvim_buf_is_valid(self.code.bufnr) then return self end
|
if not self.code.bufnr or not api.nvim_buf_is_valid(self.code.bufnr) then return self end
|
||||||
|
|
||||||
|
-- check if the filetype of self.code.bufnr is disabled
|
||||||
|
local buf_ft = api.nvim_get_option_value("filetype", { buf = self.code.bufnr })
|
||||||
|
if vim.list_contains(Config.selector.exclude_auto_select, buf_ft) then return self end
|
||||||
|
|
||||||
local buf_path = api.nvim_buf_get_name(self.code.bufnr)
|
local buf_path = api.nvim_buf_get_name(self.code.bufnr)
|
||||||
-- if the filepath is outside of the current working directory then we want the absolute path
|
-- if the filepath is outside of the current working directory then we want the absolute path
|
||||||
local filepath = Utils.file.is_in_cwd(buf_path) and Utils.relative_path(buf_path) or buf_path
|
local filepath = Utils.file.is_in_cwd(buf_path) and Utils.relative_path(buf_path) or buf_path
|
||||||
|
|||||||
Reference in New Issue
Block a user