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

Blacklist typescript.useCodeSnippetsOnMethodSuggest in certain contexts #16415

Conversation

mjbvz
Copy link
Collaborator

@mjbvz mjbvz commented Dec 3, 2016

fixes #2092

bug
With typescript.useCodeSnippetsOnMethodSuggest enabled, we will automatically complete function calls inside some contexts where they should not be completed. For example, destructing assigments.

fix
Add a quickinfo check on the position before attempting to insert a function call. Create a blacklist of invalid contexts. Otherwise, assume that we want to complete the function call.

dec-02-2016 16-08-00

Issue microsoft#2092

**bug**
With typescript.useCodeSnippetsOnMethodSuggest enabled, we will automatically complete function calls inside some contexts where they should not be completed. For example,  destructing assigment.

**fix**
Add a quickinfo check on the position before attempting to insert a function call. Create a blacklist of invalid contexts. Otherwise, assume that we want to complete the function call.
@dbaeumer
Copy link
Member

dbaeumer commented Dec 5, 2016

Nice idea. But we should mark this as a work around and should ask the TS team to provide this information (parameter names) in the completion list result already. There might be cases which we can't easily work around.

@mjbvz
Copy link
Collaborator Author

mjbvz commented Dec 5, 2016

@dbaeumer Ok, I'll open an issue on TypeScript. Since TS returns the parameter names already, the request on the TS side would be to not return parameter names when in these assignment contexts, correct?

Also, do we want to take this workaround in our side until the TS team can provide a proper fix?

@dbaeumer
Copy link
Member

dbaeumer commented Dec 6, 2016

@mjbvz instead of not returning the names I would opt to return a context information in additional that lets us know where we are completing:

  • function name
  • arg
  • import name,
    ....

@mjbvz mjbvz added this to the January 2017 milestone Dec 9, 2016
@mjbvz mjbvz merged commit 6dc2c60 into microsoft:master Dec 12, 2016
@mjbvz
Copy link
Collaborator Author

mjbvz commented Dec 12, 2016

Tracking proper fix on the TS side, but merging in the workaround for now. Will add comment linking to the TS issue in the code

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Typescript: import autocomplete fills in function arguments
3 participants