atom-ternjs icon indicating copy to clipboard operation
atom-ternjs copied to clipboard

Allow option to complete just the function name

Open whitlockjc opened this issue 9 years ago • 4 comments

Imagine I want to end up typing Promise.resolve(), when I expand Pro I have two possible options now that #65 is complete:

  • Promise()
  • Promise(executor: fn(resolve: fn(value: ?), reject: fn(reason: ?)))

This is great and all but it doesn't help the person that just wants Promise. Thankfully you're putting the cursor in between the parentheses so it's a single keystroke to fix this but my worry isn't about the effort required but the assumptions being made that I always want to invoke the completed function name. (What's funny is prior to the fix for #65, all the user had to do to end up with an argument-less invocation was only one keystroke as well.) There are many APIs and reasons out there to access/complete the function name without invoking it. Function#apply, Function#call, passing functions around as values, etc. In all of these situations, the user will would have to use the completion and remove the parentheses. (I sure hope the user doesn't forget to remove the parentheses in these situations or their code might not work and it could be a pain to track.`)

As a user, having to undo the result of an assumption by my editor is tedious, to the point where I'd rather just not use the completion at all for Promise and only use completion after the . in my example above.

As suggested in #65, what I'd like to see is the option to just complete the function name. In fact, I'd rather see that than the argument-less completion option that came as a result of #65. (Personal opinion of course.) I think making any assumptions is a bad idea and if you just completed the name, there would be no assumption. I think it's cleaner to complete some function name and have to manually add the parentheses than it is to have to complete the function with the parentheses and have to navigate out of, or remove, the parentheses.

Just my two cents.

whitlockjc avatar May 18 '15 16:05 whitlockjc

I think that instead of writing the function parameter names directly in the code it should show the argument names on a separate box after typing parentheses, just like WebStorm does:

687474703a2f2f692e696d6775722e636f6d2f696b48426156422e676966

This way no assumption is made, but help is still given for those who need the parameter names. A function with lots of parameters can be confusing and this feature helps a lot.

TiagoMarinho avatar Jul 09 '15 04:07 TiagoMarinho

I vote for this feature too. It is very uncomfortable to work with function properties. I always have to remove the brackets.

rodmax avatar Oct 23 '15 06:10 rodmax

:+1:

tommysanterre avatar Dec 05 '15 01:12 tommysanterre

yep ..

Oblik-Design avatar Sep 06 '16 14:09 Oblik-Design