fix(esupports.indent): keep indentation of verbatim blocks without an injected TS parser#1685
fix(esupports.indent): keep indentation of verbatim blocks without an injected TS parser#1685benlubas merged 3 commits intonvim-neorg:mainfrom ALVAROPING1:fix-auto-indent
Conversation
… injected TS parser
|
You're amazing for this. Testing this PR made me realize that the visual promotion is broken If you visually select the contents of this block and press You get this: The first line is indented, and all the rest are given 0 indent. This feels related to this PR. I wonder if you have a guess as to why this happens and could maybe include the fix? Otherwise I will probably dig into the code a bit myself |
i have found a couple different bugs involved in the behavior of |
… operation `indent.reindent_range()` expects 0-based, exclusive line ranges, but the lines returned by `nvim_buf_get_mark()` for the `<`/`>` marks are 1-based, inclusive line ranges
…g ignored indent-expression might return -1 as the indentation of a line to indicate that neovim should handle the indentation of the line. When manually setting the indentation of a line with `buffer_set_line_indent` using the indentation returned by indent-expression however, the -1 indentation caused the indentation to be set to 0 instead of kept as is
|
should be fixed now. I also fixed range promotion/demotion not auto-indenting the first line in the range |
This fixes
=messing with the indentation of verbatim blocks when no language is injected (either because a parser doesn't exist/isn't installed, or because no language was specified). Sometimes this is used for diagrams, which get messed up if all lines are aligned with the tag start. The current implementation doesn't handle code blocks withnorgas language (which i can't see a good use case for) and thus those won't get auto indented eitherout.mp4