-
Notifications
You must be signed in to change notification settings - Fork 20
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
Handling cases when cursor is not at the end of line #36
Comments
Yes it would be undesirable. I don't want to not add an The code for this is at https://github.com/RRethy/nvim-treesitter-endwise/blob/master/lua/nvim-treesitter/endwise.lua#L81. This test shows what happens, https://github.com/RRethy/nvim-treesitter-endwise/blob/master/tests/endwise/lua.rb#L185-L189. |
For what it's worth, there is no perfect solution for this since we don't get a full syntax tree, we have to interpret a broken syntax tree, these are tradeoffs I made a long time ago and honestly aren't going to change. |
Yes, I have noticed. It works great in cases like
but not when it is in front of " Sow how about adding these some punctuation mark characters to the regexp here https://github.com/RRethy/nvim-treesitter-endwise/blob/master/lua/nvim-treesitter/endwise.lua#L81? |
Is your feature request related to a problem? Please describe.
When working on #35, I struggled a lot when dealing with cases when the cursor is not at the very end of the line.
Pseudocode examples:
leads to
or for example
leads to
I guess this behavior applies to multiple languages, not only julia. For example, try the following test for lua:
Maybe I'm missing something, but writing this in TS queries seems quite difficult — I have to always capture the last
")"
, which leads to many corner cases and queries become large.Describe the solution you'd like
I have only written some queries and I don't know anything about internals of this plugin. What is the preferred way to deal with that?
What if the following heuristic was used: Whenever on the current line there still is a non-whitespace character after the cursor, do not add an
"end"
? Is there any case where this would be undesirable?Thanks!
The text was updated successfully, but these errors were encountered: