cakecatz / flex-toolbar

Easily Customizable Toolbar for Atom
https://atom.io/packages/flex-tool-bar
MIT License
74 stars 11 forks source link

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

Open juschu opened 7 years ago

juschu commented 7 years ago

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.

UziTech commented 6 years ago

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

image