cakecatz / atom-hot-package-loader

:package: Hot reloading for developing pakcage
https://atom.io/packages/atom-hot-package-loader
MIT License
12 stars 3 forks source link

Update grammars for affected text buffers after reloading package #1

Closed PaulPorfiroff closed 8 years ago

PaulPorfiroff commented 8 years ago

After the targeted package has been reloaded, the GrammarRegistry updates, but currently open text editors still reference old grammars.

PaulPorfiroff commented 8 years ago

Seems like just doing TextEditor::reloadGrammar() for editors using grammars from targeted package fixes an issue.

cakecatz commented 8 years ago

@PaulPorfiroff Thanks for reporting! I fixed that and released new version.

PaulPorfiroff commented 8 years ago

Hey, @cakecatz, thanks for update. But.

It only works fine when text buffer with grammar sample has been saved to a file. But fails for all the untitled buffers in a workspace, reverting them to Null Grammar after reloading.

It also randomly fails when I've got, say, two grammars with the same scopeName (that was setup for quick tests).

I dag up Atom's sources a bit and drafted a solution to reload grammars based on grammar paths, which solves both problems.