Community
Participate
Working Groups
PartialParsingHelper#calculatePartialParsingPointers currently merges all document errors in the replace region and looks for a node that encloses this region. Merging error nodes fails if the error is sitting on a document node that is empty (totalLength = 0), because it cannot grasp this node using an offset + length. This can happen with an AbstractSplittingTokenSource that inserts synthetic tokens in the token stream to represent concepts that don't have a direct representation in the text document, f.e. BEGIN/END tokens for increasing/decreasing indentation in the document. Attached patch series fixes this issue regarding partial parsing and such synthetic tokens. 0001/0002 adds a simple indentation-sensitive test-language. It doesn't work yet with partial parsing as IndentTokenSource is stateful. Still, it is useful to demonstrate this issue and as I plan to continue the work on such languages, it would be great if this could sit around as general-purpose test language so I could refer to it in later patches. 0003 adds a test that shows the problem regarding partial parsing and empty tokens (thx again to Jan who helped me to get this working at ESE) 0004+0005 extracts some general-purpose code from PartialParsingHelper into the general-purpose Range / NodeUtil classes. I added functionality to walk trees searching for specific nodes matching a predicate and narrow it up to enclose a document region. Includes docs + tests. 0006 uses this new functionality to find the node(s) that encloses the document region and includes all errors. Essentially, this changes the inclusion of errors 'by document region' to 'by node'. AllTests are green for me.
Created attachment 182561 [details] 0001-added-IndentationAwareTestLanguage.patch
Created attachment 182562 [details] 0002-generated-IndentationAwareTestLanguage.patch
Created attachment 182563 [details] 0003-added-PartialParsingEmptyTokensTest.patch
Created attachment 182564 [details] 0004-Range-encloses-getLength-extracted-from-PartialParsi.patch
Created attachment 182565 [details] 0005-Parse-tree-helper-methods-for-partial-parsing-in-Nod.patch
Created attachment 182566 [details] 0006-Fixed-PartialParsingEmptyTokensTest.patch
The attached testcase did not fail with the given sample language. I pushed the test to the repo. Please reopen with a new test attached if the problem is still present.
Tested with the 2.0 stream.
Closing all bugs that were set to RESOLVED before Neon.0