mirror of
https://github.com/neovim/neovim.git
synced 2024-12-31 17:13:26 -07:00
fix(treesitter): EditQuery shows swapfile ATTENTION #30536
Problem:
EditQuery shows swapfile ATTENTION, but this buffer is not intended for
preservation (and the dialog breaks the UX).
Solution:
Set 'noswapfile' on the buffer before renaming it.
(cherry picked from commit b63cd8cbae
)
This commit is contained in:
parent
d535482ab2
commit
c9d7ad4a34
@ -154,7 +154,7 @@ end
|
|||||||
|
|
||||||
---@param w integer
|
---@param w integer
|
||||||
---@param b integer
|
---@param b integer
|
||||||
local function set_dev_properties(w, b)
|
local function set_dev_options(w, b)
|
||||||
vim.wo[w].scrolloff = 5
|
vim.wo[w].scrolloff = 5
|
||||||
vim.wo[w].wrap = false
|
vim.wo[w].wrap = false
|
||||||
vim.wo[w].foldmethod = 'expr'
|
vim.wo[w].foldmethod = 'expr'
|
||||||
@ -165,6 +165,7 @@ local function set_dev_properties(w, b)
|
|||||||
vim.bo[b].buftype = 'nofile'
|
vim.bo[b].buftype = 'nofile'
|
||||||
vim.bo[b].bufhidden = 'wipe'
|
vim.bo[b].bufhidden = 'wipe'
|
||||||
vim.bo[b].filetype = 'query'
|
vim.bo[b].filetype = 'query'
|
||||||
|
vim.bo[b].swapfile = false
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Updates the cursor position in the inspector to match the node under the cursor.
|
--- Updates the cursor position in the inspector to match the node under the cursor.
|
||||||
@ -349,7 +350,7 @@ function M.inspect_tree(opts)
|
|||||||
vim.b[buf].dev_inspect = w
|
vim.b[buf].dev_inspect = w
|
||||||
vim.b[b].dev_base = win -- base window handle
|
vim.b[b].dev_base = win -- base window handle
|
||||||
vim.b[b].disable_query_linter = true
|
vim.b[b].disable_query_linter = true
|
||||||
set_dev_properties(w, b)
|
set_dev_options(w, b)
|
||||||
|
|
||||||
local title --- @type string?
|
local title --- @type string?
|
||||||
local opts_title = opts.title
|
local opts_title = opts.title
|
||||||
@ -586,7 +587,7 @@ function M.edit_query(lang)
|
|||||||
|
|
||||||
vim.b[buf].dev_edit = query_win
|
vim.b[buf].dev_edit = query_win
|
||||||
vim.bo[query_buf].omnifunc = 'v:lua.vim.treesitter.query.omnifunc'
|
vim.bo[query_buf].omnifunc = 'v:lua.vim.treesitter.query.omnifunc'
|
||||||
set_dev_properties(query_win, query_buf)
|
set_dev_options(query_win, query_buf)
|
||||||
|
|
||||||
-- Note that omnifunc guesses the language based on the containing folder,
|
-- Note that omnifunc guesses the language based on the containing folder,
|
||||||
-- so we add the parser's language to the buffer's name so that omnifunc
|
-- so we add the parser's language to the buffer's name so that omnifunc
|
||||||
|
Loading…
Reference in New Issue
Block a user