Language plugin - adding support for multiple languages in one file

已计划

I'm creating a RubyMine plugin for RBlade, a blade-like templating language for Ruby on Rails. I'm basically trying to recreate the Blade plugin for PHPStorm, but I'm having trouble getting three languages to mix in an RBlade file: I can get RBlade directives and HTML to mix fine, but cannot figure out how to get Ruby to work in the same file.

I've tried:

The latter two I think I'm just implementing wrong, but I can't get them to actually do anything, even when removing any checks for the type of element to work on.

I'm not sure how the Blade plugin gets PHP to work inside Blade templates - is there somewhere I can see how it does it? What's the best approach to get third language support in a file?

2

Update: I've managed to get the language injection working by adding my Ruby expression token to the `ParserDefinition::getCommentTokens()` token set.

While this has worked, it seems like a hack and not a proper solution? Any ideas?

0

请先登录再写评论。