Skip to content
This repository has been archived by the owner on Jun 13, 2022. It is now read-only.

It's not obvious which grammar names to use #105

Open
juschu opened this issue Mar 25, 2017 · 1 comment
Open

It's not obvious which grammar names to use #105

juschu opened this issue Mar 25, 2017 · 1 comment

Comments

@juschu
Copy link

juschu commented Mar 25, 2017

show, hide, enable and disable need the names of the grammar. But the README.md doesn't show any information which names those are.
I tried to add a JavaScript button. show: "js" didn't work. Then I tried show: ".source.js" and show: "source.js" because this is what you have to use in snippets and you can find it in the language package next to "Scope". But it didn't work.
Then I tried to find out the grammar name with atom.workspace.getActiveTextEditor().getGrammar().name and this gave me the correct grammar name for any language I needed.

At least I solved my problem but others still could run in the same problem. Perhaps you could include a toolbar.coffe instead of a toolbar.cson by default which already has a "get grammar" button like this.

module.exports = [
	{
		type: "function"
		icon: "language"
		iconset: "fa"
		callback: (target) ->
			alert atom.workspace.getActiveTextEditor().getGrammar().name
		tooltip: "get grammar"
	}
]

That would be much better that just trying out different names until you find the right one.

tjapro added a commit to tjapro/flex-toolbar that referenced this issue Oct 3, 2017
Add icon and iconset configuration.
Add a note about grammar: issue cakecatz#105
@UziTech
Copy link
Collaborator

UziTech commented Mar 7, 2018

Another way to find the grammar name is to use the name in the change grammar dropdown list

image

@UziTech UziTech pinned this issue Mar 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants