You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thread 'main' panicked at 'byte index 14 is out of bounds of ` foo = "foo"`', src/formatting.rs:440:43
Expected behavior
The diff should be printed without any error.
Log output/screenshots
❯ RUST_BACKTRACE=full diffsitter --debug test-a.tf test-b.tf
2022-11-16T20:11:09.402Z DEBUG diffsitter > Checking if test-a.tf can be parsed
2022-11-16T20:11:09.402Z INFO diffsitter::parse > Deduced language "hcl" from extension "tf" provided from user mappings
2022-11-16T20:11:09.402Z INFO diffsitter::parse > Using tree-sitter parser for language hcl
2022-11-16T20:11:09.402Z INFO diffsitter::parse > Succeeded loading grammar for hcl
2022-11-16T20:11:09.402Z DEBUG diffsitter > Checking if test-b.tf can be parsed
2022-11-16T20:11:09.402Z INFO diffsitter::parse > Deduced language "hcl" from extension "tf" provided from user mappings
2022-11-16T20:11:09.402Z INFO diffsitter::parse > Using tree-sitter parser for language hcl
2022-11-16T20:11:09.402Z INFO diffsitter::parse > Succeeded loading grammar for hcl
2022-11-16T20:11:09.402Z DEBUG diffsitter > Extensions for both input files are supported
2022-11-16T20:11:09.402Z DEBUG diffsitter > Reading test-a.tf to string
2022-11-16T20:11:09.402Z INFO diffsitter > Will deduce filetype from file extension
2022-11-16T20:11:09.402Z INFO diffsitter::parse > Deduced language "hcl" from extension "tf" provided from user mappings
2022-11-16T20:11:09.402Z INFO diffsitter::parse > Using tree-sitter parser for language hcl
2022-11-16T20:11:09.402Z INFO diffsitter::parse > Succeeded loading grammar for hcl
2022-11-16T20:11:09.402Z DEBUG diffsitter::parse > Constructed parser
2022-11-16T20:11:09.402Z DEBUG diffsitter::parse > Parsed AST
2022-11-16T20:11:09.402Z INFO TimerFinished > parse::parse_file(), Elapsed=225.133µs
2022-11-16T20:11:09.403Z DEBUG diffsitter > Reading test-b.tf to string
2022-11-16T20:11:09.403Z INFO diffsitter > Will deduce filetype from file extension
2022-11-16T20:11:09.403Z INFO diffsitter::parse > Deduced language "hcl" from extension "tf" provided from user mappings
2022-11-16T20:11:09.403Z INFO diffsitter::parse > Using tree-sitter parser for language hcl
2022-11-16T20:11:09.403Z INFO diffsitter::parse > Succeeded loading grammar for hcl
2022-11-16T20:11:09.403Z DEBUG diffsitter::parse > Constructed parser
2022-11-16T20:11:09.403Z DEBUG diffsitter::parse > Parsed AST
2022-11-16T20:11:09.403Z INFO TimerFinished > parse::parse_file(), Elapsed=73.527µs
2022-11-16T20:11:09.403Z INFO TimerFinished > ast::from_ts_tree(), Elapsed=18.268µs
2022-11-16T20:11:09.403Z INFO TimerFinished > ast::process(), Elapsed=37.945µs
2022-11-16T20:11:09.403Z INFO TimerFinished > ast::from_ts_tree(), Elapsed=3.375µs
2022-11-16T20:11:09.403Z INFO TimerFinished > ast::process(), Elapsed=9.209µs
2022-11-16T20:11:09.403Z INFO TimerFinished > diff::compute_edit_script(), Elapsed=4.517µs
2022-11-16T20:11:09.403Z INFO diffsitter::formatting > Detected terminal width: 104 columns
2022-11-16T20:11:09.403Z INFO diffsitter::formatting > Using stack style horizontal for title
2022-11-16T20:11:09.403Z DEBUG diffsitter::formatting > Printing remaining old hunks
2022-11-16T20:11:09.403Z DEBUG diffsitter::formatting > Printing remaining new hunks
2022-11-16T20:11:09.403Z DEBUG diffsitter::formatting > Printing hunk (lines 1 - 1)
2022-11-16T20:11:09.403Z DEBUG diffsitter::formatting > Title string has length of 3
2022-11-16T20:11:09.403Z DEBUG diffsitter::formatting > Printing line 1
thread 'main' panicked at 'byte index 14 is out of bounds of ` foo = "foo"`', src/formatting.rs:440:43
stack backtrace:
0: 0x10026b306 - __mh_execute_header
1: 0x10021093b - __mh_execute_header
2: 0x1002672e0 - __mh_execute_header
3: 0x10026ebbb - __mh_execute_header
4: 0x10026f428 - __mh_execute_header
5: 0x10026ef24 - __mh_execute_header
6: 0x10026ee99 - __mh_execute_header
7: 0x10026ee55 - __mh_execute_header
8: 0x10036da03 - __mh_execute_header
9: 0x10036deec - __mh_execute_header
10: 0x100185de8 - __mh_execute_header
11: 0x10019468b - __mh_execute_header
12: 0x1001a9096 - __mh_execute_header
13: 0x1001ab227 - __mh_execute_header
14: 0x7ff809791310 - <unknown>
2022-11-16T20:11:09.404Z INFO TimerFinished > formatting::print(), Elapsed=727.907µs
test-a.tf -> test-b.tf
======================
1:
--
+ foo = "foo"%
Platform:
OS: macOS 13 (Ventura)
The text was updated successfully, but these errors were encountered:
Thanks for the report, this is an interesting little bug. The Go one appears to because I assumed that there would never be a node that's just a newline, unclear if this one is the same
Describe the bug
Out of Bounds error while diffing two Terraform files
To Reproduce
Steps to reproduce the behavior:
.tf
files ashcl
.Expected behavior
The diff should be printed without any error.
Log output/screenshots
Platform:
OS: macOS 13 (Ventura)
The text was updated successfully, but these errors were encountered: