Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

feat: Strip/ignore whitespace in nodes #761

Merged
merged 1 commit into from
Nov 30, 2023
Merged

Conversation

afnanenayet
Copy link
Owner

@afnanenayet afnanenayet commented Nov 17, 2023

This cleans up some code and allows for stripping whitespace/newlines from the diffs when processing the tree-sitter AST. This yields more granular diffs that don't break on whitespace differences and newlines, which seems to be desirable.

This also updates some APIs for constructing tree-sitter grammars which makes it easier to make unit tests.

@afnanenayet afnanenayet force-pushed the afnan/strip-whitespace branch from 7d87cdc to c733618 Compare November 25, 2023 04:42
@codecov-commenter
Copy link

Codecov Report

Attention: 36 lines in your changes are missing coverage. Please review.

Comparison is base (1da051a) 59.47% compared to head (9e0b1d8) 59.00%.

Files Patch % Lines
src/input_processing.rs 61.81% 21 Missing ⚠️
src/diff.rs 62.50% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #761      +/-   ##
==========================================
- Coverage   59.47%   59.00%   -0.48%     
==========================================
  Files          13       13              
  Lines        1451     1488      +37     
==========================================
+ Hits          863      878      +15     
- Misses        588      610      +22     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Add an option to ignore whitespace within nodes. This also adds some
performance improvements by reducing copies. We uncovered extra copies
when refactoring the code and removed them.

This also refactors some code to be simpler and cleans up the APIs
around constructing tree sitter parsers for specific languages, which
also makes testing easier.
@afnanenayet afnanenayet force-pushed the afnan/strip-whitespace branch from 9e0b1d8 to 20a769e Compare November 30, 2023 18:11
@afnanenayet afnanenayet merged commit ae32472 into main Nov 30, 2023
@afnanenayet afnanenayet deleted the afnan/strip-whitespace branch November 30, 2023 18:16
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants