66 CodeActionKind ,
77 CodeActionProvider ,
88 Command ,
9+ Diagnostic ,
910 DiagnosticSeverity ,
1011 ProviderResult ,
1112 Range ,
@@ -14,7 +15,7 @@ import {
1415 l10n ,
1516} from "vscode" ;
1617
17- import { sasDiagnostic } from "./sasDiagnostics" ;
18+ import { diagnosticSource , sasDiagnostic } from "./sasDiagnostics" ;
1819
1920export class DiagnosticCodeActionProvider implements CodeActionProvider {
2021 public static readonly providedCodeActionKinds = [ CodeActionKind . QuickFix ] ;
@@ -23,37 +24,40 @@ export class DiagnosticCodeActionProvider implements CodeActionProvider {
2324 _range : Range | Selection ,
2425 context : CodeActionContext ,
2526 ) : ProviderResult < ( CodeAction | Command ) [ ] > {
26- if ( context . diagnostics . length === 0 ) {
27+ const diagnostics = context . diagnostics . filter (
28+ ( diagnostic ) => diagnostic . source === diagnosticSource ,
29+ ) ;
30+ if ( diagnostics . length === 0 ) {
2731 return [ ] ;
2832 }
2933
3034 return [
3135 this . createCodeAction (
3236 document ,
33- context ,
37+ diagnostics ,
3438 sasDiagnostic . DiagnosticCommands . IgnoreCommand ,
3539 ) ,
3640 this . createCodeAction (
3741 document ,
38- context ,
42+ diagnostics ,
3943 sasDiagnostic . DiagnosticCommands . IgnoreAllWarningCommand ,
4044 ) ,
4145 this . createCodeAction (
4246 document ,
43- context ,
47+ diagnostics ,
4448 sasDiagnostic . DiagnosticCommands . IgnoreAllErrorCommand ,
4549 ) ,
4650 this . createCodeAction (
4751 document ,
48- context ,
52+ diagnostics ,
4953 sasDiagnostic . DiagnosticCommands . IgnoreAllCommand ,
5054 ) ,
5155 ] ;
5256 }
5357
5458 private createCodeAction (
5559 document : TextDocument ,
56- context : CodeActionContext ,
60+ diagnostics : Diagnostic [ ] ,
5761 command : string ,
5862 ) : CodeAction {
5963 const action = new CodeAction ( "" , CodeActionKind . QuickFix ) ;
@@ -64,7 +68,7 @@ export class DiagnosticCodeActionProvider implements CodeActionProvider {
6468 action . command = {
6569 command : command ,
6670 title : l10n . t ( "Ignore: current position" ) ,
67- arguments : [ context . diagnostics , document . uri ] ,
71+ arguments : [ diagnostics , document . uri ] ,
6872 } ;
6973 break ;
7074 case sasDiagnostic . DiagnosticCommands . IgnoreAllWarningCommand :
0 commit comments