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

Add indent guides #1796

Merged
merged 3 commits into from
Jun 21, 2022
Merged

Add indent guides #1796

merged 3 commits into from
Jun 21, 2022

Conversation

sudormrfbin
Copy link
Member

@sudormrfbin sudormrfbin commented Mar 11, 2022

Adds a theme scope ui.virtual.indent-guide.

Screenshot_2022-03-12_01-49-48

TODO

  • Guides for the last line is not rendered

@the-mikedavis the-mikedavis mentioned this pull request Mar 12, 2022
5 tasks
@CptPotato
Copy link
Contributor

Would it make sense to allow configuring which character to use as indent guide?
I see dotted or dashed lines as possible alternatives.

@sudormrfbin
Copy link
Member Author

Would it make sense to allow configuring which character to use as indent guide? I see dotted or dashed lines as possible alternatives.

Yup, it should also be possible to disable it altogether, I'm planning to follow this up with a configuration PR.

@sudormrfbin sudormrfbin changed the title Implement virtual text based indent guides Add indent guides Apr 2, 2022
@sudormrfbin sudormrfbin requested a review from archseer April 2, 2022 11:35
@archseer
Copy link
Member

archseer commented Apr 5, 2022

I'm planning to follow this up with a configuration PR.

Can we add this here? I find indent guides distracting so I'd turn them off by default.

@sudormrfbin sudormrfbin linked an issue Apr 9, 2022 that may be closed by this pull request
@sudormrfbin sudormrfbin mentioned this pull request Apr 17, 2022
@the-mikedavis the-mikedavis added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 18, 2022
@sudormrfbin
Copy link
Member Author

sudormrfbin commented May 31, 2022

Indent guides are now configurable (off by default):

[editor.indent-guides]
render = true
character = ""

When both whitespace and indent guides are enabled, indent guides currently take precedence and display over visible whitespace (this mostly affects leading space characters):

Indent guides only Visible whitespace only Indent guides & visible whitespace together
indent_only whitespace_only whitespace_and_indents

@the-mikedavis the-mikedavis removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label May 31, 2022
@sudormrfbin sudormrfbin requested a review from the-mikedavis June 7, 2022 15:59
Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I gave this a try locally and it looks great 🚀

The only thing I see that could be surprising is that the indent guides draw over tab characters if you have visible whitespace turned on. I think it makes sense for the indent guide to win in that case but we could re-think the rendering of tab in the future to offset by one column so it's visible or something similar.

@sudormrfbin
Copy link
Member Author

Properly addressing that issue would have been easier if we were not limited to fixed width fonts. VSCode for example squeezes both the tab character and indent guide character into the same column by adjusting their sizes as required.

Copy link
Member

@archseer archseer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! No complaints

@archseer archseer merged commit 8ad0b83 into helix-editor:master Jun 21, 2022
@sudormrfbin sudormrfbin deleted the indent-guides branch June 21, 2022 16:54
@xcdkz xcdkz mentioned this pull request Jun 25, 2022
@the-mikedavis the-mikedavis mentioned this pull request Jul 12, 2022
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

Successfully merging this pull request may close these issues.

Optionally show vertical indentation block lines
4 participants