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

Remove "hacky" fix for CST Building while backtracking #272

Closed
clementdessoude opened this issue Sep 27, 2019 · 2 comments · Fixed by #275
Closed

Remove "hacky" fix for CST Building while backtracking #272

clementdessoude opened this issue Sep 27, 2019 · 2 comments · Fixed by #275

Comments

@clementdessoude
Copy link
Contributor

We can now remove this "hack" since it was fixed in the new releases of Chevrotain.

See:

// hack to turn off CST building side effects during backtracking
// TODO: should be patched in Chevrotain
cstPostNonTerminal(ruleCstResult, ruleName) {
if (this.isBackTracking() === false) {
super.cstPostNonTerminal(ruleCstResult, ruleName);
}
}
and Chevrotain/chevrotain#789

I assign this to @Shaolans since he coded the prettier-ignore support which could be affected here. Please let me know if you don't have time to look at it, and I'll try to do it

@Shaolans
Copy link
Member

Shaolans commented Oct 1, 2019

@bd82 Does the node in ruleCstResult is built during backtracking ? Because if not it might fail due the fact that we need the location of the node for the comments.

@bd82
Copy link
Contributor

bd82 commented Oct 1, 2019

I think the CSTNode is build but the position information is not added to it nor is it added to its parent CSTNode.

You could disable comment tracking logic while backtracking as well...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants