Open mjbvz opened 1 year ago
I think it's essentially duplicate of https://github.com/microsoft/TypeScript/issues/51427
Returning both completions for
completeFunctionCalls
would be useful as it is sometimes not possible to tell if the user meant to pass around the function as an object or call the function
Also thanks for exposing tsApi.onCompletionAccepted
as this is just ideal place for handling this case (instead of putting it to insertText
of completion). That's how I implemented it in my plugin: https://github.com/zardoy/typescript-vscode-plugins#method-snippets
Problem
In VS Code, the
javascript.suggest.completeFunctionCalls
andtypescriptscript.suggest.completeFunctionCalls
settings make VS Code automatically add parens and argument snipper stops when you complete a function call. For example:Result inL
Users generally like this feature but we cannot properly implement it on the VS Code side as we don't have enough context about the completion or where the completion is occurring. This has resulted in number of bugs that severely limit the usefulness of this feature
Request
I proposed that we move the logic from
completeFunctionCalls
into the TypeScript server. Not only does TS have more information about the context of the completion and would therefore be better able to implement this, adding this to TS server means that feature could also be used by other editors, including VSFor this, we may want to take inspiration for the snippets we return for overload functions. With these, we return the normal function name completion along with the full overload completion. Returning both completions for
completeFunctionCalls
would be useful as it is sometimes not possible to tell if the user meant to pass around the function as an object or call the function