Top bracket for editor

I created a basic editor that has a code autofill function and also shows a list of options. Now I want to add to highlight a suitable bracket . I do not know how to do that!

Any help would be great :)

Update
I know some basic algorithm to find a suitable bracket, but I don’t know how to highlight it! [change the color or make it in bold from the corresponding bracket].
I am using a multiline text file for this problem.

+4
source share
1 answer

Based on your current functions, you are likely to have some kind of syntax source tree. If true, you should be able to relatively easily find nodes that represent braces over the current location in the source.

Otherwise, a brace count suggested by Hunter Macmillen might be sufficient. Remember to skip comments and string literals if you support them.

+1
source

Source: https://habr.com/ru/post/1395536/


All Articles