ternjs / tern_for_sublime

Sublime Text package adding Tern support
MIT License
801 stars 52 forks source link

Allow completing functions as first-class objects #103

Closed websash closed 8 years ago

websash commented 9 years ago

Wouldn't it be better to complete just function names without parenthesis? And for the function signature to appear once you've typed invocation parenthesis? In code like this

const even = n => n % 2 === 0
;[0, 1, 2, 3, 4].filter(even)

tern autocompletes even with parenthesis (not what's needed here and in many places like this)

mokkabonna commented 8 years ago

I agree, after this landed in tern, I have realized just how many times I pass around functions or access properties on the function itself.

I think more often than invoking it directly.

marijnh commented 8 years ago

Isn't this an option (tern_argument_completion) that already defaults to false?

websash commented 8 years ago

Not quite. I have "tern_argument_completion": false and tern still inserts empty parenthesis with the cursor inside after each completed function name. I have to hit backspace to clean them up every time I mean a function as first-class value, that is I don't mean to invoke it. I think the default behavior should be not to insert invocation parenthesis. E.g. MS Visual Studio Code doesn't do it and Atom's version has this option Do not add parenthesis if method is completed (not enabled by default though)

marijnh commented 8 years ago

I see, it always added those parens. That's not good. Attached patch changes this.