Skip to content

Commit 3ffecf6

Browse files
committed
put syntax errors to output
1 parent 1f92cc8 commit 3ffecf6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/extension.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {MODES} from './clangMode';
55
import {getBinPath} from './clangPath';
66
import sax = require('sax');
77

8+
export let outputChannel = vscode.window.createOutputChannel('Clang-Format');
9+
810
export class ClangDocumentFormattingEditProvider implements vscode.DocumentFormattingEditProvider, vscode.DocumentRangeFormattingEditProvider {
911
private defaultConfigure = {
1012
executable: 'clang-format',
@@ -180,9 +182,15 @@ export class ClangDocumentFormattingEditProvider implements vscode.DocumentForma
180182
vscode.window.showInformationMessage('The \'' + formatCommandBinPath + '\' command is not available. Please check your clang-format.executable user setting and ensure it is installed.');
181183
return resolve(null);
182184
}
183-
if (err) {
185+
if (stderr) {
186+
outputChannel.show();
187+
outputChannel.clear();
188+
outputChannel.appendLine(stderr);
184189
return reject('Cannot format due to syntax errors.');
185190
}
191+
if (err) {
192+
return reject()
193+
}
186194

187195
let dummyProcessor = (value: string) => {
188196
debugger;

0 commit comments

Comments
 (0)