-
Notifications
You must be signed in to change notification settings - Fork 101
Added more formatting options for snippets #194
Conversation
Added rightLabelHTML, leftLabel, leftLabelHTML in the Snippet class to be able to pass use values in a snippet, and those values to snippets-autocomplete and finally to autocomplete-plus
To be accepted, this extra functionality would need specs and updates to the documentation in the |
Thanks for the suggestions @lee-dohm, I've added a description of the fork in my first comment and updated the readme. |
Is there anything else I should do? |
@PierBover The new functionality still needs specs to make sure it doesn't regress in the future. |
Thanks @50Wliu Could you point me to an example of the type of specs you are expecting? |
Hmm, it looks like there aren't any tests for the existing parameters either 😦. Since all you're doing here is passing some new params along and not actually doing anything with them, I think it'd actually be fine not to add specs here and instead add them in autocomplete-snippets or autocomplete-plus. Thoughts @lee-dohm? |
|
||
* `leftLabel` will add text to the left part of the autocomplete results box. | ||
* `leftLabelHTML` will overwrite what's in `leftLabel` and allow you to use a bit of CSS such as `color`. | ||
* `rightLabelHTML`. By default, in th right part of the results box you will see the name of the snippet. When using `rightLabelHTML` the name of the snippet will no longer be displayed, and you will be able to use a bit of CSS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, in *the* right part
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it
I've also modified |
I'd expect to at least see something like this that shows the new snippet values get parsed correctly from a sample snippet file: https://github.com/atom/snippets/blob/master/spec/snippet-loading-spec.coffee#L33-L49 |
@lee-dohm it seems the part you highlighted is for required arguments, although since this is the first time I'm writing specs for Atom and writing in CS I'm not so sure. I've updated Checks have passed... let me know if there's anything else I must do. |
Thanks for the ping @PierBover. I missed your earlier post. Unfortunately with a project this size, sometimes that happens 😞 On the face of it, this looks good. I need to do some more testing and then if everything is working, this should be good to go. |
Awesome! @lee-dohm are you also in charge of |
I don't know that I'm necessarily "in charge" of anything 😀 But I've got my fingers in everything 😆 Why do you ask? |
:) Sorry... I'm a bit of a noob at contributing to Atom. I was asking because if / when this PR gets accepted I will need to make a PR in |
You can create it now and just say in the PR comment that it is dependent On Fri, Mar 18, 2016 at 7:13 PM, Pier Bover notifications@github.com
|
Thanks for contributing! Sorry for the delay 😀 |
Yay! :) I've been super busy but I will create the PR on |
When working on a snippet I was wondering how other packages formatted the results in the autocomplete list. So I found the
autocomplete-plus
API can accept more parameters for formatting the results.I thought it would be awesome to be able to visually format results for snippets too, so I have added those properties in the Snippet class so that you could add those in the cson files that define snippets.
The idea is to read those optional properties from the cson file and provide them to autocomplete-snippets which in turn will deliver those results to autocomplete-plus.
Additions to the Snippet class (All parameters are optional)
I haven't added rightLabel because
autocomplete-snippets
uses thename
of the snippet to fill that and is what all current snippets use to display some info.I have also worked on
autocomplete-snippets
locally, but I will wait for this pull request to be accepted before submitting it there.