Good news: from 1.1.0 version, manual setup of line height and char width is not needed anymore, thanks to alexdima (Alexandru Dima).
Buy Me A Coffee (With PayPal): https://www.buymeacoffee.com/leodevbro
Bank account (USD): GE08TB7774936615100013 (TBCBGE22)
Bank account (GEL/Lari): GE18TB7774936515100011 (TBCBGE22)
VSCode Extension For Nested Block Highlighting
Github repository: https://github.com/leodevbro/vscode-blockman
You can toggle enable/disable: Press F1 and then type "blockman toggle"
Supported programming langauges:
Indentation based language(s): currently Python only.
If you use double width characters like these Chinese characters:
You can change nesting depth
You can choose color combos
You can change color of each depth
Colors can be any CSS color value: red, green... rgb(), hsl(), linear-gradient()...
You can change focused block colors and general border color
You can change basis of block analysis
(Curly brackets, square brackets, round brackets, tags, indentation)
Currently only Python is supported from indentation based languages
You can provide other tokenizer algorithms and we can add them into this extension, so Blockman will be able to highlight blocks based on different or more advanced logic, or add support for other indentation based languages.
You can disable rendering single line blocks
Things to consider
1) Each line of code must have less than 500 characters, otherwise blocks will not be rendered in entire file.
2) Please don't use non-monospace font. Use only monospace font like 'Oxygen Mono', 'BPG 2017 DejaVu Sans Mono' or other. Block-rendering is based on equal character-frame-widths, because pixel locations of characters is not accessible through VSCode API.
3) If you want to use mix of multiple fonts (like in the image above), Please don't use any non-monospace font. Use monospace fonts which have at least almost same width of character. For example: 'Oxygen Mono' and 'BPG 2017 DejaVu Sans Mono' have not only equal char frame width by themselves alone, but also almost equal char frame width to each other.
For Geogian (ქართული) language oriented developers: without multiple font mixing, just BPG 2017 DejaVu Sans Mono as a single font seems fine for me, and maybe you can use it too. I think it is the one and only monospace font which has English and Georgian lowercase letters, as well as Georgian CAPITAL (uppercase) letters.
For English language oriented developers: the same statement above goes here.
4) If you want to use ligatured monospace font like "Fira Code" (Typographic ligatures are when multiple characters appear to combine into a single character), please make sure that the font maintains the text width on every line with ligatures like there were no ligatures. "Fira Code" seems fine, and maybe most of ligatured monospace fonts are fine.
5) Recommended to turn off word wrap. Blocks will not render properly if there is any word wrapping.
6) Recommended to turn off "Editor: Highlight Active Indent Guide" and "Editor: Render Indent Guides".
7) Recommended to set pale color (e.g. pale blue) to lineHighlightBorder and lineHighlightBackground like this:
First, press F1
then, type >settings json
then, open and edit settings.json file:
8) Inline decorators such as VSCode Color Decorators of styles causes wider text line, some situations are handled, some situations are not handled yet, for example when linear-gradient has more than three colors.
Optimization is taken very seriously, half of the work is dedicated just for the optimization. The source code is full of logic which prevents many unnecessary block re-renderings.
File analysis needs super short time, so it's not a big problem. The main problem is that the vscode block rendering functions (vscode.window.createTextEditorDecorationType and setDecorations) are very slow, and I cannot touch its internal code, because it's just an API of VSCode. So, almost all optimization algorithms are trying to prevent as many unnececary block renderings as possible. For example, when scrolling, blocks are rendered into only newly visible code, and the blocks which are already visible, stay there and does not rerender.
Big thanks to these source codes
Bracket Pair Colorizer 2 (by CoenraadS)
Highlight Matching Tag (by vincaslt)
dt-python-parser (by DTStack)