Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check count for 'not None' instead of truthy in command decorator #298

Merged
merged 2 commits into from
Feb 5, 2018
Merged

Check count for 'not None' instead of truthy in command decorator #298

merged 2 commits into from
Feb 5, 2018

Conversation

malramsay64
Copy link
Contributor

The command decorator was only checking the truthyness of count, which
meant that a value of 0 was considered falsy and so the value not passed
to the decorated function. A value of 0 for count should be valid
since this is the default in both vim and neovim (see help v:count).

The command decorator was only checking the truthyness of `count`, which
meant that a value of 0 was considered falsy and so the value not passed
to the decorated function. A value of 0 for `count` should be valid
since this is the default in both vim and neovim (see `help v:count`).
@justinmk
Copy link
Member

justinmk commented Feb 1, 2018

Good catch. Can you add a test?

This adds tests to ensure the appropriate functioning of the count
option of the _nvim_rpc_spec when using the command decorator.
@malramsay64
Copy link
Contributor Author

There are no other tests I could find for the decorators so I created a new file with the test case, I hope that is alright.

@justinmk justinmk merged commit 320cb7d into neovim:master Feb 5, 2018
bfredl added a commit that referenced this pull request Mar 1, 2018
In this release support of python3.3 is dropped. Henceforth we want python3
rplugins to be able to assume the usage of asyncio, so they can use the asyncio
event loop and libraries that build on it.

Furthermore, a close() method is added on nvim session objects. When used as
a library for externally connecting to a nvim instance (i e not rplugins),
it is recommended to call the close() method on the session object when it is
not needed anymore. Alternatively, sessions can be used as a context manager:

    with neovim.attach('socket', path=thepath) as nvim:
        # do stuff with nvim session in this block:
        print(nvim.funcs.getpid())
        print(nvim.current.line)

This will close the session automatically.

Changes since 0.2.1:
* 2689ddc add tests for plugin decorators #298
* 63f257f allow library users to properly cleanup the event loop #303
* 59c184f expose the asyncio event loop as nvim.loop (python 3.4+ only) #294
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants