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

Commit d7099c0

Browse files
committed
Added configs for hiding error annotations or diagnostics
1 parent 67587e6 commit d7099c0

File tree

5 files changed

+23
-7
lines changed

5 files changed

+23
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## 0.8.1 - Sep 13, 2018
4+
- [Hotfix] Added settings to hide either of the diagnostics or error annotations
5+
36
## 0.8.0 - Sep 13, 2018
47
- [Feature] Invalid parameters in JS will now appear in the Problems panel
58

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ There currently is a few configurable settings in the extension
1717
|-------|------------|---------|
1818
| `jsannotations.enabled` | Enable JS Annotations | true |
1919
| `jsannotations.hideIfEqual` | Hide annotation if argument name matches parameter name | true |
20+
| `jsannotations.hideInvalidAnnotation` | Hide annotations for invalid params | true |
21+
| `jsannotations.hideDiagnostics` | Hide red squiggles under invalid parameters | false |
2022
| `jsannotations.fontWeight` | Annotation styling of font-weight CSS property | "400" |
2123
| `jsannotations.fontStyle` | Hide annotation if argument name matches parameter name | "italic" |
2224

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vscode-js-annotations",
33
"displayName": "JS Parameter Annotations",
44
"description": "Annotations for parameters in your JS / TS Files to mimic named parameters",
5-
"version": "0.8.0",
5+
"version": "0.8.1",
66
"publisher": "lannonbr",
77
"engines": {
88
"vscode": "^1.25.0"
@@ -39,6 +39,16 @@
3939
"description": "Enable JS Annotations",
4040
"default": true
4141
},
42+
"jsannotations.hideInvalidAnnotation": {
43+
"type": "boolean",
44+
"description": "Hide annotations for invalid params",
45+
"default": true
46+
},
47+
"jsannotations.hideDiagnostics": {
48+
"type": "boolean",
49+
"description": "Hide red squiggles under invalid parameters",
50+
"default": false
51+
},
4252
"jsannotations.hideIfEqual": {
4353
"type": "boolean",
4454
"description": "Hide annotation if argument name matches parameter name",

src/decorator.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,16 @@ export async function decorateFunctionCall(currentEditor: vscode.TextEditor, doc
4949
decoration = Annotations.paramAnnotation(paramList[restParamIdx] + `[${idx - restParamIdx}]: `, currentArgRange);
5050
} else {
5151
if (idx >= paramList.length) {
52-
const errorDecoration = Annotations.errorParamAnnotation(currentArgRange);
53-
54-
if (currentEditor.document.languageId === "javascript") {
55-
52+
if (currentEditor.document.languageId === "javascript" && vscode.workspace.getConfiguration("jsannotations").get("hideDiagnostics") === false) {
5653
const diag = new vscode.Diagnostic(currentArgRange, "[JS Param Annotations] Invalid parameter", vscode.DiagnosticSeverity.Error);
5754
diagnostics.push(diag);
5855
}
5956

60-
errDecArray.push(errorDecoration);
57+
if (vscode.workspace.getConfiguration("jsannotations").get("hideInvalidAnnotation") === false) {
58+
const errorDecoration = Annotations.errorParamAnnotation(currentArgRange);
59+
errDecArray.push(errorDecoration);
60+
}
61+
6162
continue;
6263
}
6364
decoration = Annotations.paramAnnotation(paramList[idx] + ": ", currentArgRange);

0 commit comments

Comments
 (0)