Skip to content
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

Feat: add incremental reparsing, incremental relinting, and file watching #16

Closed
wants to merge 3 commits into from

Conversation

RDambrosio016
Copy link
Collaborator

This PR adds incremental relinting, incremental reparsing, and file watching.

Incremental reparsing is calculating what changes occurred in the file and only parsing the least amount of text we need. This is achieved through two methods:

  • If the change only affects a single token and its not contextual we lex the token and replace it in the tree
  • Otherwise we look for the nearest block (block stmt, class body, etc) to reparse.

I am not certain of its stability yet and i am sure there are some weird cases in which it fails or parses incorrectly which needs to be sorted out. The reparser needs some tests too.

To test this simply clone the branch and then use cargo run -- ./glob/pattern -w which will watch the already linted files for changes and try to lint them again with incremental reparsing.

I would also like to add an #[incremental_safe] macro which marks if a rule relies on a single node and only has to be run on the specific nodes that have been changed, this is not the case for most rules however.

@RDambrosio016 RDambrosio016 added T-Parser This issue primarily relates to rslint_parser T-Runner This issue primary relates to the lint runner, rslint_core T-CLI This issue primarily relates to the CLI (rslint_cli) labels Oct 1, 2020
@RDambrosio016 RDambrosio016 changed the title Feat: add incremental reparsing and incremental relinting and watching Feat: add incremental reparsing, incremental relinting, and file watching Oct 1, 2020
@RDambrosio016 RDambrosio016 changed the base branch from dev to master October 2, 2020 17:36
@RDambrosio016
Copy link
Collaborator Author

Closing in favor of #45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-CLI This issue primarily relates to the CLI (rslint_cli) T-Parser This issue primarily relates to rslint_parser T-Runner This issue primary relates to the lint runner, rslint_core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant