fix side-comments, add tabs or spaces functionality#197
Conversation
|
There should be only one \t character per indent level. The |
|
oops, can you try again? |
|
Yes, now only one tab char is inserted per indentation level. But layout calculation doesn't respect the # The `echo` line becomes 80 characters long and still doesn't wrap, even though max is specified to be 40 in the config
# I assume this is because the length of the line after trimming whitespace is exactly 40
# If we add one more char to that line, it makes it wrap again.
def test [] {
{
echo abv def fef faei feal afea abcdefgh
}
}Config: |
|
i'll see what i can do. it's not the same issue but related. |
…stments and add tests for indentation behavior
|
ok @Juhan280 try this one. crossing my fingers it's right now. |
|
It seems to be working correctly from my limited testing |
| IndentChar::Space => { | ||
| for _ in 0..(self.config.indent * self.indent_level) { | ||
| self.output.push(b' '); | ||
| } | ||
| } | ||
| IndentChar::Tab => { | ||
| for _ in 0..self.indent_level { | ||
| self.output.push(b'\t'); | ||
| } | ||
| } |
There was a problem hiding this comment.
Should we call self.output.reserve before starting the loop?
There was a problem hiding this comment.
ya, probably so. thanks
Description of changes
Add the ability to have tabs or spaces in formatting.
Fix the side-comments bug
Relevant Issues
closes #195
closes #196