Compare commits

...

5 Commits

Author SHA1 Message Date
roycrippen4
80f264b43b
Merge c1735fccaedbf2741d31eb4a1cf5d08376eed8c0 into 323a3e16ed603e2e17b26b1c836d1e86c279f726 2024-07-14 13:39:06 -04:00
roycrippen4
c1735fccae Merge branch 'windwp:main' into fix-#199 2024-07-14 13:36:37 -04:00
windwp
323a3e16ed fix: map Insertleave by buffer. 2024-07-07 15:07:44 +07:00
ddfccbf0df
Merge pull request #198 from mbromell/patch-1
fix: error message when using nvim-treesitter 'main' branch
2024-06-21 13:56:10 -05:00
mbromell
30aea007e0
Stop error message when using 'main' branch treesitter 2024-06-19 21:00:25 +01:00
2 changed files with 8 additions and 8 deletions

View File

@ -9,6 +9,9 @@ function M.init()
if not nvim_ts then
return
end
if nvim_ts.define_modules == nil then
return
end
nvim_ts.define_modules({
autotag = {
attach = function(bufnr, _)

View File

@ -245,9 +245,9 @@ end
local function is_react_file()
local ft = vim.bo.ft
-- check filetypes first.
if ft == 'javascriptreact' or 'typescriptreact' then
if ft == "javascriptreact" or "typescriptreact" then
return true
elseif ft ~= 'javascript' then
elseif ft ~= "javascript" then
return false
end
@ -263,7 +263,7 @@ local function is_react_file()
local root = tree[1]:root()
-- parse the tree for jsx nodes
local query = vim.treesitter.query.parse('javascript', [[
local query = vim.treesitter.query.parse("javascript", [[
(jsx_element)
(jsx_self_closing_element)
]])
@ -494,7 +494,7 @@ M.attach = function(bufnr)
if TagConfigs:get(vim.bo.filetype) ~= nil then
setup_ts_tag()
local group = vim.api.nvim_create_augroup("nvim-ts-autotag", { clear = true })
local group = vim.api.nvim_create_augroup("nvim-ts-autotag-" .. bufnr, { clear = true })
if Setup.get_opts(vim.bo.filetype).enable_close then
vim.keymap.set("i", ">", function()
local row, col = unpack(vim.api.nvim_win_get_cursor(0))
@ -524,12 +524,9 @@ M.attach = function(bufnr)
})
end
if Setup.get_opts(vim.bo.filetype).enable_rename then
-- HACK: This does not bind to a specific buffer, unfortunately it seems doing so will
-- break rename when switching between different buffers. Making it *not* bind to a
-- specific buffer shouldn't cause any problems in theory. Ideally it would be bound per
-- buffer, but for now this works (and I'm lazy).
vim.api.nvim_create_autocmd("InsertLeave", {
group = group,
buffer = bufnr,
callback = M.rename_tag,
})
end