The current implementation of warn() annoyingly indents its message by one space character.
For example, the following:
warn("Log in to X to auto-complete Ys")
renders
Log in to X to auto-complete Ys
^ <- space character
but it should be
Log in to X to auto-complete Ys
^ <- no leading space
Why is this happening?
This is due to the fact that print() (which is what warn() uses under the hood) uses space (' ') as its separator. Hence, since a newline ('\n') is printed first, a space will be inserted before the next item (the actual message) is output.
Proposed solution
Simply do two print() calls. One for prepending the newline, and another for the message. The first print() doesn't even need a newline since print() automatically outputs a '\n' at the end.
The current implementation of
warn()
annoyingly indents its message by one space character.For example, the following:
renders
but it should be
Why is this happening? This is due to the fact that
print()
(which is whatwarn()
uses under the hood) uses space (' ') as its separator. Hence, since a newline ('\n') is printed first, a space will be inserted before the next item (the actual message) is output.Proposed solution Simply do two
print()
calls. One for prepending the newline, and another for the message. The firstprint()
doesn't even need a newline sinceprint()
automatically outputs a '\n' at the end.In code:
I'll throw together a PR, if you come to agree with this being the expected behavior.