aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/treesitter/dev.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-09-27 03:27:00 -0700
committerGitHub <noreply@github.com>2024-09-27 03:27:00 -0700
commitb63cd8cbaec1518b6580bf6e07e75a72c8779253 (patch)
treef2f9f38c5496bd7d37258c7420802e71d1719b25 /runtime/lua/vim/treesitter/dev.lua
parent6f2fe8a791646d6d662e89d7eccf6c515ccc9c8c (diff)
downloadrneovim-b63cd8cbaec1518b6580bf6e07e75a72c8779253.tar.gz
rneovim-b63cd8cbaec1518b6580bf6e07e75a72c8779253.tar.bz2
rneovim-b63cd8cbaec1518b6580bf6e07e75a72c8779253.zip
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.
Diffstat (limited to 'runtime/lua/vim/treesitter/dev.lua')
-rw-r--r--runtime/lua/vim/treesitter/dev.lua7
1 files changed, 4 insertions, 3 deletions
diff --git a/runtime/lua/vim/treesitter/dev.lua b/runtime/lua/vim/treesitter/dev.lua
index 606d5b27b9..2a6e166ef1 100644
--- a/runtime/lua/vim/treesitter/dev.lua
+++ b/runtime/lua/vim/treesitter/dev.lua
@@ -153,7 +153,7 @@ end
---@param w 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].wrap = false
vim.wo[w].foldmethod = 'expr'
@@ -164,6 +164,7 @@ local function set_dev_properties(w, b)
vim.bo[b].buftype = 'nofile'
vim.bo[b].bufhidden = 'wipe'
vim.bo[b].filetype = 'query'
+ vim.bo[b].swapfile = false
end
--- Updates the cursor position in the inspector to match the node under the cursor.
@@ -354,7 +355,7 @@ function M.inspect_tree(opts)
vim.b[buf].dev_inspect = w
vim.b[b].dev_base = win -- base window handle
vim.b[b].disable_query_linter = true
- set_dev_properties(w, b)
+ set_dev_options(w, b)
local title --- @type string?
local opts_title = opts.title
@@ -606,7 +607,7 @@ function M.edit_query(lang)
vim.b[buf].dev_edit = query_win
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,
-- so we add the parser's language to the buffer's name so that omnifunc