Skip to content
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

TextArea syntax highlighting for multi-language code #4199

Open
TomJGooding opened this issue Feb 22, 2024 · 2 comments
Open

TextArea syntax highlighting for multi-language code #4199

TomJGooding opened this issue Feb 22, 2024 · 2 comments

Comments

@TomJGooding
Copy link
Contributor

TomJGooding commented Feb 22, 2024

Currently the TextArea syntax highlighting works based on a single defined language, but often code can contain multiple different languages. The obvious example is HTML which can contain JavaScript inside of <script> tags and CSS inside of <style> tags. But also TypeScript syntax highlighting should include the JavaScript as well as the added types.

@Textualize Textualize deleted a comment from github-actions bot Feb 23, 2024
@darrenburns
Copy link
Member

I think this is probably beyond the scope of what we'd want to offer out of the box, but we should definitely think about how it could be achieved by someone who wishes to add that functionality.

tree-sitter offers a mechanism for this: https://tree-sitter.github.io/tree-sitter/using-parsers#multi-language-documents

However, it appears that the set_included_ranges function is not available as part of the Python bindings.

@TomJGooding
Copy link
Contributor Author

Thanks Darren, I do appreciate this might be out of scope especially if it would require a lot of work!

I haven't looked into this in much depth yet, but there's also the feature of language injection which might be useful? I'm not sure if this would still require set_included_ranges though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants