Skip to content

New feature: indent guides #44

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

Closed
danilshvalov opened this issue Jan 10, 2022 · 7 comments
Closed

New feature: indent guides #44

danilshvalov opened this issue Jan 10, 2022 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@danilshvalov
Copy link
Contributor

Add the ability to enable indent guides like this:

indent guides

I have some developments, so I can open a pull request, if you think it's worth adding this feature.

@cseickel
Copy link
Contributor

It's definitively worth having. I would prefer they be a component that people can add to their renderers. Is that how you have done this?

@cseickel cseickel added the enhancement New feature or request label Jan 11, 2022
@danilshvalov
Copy link
Contributor Author

It's possible, but I need to add new fields to the node (for example I use fields from renderer.lua):

local nodeData = {
  id = item.id,
  name = item.name,
  type = item.type,
  loaded = item.loaded,
  indent = node_indent,
  extra = item.extra,
  path = item.path,
  ext = item.ext,
  search_pattern = item.search_pattern,
+ level = level,
+ is_last = i == #source_items,
}

@cseickel
Copy link
Contributor

cseickel commented Jan 11, 2022

The hard part about this is to make it in a way that is open ended and configurable. Here is what I am thinking right now:

  1. We add the two properties, but call the second one is_last_child to be more explicit.
  2. We add a config option for a special component called "indent_renderer" which follows the interface of a component but is at the global config level. That component has options for:
  • indent_marker which defaults to " " (two spaces)
  • last_indent_marker which also defaults to " " (two spaces)
  • highlight which is the highlight group to use for this NuiText, defaulting to nil

Then I (as an end user) can tweak it in any way I want to change the amount of indent or add any style of markers.

How does that sound?

@cseickel
Copy link
Contributor

... and your specific config there could be an example in the README or the wiki.

@danilshvalov
Copy link
Contributor Author

I think this is the best option. I will create a pull request with indent guides this week.

@danilshvalov
Copy link
Contributor Author

I've added this feature in #107.

@cseickel cseickel linked a pull request Feb 2, 2022 that will close this issue
@nyngwang
Copy link

nyngwang commented Feb 2, 2022

Great! Can't believe that this is about to be added :)

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

Successfully merging a pull request may close this issue.

3 participants