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

Prevent omitting empty matches field from complete_reply during json serialization #785

Merged
merged 3 commits into from
Apr 1, 2021

Conversation

kiendang
Copy link
Collaborator

Fix the issue when doing completion and there are no matches, the matches field is omitted from the reply message during json serialization, so for example returns

{"cursor_start":7,"cursor_end":7,"metadata":{},"status":"ok"}

instead of the correct

{"matches":[],"cursor_start":7,"cursor_end":7,"metadata":{},"status":"ok"}

Discovered when I was using jupyter console, might cause problems with other jupyter clients as well.

On an unrelated note, also add the white space I missed in my previous PR. Doesn't affect anything, but kinda trips me a little bit once I've noticed it...

@kiendang kiendang changed the title Complete reply no match Prevent omitting empty matches field from complete_reply during json serialization Mar 30, 2021
Copy link
Member

@alexarchambault alexarchambault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kiendang!

Maybe we add a non-regression test for that in ProtocolTests? Converting a Completion.Reply to JSON, and checking that it contains "matches":[], for example.

Copy link
Member

@alexarchambault alexarchambault left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@alexarchambault alexarchambault merged commit b3ecf5c into almond-sh:master Apr 1, 2021
@kiendang kiendang deleted the complete_reply_no_match branch April 2, 2021 07:07
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