Fixes #103. BeautifyEntireFileOnSave only applies when saving
This commit is contained in:
parent
9ec22bf43f
commit
dda313fbfe
|
@ -125,7 +125,7 @@ getConfigOptionsFromSettings = (langs) ->
|
||||||
# console.log(options);
|
# console.log(options);
|
||||||
options
|
options
|
||||||
|
|
||||||
beautify = ->
|
beautify = ({onSave})->
|
||||||
path ?= require("path")
|
path ?= require("path")
|
||||||
MessagePanelView ?= require('atom-message-panel').MessagePanelView
|
MessagePanelView ?= require('atom-message-panel').MessagePanelView
|
||||||
PlainMessageView ?= require('atom-message-panel').PlainMessageView
|
PlainMessageView ?= require('atom-message-panel').PlainMessageView
|
||||||
|
@ -133,7 +133,7 @@ beautify = ->
|
||||||
@messagePanel ?= new MessagePanelView title: 'Atom Beautify Error Messages'
|
@messagePanel ?= new MessagePanelView title: 'Atom Beautify Error Messages'
|
||||||
@loadingView ?= new LoadingView()
|
@loadingView ?= new LoadingView()
|
||||||
@loadingView.show()
|
@loadingView.show()
|
||||||
forceEntireFile = atom.config.get("atom-beautify.beautifyEntireFileOnSave")
|
forceEntireFile = onSave && atom.config.get("atom-beautify.beautifyEntireFileOnSave")
|
||||||
# Show error
|
# Show error
|
||||||
showError = (e) =>
|
showError = (e) =>
|
||||||
@loadingView.hide()
|
@loadingView.hide()
|
||||||
|
@ -306,7 +306,7 @@ handleSaveEvent = =>
|
||||||
plugin.unsubscribe buffer
|
plugin.unsubscribe buffer
|
||||||
if atom.config.get("atom-beautify.beautifyOnSave")
|
if atom.config.get("atom-beautify.beautifyOnSave")
|
||||||
events = "will-be-saved"
|
events = "will-be-saved"
|
||||||
plugin.subscribe buffer, events, beautify.bind(@)
|
plugin.subscribe buffer, events, beautify.bind(@, {onSave:true})
|
||||||
return
|
return
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue