Python docstring with vim pythoncomplete does not display newlines for my own class functions

I am getting unexpected results when trying to use Python Omni Completion on my own class functions. The docstring function for functions is not formatted correctly with line breaks as shown in the image below:

Unexpected result

When I import modules from the python standard library, I get the result I would expect:

Expected result

According to python docstring convention, a newline in the source file should be interpreted as a newline. Does anyone know what's going on here and maybe how to fix the problem?

+3


source to share


1 answer


Edit: I wrote an autocomplete that should be much better than pythoncomplete: https://github.com/davidhalter/jedi-vim


Python Omni Completion

vim is pretty silly. This is a simple script that parses the current file and imports

everyone else. This is quite dangerous and should not be done. However, it doesn't work that badly (but not very well either).

So the difference between your two scripts is that the standard libraries are imported. Likewise your files, but not the current file. If you used a second named module test2

and used:

import test
test.mydoc.prettyStr

      



It should work.

Your current file is being processed. The parser is simple and not very good. Because of this line (line number ~ 290), the paring parser is especially strange:

docstr = docstr.replace('\n', ' ')

      

You can change it - just change this file: /usr/share/vim/vim73/autoload/pythoncomplete.vim

It might be in a different directory.

I am currently in the process of writing the best autocomplete for python / vi (this is also the reason why I know this). But it's still pretty good work. Hopefully in a month I'll be ready with a beta version. I try to keep you informed.

+3


source







All Articles