-
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
Merged
cristianoc
merged 13 commits into
rescript-lang:master
from
aspeddro:feat-publish-diagnostics
Jun 29, 2022
Merged
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9039a04
feat: add diagnostics syntax
aspeddro c74af0a
add help to cli
aspeddro 6b4acd0
add tests
aspeddro 3d1e5c1
fix tests
aspeddro 0a681ef
fix stringify
aspeddro 3b41ad0
fix position
aspeddro d11c143
add source
aspeddro 70a3846
Merge branch 'master' into feat-publish-diagnostics
aspeddro f9de5e0
fix test
aspeddro 7519dce
feat(server): syntax error as you type
aspeddro e945742
Merge branch 'master' into feat-publish-diagnostics
aspeddro 39079ad
support .resi
aspeddro d93311a
refactor
aspeddro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,26 @@ | ||
let document_syntax ~path = | ||
let parse = | ||
Res_driver.parsingEngine.parseImplementation ~forPrinter:false | ||
aspeddro marked this conversation as resolved.
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 - 1; character = startcol}; | ||
end_ = {line = endline - 1; character = endcol}; | ||
}; | ||
message = Res_diagnostics.explain diagnostic; | ||
severity = Error; | ||
}) |
This file contains hidden or 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 hidden or 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,5 @@ | ||
let = 1 + 1.0 | ||
let add = =2 | ||
lett a = 2 | ||
|
||
//^dia |
This file contains hidden or 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,17 @@ | ||
[{ | ||
"range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 5}}, | ||
"message": "I was expecting a name for this let-binding. Example: `let message = \"hello\"`", | ||
"severity": 1, | ||
"source": "ReScript" | ||
}, { | ||
"range": {"start": {"line": 1, "character": 9}, "end": {"line": 1, "character": 11}}, | ||
"message": "This let-binding misses an expression", | ||
"severity": 1, | ||
"source": "ReScript" | ||
}, { | ||
"range": {"start": {"line": 2, "character": 4}, "end": {"line": 2, "character": 6}}, | ||
"message": "consecutive statements on a line must be separated by ';' or a newline", | ||
"severity": 1, | ||
"source": "ReScript" | ||
}] | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.