Custom styling for specific ranges in editor #5789
Answered
by
nightwing
bajrangCoder
asked this question in
Q&A
-
I have the ranges for the symbols(brackets) where I want to give custom color. But I can't find any api to do so ? Is there any api available for this purpose? I have seen marker api but that isn't usable in this case |
Beta Was this translation helpful? Give feedback.
Answered by
nightwing
Apr 5, 2025
Replies: 1 comment 7 replies
-
Are you trying to implement something like rainbow brackets of vscode? There is no api to set custom color but it is possible to change tokens, though the way to do it will depend on how you get ranges and how do you update them during editing. |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
editor.session.bgTokenizer.lines[row]
has a list of objects like{type: 'paren.rparen', value: ')'}
you need to find the one you want add a class to it, and calleditor.renderer.updateLines
e.g. you can try on https://ace.c9.io/
but depending on how you get the ranges, and how you update them during editing, you may need to optimize performance and handle the case when several brackets are in the same token.