Posted 14 years ago by Werdna
Version: 4.0.0248
I'm implementing custom language by inheriting from MergableSyntaxLanguage.
I have my custom IToken implementations and lexer and implemented methods: IsPairedEnd, IsPairedStart and MatchingTokenID, but I get no highlighting.
When running in debugger, my IsPairedEnd called only once on initial startup on Document End token and never after that.
I set BracketHighlightingVisible to true on the editor itself.
What else do I have to do to make it work?

Comments (3)

Posted 14 years ago by Actipro Software Support - Cleveland, OH, USA
If you are running a non-dynamic language it should be firing any time the caret moves. Doing what you said is what we did in the .NET Languages Add-on and it works ok. Perhaps try loading your custom language in our SDI Editor sample using the Load Custom Add-on feature (as long as you compile your language in a separate assembly).

For anyone else reading this, per the docs:
If not using a dynamic language, bracket highlighting can be defined by making a custom token class and implementing the IsPairedStart, IsPairedEnd, and MatchingTokenID members of IToken.

I believe that's all we did for our add-ons to get it working there.

Actipro Software Support

Posted 13 years ago by Werdna
This wasn't working because I didn't override CreateToken in my language. I did for CreateDocumentEndToken and CreateInvalidToken, but forgot for CreateToken.
This was causing for my tokens to be created from lexer, but somehow they got lost and converted to defaultTokens.

I have another question on bracket matching. Is there a way to match multiple tokens?
I want to be able to match: function and "end function", where the later is multiple tokens "end" and "function". I probably could create one token EndFunction out of it, but I don't think this is a good solution.
Posted 13 years ago by Actipro Software Support - Cleveland, OH, USA
Yes, check out the documentation's "SyntaxEditor Text Visualization Features / Bracket Highlighting" topic under "Advanced Bracket Highlighting" and that covers what you need to do.

Actipro Software Support

The latest build of this product (v2020.1 build 0402) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.