Use grammar from editor when available

Saves an attempt to reselect the grammar by simply using the grammar
of the editor being previewed.