-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CodeActions provider to suppress typechecker errors via HH_FIXME …
…comment.
- Loading branch information
1 parent
2964104
commit 65912d8
Showing
7 changed files
with
58 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/** | ||
* @file Function triggered from 'hack.suppressError' command to add a suppress error comment before the given line. | ||
*/ | ||
|
||
import * as vscode from 'vscode'; | ||
|
||
export function suppressError(document: vscode.TextDocument, line: number, errorCodes: number[]) { | ||
const edit = new vscode.WorkspaceEdit(); | ||
const fullLine = document.lineAt(line); | ||
const prefixIndex = fullLine.firstNonWhitespaceCharacterIndex; | ||
const prefix = fullLine.text.substr(0, prefixIndex); | ||
errorCodes.forEach(code => { | ||
edit.insert(document.uri, new vscode.Position(line, 0), prefix + '/* HH_FIXME[' + code + '] */\n'); | ||
}); | ||
return vscode.workspace.applyEdit(edit); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters