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
Parsing can not be restarted in a certain parser state, which is required by RSyntaxDocument#getTokenListForLine.
Since RSyntaxDocument#getTokenListForLine is marked final, i can not override this behaviour and therefore can not reuse the parser.
Are there any workarounds?
Not really
Additional context
Solution
A solution would be to remove the final modifier from RSyntaxDocument#getTokenListForLine. Then a subclass of the RSyntaxDocument can be created that parses the whole document on each change and caches the tokens by line.
This cache is then used to answer RSyntaxDocument#getTokenListForLine as expected by the rest of the system.
The text was updated successfully, but these errors were encountered:
Describe the solution you'd like
I want to reuse a parser for syntax highlighting that provides an interface as following:
Parsing can not be restarted in a certain parser state, which is required by
RSyntaxDocument#getTokenListForLine
.Since
RSyntaxDocument#getTokenListForLine
is markedfinal
, i can not override this behaviour and therefore can not reuse the parser.Are there any workarounds?
Not really
Additional context
Solution
A solution would be to remove the
final
modifier fromRSyntaxDocument#getTokenListForLine
. Then a subclass of theRSyntaxDocument
can be created that parses the whole document on each change and caches the tokens by line.This cache is then used to answer
RSyntaxDocument#getTokenListForLine
as expected by the rest of the system.The text was updated successfully, but these errors were encountered: