top | item 34234274

(no title)

dropofwill | 3 years ago

I've used vim's conceal feature to do something like this before to read some ridiculous code that had 16 space indentations. You can use this for all sorts of fun things like making lambda: render as λ. That doesn't use any code analysis, it's just dumb rendering, not sure why you would need anything else?

discuss

order

still_grokking|3 years ago

> That doesn't use any code analysis, it's just dumb rendering, not sure why you would need anything else?

Because this would not work in the general case. Without code analysis you can't know which spaces are indentation and which aren't. Spaces are everywhere in code…

You could have some heuristic like "new-line followed by x spaces" but this wouldn't work correctly in all cases.

Thanks for the pointer to vim's conceal feature, btw! I'm looking for something like that, but I'm not using vi(m) (I'm too lazy to learn it, even after 20 years of desktop Linux). Now I know what VSCode extension to look for. Does something like that exist that works on the AST level? (May be even some external filter-like tool).