Alexey-T / CudaText

Cross-platform text editor, written in Free Pascal
Mozilla Public License 2.0
2.39k stars 166 forks source link

Indentation guide a.k.a Staples for every indentation #5518

Closed ThaiDat closed 1 month ago

ThaiDat commented 1 month ago

Did we have a way (i.e. an option) to put staple for every indentation. Below are examples how Cuda, Vscode, and Sublime render indentation guide on same documents: image image image

ThaiDat commented 1 month ago

Base on current behavior, I guess Cuda indentation guide is per lexer.

Alexey-T commented 1 month ago

Cud's indent-guides are from lexer rules. for your examples:

no, Cud cannot force indent-guides for all indents, no need to do it.

ThaiDat commented 1 month ago

I would prefer to have indentation guide for every indent. But, I know to change it from per-lexer block to indent-based block will require a lot of rework.

May need to hear from other CudaText users.

Alexey-T commented 1 month ago

Even indent based blocks are from lexer rules. we cannot add staples w/o lexer rules.

pintassilgo commented 1 month ago

Plugin Detect_Indent could be updated with a new option to force staples based on indentation. So any line starting with the indentation set for that document (like 4 spaces) would have staples for every indentation.

Alexey-T commented 1 month ago

Detect_Indent only detects. it cannot add staples yet. to add staple, plugin must react to lexer-parsing-done, and then insert fold-ranges based on indents. (each fold range can have staple). and: plugin must avoid adding duplicate fold-ranges (if lexer already added some). I don't plan it. neither in Detect_Indent nor in others.