Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
fix(save): On save, use editor provided by observer
Browse files Browse the repository at this point in the history
We fetched the active text editor on every save, which prevented formatting all saved files.

Fixes #96
  • Loading branch information
darahak committed Jun 14, 2017
1 parent 7538c7b commit b93ec93
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 1 addition & 3 deletions dist/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@ var lazyFormat = function lazyFormat() {
};

// HACK: lazy load most of the code we need for performance
var lazyFormatOnSave = function lazyFormatOnSave() {
var lazyFormatOnSave = function lazyFormatOnSave(editor) {
if (!formatOnSave) formatOnSave = require('./formatOnSave'); // eslint-disable-line global-require

var editor = atom.workspace.getActiveTextEditor();
if (editor) formatOnSave(editor);
};

Expand Down
4 changes: 1 addition & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ const lazyFormat = () => {
};

// HACK: lazy load most of the code we need for performance
const lazyFormatOnSave = () => {
const lazyFormatOnSave = (editor) => {
if (!formatOnSave) formatOnSave = require('./formatOnSave'); // eslint-disable-line global-require

const editor = atom.workspace.getActiveTextEditor();
if (editor) formatOnSave(editor);
};

Expand Down

0 comments on commit b93ec93

Please sign in to comment.