Sublime Forum

tmLanguage - scope within another scope

#1

hi

I’m a tmLanguage newbie, and I’m not even sure if what I’m asking for is possible at all.
In C++ source file I want to match todo in a comment section of the code.

I’ve added something like this:

<dict>
	<key>match</key>
	<string>\b(todo|TODO)\b</string>
	<key>name</key>
	<string>misc.todo</string>
</dict>

to the C++.tmLanguage. I’ve also extended my current theme with following lines:

		<dict>
			<key>name</key>
			<string>TODO</string>
			<key>scope</key>
			<string>misc.todo</string>
			<key>settings</key>
			<dict>
				<key>fontStyle</key>
				<string>bold</string>
				<key>foreground</key>
				<string>#ff0000</string>
				<key>background</key>
				<string>#ffff99</string>
			</dict>
		</dict>

To my disappointment, it only works in the main scope of the file :cry: and it doesn’t work in either of comment scopes.

The question:

How do I force sope applying within another scope, i.e. I want misc.todo to be applied in the comments’ scopes?

Cheers

0 Likes