-
-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Allow multi-line lookahead in modes #839
Comments
Did this ever get looked at? I've been trying to update the JavaScript mode so that it recognizes functions as "in scope" even if they were declared after they were used. It's not proving easy... |
This was only ever intended for simple, limited lookahead. Arbitrary lookahead like what you'd need to find all locals in a block won't be possible -- you'd have to do that with an out-of-line background scan, though wiring that up to a mode is also currently not trivial. |
What about simple limited lookahead? |
Also interested in limited look-ahead, particularly for Fountain.io markup. I've been able to mostly implement highlighting by updating state with blank lines, but I think the canonical syntax definitions rely on look-ahead. |
This was finally implemented in 5.27.0 (via the |
Since patch 846d043 , the considerations that made lookahead past the current line problematic have largely been made irrelevant.
See discussion here
A mode would still have to declare its maxmimum lookahead, so that the parser frontier can be backed up appropriately when the document is edited. And it does muddle up the StringStream API a bit more (i.e. the various pieces of code that run parsers, such as
runMode
, need to somehow expose the whole document to the stream), but it's probably worth it.The text was updated successfully, but these errors were encountered: