Wrong matching across strings
Isrothy opened this issue · comments
Explain the issue
- What vim version are you using? If using neovim, Are you using
tree-sitter or classic matching?
❯ nvim --version
NVIM v0.10.0-dev-1031+gc431d820e
Build type: RelWithDebInfo
LuaJIT 2.1.1693350652
Run "nvim -V1 -v" for more info
Both tree-sitter and classic matching produce this bug
- Steps to reproduce
In a file, write two strings.
One string contains a '{' and another contains a '}'
For example
local s1 = "{...."
local s2 = ".....}"
Then move the cursor onto on of the dots.
- Expected behavior
No parentheses is highlighted
- Observed behavior
The parentheses are highlighted
Minimal working example
local s1 = "{...."
local s2 = ".....}"
Minimal vimrc file
I'm using lazy for neovim
{
"andymass/vim-matchup",
init = function()
vim.g.loaded_matchparen = 1
vim.g.matchup_matchparen_deferred = 1
vim.g.matchup_matchparen_hi_surround_always = 1
end,
}
Does the following option do what you want (disable matching in strings)?
let g:matchup_delim_noskips = 2
Unfortunately, I don't see any way in treesitter to match this
local s3 = "{.....}"
but not this
local s1 = "{...."
local s2 = ".....}"
as the braces are not tree nodes.
Thank you for your reply.
I tried this method. It works without vim.g.matchup_matchparen_hi_surround_always = 1
. No matching in strings.
However, if I turn on vim.g.matchup_matchparen_hi_surround_always
and matchup_matchparen_deferred
, this issue still exists.