justinmahar / SublimeCSAutocompletePlus

CoffeeScript autocompletions and more!
172 stars 12 forks source link

Autocompletion for functions used as arguments #3

Closed degorov closed 11 years ago

degorov commented 11 years ago

Now you offer {"name":"sort", "args": [{"name": "[compareFunction]"}]} Maybe you should consider using {"name":"sort", "args": [{"name": "(a, b) ->"}]} ?

Another example: {"name":"forEach", "args": [{"name": "callback"}, {"name": "[thisArg]"}]} {"name":"forEach", "args": [{"name": "(elt, idx, arr) ->"}, {"name": "[thisArg]"}]}

Less typing, much more helpful.

justinmahar commented 11 years ago

great idea!

degorov commented 11 years ago

Would be even greater if we could have the ability to show some shortened version of the completion in the list and full string inserted to the document. So we could have forEach(callbackfn, [thisArg]) shown in the list and forEach((value, index, object) ->, [thisArg]) inserted. The second string is just too long to display in the list...

I worked on .sublime-completion files and trigger and content fields can be different there, I suppose it can be done in plugin as well.

P. S. There are a lot of threads asking to make completion list in Sublime wider, but AFAIK there is no solution :(

justinmahar commented 11 years ago

You got me thinking about this. Let's do this: you can, optionally, have an "insertion" property. "name" will be the display name, "insertion" will be the text that's actually inserted.

Example:

{"name":"forEach", "args": [{"name": "callback", "insertion": "(value, index, object) ->"}, {"name": "[thisArg]"}]},

On Thu, Feb 14, 2013 at 12:43 PM, Dmitry Egorov notifications@github.comwrote:

Would be even greater if we could have the ability to show some shortened version of the completion in the list and full string inserted to the document. So we could have forEach(callbackfn, [thisArg]) shown in the list and forEach((value, index, object) ->, [thisArg]) inserted. The second string is just too long to display in the list...

I worked on .sublime-completion files and trigger and content fields can be different there, I suppose it can be done in plugin as well.

P. S. There are a lot of threads asking to make completion list in Sublime wider, but AFAIK there is no solution :(

— Reply to this email directly or view it on GitHubhttps://github.com/justinmahar/SublimeCSAutocompletePlus/issues/3#issuecomment-13568292.

Regards, Justin

degorov commented 11 years ago

Yes, that would be perfect!

justinmahar commented 11 years ago

Implementing this right now. Check back in 20.

justinmahar commented 11 years ago

Implemented. See custom types in README for example of how to use.