You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A trouble that I have is that when I hit v., the plugin will put the cursor on the next or preceding line. This is particularly biting me because I'd like to do v.. to expand the selection to grab the function along with its signature, but v. moves the cursor outside of the syntax nodes where the range would apply.
I'm not quite sure whose bug this is, or if it is an issue with my query in some way. It doesn't seem to happen when there's not whitespace surrounding the lines in question.
Minimal textsubjects query to reproduce the issue:
The issue is with how nvim-treesitter-textsubjects selects whitespace that surrounds the object. The plugin tries to be as smart of possible with whitespace and how it selects it, it also tries to somewhat mimic Neovim's behaviour with its other textobjects. If we take a look at a basic text file:
foobar
bazbin
tictac
If we put our cursor on bazbin and do a vap, it'll highlight the last two lines along with the whitespace line above it since for most common uses cases that would be the correct behaviour. This is mimic'd in nvim-treesitter-textsubjects and the behaviour you're seeing (see relevant code here ).
The placement of the cursor doesn't actually matter for your description (although fwiw we break from Neovim and put the cursor at the top of the selection not the bottom).
For now, I'd say maybe just put the function and signature together to get selected with v.. I'll leave this issue open though because I have a general idea on a non-invasive solution but it's going to take a bit of work but I'm busy rn. Essentially we should be able to modify this does_surround check to use prev_selections instead of the visual selection if the user is in the process of visually selecting text. I'll need to think about this a bit more though to consider any hidden ramifications.
Hi! I love your plugin and I'm currently implementing a Haskell query for it so I can use it at work. I'll PR it upstream after I have a week or two to smoke test it at work. Here's my current progress: https://github.com/lf-/dotfiles/blob/main/configs/nvim/after/queries/haskell/textsubjects-smart.scm
A trouble that I have is that when I hit
v.
, the plugin will put the cursor on the next or preceding line. This is particularly biting me because I'd like to dov..
to expand the selection to grab the function along with its signature, butv.
moves the cursor outside of the syntax nodes where the range would apply.I'm not quite sure whose bug this is, or if it is an issue with my query in some way. It doesn't seem to happen when there's not whitespace surrounding the lines in question.
Minimal textsubjects query to reproduce the issue:
Sample haskell code that could show it:
Relevant parts of syntax tree:
The text was updated successfully, but these errors were encountered: