Skip to content

feat: configurable indent marker level #1705

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

and-rs
Copy link

@and-rs and-rs commented Feb 28, 2025

The current marker starts after the 2nd node, and this PR modifies the indent function to make the indent marker start from node 0 or 1, also making it configurable. Just like this:

combined

I tried covering some edge cases due to the different combinations from:

  local indent_size = config.indent_size
  local padding = config.padding
  local marker_start_level = config.marker_start_level
  local level = node.level
  local with_markers = config.with_markers
  local with_expanders = config.with_expanders == nil and file_nesting.is_enabled()
    or config.with_expanders

Most of the logic was changed, of course I am open to improving the quality of the code and implement perhaps more edge cases or anything else. Thank you

Edit: There are still issues with the conditionals, and honestly I am having a hard time putting it all together, this is definitely not ready to be merged

@and-rs and-rs marked this pull request as draft February 28, 2025 06:24
@and-rs
Copy link
Author

and-rs commented Mar 1, 2025

Alright, I refactored the code again, and this should handle most cases for indentation options. Perhaps other people trying it would be great.

@sand4rt
Copy link
Contributor

sand4rt commented Mar 2, 2025

It works great on my machine. Got the same behaviour as the screenshots in the PR description.

Not a showstopper IMO, but it would be nice if marker_start_level = 0 + hide_root_node = false:

image

would behave same as with marker_start_level = 0 + hide_root_node = true:

image

@sand4rt
Copy link
Contributor

sand4rt commented Mar 2, 2025

found something:

image

image

the indent_size and the marker_start_level looks off when using: ["<"] = "prev_source" [">"] = "next_source".

@and-rs
Copy link
Author

and-rs commented Mar 2, 2025

Mmm yea I just saw that too, I guess I never use other sources, that's a really weird extra padding. Will check that out tomorrow or Tuesday. Thank you for testing it out

@sand4rt
Copy link
Contributor

sand4rt commented May 2, 2025

Did you make any more progress? Maybe we should merge it as is?

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.

2 participants