Repository navigation
Add suggestion type icons and left label - #334
Conversation
|
LGTM. A few thoughts:
|
The provider should use one of the supported types if it can, in this case:
Each is displayed as a table column. There are 3 columns: For the icon and left label, when nothing defines them, then those columns will take up no space. If one suggestion defines either the icon or left label, there will be space for the whole column. For the
I'm not totally following. Yes, we should explain in the docs what we think should be in those fields. |
|
cc @bolinfest as you guys need something like this. If you have a list of all suggestion types you guys use, that would be helpful. Does the list above cover your needs? |
|
For go, the values I have been using in type are:
My concern here is that each grammar has a different definition of syntax types, and consequently you're going to get into a mapping quandary for most grammars. Perhaps a more flexible approach would be to somehow tie this to [a variable number of] things defined in the grammar, and use those to drive the icon and styling. |
|
The symbol types chosen are based on the scopes / classes used in the syntax themes. How are those things listed scoped / styled for go? This problem exists already in the syntax themes, no? How was it worked around? We could generify some of them. Just having a list of colors and randomly assigning them is an option, but it would be nice to tie them back to the colors the users sees in the syntax. |
|
@benogle These don't seem to map to any syntax theme, and yet the scopes they define do seem to affect colorization of the source. So I wonder if it's the scope (or parts thereof) that we should be narrowing in on, as it seems like it may be a common denominator across language? |
|
Here is a list of types this could support by default
What else would we need? Could some crazy language map onto these? |
|
Given:
Do we really want to be defining another set of 'types' that can be themed, or should we really just accept any scope (just like a grammar) and let things wash out in the syntax themes? That is; if a grammar is themed correctly, the suggestion list for that grammar should also. It forces the themes to agree upon a set of common things, as well as specific language concessions. It forces the grammars to use scopes that are commonly accepted, or work to have the syntax theme specification extended for their use case. So rather than having an accepted whitelist of types, we should move https://github.com/atom-community/autocomplete-plus/blob/075ad4348bf5b969b38fbc5527e44fb91a179433/styles/autocomplete.less#L1-L10 into the syntax themes themselves, and then do what you've done above and make sure the syntax themes include additional things. |
Yes, this is the intent. Those variables linked are defaults, and the syntax themes should override them. I think this will move toward a more consistent ecosystem of themes, and allow easier extension of themes -- new users can just fork a theme change some variables to get 95% of the way to what they want. The themes we control should have these defined shortly after merging this.
I dont understand this. Which part above?
This has always frustrated me. I would love love to have some conventions on defining scopes. I did a bunch of work on a grammar a while back, and it required looking at ~5 other grammars to understand the common scopes for something I wanted to define.
I'm not fully understanding your position here. Looks like the first paragraph disagrees with the list of types, but the second agrees. What is your read on the list I've defined above? Are you saying we should change the names to match scopes? Or not define them at all? |
I'm saying we should define the styles for them in some core stylesheet, not in the autocomplete-plus stylesheet.
Does this belong at https://atom.io/docs / https://atom.io/docs/latest/using-atom-grammar? Sounds like we're saying the same things in all the other areas. This PR is good forward movement. |
The variable defaults or the color styles for these icons? |
|
The variable defaults. |
|
|
|
This is ready to go, but I'm going to sit on it until we release 189 tomorrow. |
They are in core in version 0.189.0
Add suggestion type icons and left label

This add support for three properties on a suggestion:
leftLabel,type, andiconHTML. Your provider might return something like this:The
typeis turned into an icon in the left-most column. TheleftLabelis rendered right aligned between the icon and suggestion replacement. The user would see:In dark:
Alternatively you can use your own icon with the
iconHTMLproperty:(note the first suggestion)
Optional
Al three of these properties are optional. When not specified, the suggestion list looks much like it's looked since the beginning:
Types, Icons and Colors
Default icons are just the first letter of the type. Over time, they may be replaced by purpose-built icons.
Icon colors are determined by syntax variables. The idea is to match the icon color with the color of the symbol type. i.e. when variables are colored red, the variable icon is red.
Currently supported types with predefined colors are
variable,constant,property,value,method,function,class,keyword,tag,snippet. This list represents nearly everything being colorized.Each syntax theme can set these variables to set the icon colors:
A list of fallback colors are defined for syntax themes that do not define these variables.
Types not defined here can be used in the
typefield, but will have a fallback color. A theme can style the icons with the following less: