monkoose / matchparen.nvim Goto Github PK
View Code? Open in Web Editor NEWalternative to matchparen neovim plugin
License: MIT License
alternative to matchparen neovim plugin
License: MIT License
After reformatting a file with vim.lsp.buf.format{async=true}
I get the error below. This occurs in Clojure file, if that matters. Then if I reformat again immediately, the error does not happen. But after a while, if I reformat, then the error occurs again.
Error detected while processing CursorMoved Autocommands for "*":
Error executing lua callback: ...rko/nvim/share/nvim/runtime/lua/vim/treesitter/query.lua:422: bad argument #2 to 'handler' (string expected, got nil)
stack traceback:
[C]: in function 'handler'
...rko/nvim/share/nvim/runtime/lua/vim/treesitter/query.lua:422: in function 'match_preds'
...rko/nvim/share/nvim/runtime/lua/vim/treesitter/query.lua:508: in function '(for generator)'
...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:45: in function 'cache_nodes'
...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:59: in function 'get_skip_node'
...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:158: in function 'skip_by_region'
...k/packer/start/matchparen.nvim/lua/matchparen/search.lua:162: in function 'match_pos'
...acker/start/matchparen.nvim/lua/matchparen/highlight.lua:108: in function 'update'
...ite/pack/packer/start/matchparen.nvim/lua/matchparen.lua:63: in function <...ite/pack/packer/start/matchparen.nvim/lua/matchparen.lua:63>
When starting up neovim with multiple arguments (and with on_startup
set to true), e.g. nvim file1 file2
, I get this error:
Error detected while processing CursorMoved Autocommands for "*":
E5108: Error executing lua ....vim/bundle/matchparen.nvim/lua/matchparen/highlight.lua:59: attempt to index field 'matchpairs' (a nil value)
stack traceback:
....vim/bundle/matchparen.nvim/lua/matchparen/highlight.lua:59: in function 'update'
[string ":lua"]:1: in main chunk
It seems like the update()
function is getting executed before conf.matchpairs
is defined. I've tried two fixes for this locally. One is to add a check for matchpairs
existing before executing update()
diff --git i/lua/matchparen/highlight.lua w/lua/matchparen/highlight.lua
index abc6b7f..474deb1 100644
--- i/lua/matchparen/highlight.lua
+++ w/lua/matchparen/highlight.lua
@@ -33,6 +33,7 @@ end
-- and then if there is matching brackets pair at the new cursor position highlight them
function M.update(in_insert)
M.remove()
+ if not conf.matchpairs then return end
vim.g.matchparen_tick = vim.api.nvim_buf_get_changedtick(0)
local line, col = utils.get_current_pos()
Since this plugin is so performance sensitive I'm a bit wary of adding any code to the update function, although checking if a key exists in a table should only take a fraction of a millisecond.
The other fix is a simple workaround of setting on_startup
to false, and then calling MatchParenEnable
on a VimEnter
autocmd. I suppose this autocmd could conditionally be added in create_autocmds()
if on_startup
is true, which should also work. Not sure which approach you'd prefer so not opening a PR, but happy to do that if you want to go down any of those routes.
it seems the vim regex engine cant highlight the quote correctly, I don't know if treesitter can highlight it
While scrolling through terraform file I get following error:
Error detected while processing CursorMoved Autocommands for "*":
Error executing lua callback: ...5efc2/share/nvim/runtime/lua/vim/treesitter/language.lua:25: no parser for 'terraform' language, see :help treesitter-parsers
stack traceback:
[C]: in function 'error'
...5efc2/share/nvim/runtime/lua/vim/treesitter/language.lua:25: in function 'require_language'
...m/HEAD-a75efc2/share/nvim/runtime/lua/vim/treesitter.lua:39: in function '_create_parser'
...m/HEAD-a75efc2/share/nvim/runtime/lua/vim/treesitter.lua:94: in function 'get_parser'
...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:119: in function 'get_tree_root'
...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:191: in function 'skip_by_region'
...k/packer/start/matchparen.nvim/lua/matchparen/search.lua:162: in function 'match_pos'
...acker/start/matchparen.nvim/lua/matchparen/highlight.lua:99: in function 'update'
...ite/pack/packer/start/matchparen.nvim/lua/matchparen.lua:60: in function <...ite/pack/packer/start/matchparen.nvim/lua/matchparen.lua:60>
I do have hcl
parser installed (there is no terraform
parser).
matchparen.nvim version: 308dfed
Neovim: NVIM v0.8.0-dev+1517-ga75efc237
I installed matchparen exactly as the readme states, however in the config file when I require('matchparen') neovim throws an error. I made sure to set:
vim.g.loaded_matchparen = 1
so I am at a bit of a loss as to what to do here.
I am on the latest neovim nightly/maybe a little ahead since I built from source from git.
Edit: Tried it from a standard nightly build from a few days ago I had installed but aliased. Still doesn't work :(
Error executing Lua callback: .../packer/opt/matchparen.nvim/lua/matchparen/highlight.lua:47: attempt to index a nil value
stack traceback:
.../packer/opt/matchparen.nvim/lua/matchparen/highlight.lua:47: in function 'highlight_brackets'
.../packer/opt/matchparen.nvim/lua/matchparen/highlight.lua:101: in function 'update'
.../site/pack/packer/opt/matchparen.nvim/lua/matchparen.lua:86: in function <.../site/pack/packer/opt/matchparen.nvim/lua/matchparen.lua:83>
use { 'monkoose/matchparen.nvim',
opt = true,
ft = {
'lua',
'js', 'javascript',
'ts', 'typescript',
'html', 'njk', 'ejs', 'jinja',
'fish', 'bash', 'sh',
'json',
},
config = function()
require'matchparen'.setup {
on_startup = false,
hl_group = 'MatchParen',
}
end }
NVIM v0.7.0
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by brew@BigSur
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/local/Cellar/neovim/0.7.0/share/nvim"
Run :checkhealth for more info
Love the simplicity of this plugin! I would like, however, to be able to configure how matched characters are identified.
When inlay hints are enabled the first hint next to the opening parentheses is highlighted as a matching parentheses.
The only reason I can't leave vim-matchup :(
Got this error message:
Error in packer_compiled: .../packer/start/matchparen.nvim/lua/matchparen/options.lua:32: bad argument #1 to 'pairs' (table expected , got nil) Please check your config for correctness
Could you fix it?
ps: related configuration:
use {
'monkoose/matchparen.nvim',
config = [[require('matchparen').setup()]],
}
test.py
print("{([(})])}")
nvim version:NVIM v0.7.0-dev+839-g09d270bcea
matchparen.nvim conf: default
treesitter: installed python
This bug appears after lastest refactor so I guess you introduce some broken.
Error detected while processing CursorMoved Autocommands for "*":
Error executing lua callback: ...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:36: attempt to call field 'is_in_node_range' (a nil value)
stack traceback:
...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:36: in function 'get_skip_node'
...cker/start/matchparen.nvim/lua/matchparen/treesitter.lua:130: in function 'skip_by_region'
...k/packer/start/matchparen.nvim/lua/matchparen/search.lua:159: in function 'match_pos'
...acker/start/matchparen.nvim/lua/matchparen/highlight.lua:72: in function 'update'
...ite/pack/packer/start/matchparen.nvim/lua/matchparen.lua:60: in function <...ite/pack/packer/start/matchparen.nvim/lua/matchparen.lua:60>
NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
Compiled by builduser
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "$VIM/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
I get error that default MatchParen is active- even though, if I understand this correctly, I have set: vim.g.loaded_matchparen = 1 - which should disable default matchParent right?
use {
"monkoose/matchparen.nvim",
disable = false, -- what idt does? - faster highlight (), [], & {} compared to vim builtin matchparen
config = function()
vim.g.loaded_matchparen = 1
require("matchparen").setup()
end,
}
ERROR
nodes somewhere inside current tree will break highlighting of matching brackets too, this one is definitely a syntax error, can't be fixed with current implementationwhen I enter on neovim I get this error
then I run :MatchParenError
and I get this error
after that, the plugin seems to partially work but it still matches on comments/strings
https://gyazo.com/f9bd2bb2abafdcafc8825744cfa9edc7
btw I have disabled the builtin matchparen plugin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.