-
-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: tsx node renaming #201
Conversation
Hey there, thanks for the PR! Apologies for missing this yesterday 😅. I'll be looking at this more in depth later today in the afternoon. Based on a cursory glance though (from my phone), would it be possible to reparse the tree if the initial text for the node comes up empty? If not, no problem, I'm quite literally throwing an idea at the wall and hoping it sticks -- not actually at a computer to test that idea. |
@PriceHiller Hi! I am not sure that I get it correctly. Do you mean to reparse the tree instead of just fix validation function? Probably in this case we mustn't use |
Don't worry about it, my comment was in error. If you can get those tests passing that would be great! As it stands, I think all rename behavior for |
d970750
to
6c42f2b
Compare
6c42f2b
to
7f9f55b
Compare
The problem of other tests is in rescript files. I suggest to merge what we have now. Also I moved this fix from validation function to |
Sounds good to me 🙂. Seems we still have a test failure going on, which is irrititating, but this does resolve most test failures so we'll roll with it. Thanks for the work here! |
Hello!
I've faced with issue when renaming tags works differently for
tsx
andjsx
files.Sometimes renaming doesn't work for
tsx
nodes, but it's fine withjsx
.I think it's related to #190
The problem is
vim.treesitter.get_node_text
return empty lines and lines with spaces fortsx
nodes so validation failed.I'm not sure that this is the right way to fix it. But I'm not familiar with treesitter. Probably it should be fixed there or in parser.
How to check it:
Just try to rename any node in tsx file
https://github.com/inferst/vite-react-ts/blob/master/src/App.tsx
Without fix:
wofix.mp4
With fix:
wfix.mp4