diff --git a/lib/main.js b/lib/main.js index 69aceddc..901c32d5 100644 --- a/lib/main.js +++ b/lib/main.js @@ -129,18 +129,12 @@ module.exports = { rules = ignoredRulesWhenFixing; } - // The fix replaces the file content and the cursor jumps automatically - // to the beginning of the file, so save current cursor position - const cursorPosition = editor.getCursorBufferPosition(); _this.worker.request('job', { type: 'fix', config: atom.config.get('linter-eslint'), rules, filePath, projectPath - }).then(function () { - // set cursor to the position before fix job - editor.setCursorBufferPosition(cursorPosition); }).catch(function (err) { atom.notifications.addWarning(err.message); }); @@ -189,9 +183,6 @@ module.exports = { rules = ignoredRulesWhenFixing; } - // The fix replaces the file content and the cursor jumps automatically - // to the beginning of the file, so save current cursor position - const cursorPosition = textEditor.getCursorBufferPosition(); _this.worker.request('job', { type: 'fix', config: atom.config.get('linter-eslint'), @@ -200,9 +191,6 @@ module.exports = { projectPath }).then(function (response) { return atom.notifications.addSuccess(response); - }).then(function () { - // set cursor to the position before fix job - textEditor.setCursorBufferPosition(cursorPosition); }).catch(function (err) { atom.notifications.addWarning(err.message); }); diff --git a/src/main.js b/src/main.js index 707cc820..187866aa 100644 --- a/src/main.js +++ b/src/main.js @@ -123,18 +123,12 @@ module.exports = { rules = ignoredRulesWhenFixing } - // The fix replaces the file content and the cursor jumps automatically - // to the beginning of the file, so save current cursor position - const cursorPosition = editor.getCursorBufferPosition() this.worker.request('job', { type: 'fix', config: atom.config.get('linter-eslint'), rules, filePath, projectPath - }).then(() => { - // set cursor to the position before fix job - editor.setCursorBufferPosition(cursorPosition) }).catch((err) => { atom.notifications.addWarning(err.message) }) @@ -176,9 +170,6 @@ module.exports = { rules = ignoredRulesWhenFixing } - // The fix replaces the file content and the cursor jumps automatically - // to the beginning of the file, so save current cursor position - const cursorPosition = textEditor.getCursorBufferPosition() this.worker.request('job', { type: 'fix', config: atom.config.get('linter-eslint'), @@ -187,10 +178,7 @@ module.exports = { projectPath }).then(response => atom.notifications.addSuccess(response) - ).then(() => { - // set cursor to the position before fix job - textEditor.setCursorBufferPosition(cursorPosition) - }).catch((err) => { + ).catch((err) => { atom.notifications.addWarning(err.message) }) }