Skip to content

Code snippet for function call not available for aliased functions. #53716

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

Closed
chemzqm opened this issue Jul 6, 2018 · 9 comments
Closed

Code snippet for function call not available for aliased functions. #53716

chemzqm opened this issue Jul 6, 2018 · 9 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities upstream-issue-linked This is an upstream issue that has been reported upstream
Milestone

Comments

@chemzqm
Copy link

chemzqm commented Jul 6, 2018

  • VSCode Version: 1.25.0
  • OS Version: MacOS

Steps to Reproduce:

  1. Add "typescript.useCodeSnippetsOnMethodSuggest": true, to settings file to enable code snippet for method suggest.
  2. Create a.ts with
    export function func(str:string):void {
        // noop
    }
  3. Create b.ts with
    import {func} from './a'
    and then type func and select func item, the completion is done, but no code snipet would b used.

The reason is because typescript server would return alias for the import variable but not function, so typescript-language-features extension would not consider it as function and no code snippet is generated.
screen shot 2018-07-06 at 9 42 53 pm

Does this issue occur when all extensions are disabled?: Yes

@vscodebot vscodebot bot added the new release label Jul 6, 2018
@mjbvz mjbvz added bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities labels Jul 6, 2018
@vscodebot vscodebot bot removed the new release label Jul 10, 2018
@yogeshmangaj
Copy link

@mjbvz I'd like to help, is there any more information that I could use to debug and fix this?

@chemzqm
Copy link
Author

chemzqm commented Jul 16, 2018

@yogeshmangaj
Copy link

@chemzqm I am not sure if I'm missing something, and this may be unrelated to the issue you have mentioned, but code snippet for a function does not show from within the same file either.

  1. Create a.ts with
export function func(str:string):string {
    return "hello world";
}
  1. On the next line in a.ts type func, the code snippet is same as what it shows for the alias function visible in your screenshot.

image

@chemzqm
Copy link
Author

chemzqm commented Jul 20, 2018

@yogeshmangaj I'm able to complete that, you should enable code snippet in your VSCode settings

    "typescript.useCodeSnippetsOnMethodSuggest": true,

@yogeshmangaj
Copy link

@chemzqm I have that setting enabled, and I still get the same thing, is there any other setting that has to be enabled? Could you please post a screenshot of the snippet that you're seeing (hope this is not bothersome)?
image
Thanks!

@chemzqm
Copy link
Author

chemzqm commented Jul 21, 2018

@yogeshmangaj other setting should be unrelated.
I think you don't have snippet is because your tsserver is old, it should be 2.9.2 or later.

@yogeshmangaj
Copy link

@chemzqm that does not seem to be the case either, tsserver is 2.9.2

@chemzqm
Copy link
Author

chemzqm commented Aug 2, 2018

On the next line in a.ts type func, the code snippet is same as what it shows for the alias function visible in your screenshot.

It's not the same, there not alias, you should be able to get the snippet by confirm the selection.

@mjbvz mjbvz added this to the Backlog milestone Oct 15, 2019
@mjbvz
Copy link
Collaborator

mjbvz commented Nov 5, 2020

Closing this in favor of microsoft/TypeScript#25207

We are limited in what we can do generating snippets on the VS Code side and really need TS support for more advanced support like this

@mjbvz mjbvz closed this as completed Nov 5, 2020
@mjbvz mjbvz added the upstream-issue-linked This is an upstream issue that has been reported upstream label Nov 5, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug help wanted Issues identified as good community contribution opportunities upstream-issue-linked This is an upstream issue that has been reported upstream
Projects
None yet
Development

No branches or pull requests

3 participants