Skip to content

Commit

Permalink
Bump tree-sitter-r (#624)
Browse files Browse the repository at this point in the history
* Bump tree-sitter version to get r-lib/tree-sitter-r#152

* Add indent test

* tree-sitter-r PR has been merged
  • Loading branch information
DavisVaughan authored Nov 14, 2024
1 parent e0ffe15 commit edb1a87
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/ark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ stdext = { path = "../stdext" }
tokio = { version = "1.26.0", features = ["full"] }
tower-lsp = "0.19.0"
tree-sitter = "0.23.0"
tree-sitter-r = { git = "https://github.com/r-lib/tree-sitter-r", rev = "2097fa502efa21349d26af0ffee55d773015e481" }
tree-sitter-r = { git = "https://github.com/r-lib/tree-sitter-r", rev = "c094bd57652f8a08edc31d79a31222268fe798ee" }
uuid = "1.3.0"
url = "2.4.1"
walkdir = "2"
Expand Down
16 changes: 16 additions & 0 deletions crates/ark/src/lsp/indent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,22 @@ mod tests {
assert_match!(indent_edit(&doc, 2), Err(_));
}

#[test]
fn test_line_indent_leading_whitespace() {
// Indent should be unchanged regardless of how much leading whitespace
// there is before the first newline
// https://github.com/posit-dev/positron/issues/5258
let text = String::from(" \nx");
let doc = test_doc(&text);
let edit = indent_edit(&doc, 1).unwrap();
assert!(edit.is_none());

let text = String::from("\r\nx");
let doc = test_doc(&text);
let edit = indent_edit(&doc, 1).unwrap();
assert!(edit.is_none());
}

#[test]
fn test_line_indent_chains() {
let mut text = String::from("foo +\n bar +\n baz + qux |>\nfoofy()");
Expand Down

0 comments on commit edb1a87

Please sign in to comment.