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

WIP (Blocked): Indentation guides #720

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

igor-ramazanov
Copy link
Contributor

@igor-ramazanov igor-ramazanov commented Feb 17, 2024

Copy of the #711 moved to the repo.

Adds indentation guides highlighting the scope of the functions/methods/classes/etc.

The implementation depends on the document symbols LSP API.

  • Adds 2 new commands similar to existing commands.
    • lsp-indent-guides-(enable|disable) {buffer|global|window}.
  • Adds 2 new faces.
    • IndentGuide and IndentGuideFocused, defaults comment and MatchingChar.
  • Nested characters can be customized according to their level.
    Picks the last one if the scope is deeper than the amount of characters.
    • lsp_indent_guides_characters, defaults to │ ┆ ┊ ⸽.
  • Adds an option to skip specified levels of nestedness.
    • lsp_indent_guides_skip, defaults to 1.

Screenshot before:
image

Screenshot after:
image

NOTE: As you see in the screenshot it shifts the indended code to the right. This is an issue which needs to be fixed within Kakoune itself to allow highlighters to render on empty places, see the comment.

Adds `IndentGuidesParams` which will be receved from Kakoune.
Adds new `kak-lsp/indent-guides` request type and calling unimplemented function.
Implements the `fn indent_guides(...)` function.
Adds KakScript code with indent guides related options and commands.
@igor-ramazanov
Copy link
Contributor Author

@krobelus Answering your comment in a previous PR: #711 (comment)

I like the idea with specifying only start of the indent.

In my opinion, it's good to mirror the existing combination of line-specs option + flag-lines highlighter for columns: column-specs + flag-columns.

It'll be intuitive to understand and use through an analogy, I think.

Not exactly what you proposed, but a development of your idea.

Hopefully, this similarity can also help in implementation.

@igor-ramazanov
Copy link
Contributor Author

Ah, I've forgot that flag-lines is only for the gutter.

The only API we have to replace/render characters is replace-ranges.

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.

None yet

1 participant