atom-ide-purescript icon indicating copy to clipboard operation
atom-ide-purescript copied to clipboard

Add a specific class to the <atom-text-editor> elements where ide-purescript is active

Open arthurxavierx opened this issue 8 years ago • 3 comments

Adding and removing a specific class (e.g. ide-purescript-editor) to the elements where ide-purescript is active or not is a good way of keeping track of the availability of certain commands (in keymaps, for example) or it can be used for extra styling customizations.

Using syntax--* or source-like selectors is bad and should be avoided, as, for instance, there could be different packages which use the same syntax grammars but do not provide the same commands.

arthurxavierx avatar Feb 22 '17 23:02 arthurxavierx

That sounds reasonable, is there an existing example of this you can point to maybe in one of the more major language packages? I'm pretty sure I just cribbed selector pattern from existing examples.

nwolverson avatar Feb 22 '17 23:02 nwolverson

The only atom package which I know of that does this is omnisharp-atom. The mainstream is to add [data-grammar~="purs"]-like selectors to the keymaps and styles for example, but they won't work as they should if two packages use the same grammar and are both active.

But after thinking a little more about this, I think that maybe this is nit-picking of my part, as it is an extreme edge case which maybe never will be hit.

arthurxavierx avatar Feb 22 '17 23:02 arthurxavierx

It is certainly the case that the grammar this package uses is provided by another package, language-purescript.

(The bigger problem in my mind is that the keymaps that are provided as part of this package itself can't be scoped properly in any way or the key bindings will not be shown on the menus etc, due to the way atom tests selectors against a mock element)

nwolverson avatar Feb 23 '17 00:02 nwolverson