@@ -9,12 +9,20 @@ export interface LinterConfig {
99 path : string ;
1010 args : string [ ] ;
1111 excludeGlobs : string [ ] ;
12+ diagnosticSeverity : vscode . DiagnosticSeverity ;
1213}
1314
1415interface RepoPickItem extends vscode . QuickPickItem {
1516 repo : Repository ;
1617}
1718
19+ const diagSeverityMap = new Map < string , vscode . DiagnosticSeverity > ( [
20+ [ 'Error' , vscode . DiagnosticSeverity . Error ] ,
21+ [ 'Warning' , vscode . DiagnosticSeverity . Warning ] ,
22+ [ 'Information' , vscode . DiagnosticSeverity . Information ] ,
23+ [ 'Hint' , vscode . DiagnosticSeverity . Hint ] ,
24+ ] ) ;
25+
1826export default class CheckpatchProvider implements vscode . CodeActionProvider {
1927 private linterConfig ! : LinterConfig ;
2028 private documentListener ! : vscode . Disposable ;
@@ -58,6 +66,7 @@ export default class CheckpatchProvider implements vscode.CodeActionProvider {
5866 path : config . checkpatchPath ,
5967 args : config . checkpatchArgs ,
6068 excludeGlobs : config . exclude ,
69+ diagnosticSeverity : diagSeverityMap . get ( config . diagnosticLevel ) ?? vscode . DiagnosticSeverity . Information
6170 } ;
6271
6372 if ( this . documentListener ) {
@@ -103,8 +112,8 @@ export default class CheckpatchProvider implements vscode.CodeActionProvider {
103112 let fileName = matches [ 4 ] ;
104113 let errorline = parseInt ( matches [ 5 ] ) ;
105114 let range = new vscode . Range ( errorline - 1 , 0 , errorline - 1 , Number . MAX_VALUE ) ;
115+ let diagnostic = new vscode . Diagnostic ( range , `${ type } :${ message } ` , this . linterConfig . diagnosticSeverity ) ;
106116
107- let diagnostic = new vscode . Diagnostic ( range , `${ type } :${ message } ` , vscode . DiagnosticSeverity . Information ) ;
108117 diagnostic . code = type ;
109118 diagnostic . source = 'checkpatch' ;
110119
0 commit comments