Skip to content

Detect multiline imports and don't show snippets for them #694

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

Merged
merged 4 commits into from
Nov 14, 2019
Merged

Detect multiline imports and don't show snippets for them #694

merged 4 commits into from
Nov 14, 2019

Conversation

muffinmad
Copy link
Contributor

Proposed changes in pyls/plugins/jedi_completion.py

pyls_completions: Check variables before calling function.
use_snippets: Include previous lines in parsed snippet if they ends with \;
Limit splits count by line number; Check token type instead of token code.

Proposed changes in pyls/plugins/jedi_completion.py

pyls_completions: Check variables before calling function.
use_snippets: Include previous lines in parsed snippet if they ends with `\`;
Limit splits count by line number; Check token type instead of token code.
@ccordoba12 ccordoba12 added this to the 0.30.1 milestone Nov 12, 2019
@ccordoba12
Copy link
Contributor

@muffinmad, thanks a lot for the quick response!

@steff456, please review this one.

Copy link
Contributor

@steff456 steff456 left a comment

Choose a reason for hiding this comment

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

I left a minor comment on the PR, it looks great!

@muffinmad
Copy link
Contributor Author

Besides requested changes, detection import in multi-statement lines is added. Although cases like

a = 1; from datetime import date

and

from datetime import date; a = date

are not commonly used, it's good to handle them correctly.

Please see updated PR.

Thanks!

Copy link
Contributor

@steff456 steff456 left a comment

Choose a reason for hiding this comment

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

Thanks for this PR @muffinmad !

@ccordoba12 ccordoba12 changed the title Detect multiline imports Detect multiline imports and don't show snippets for them Nov 14, 2019
@ccordoba12 ccordoba12 merged commit e57119f into palantir:develop Nov 14, 2019
@muffinmad muffinmad deleted the mad/multiline-import branch November 15, 2019 06:51
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.

3 participants