EditorGuidelines
EditorGuidelines copied to clipboard
Dynamic guidelines
For years I've wanted dynamic guidelines for comments (or all text, if that's easier). "Dynamic" meaning the guidelines start at the line's indentation. In other words, the comment "block" is always the same width regardless of how it is indented. I.e., if your comment is indented, the beginning/end of the guidelines are as well.
It would help for making more readable comments that are nested in methods or statements and/or automatically wrapping comments (via other extensions) while maintaining the same width when indented, instead of squishing intended comments when wrapped at the "standard" 80 characters. I've read that humans read best at a width of ~65 characters so I try to make comment blocks that wide, if it's just normal text (not sample code, etc.). Rather than needing to do find the column number and do math, a simple guideline would be nice.
I like the idea and I understand the motivation.
I have lots of questions, so here's your opportunity to shape the feature:
- Would you ever want more than one dynamic guideline?
- Would you ever want a mix of dynamic and non-dynamic guidelines?
- If we have a mix, would you want dynamic guidelines to have a different color?
- Would it be sufficient to show a dynamic guideline only for the current line? Or, if set, would you want them to show on every line?
- How would you create dynamic guidelines? Would it just be a new command on the context menu?
- Should dynamic guidelines display on blank lines? If so, should they position themselves based on "no indent", or should we search the lines above (or below) to find the nearest indented line?
If/when this feature is implemented, I suggest the guide lines are named “indented” which IMHO best conveys the meaning.
Here are my personal answers to the above questions:
* Would you ever want more than one dynamic guideline?
Yes, e.g. the “soft” margin and the “hard” one.
* Would you ever want a mix of dynamic and non-dynamic guidelines?
Yes, as the source code has to adhere to the “fixed” guides whereas the comments would fit into the “indented” ones.
* If we have a mix, would you want dynamic guidelines to have a different color?
Absolutely. Ideally, both color and pattern (dotted/dashed/dash-dotted/etc) should be customizable for each individual guide line (e.g. I would use the same color for the indented guides as the comments are highlighted with).
* Would it be sufficient to show a dynamic guideline only for the current line? Or, if set, would you want them to show on every line?
That's an interesting idea. It's hard to tell though what will be more comfortable.
* How would you create dynamic guidelines? Would it just be a new command on the context menu?
I'd suggest yet another context submenu item named “Add indented guideline”. (And the existing item could be renamed to “Add fixed guideline”.)
* Should dynamic guidelines display on blank lines? If so, should they position themselves based on "no indent", or should we search the lines above (or below) to find the nearest indented line?
Maybe only display them in such empty line runs which are between non-empty lines having the same indentation?