Skip to content
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

Match first node for expand options. #31

Open
NiamhFerns opened this issue Dec 26, 2022 · 0 comments
Open

Match first node for expand options. #31

NiamhFerns opened this issue Dec 26, 2022 · 0 comments

Comments

@NiamhFerns
Copy link

NiamhFerns commented Dec 26, 2022

Current Behaviour:
Currently, when you have nodes to expand to in your twilight config, twilight will expand to whatever the outer most one is. That is, say I have my expand to expand to conditionals, loops, methods, and classes, then I have some code that looks like this.

class Foo:
    def bar():
        if condition:
            var = expression
            for i in collection:
                # do things

Say I have my cursor on line 4, it will highlight every single line of code because it matches to the outermost node, that being the class.

Desired Behaviour:
I'd like it to match to innermost scope/node and no further. That is, if we have the above example, I'd want it to highlight only the conditional. If I had my cursor on line 6 I'd want it to highlight only the for loop.

Ideally, it would do this from within the block but not on the block declaration itself. This means that if I had my cursor on line 3, it's on the conditional line but it considers it considers the closest inner node as the one just above, that being the method. It also prevents annoying cases where you have a one-liner if statement or things like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant