Skip to content

Commit

Permalink
chore: add Diagnostic type to code-actions
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Feb 17, 2021
1 parent 017ea43 commit 9682198
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions types-packages/code-actions.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import * as Atom from "atom"
import { Message } from "atom/linter"

export type DiagnosticType = 'Error' | 'Warning' | 'Info';

export interface Diagnostic {
providerName: string;
type: DiagnosticType;
filePath: string;
text?: string;
range: Atom.Range;
}

export interface CodeAction {
apply(): Promise<void>
getTitle(): Promise<string>
Expand All @@ -13,7 +23,7 @@ export interface CodeActionProvider {
getCodeActions(
editor: Atom.TextEditor,
range: Atom.Range,
diagnostics: Message[]
diagnostics: Message[] | Diagnostic[]
): Promise<CodeAction[] | null | undefined>
}

Expand All @@ -24,5 +34,5 @@ export interface CodeActionProvider {
* extended to provide a stream of CodeActions based on the cursor position.
*/
export interface CodeActionFetcher {
getCodeActionForDiagnostic: (diagnostic: Message, editor: Atom.TextEditor) => Promise<CodeAction[]>
getCodeActionForDiagnostic: (diagnostic: Message | Diagnostic, editor: Atom.TextEditor) => Promise<CodeAction[]>
}

0 comments on commit 9682198

Please sign in to comment.