20Tauri / DoxyDoxygen

The last word in code documentation generation
140 stars 5 forks source link

Don't introduce trailing white space #141

Closed rchl closed 4 years ago

rchl commented 4 years ago

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: Screenshot 2020-05-14 at 21 57 04

Trailing spaces should not be added when adding documentation. Version 0.76.2

20Tauri commented 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

If someone know how to solve this,..

As, usually, on save whitespaces are removed, this will hide the problem.

rchl commented 4 years ago

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)
20Tauri commented 4 years ago

Please try my example. The empty line introduced by "\n\n" sequence will produce the problem... and there's no whitespace in "\n\n".

rchl commented 4 years ago

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.

20Tauri commented 4 years ago

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

rchl commented 4 years ago

Looks good now. Thanks :)