Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

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

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...

@Textualize Textualize locked and limited conversation to collaborators Jul 15, 2024
@darrenburns darrenburns converted this issue into discussion #4746 Jul 15, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants