Vscode: Autocomplete should insert parenthesis for methods

Created on 4 Dec 2015  路  8Comments  路  Source: microsoft/vscode

During autocompletion for methods, parenthesis do not get inserted automatically. Most of the time they are required and it's easier to delete them than insert them manually.

Eg: Tab or Return after var arr = str.sp should autocomplete to var arr = str.splice() rather than var arr = str.splice with the cursor between the parenthesis.

feature-request ux

Most helpful comment

Calling methods is common than passing them as arguments. Many IDEs like WebStorm, IntelliJ Idea and Android Studio use this as default behaviour and it really helps in coding faster.

I understand that this could irritate developers who are accustomed to typing parenthesis but for other developers who come from the JetBrains world, it becomes an extra effort. A simple option to enable this behaviour in settings would really help.

All 8 comments

Not sure I agree with this as the default behavior, in JS and more functional languages in particular it is quite common to use functions as references such as passing them in as arguments. Something like this could irritate developers when they're used to typing () anyhow. An example of where this would get annoying:

var func = function (a, b) { /*...*/ }
if (func) {
  someFunction(func);
  someOtherFunction(func.bind(null, x, y));
}

Do you know any editors/IDEs that use this as the default?

Calling methods is common than passing them as arguments. Many IDEs like WebStorm, IntelliJ Idea and Android Studio use this as default behaviour and it really helps in coding faster.

I understand that this could irritate developers who are accustomed to typing parenthesis but for other developers who come from the JetBrains world, it becomes an extra effort. A simple option to enable this behaviour in settings would really help.

After using Cloud9 IDE online and then switching to Visual Studio Code for offline work makes you realise the importance of this feature. Will it be available in the future?

Totally agree on @xeoneux :+1: . If one just wants the identifier, it is just one backspace away. I have been quite annoyed by this also. It seems like the autocomplete suggests me a variable and not a function or method.

We have experimented with different options in the past. Currently we defer it to the language service.
CC @jrieken.

for TypeScript this should still be supported with the useCodeSnippetsOnMethodSuggest setting

useCodeSnippetsOnMethodSuggest option for JS and TS works beautifully! I wonder why it isn't enabled by default. Thanks @jrieken :+1:

For C# there is open issue for now https://github.com/dotnet/roslyn/issues/12363

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sirius1024 picture sirius1024  路  3Comments

trstringer picture trstringer  路  3Comments

philipgiuliani picture philipgiuliani  路  3Comments

VitorLuizC picture VitorLuizC  路  3Comments

lukehoban picture lukehoban  路  3Comments