atom-ternjs
atom-ternjs copied to clipboard
Allow option to complete just the function name
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.
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:
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.
I vote for this feature too. It is very uncomfortable to work with function properties. I always have to remove the brackets.
:+1:
yep ..