Closed npduykhoa closed 1 month ago
Sorry, but I was unable to reproduce how this issue occurred.
and the treesitter parser for jsx is same as javascript, so I am not sure what cause this problem...
Could you record a video or GIF to demonstrate this bug? and can you provide the config file about how to config chunk
I will close this issue for now, and if there are any new developments, I will reopen it~
Hi @shellRaining,
I have fixed this problem by remove (rm -rf) folder plugged/ (where contain plugins installed) and then re-install all plugins.
So, I think the issue I encountered before was due to "hlchunk" conflicting with one or some plugins (may be nvim-treesitter old version), resulting in the chunks not working as expected in JSX and TSX files.
Now, chunk has been worked in JSX and TSX.
**Working in JSX https://github.com/shellRaining/hlchunk.nvim/assets/55375876/99313790-a6b0-4851-a608-f3b22f147002
**Working in TSX
Thank you for creating this wonderful plugin, @shellRaining .
Glad to know that you have solved the problem. If you encounter any new bugs, please feel free to let me know at any time.
Chunk is highlighting the sibling relationship here instead of the whole scope of the parent tag.
I've seen it does this a lot in .tsx
files, is this normal?
@ic-768 seems not correct... can you provide this piece of code, I write a test code but not reproduce this bug, and can you share the config of hlchunk (include version)
@ic-768 seems not correct... can you provide this piece of code, I write a test code but not reproduce this bug, and can you share the config of hlchunk (include version)
here's a simpler example:
const Test = () => {
return (
<div>
<span>test</span>
<span>test</span>
</div>
);
};
hlchunk installation using lazy.nvim:
plugin.lua:
return {
"shellRaining/hlchunk.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
require("hlchunk").setup({
chunk = {
enable = true,
chars = {
horizontal_line = "─",
vertical_line = "│",
left_top = "╭",
left_bottom = "╰",
right_arrow = ">",
},
style = "#806d9c",
},
})
end
},
not sure how to get the version, but I just installed it today
oh I found why cause this, I was using the JSX file type earlier, which prevented the bug from being reproduced. I will attempt to fix it~
The behavior of the TSX parser and the JSX parser is different.
tsx:
jsx:
for the code you provide, tsx mark the jsx_element
node start from 18-19, but jsx mark from 19-19. The former's judgment includes spaces and line breaks, but this behavior is quite strange, leading to your bug.
so it's hard to fix unless tsx parser become more precise...
The behavior of the TSX parser and the JSX parser is different.
tsx:
jsx:
for the code you provide, tsx mark the
jsx_element
node start from 18-19, but jsx mark from 19-19. The former's judgment includes spaces and line breaks, but this behavior is quite strange, leading to your bug.so it's hard to fix unless tsx parser become more precise...
Ahh that makes sense.. Thanks for all your work anyway :)
thanks for the beautiful plugin, coming from indent-blankline.nvim for me chunk not working for me for .java file - reinstalling hlchunk didn't work
any one else have problem with .java files? any fixes or work arounds?
@lazydeveloper maybe you should reinstall java treesitter parser, It works for me
https://github.com/user-attachments/assets/62a42cdf-9b81-4a3f-93fd-c36d060b83e3
@shellRaining Installing Treesitter fixed my problem. Cheers!
Here's my config - might come handy if someone else having the same issue.
{
'nvim-treesitter/nvim-treesitter',
run = ':TSUpdate',
config = function()
require'nvim-treesitter.configs'.setup {
ensure_installed = {
"java", "python", "javascript", "html", "css"
},
sync_install = false,
auto_install = true,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
}
end
},
The behavior of the TSX parser and the JSX parser is different.
tsx:
jsx:
for the code you provide, tsx mark the
jsx_element
node start from 18-19, but jsx mark from 19-19. The former's judgment includes spaces and line breaks, but this behavior is quite strange, leading to your bug.so it's hard to fix unless tsx parser become more precise...
@shellRaining, do you think anything can be done about this? It just updated all the plugins today (after around 8months) and suddenly this issue popped up.
Thanks for this awesome plugin!!!
@dhruvindsd-dev I'm sorry, I don't have a good solution to this problem yet, and I've recently started an internship and found some other things that interest me, so it might be a long time before this issue gets resolved.
No worries @shellRaining , thanks for the update!
For anyone else facing this issue, I've found the older version of nvim-treesitter-textobjects
and treesitter
work.
You can use these specific commits:
{
"nvim-treesitter/nvim-treesitter-textobjects",
commit = "95933e762e28f9d38b572d65e7e4da9d2f4d90cb",
},
{
"nvim-treesitter/nvim-treesitter",
commit = "62b0bb4f24ad09f535efe44cc9d088f90dcd2498",
},
now seems work properly, close temporarily
Describe the bug I'm having issues with "chunk" in the filetypes: jsx and tsx. The chunks don't seem to work even though I've checked that the plugin supports both in support_filetypes.
I have tested it with file formats .lua or .js, and the chunking works fine in those cases.
Screenshots
Chunk working with .lua and .js:
Chunk NOT working with .jsx and .tsx:
Thank you, and I look forward to receiving a prompt response from you.