Closed rchl closed 4 years ago
This occurs when there's blank line... It's not python specific but docstrings are the most common case. Spaces are not directly generated by the plugin, but the plugin use "insert_snippet". And spaces are generated by "insert_snippet.
To reproduce just using "insert_snippet
view.run_command("insert_snippet", {"contents": "\n-----------\n\n--------------\n"})
If someone know how to solve this,..
As, usually, on save whitespaces are removed, this will hide the problem.
Do you have the range of created block? If yes then you can just kill trailing spaces with a regex.
re.sub('^[ \t]+$', text, '', count=0, flags=re.MULTILINE)
Please try my example. The empty line introduced by "\n\n" sequence will produce the problem... and there's no whitespace in "\n\n".
Yes, I can reproduce. I was just trying to find a solution outside of having ST API fixed. But I don't know your code so I can only guess what is available to you.
A way to fix this problem is to insert the newline before insert the snippet.
This is implemented in 0.76.3 (evolution channel only). This version also include the 2 others problems you have discovered.
Thanks again for your reporting
Looks good now. Thanks :)
Not sure if the problem is specific to Python but I've noticed it there lately.
Pressed shortcut to generate documentation for a function and got this:
Trailing spaces should not be added when adding documentation. Version 0.76.2