Minor enhancements on the autocompletion feature
futuresplash opened this issue · 5 comments
Autocompletion is such an important (and useful) feature that I feel compelled to make some suggestions for improving it.
Please don't be alarmed by the size of the message. These are just 6 small improvements that I would like you to consider.
- Sort list entries alphabetically.
- Currently entries appear in random order (?). This way it's harder to find the relevant suggestions on the list.
- Group list entries by type.
- Ex. first, show all properties sorted alphabetically, then, show all methods sorted alphabetically, then show all constants, etc.
- Better filtering for middle-of-word completion.
- Currently, the characters on the left of the cursor can be used individually for matching word segments. Ex: pressing Ctrl+Space in the word "thresholds" with the cusor after the r (i.e. trying to match "thr") includes matches such as: MSBorderColorS
t
yle_H
TMLTableR
owElement (WTF?) - Usually, only entries starting with "thr" should be included. Eventually, entries containing "thr" somewhere could also be included, but only if requested (via a second Ctrl+Space, for instance).
- Currently, the characters on the left of the cursor can be used individually for matching word segments. Ex: pressing Ctrl+Space in the word "thresholds" with the cusor after the r (i.e. trying to match "thr") includes matches such as: MSBorderColorS
- Increase the widh of the dropdown list when entries don't fit.
- Currently, entries become truncated and there is no way to resize the list manually. That hinders readability a lot!
- Better info split:
- Put var/method name on the left (including method arguments list, ex.
method (arg1, arg2)
) and only show the var type / method return type on the right.
- Put var/method name on the left (including method arguments list, ex.
- Apply some color and formatting to the list items' text (this would increase readability).
- Looking into IDEs like Eclipse, Netbeans and IDEA I can suggest:
- the var/function/method/constant name could be bold.
- the matched chars could be a different color.
- the function/method parameters could be a different color.
- Looking into IDEs like Eclipse, Netbeans and IDEA I can suggest:
Implementing these little enhancements would improve a lot the usefulness of this plugin.
Of course I know you may have better things to do with you life than implementing this, but any and all improvements on this plugin would be very much welcome, as currently there are very few options for those who wish to develop with Typescript and do not want to use Visual Studio.
Hey futuresplash.
1 and 2 are implemented, i just pushed a commit with them inside :)
The order of groups is not right yet, i'm on it.
5, i'm not sure about, i like the way the data is formatted right now.
3 4 and 6 are actually impossible in the current state of the Sublime Text plugin API. You can actually vote for 4 here, but given that Sublime Text 3 beta was just announced, and that the whole plugin API was changed, i wouldn't bet on that.
Making the plugin work on Sublime Text 3 will require some work, work that i'm not sure i'll be willing to do, given that :
- I have no guarantee that the API will be improved regarding the features i need
- I actually use Vim day to day, only used Sublime for this plugin because it has a decent API, but if it changes every 3 monthes, i might reconsider
- I consider Sublime to be too expensive, and too opaque regarding updates right now (this version 3 should have been 2.2, and free to everyone)
So my goal for this project is :
- Remove some functionality from the python side to put it on the Js server side.
- Decouple the Js part to make a real IDE server, to facilitate plugin development
- Make a plugin for Vim ? I don't want to learn VimScript, but who knows :)
Bottom line is, i make no guarantee about Sublime Text support
Hey futuresplash, in the absence of more suggestions about how to improve autocompletion in the current version of Sublime Text 2, i'm gonna close the issue. Feel free to reopen it or open another one if you have new stuff
Hi Raph
Sorry for not having the chance to answer sooner.
About items 1 and 2: great! It's much better like this. :-)
As for items 5 and 6, my suggestions were based on the way IDEs like Nebeans, IDEA and Eclipse show the autocompletion. The goal was to make your plugin's autocompletion more similar to what people are used to see on an IDE.
On item 3, I believe you should be able to further filter the list of suggestions on your code before inserting the result in the completion popup.
I'm glad to know about your goals for this project, this makes things much more clear. It's always good to know what to expect.
I am sorry to hear you have no plans to improve Sublime functionality much further, but I do understand the technical restrictions and the other problems you mentioned. Still, I have no interest on Vim, and at least Sublime was bearable.
For now I'm using WebStorm EA as a TypeScript IDE, but I'm still looking for (cheaper / lighter) alternatives. Your plugin at least gives me one alternative.
Perhaps your goal to create an IDE server could result in somehting that could be used for other text editors...
I'll keep an eye on this project and, meanwhile, whish you good luck!
On item 3, I believe you should be able to further filter the list of suggestions on your code before inserting the result in the completion popup.
Actually that's not how sublime API works. You provide the list of words on autocompletion initialization. You then have no hook to further filter the list.
I'll keep an eye on this project and, meanwhile, whish you good luck!
Thanks !
Thanks for the clarification.
But I supposed your algorithm worked like this:
- user presses Ctrl + Space
- Your code calls the TypeScript language service with the file and cursor coordinates.
- The language service returns a list of possible autocompletions.
- You filter the array to remove undesirable stuff.
- You call the Sublime API to show the completion popup and give it the array as an argument.
Given your previous post, It seems things work differently. Where am I mistaken?