Skip to content

Commit a8bb5b6

Browse files
Merge pull request #16 from Workiva/suppress-output-error-option
Add new option to suppress output errors
2 parents 7930bbc + e0b1841 commit a8bb5b6

4 files changed

Lines changed: 16 additions & 7 deletions

File tree

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ RUN yum install -y \
1010

1111
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash && \
1212
. ~/.nvm/nvm.sh && \
13-
nvm install node && \
13+
nvm install 17 && \
1414
npm install yarn -g && \
1515
yarn install && \
1616
yarn compile && \

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "over-react-format-on-save",
33
"displayName": "OverReact Format on Save",
44
"description": "A Dart project formatting tool that enables formatting on file save. Attempts to use OverReact Format but defaults to dartfmt.",
5-
"version": "1.0.0",
5+
"version": "1.0.1",
66
"publisher": "Workiva",
77
"repository": "https://github.com/Workiva/vs-code-format-on-save/",
88
"engines": {
@@ -12,7 +12,7 @@
1212
"Other"
1313
],
1414
"activationEvents": [
15-
"*"
15+
"onLanguage:dart"
1616
],
1717
"main": "./out/extension.js",
1818
"contributes": {
@@ -47,6 +47,12 @@
4747
"type": "boolean",
4848
"description": "Allows the extension to scan for pubspec.yaml files that are nested somewhere in the project (defaulting to the project root) when the formatter runs.\n\nSee the extension details for more information.",
4949
"default": false
50+
},
51+
"overReact.formatOnSave.showOutputOnError": {
52+
"Title": "Show output console when error occurs in formatter",
53+
"type": "boolean",
54+
"description": "By default the extension will show the output console when an error occurs in the formatter. This can be disabled.",
55+
"default": true
5056
}
5157
}
5258
}

src/extension.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,14 @@ class RunFormatOnSave {
186186

187187
child.on('exit', (e) => {
188188
if (e === 0) {
189-
this.showStatusMessage('Formatting succeeded');
190-
}
189+
this.showStatusMessage('OverReact formatting succeeded');
190+
} else {
191+
this.showStatusMessage('OverReact formatting failed');
191192

192-
if (e !== 0) {
193-
this.channel.show(true);
193+
const shouldShowOutputOnError = this.config.get<Boolean>('showOutputOnError');
194+
if (shouldShowOutputOnError) {
195+
this.channel.show(true);
196+
}
194197
}
195198
});
196199
}

0 commit comments

Comments
 (0)