-
-
Notifications
You must be signed in to change notification settings - Fork 384
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
lexers.DelegatingLexer
always does not highlight tokens correctly
#960
Comments
Also noticing the issue, particularly with PHP and html, with any any combination of PHP or html being the root. |
@Delta456 the delegating lexer is working as intended. If you read the documentation it describes how it works, in that the root lexer must return a token type of |
@isabelroses if you find a bug please file an issue. There are tests for the delegating lexer, and the "phtml" lexer uses it directly and nobody has filed any bugs for a few years, but anything's possible. |
That's true indeed. Can you add an explicit list of supported explicit languages for |
No, but if you wish to send a PR with an update to the README I'd consider it. |
Is there an existing issue for this?
Describe the bug
I am currently working on a feature for
charmbracelet/freeze
which makes use of thechroma
library and I am using theDelegatingLexer
where I am passing two languagespy
andgo
as thelanguage
androot
respectively. My PR implementation can be seen here: charmbracelet/freeze#79Using
./freeze --language py,go file.py
gives./freeze --language go,py file.py
givesAs it can be seen
chroma
doesn't highlight theroot
of thelexers.DelegatingLexer
. Only thelanguage
part is highlighted. However, this is not always the case../freeze --language jinja,html file.jinja
gives./freeze --language jinja file.jinja
givesIn this case,
jinja,html
languages correctly highlight the code snippet.To Reproduce
Chroma Playground doesn't support syntax highlighting of two languages at one time.
To locally reproduce this:
go build .
./freeze --language py,go file.py
Contents of
file.py
:The text was updated successfully, but these errors were encountered: