Skip to content
This repository has been archived by the owner on Apr 30, 2021. It is now read-only.

Commit

Permalink
Added configs for hiding error annotations or diagnostics
Browse files Browse the repository at this point in the history
  • Loading branch information
lannonbr committed Sep 14, 2018
1 parent 67587e6 commit d7099c0
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 0.8.1 - Sep 13, 2018
- [Hotfix] Added settings to hide either of the diagnostics or error annotations

## 0.8.0 - Sep 13, 2018
- [Feature] Invalid parameters in JS will now appear in the Problems panel

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ There currently is a few configurable settings in the extension
|-------|------------|---------|
| `jsannotations.enabled` | Enable JS Annotations | true |
| `jsannotations.hideIfEqual` | Hide annotation if argument name matches parameter name | true |
| `jsannotations.hideInvalidAnnotation` | Hide annotations for invalid params | true |
| `jsannotations.hideDiagnostics` | Hide red squiggles under invalid parameters | false |
| `jsannotations.fontWeight` | Annotation styling of font-weight CSS property | "400" |
| `jsannotations.fontStyle` | Hide annotation if argument name matches parameter name | "italic" |

Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "vscode-js-annotations",
"displayName": "JS Parameter Annotations",
"description": "Annotations for parameters in your JS / TS Files to mimic named parameters",
"version": "0.8.0",
"version": "0.8.1",
"publisher": "lannonbr",
"engines": {
"vscode": "^1.25.0"
Expand Down Expand Up @@ -39,6 +39,16 @@
"description": "Enable JS Annotations",
"default": true
},
"jsannotations.hideInvalidAnnotation": {
"type": "boolean",
"description": "Hide annotations for invalid params",
"default": true
},
"jsannotations.hideDiagnostics": {
"type": "boolean",
"description": "Hide red squiggles under invalid parameters",
"default": false
},
"jsannotations.hideIfEqual": {
"type": "boolean",
"description": "Hide annotation if argument name matches parameter name",
Expand Down
11 changes: 6 additions & 5 deletions src/decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ export async function decorateFunctionCall(currentEditor: vscode.TextEditor, doc
decoration = Annotations.paramAnnotation(paramList[restParamIdx] + `[${idx - restParamIdx}]: `, currentArgRange);
} else {
if (idx >= paramList.length) {
const errorDecoration = Annotations.errorParamAnnotation(currentArgRange);

if (currentEditor.document.languageId === "javascript") {

if (currentEditor.document.languageId === "javascript" && vscode.workspace.getConfiguration("jsannotations").get("hideDiagnostics") === false) {
const diag = new vscode.Diagnostic(currentArgRange, "[JS Param Annotations] Invalid parameter", vscode.DiagnosticSeverity.Error);
diagnostics.push(diag);
}

errDecArray.push(errorDecoration);
if (vscode.workspace.getConfiguration("jsannotations").get("hideInvalidAnnotation") === false) {
const errorDecoration = Annotations.errorParamAnnotation(currentArgRange);
errDecArray.push(errorDecoration);
}

continue;
}
decoration = Annotations.paramAnnotation(paramList[idx] + ": ", currentArgRange);
Expand Down

0 comments on commit d7099c0

Please sign in to comment.