Custom Language: BraceMatcher ignoring right brace

Answered

So, I'm working on a language that uses {{ something }} to make a closure. I pass both in my BraceMatcher, and when I type {{ a single } is inserted. Finding this puzzling, I dug around the source code and found what I felt to be some pretty severe assumptions in TypedHandler. Essentially a "if you type {.. insert }", seeming entirely to ignore what's in the BracePair. My question is, why? And what work around should I use to have my custom language work properly? My guess is that it's going to be me listening to char presses, and manually inserting the "}}" when I detect a "{{", which um.. doesn't sound too fun. Anywho, thanks for your help!

0
3 comments

> My question is, why?

That code was most surely written when no supported language used "double" braces. And now, information from BracePair doesn't seem to be enough - it only contains token types, not textual representation of tokens.

> And what work around should I use to have my custom language work properly?

I believe, providing corresponding TypedHandlerDelegate implementation should solve the problem. You can implement your logic in 'beforeCharTyped' method, before the 'standard' logic triggers.

0
Avatar
Permanently deleted user

Makes sense. Is a custom TypedHandlerDelegate the same method that HTML uses when it auto-creates the close tag?

0

Yes, XmlGtTypedHandler is the example.

0

Please sign in to leave a comment.