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

PR: Filter completions with an empty value for the 'insertText' key #10605

Merged
merged 1 commit into from
Nov 5, 2019

Conversation

dalthviz
Copy link
Member

@dalthviz dalthviz commented Nov 4, 2019

Description of Changes

  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable)
  • Included a screenshot or animation (if affecting the UI, see Licecap)

Filter completion list to prevent completions with an empty 'insertText' value.

Seems like the LSP is returning this as a completion:

{'label': '',
'kind': 9,
'detail': 'cv2.cv2',
'documentation': 'cv2.cv2()\n\nPython wrapper for OpenCV.',
'sortText': (1, 'a'),
'insertText': '',
'filterText': '',
'insertTextFormat': 1,
'provider': 'LSP'}

Issue(s) Resolved

Fixes #10593

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct: dalthviz

@ccordoba12
Copy link
Member

So the LSP is not giving any completions for cv2?

@dalthviz
Copy link
Member Author

dalthviz commented Nov 5, 2019

It takes a little bit for the LSP to retrieve the completions and sometimes the list contains the completion refereed above that has an empty insertText value as well as empty values for filterText and label:

cv2
Maybe the fix should be done over the pyls package?

@ccordoba12
Copy link
Member

Maybe the fix should be done over the pyls package?

I don't think so. insertText depends on what Jedi returns, and it seems in this case it returns empty strings for some completions.

Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Thanks @dalthviz!

@ccordoba12 ccordoba12 merged commit 6fd5e0e into spyder-ide:master Nov 5, 2019
@MadsDyrmann
Copy link

I just looked through some of the issues and found #4859, which might be related to this.

And, by the way, it's a pleasure to use Spyder. Thank you for your great work.

@metalogical
Copy link
Contributor

@ccordoba12 @dalthviz

This breaks Kite completions because those completions specify a textEdit, but no insertText (so an exception is raised when doing this check).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error in cv2 autocompletion
4 participants