-
Notifications
You must be signed in to change notification settings - Fork 72
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
Maintain a list of tokens #133
Comments
This issue turns out to be more worse than I initially thought. So, since We can do with our current lexer, but the crux of the problem is in implementing some kind of cache incremental cache for tokens. We should store the tokens in something more sophisticated than a
I've tried both solutions and the first one seem simple but is complicated in practice (mostly handling multi-line tokens). I've got invalidation implemented for both approaches, the code is at https://github.com/vosen/VSEditorLexingModel/ and I hope to wrap it up soon. |
I have noticed the problem where syntax highlighting goes wrong with multi-lined things. The technique that I've seen used multiple times is this one: Note that I believe Visual Studio automatically does the right thing except with multi-line tokens, since it doesn't understand multi-line tokens. So, I think it is sufficient to just special-case the multi-line token case. |
Closed by #197 |
Most of our functionality that relies on output of token list, just lexes whatever text it needs ad-hoc. It'd be much much better to maintain a list of tokens for every span. I've got some Rust lexing code lying around but it'll need some improvements and wrapping (handling newlines as separate tokens, incremental mode, some kind of cache for queries "give ma list of tokens that intersect this span", etc).
The text was updated successfully, but these errors were encountered: