flex-toolbar icon indicating copy to clipboard operation
flex-toolbar copied to clipboard

It's not obvious which grammar names to use

Open juschu opened this issue 7 years ago • 1 comments

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.

juschu avatar Mar 25 '17 07:03 juschu

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

image

UziTech avatar Mar 07 '18 05:03 UziTech