1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-02-20 14:54:31 +01:00

Added setting for autoformat before saving (editor.autoformat_currentfile_before_saving)

This commit is contained in:
Cristian Maglie 2017-04-10 15:52:21 +02:00 committed by Martino Facchin
parent 8e0d668344
commit a15abacc7f

View File

@ -2016,6 +2016,11 @@ public class Editor extends JFrame implements RunnerListener {
statusNotice(tr("Saving..."));
boolean saved = false;
try {
if (PreferencesData.getBoolean("editor.autoformat_currentfile_before_saving")) {
Tool formatTool = getOrCreateToolInstance("cc.arduino.packages.formatter.AStyle");
formatTool.run();
}
boolean wasReadOnly = sketchController.isReadOnly(BaseNoGui.librariesIndexer.getInstalledLibraries(), BaseNoGui.getExamplesPath());
String previousMainFilePath = sketch.getMainFilePath();
saved = sketchController.save();