Changes the function kind so that the context of this is now TextEditorElement and this.getModel() works. Also changed the following snippet to use this.getModel() as well.
Semicolons introduced for consistency with Atom code base (and the other snippets in here I came across).
Alternatives
TextEditorElement is undocumented. Technically could replace this.getModel() with atom.workspace.getActiveTextEditor(), to avoid an undocumented method call. However, getModel feels more correct in terms of linking the event to the right editor; it is possible for atom.workspace.getActiveTextEditor() to return a different editor, or none at all, whereas we can (probably) safely assume this.getModel() will always return the correct editor.
RIP template links.
Fixes https://github.com/atom/atom/issues/19855
Description
Changes the function kind so that the context of
this
is nowTextEditorElement
andthis.getModel()
works. Also changed the following snippet to usethis.getModel()
as well.Semicolons introduced for consistency with Atom code base (and the other snippets in here I came across).
Alternatives
TextEditorElement
is undocumented. Technically could replacethis.getModel()
withatom.workspace.getActiveTextEditor()
, to avoid an undocumented method call. However, getModel feels more correct in terms of linking the event to the right editor; it is possible foratom.workspace.getActiveTextEditor()
to return a different editor, or none at all, whereas we can (probably) safely assumethis.getModel()
will always return the correct editor.