Skip to content

Commit b60008f

Browse files
authored
Merge pull request #2 from nunojsa/master
Extension improvements
2 parents b4508d5 + 041ff20 commit b60008f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/checkpatchProvider.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ export default class CheckpatchProvider implements vscode.CodeActionProvider {
6767

6868
// testing given configuration:
6969
var re = /total: \d* errors, \d* warnings, \d* lines checked/g;
70-
let args = this.linterConfig.args.slice();
71-
args.push('--no-tree - ');
70+
var args = ['--no-tree'];
7271
let childProcess = cp.spawnSync(this.linterConfig.path, args, { shell: true, input: ' ' });
7372
if (childProcess.pid && re.test(childProcess.stdout.toString())) {
7473
// all good
@@ -96,7 +95,7 @@ export default class CheckpatchProvider implements vscode.CodeActionProvider {
9695
private parseCheckpatchLog(log: string, basePath: string): number {
9796
const dictionary: { [fileUri: string]: vscode.Diagnostic[] } = {};
9897

99-
var re = /(WARNING|ERROR): ?(.+):(.+)?(?:\n|\r\n|)#\d+: FILE: (.*):(\d+):/g;
98+
var re = /(WARNING|ERROR|CHECK): ?(.+):(.+)?(?:\n|\r\n|)#\d+: FILE: (.*):(\d+):/g;
10099
var matches;
101100
while (matches = re.exec(log)) {
102101
let type = matches[2];
@@ -140,6 +139,8 @@ export default class CheckpatchProvider implements vscode.CodeActionProvider {
140139

141140
let childProcess = cp.spawn(this.linterConfig.path, args, { shell: true });
142141
if (childProcess.pid) {
142+
// clean old diagostics. Prevents files with only one warning from being updated
143+
this.diagnosticCollection.delete(textDocument.uri);
143144
childProcess.stdout.on('data', (data: Buffer) => log += data);
144145
childProcess.stdout.on('end', () => this.parseCheckpatchLog(log, ''));
145146
} else {

0 commit comments

Comments
 (0)