Skip to content

Commit

Permalink
Bump tree-sitter-r 4 - Syntax vs Semantic Diagnostics (#523)
Browse files Browse the repository at this point in the history
* Fix invalid R code in `indent.R` causing issues

* Embrace `{ }` illegal if/else statements in `indent.R`

* Bump tree-sitter-r

* Remove `UnmatchedDelimiter` node

* First pass at diagnostics update

* Bump tree-sitter-r again

To get a combination of fixes that work nicely together

* Split syntax and semantic diagnostics

* Tweak some message formatting

* Allow semantic diagnostics on subtrees with no errors

* Add customized syntax error for unmatched closing token

* Don't need a mutable context

* More on not needing a mutable context

* Add syntax error range truncation to avoid overwhelming the user

Can often occur when you have unmatched string delimiters, which there isn't much else we can do about

* Ha, use a package that will always be installed

Otherwise we get a diagnostic about dplyr not being installed

* Simplify `node_find_string()` a little

* Remove `build_` prefix

* Tweak message

* Bump to latest tree-sitter-r, includes tree-sitter 0.23.0

* Adapt to new tree-sitter `LANGUAGE` conventions

* Update to `LANGUAGE` in tests too

* Add test for previous `(0, 0)` `program` node issue

* Fix more invalid R syntax in `indent.R`

Otherwise example 34 now indents out one level

* Custom panic message in `statement_range_test()`

* Bump tree-sitter-r one more time for r-lib/tree-sitter-r#145

* Fix tests related to `(0, 0)` `program` node issue

* Adapt diagnostics tests to tree-sitter-r grammar changes

* Bump tree-sitter-r once again

* Rename syntactic -> syntax

* Remove TODOs in `indent.R`

* Token -> Delimiter

* Switch to snapshot testing for diagnostics

* Use simpler recursion scheme for only reporting terminal `ERROR`s
  • Loading branch information
DavisVaughan committed Sep 23, 2024
1 parent 9ed08ae commit 0223ef4
Show file tree
Hide file tree
Showing 34 changed files with 974 additions and 480 deletions.
26 changes: 17 additions & 9 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions crates/ark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ serde_json = { version = "1.0.94", features = ["preserve_order"]}
stdext = { path = "../stdext" }
tokio = { version = "1.26.0", features = ["full"] }
tower-lsp = "0.19.0"
tree-sitter = "0.22.6"
tree-sitter-r = { git = "https://github.com/r-lib/tree-sitter-r", rev = "63ee9b10de3b1e4dfaf40e36b45e9ae3c9ed8a4f" }
tree-sitter = "0.23.0"
tree-sitter-r = { git = "https://github.com/r-lib/tree-sitter-r", rev = "2097fa502efa21349d26af0ffee55d773015e481" }
uuid = "1.3.0"
url = "2.4.1"
walkdir = "2"
Expand Down
Loading

0 comments on commit 0223ef4

Please sign in to comment.