-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Only show indent guides for current block (resolves #561) #723
Conversation
I think it makes more sense if this builds on current indent right? |
You are right, but I thought some people will want to use this without using |
Sorry, I will reopen this, but I improved it so it doesn't use scope now. It was not a good idea to use scope since it doesn't capture the right thing, but I do think we want to use treesitter for this. Without treesitter, it can be hard to describe the exact block you are in (this is a different thing than what All languages I have tested (and I think this should generally be true for treesitter?) has new code blocks as the child of the root, so going up the tree until you see the root should always work (if my assumption is true). |
I don't think treesitter is the right tool for this. For current indent, you keep a stack of all indents until you hit the cursor, then display the deepest one differently. |
Ah, I think I misunderstood what you said originally. Keeping a stack similar to current_ident but for current_block like what you described should definitely be possible. I can try to do that later. I think I will wait until |
This should resolve #561. If you want anything to change I can edit it later today.
One thing to consider is if there should be an option to change the behavior when you are not in any code block. Right now it will not show any indent guides when you are not in a code block, and then only show the blocks indent guides when you are in a code block. I think this could be useful for viewing large files with multiple different blocks, which is why I picked this behavior as the standard.
Also, I am not sure exactly how you would want to write tests for this, but if you point me in the right direction, I can also try to look into that.