-
Notifications
You must be signed in to change notification settings - Fork 203
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
Treatment of whitespace is inconsistent/inconvenient #69
Comments
The behavior is even weirder when selecting |
At the moment we have no treatment of whitespaces at at all in this plugin. I always wanted to do this finally but I've never come to point to actually handle it. But I hope that at least some weirdness regard parameter.{inner/outer} got fixed by #87. For all other white space issues I would really recommend to submit a whitespace handling strategy to this plugin because at the moment we don't have any. |
I just tried to fix some whitespace stuff here for parameter.inner and outer, (#87). The problem basically is that treesitter "smartly" ignores whitespace. The If you know a way to capture pre or post whitespace (without capturing the prev/next token) then we could fix a lot of these problems. I'd be happy to do the work if someone finds a technique |
This is already fixed, you need to set the
|
Look ahead doesn't work. In my second example, it would actually have to look backwards to find the parameter. |
@stsewd can you reopen this, please? |
@bkoropoff we do support the lookbehind option too
|
Consider a python snippet like the following with the cursor placed at the caret:
If you try to select
parameter.inner
orparameter.outer
, nothing will happen.If the cursor is in a different location:
Now
parameter.outer
will select something (the"b"
parameter up to its comma, but not its leading space),but
parameter.inner
still does nothing.This is probably technically correct according to the way the syntax tree maps to tokens, but it's not very convenient for editing. You'll get similar behavior if you happen to be in whitespace for other text objects, e.g.:
Here
function.outer
will select the entire function and body as expected, butfunction.inner
selects nothing.When the cursor is on whitespace, it should probably "snap" to the next non-whitespace token before looking for the surrounding text object.
The text was updated successfully, but these errors were encountered: