onivim / oni

Oni: Modern Modal Editing - powered by Neovim
https://www.onivim.io
MIT License
11.34k stars 299 forks source link

Indent Guide Colour #2434

Open CrossR opened 6 years ago

CrossR commented 6 years ago

One small Quality of Life thing for the indent guides (in my opinion) would be highlighting the most relevant indent guide for the current cursor position.

Ie, for this code in the Oni repo with an example from VSCode:

image

The most relevant guide is ever so slightly highlighted, just so the current scope can be seen.

@Akin909, I can see a colour variable is being passed over for each guide...would this be as simple as find the indent level one above the cursor and pass over a colour that is slightly lighter for that single guide? If it is, may be worth tagging this as good-first-issue and linking to the code and what needs doing.

akinsho commented 6 years ago

@CrossR I was actually just looking through the code for some vscode indentation plugins this for example, so I actually saw this feature recently for the first time. Unfortunately I don't think this would be a good first issue as it wouldn't be straightforward to implement. The color prop is actually just so a user can decide what color they want all the indent lines to be so though each indentline can be coloured separately there'll need to be logic to get all the correct lines because each line draws indents separately they just overlap to look like one long line.

The cursor's position is completely unknown to the indent buffer layer so first thing would be figuring out how to pass that through. Re implementation tbh I have a couple of ideas but none of them are simple, I think in all likelihood itll require a fair bit of experimentation. I think personally as far as working on the indent lines I plan on looking more at wrapping, and folding which it currently handles badly, though if anyone wants to have a look, let me know if I can help

akinsho commented 6 years ago

Took a peek at vscode's indent implementation to see how they do this here, the function is fairly involved so its not immediately clear (to me) how it works at a glance but putting it here for inspiration