Fix #52 to prevent spitting an error message when whitespace package is not active

This commit is contained in:
Seongjae Lee
2016-06-23 19:07:40 -07:00
parent aa641ba695
commit 0dd99d805b
+5 -2
View File
@@ -105,9 +105,12 @@ class NotationalVelocityView extends SelectListView
if filePath
atom.workspace.open(filePath).then (editor) ->
save = ->
atom.packages.deactivatePackage 'whitespace'
isWhiteSpaceActive = atom.packages.isPackageActive 'whitespace'
if isWhiteSpaceActive
atom.packages.deactivatePackage 'whitespace'
editor.save()
atom.packages.activatePackage 'whitespace'
if isWhiteSpaceActive
atom.packages.activatePackage 'whitespace'
debouncedSave = _.debounce save, 1000
editor.onDidStopChanging () ->
debouncedSave() if editor.isModified()