-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Prism warnings in diagnostics (#1437)
* feat: surface prism warnings as diagnostics * clean: shorter location usage
- Loading branch information
Showing
4 changed files
with
162 additions
and
11 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
110 changes: 110 additions & 0 deletions
110
test/expectations/diagnostics/syntax_diagnostics.exp.json
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,110 @@ | ||
{ | ||
"result": [ | ||
{ | ||
"range": { | ||
"start": { | ||
"line": 7, | ||
"character": 0 | ||
}, | ||
"end": { | ||
"line": 7, | ||
"character": 0 | ||
} | ||
}, | ||
"severity": 1, | ||
"source": "Prism", | ||
"message": "unexpected end of file, assuming it is closing the parent top level context" | ||
}, | ||
{ | ||
"range": { | ||
"start": { | ||
"line": 7, | ||
"character": 0 | ||
}, | ||
"end": { | ||
"line": 7, | ||
"character": 0 | ||
} | ||
}, | ||
"severity": 1, | ||
"source": "Prism", | ||
"message": "expected an `end` to close the `def` statement" | ||
}, | ||
{ | ||
"range": { | ||
"start": { | ||
"line": 0, | ||
"character": 2 | ||
}, | ||
"end": { | ||
"line": 0, | ||
"character": 3 | ||
} | ||
}, | ||
"severity": 2, | ||
"source": "Prism", | ||
"message": "ambiguous first argument; put parentheses or a space even after `+` operator" | ||
}, | ||
{ | ||
"range": { | ||
"start": { | ||
"line": 1, | ||
"character": 2 | ||
}, | ||
"end": { | ||
"line": 1, | ||
"character": 3 | ||
} | ||
}, | ||
"severity": 2, | ||
"source": "Prism", | ||
"message": "ambiguous first argument; put parentheses or a space even after `-` operator" | ||
}, | ||
{ | ||
"range": { | ||
"start": { | ||
"line": 2, | ||
"character": 2 | ||
}, | ||
"end": { | ||
"line": 2, | ||
"character": 3 | ||
} | ||
}, | ||
"severity": 2, | ||
"source": "Prism", | ||
"message": "ambiguous `*` has been interpreted as an argument prefix" | ||
}, | ||
{ | ||
"range": { | ||
"start": { | ||
"line": 3, | ||
"character": 2 | ||
}, | ||
"end": { | ||
"line": 3, | ||
"character": 3 | ||
} | ||
}, | ||
"severity": 2, | ||
"source": "Prism", | ||
"message": "ambiguous `/`; wrap regexp in parentheses or add a space after `/` operator" | ||
}, | ||
{ | ||
"range": { | ||
"start": { | ||
"line": 4, | ||
"character": 7 | ||
}, | ||
"end": { | ||
"line": 4, | ||
"character": 10 | ||
} | ||
}, | ||
"severity": 2, | ||
"source": "Prism", | ||
"message": "END in method; use at_exit" | ||
} | ||
], | ||
"params": [] | ||
} |
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,7 @@ | ||
b +a | ||
b -a | ||
b *a | ||
b /a/ | ||
def m; END{}; end | ||
|
||
def foo |
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