-
Notifications
You must be signed in to change notification settings - Fork 60
feat(analysis): add diagnostics syntax #457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
9039a04
c74af0a
6b4acd0
3d1e5c1
0a681ef
3b41ad0
d11c143
70a3846
f9de5e0
7519dce
e945742
39079ad
d93311a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
let document_syntax ~path = | ||
let parse = | ||
Res_driver.parsingEngine.parseImplementation ~forPrinter:false | ||
aspeddro marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
~filename:path | ||
in | ||
match parse.diagnostics with | ||
| [] -> [] | ||
| diagnostics -> | ||
diagnostics | ||
|> List.rev_map (fun diagnostic -> | ||
let _, startline, startcol = | ||
Location.get_pos_info (Res_diagnostics.getStartPos diagnostic) | ||
in | ||
let _, endline, endcol = | ||
Location.get_pos_info (Res_diagnostics.getEndPos diagnostic) | ||
in | ||
Protocol.stringifyDiagnostic | ||
{ | ||
range = | ||
{ | ||
start = {line = startline; character = startcol}; | ||
end_ = {line = endline; character = endcol}; | ||
}; | ||
message = Res_diagnostics.explain diagnostic; | ||
severity = Error; | ||
}) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
let = 1 + 1.0 | ||
let add = =2 | ||
lett a = 2 | ||
|
||
//^dia |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[{ | ||
|
||
"range: {"start": {"line": 1, "character": 4}, "end": {"line": 1, "character": 5}}, | ||
"message": "I was expecting a name for this let-binding. Example: `let message = \"hello\"`", | ||
"severity": 1, | ||
}, { | ||
"range: {"start": {"line": 2, "character": 9}, "end": {"line": 2, "character": 11}}, | ||
"message": "This let-binding misses an expression", | ||
"severity": 1, | ||
}, { | ||
"range: {"start": {"line": 3, "character": 4}, "end": {"line": 3, "character": 6}}, | ||
"message": "consecutive statements on a line must be separated by ';' or a newline", | ||
"severity": 1, | ||
}] |
Uh oh!
There was an error while loading. Please reload this page.