Skip to content
This repository has been archived by the owner on Oct 19, 2018. It is now read-only.

Added scopeNames to the grammar modal #38

Merged
merged 1 commit into from
Oct 17, 2018

Conversation

DamnedScholar
Copy link
Contributor

Description of the Change

It came up on the forum, so I decided that it would be cool if the grammar selector also displayed the scopeName for each grammar. This would make it much more convenient for someone to identify the scope selector of a given language than having to go to Settings, Packages, wait for the package list to load, and then the package settings page. So I did it.

http://puu.sh/toDVZ/02f699229f.png

Alternate Designs

I used precisely the same method as is used to display keybindings in the Command Palette, so that the appearance of the two modals will be consistent. I didn't consider any alternatives.

Benefits

Centralized scopeNames, less work for someone to figure out which selector they need for an entry in config.cson, snippets.cson, or styles.less.

Possible Drawbacks

I can't conceive of any.

@ghost
Copy link

ghost commented Sep 7, 2017

(?) Any idea when this will add into the main project?

@winstliu
Copy link
Contributor

I am actually 👎 on the "consistent" appearance. Command Palette actually uses keybindings; scope names are not keybindings. Would this be better suited as a tooltip (#42)?

@ghost
Copy link

ghost commented Oct 29, 2017

@50Wliu :

I am actually 👎 on the "consistent" appearance.

That should not be the overriding argument. It is a functionality/information that is (IMHO) useful to have "close by". I know I would use this.

It would be better to have a functionality there and have the community hit heads together on how to make it pretty; in contrast for the community not having such functionality.

A tooltip will work if it pops up on the selection list of grammars.. not as shown in link (#42).

Counter suggestion - have the scope names be written in the same colour as the background, then when the grammar is selected / mouse pointer hover over it, the colour of the text changes. Very much the same as highlighting text in another colour, but this time it becomes visible.

@winstliu
Copy link
Contributor

winstliu commented Oct 29, 2017

My 👎 was not a 👎 on the whole concept, merely the styling. See how the Command Palette shows extra information, for example:
command-palette-description

I think that's a much better way of displaying the scope names if it were to remain in the grammar selector list and not the tooltip.

@ghost
Copy link

ghost commented Oct 30, 2017

@50Wliu - I rather like your newest proposal.
@DamnedScholar .. this is your brain-child, any opinions from you?

My personal view is to have it in the grammar selector. When needing to know the scope name, one is not always busy with text of that particular grammar. Think of adding keybinding or snippet as example.

The scope name could be placed in a tooltip.. but that is also and not instead of.

@DamnedScholar
Copy link
Contributor Author

DamnedScholar commented Nov 2, 2017

I don't think it works as a tooltip for two reasons: tooltips are used to save space and for supplemental information. This information is something that someone might open the grammar selector in order to find, so making them mouse over the box in order to get that information would be additional work when the proposal was aimed at reducing work. There's also plenty of real estate.

Having the scope name be inline with the grammar name is a possibility, but one of the things I like about pushing them over to the right is that it looks better when two different items of information are balanced on either side of the available real estate. Obviously, the most important part is to get the information included, so if the maintainers decide that they want a format with all of the information left-justified, then that's perfectly doable.

The scope names are like the keybindings in the sense that both are supplemental information to the primary item of information. You pull up the Command Palette to check keybindings in the same way that you might pull up the Grammar Selector to check scopes, if this feature were implemented. I don't see much difference between the two.

@maxbrunsfeld maxbrunsfeld merged commit a660b7d into atom:master Oct 17, 2018
@maxbrunsfeld
Copy link
Contributor

maxbrunsfeld commented Oct 17, 2018

I went ahead and merged this. The class name key-binding is a bit misleading, but visually I think this design looks great (based on the screenshot that @DamnedScholar included in the body). I'm not opposed to tweaking the presentation further, but I wanted to get this in because we're going to move this code into the core Atom repo.

Thanks for the contribution @DamnedScholar!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants