heavenshell / vim-pydocstring

Generate Python docstring to your Python source code.
BSD 3-Clause "New" or "Revised" License
337 stars 53 forks source link

[WIP] Adds nvim support #81

Closed nkakouros closed 4 years ago

nkakouros commented 4 years ago

I tried to add support for nvim's job control. This still does not work as chansend() does not cause doq to produce output. I tried different stuff but couldn't make it work. The relevant part of nvim's docs mention:

chansend({id}, {data})                  *chansend()*
        Send data to channel {id}. For a job, it writes it to the
        stdin of the process. For the stdio channel |channel-stdio|,
        it writes to Nvim's stdout.  Returns the number of bytes
        written if the write succeeded, 0 otherwise.
        See |channel-bytes| for more information.

        {data} may be a string, string convertible, or a list.  If
        {data} is a list, the items will be joined by newlines; any
        newlines in an item will be sent as NUL. To send a final
        newline, include a final empty string. Example: >
            :call chansend(id, ["abc", "123\n456", ""])
<       will send "abc<NL>123<NUL>456<NL>".

I tested that chansend in the PR returns the bytes return and it does, which means that nvim writes to stdin of doq successfully.

I don't know how to proceed. Any ideas would be welcome.

brentyi commented 4 years ago

FYI -- the reason this is failing is that chanclose() and jobclose() will close all channels by default. This will close stdin (good), but also stdout (bad).

I have a tweaked/conflict-resolved version of this PR at #89 -- thanks for doing all the heavy lifting @nkakouros :slightly_smiling_face:

nkakouros commented 4 years ago

Great! I am closing this PR and following #89.