Skip to content

Conversation

@dalthviz
Copy link
Contributor

@dalthviz dalthviz commented Jan 21, 2020

  • Prevents the creation of snippets completions with none or single arguments like ..()$0 or ..(${1:args})$0.

  • Prevents the creation of snippets completions for multi-line imports statements like:

from collections import (
    defaultdict)

Fixes spyder-ide/spyder#11356

@dalthviz dalthviz changed the title [WIP] PR: Only add snippets completion when positional args are available PR: Only add snippets completion when positional args are available Jan 22, 2020
@dalthviz
Copy link
Contributor Author

I think this is ready @ccordoba12 👍

@dalthviz dalthviz requested a review from ccordoba12 January 22, 2020 02:03
snippet += ', '
snippet += ')$0'
completion['insertText'] = snippet
if len(positional_args) > 1:
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should insert () and put the cursor in the middle of them, in case positional_args == 1.

Copy link
Contributor

Choose a reason for hiding this comment

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

For positional_args == 0 we need to put the cursor to the right of ()

@ccordoba12 ccordoba12 changed the title PR: Only add snippets completion when positional args are available PR: Only add snippet completions when positional args are available Jan 22, 2020
@ccordoba12 ccordoba12 added this to the 0.31.8 milestone Feb 4, 2020
@ccordoba12 ccordoba12 changed the title PR: Only add snippet completions when positional args are available Only add snippet completions when positional args are available Feb 4, 2020
Copy link
Contributor

@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 f6df42c into palantir:develop Feb 5, 2020
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.

Completion: pyls improvements for snippets handling

2 participants