Add Buffer.__repr__ and Window.__repr__#328
Conversation
|
somewhat related, "lgtm" service also noticed some other things: https://lgtm.com/projects/g/neovim/python-client/alerts/ |
|
As an alternative, could add a generic |
They have different properties though. I've implemented it now for all three. |
|
@blueyed They all have the same essential property: the object handle. Also I'm not sure we want |
Added this now to all of them.
Thought about this as well. |
|
Note that most other attributes than the handle requires sync requests. What I had in mind was something like which can be in the |
Than I am more in favor of including them, but protecting them with a try/except then instead. Most of the current state's information is useful after all. |
|
Added a commit to remove remote calls altogether. |
| def __repr__(self): | ||
| """Get text representation of the buffer.""" | ||
| return 'Buffer(number=%r, handle=%r)' % ( | ||
| self.number, |
There was a problem hiding this comment.
number and handle are synonymous. After this, we can just as well have a shared implementation in Remote.
|
LGTM, but tests are failing. |
|
Do you think the |
|
Lets skip the mock test for now, it seems overcomplicated for only this functionality. The output is probably fine as it is. The reason for the |
|
Amended, and added the |
|
|
||
|
|
||
| def test_repr(vim): | ||
| assert repr(vim.current.buffer) == "<Buffer(handle=2)>" |
There was a problem hiding this comment.
hmm, looks a bit fragile, but test run order seems deterministic. So guess we can keep this for now and change it to a regex later if it turns out to be too much churn.
No description provided.