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

Support a "conceal" feature #5798

Open
omentic opened this issue Feb 3, 2023 · 6 comments
Open

Support a "conceal" feature #5798

omentic opened this issue Feb 3, 2023 · 6 comments
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements E-hard Call for participation: Experience needed to fix: Hard / a lot E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR

Comments

@omentic
Copy link
Contributor

omentic commented Feb 3, 2023

Vim has a wonderfully helpful "conceal" feature that allows the replacement of arbitrary text with arbitrary other text on lines that are not currently being manipulated. This is exceedingly helpful for editing LaTeX - see the vim-conceal plugin - but it's also helpful for certain other programming languages.

This may perhaps be dependent on a plugin system.

@omentic omentic added the C-enhancement Category: Improvements label Feb 3, 2023
@kirawi kirawi added A-helix-term Area: Helix term improvements E-medium Call for participation: Experience needed to fix: Medium / intermediate E-good-first-issue Call for participation: Issues suitable for new contributors and removed E-good-first-issue Call for participation: Issues suitable for new contributors labels Feb 5, 2023
@pascalkuthe
Copy link
Member

This heavily factors into the recent work I did in #5420 as conceal is technically a superset of the overlay virtual text implemted there.

Extending the work there to also render a conceal like feature would be easy. However any conceal like feature requires running treesitter. The positioning code is called very often (much more often the the highlight queries) and I strongly believe should not call TS everytime.

Currently virtual text is intended to ne stored on the document. However implementing conceal that way would require running TS for the entire document (not just the visible screen) on every keypress which is also not ok from a performance standpoint.

The only way I see this feature being added is by calcuting conceal om idle timeout if the document has changed and smoothing over conceal ranges apply_impl similar to what we do with diagnostics. As there should.never be conceal at the cursor.to begin with that should work.quite well (but can cause noticeable delay in updating conceal when a syntaxnide changes). Getting all this right will be quite tricky and probably a fairly labor intensive (although not time intensive feature). This feature needs to core support most likely as I don't see us creating APIs for such internal capabilities.

It"s a fairly nieche feature tough so I think it's important that any solution does not slow down the editor when not used or significantly complicates the core positioning code.

@pascalkuthe pascalkuthe added E-hard Call for participation: Experience needed to fix: Hard / a lot E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR and removed E-medium Call for participation: Experience needed to fix: Medium / intermediate labels Feb 7, 2023
@ghost
Copy link

ghost commented Jun 8, 2023

Conceal is great when editing or composing any markup, e.g. JSON. Would be a great feature to have out of the box in helix.

@rockboynton
Copy link

Would this be able to be built upon the overlay rendering similar to how the Amp-like jump-to-label (gw) feature is rendered?

@nkitsaini
Copy link
Contributor

feature that allows the replacement of arbitrary text with arbitrary other text on lines that are not currently being manipulated

This can be taken a step further to conceal characters even on the current line as long as the cursor is not adjacent to or above those characters. I have seen this behavior in Obsidian note taking app, and personally I prefer this approach.

I assume this might be comparatively harder to implement but since we are starting from scratch, it might be worth considering.

@glyh
Copy link

glyh commented May 29, 2024

I want to mention that neovim has a long-standing issue where concealer doesn't combo well with line wrap. This can't be resolved as the architecture is not desigend well in the first place. I hope the design of helix's conceal feature is still in early stages so this can be addressed in the design.

@pascalkuthe
Copy link
Member

pascalkuthe commented May 29, 2024

That's not a problem our text positioning and linne wrapping works fundamentally differently and has no issues with things like that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements E-hard Call for participation: Experience needed to fix: Hard / a lot E-has-instructions Call for participation: Has instructions for fixing the issue and opening a PR
Projects
None yet
Development

No branches or pull requests

6 participants