atom / language-clojure

Clojure package for Atom
Other
49 stars 48 forks source link

clojure files showing null grammar (via plugin) #8

Closed eyston closed 10 years ago

eyston commented 10 years ago

I'm working on a clojure(script) plugin. I have language-clojure installed, 0.8, but when I ask the editor for its grammar I get null:

(.log js/console (.getGrammar editor)) ; #=> NullGrammar

This also affects the token / scopes:

(.log js/console (.getCursorScopes editor)) ; #=> ["text.plain.null-grammar"]

The bottom of the editor window, next to row,column, shows 'Clojure'. The syntax highlighting seems to work okay as well.

I'm not sure if this is an issue with the grammar or just me being terrible at writing a plugin :).

kevinsawicki commented 10 years ago

When are you logging this?

The grammar can be the null grammar at startup but then switch to the clojure grammar once it is loaded.

Can you open a clojure file and when it says Clojure in the status bar run: atom.workspace.getActiveEditor().getGrammar().name from the dev tools console (cmd-alt-i)?

eyston commented 10 years ago

Ah of course :) My apologies, closed! And thanks!

kevinsawicki commented 10 years ago

The editor emit a grammar-changed event whenever the grammar switches. You can subscribe to it like so: https://github.com/atom/grammar-selector/blob/master/lib/grammar-status-view.coffee#L13-L15