atom / first-mate

TextMate helpers
http://atom.github.io/first-mate
MIT License
91 stars 57 forks source link

Does not detect and doesn't auto-reload development grammars #84

Open software-opal opened 7 years ago

software-opal commented 7 years ago

I was writing a custom grammar for an internal file format(named source.tks) on my local machine. I'd installed the package with apm link; but the grammar was not loaded. Instead I needed to force it to be added using the developer console.

Additionally any edits I made to the grammar file were not synchronised in the editor; requiring me to remove the grammar and re-add it.

I used this command:

atom.grammars.getGrammars().forEach(
  (g) => g.scopeName == 'source.tks' ? atom.grammars.removeGrammar(g) : 0);
atom.grammars.addGrammar(
  atom.grammars.readGrammarSync(
    '/home/lee/Scratchpad/language-tks/grammars/tks.cson'))

At first I thought that the problem was with my code/layout; however once I published it on APM it worked perfectly.