Another possible injection selection weirdness:
I’m injecting my text.html.markdown.github grammar into text.html.markdown using the (text.html.markdown) injection selector (was (L:text.html.markdown) until the fix in the last thread) and hidden from the user with hideFromUser in the tmLanguage file. I’m wanting to override the “Preview” menu action so that my GitHub Markdown bundle’s “Preview” menu action can take priority using the same shortcut. I’ve found a few possible options that I expected to work but don’t:
- setting the scope to text.html.markdown.github doesn’t seem to match the document scope so never actually matches and the Preview runs the old Markdown one - setting the scope to text.html.markdown pops up a little menu to let me choose between the two
This may well not be possible in TextMate 2 as-is. Any thoughts on how to do this (beyond just using another shortcut, my current solution)?
Thanks!
Mike McQuaid http://mikemcquaid.com
On 8 Jan 2016, at 9:41, Mike McQuaid wrote:
I’m wanting to override the “Preview” menu action so that my GitHub Markdown bundle’s “Preview” menu action can take priority using the same shortcut. I’ve found a few possible options that I expected to work but don’t:
- setting the scope to text.html.markdown.github doesn’t seem to
match the document scope so never actually matches and the Preview runs the old Markdown one
The scope of the document does not change, only the text matched by the injected rules (i.e. the raw blocks) will show scopes from the injection grammar.
- setting the scope to text.html.markdown pops up a little menu to let
me choose between the two
This may well not be possible in TextMate 2 as-is. Any thoughts on how to do this (beyond just using another shortcut, my current solution)?
It shows the menu because the two actions have the exact some scope selectors.
A workaround would be to use a scope selector like: `text.html.markdown attr`.
Since we always have attributes in the scope, we’re matching a bit more than just the root scope, and thus will win over the default action, but it isn’t an ideal solution, right now though I can’t find of anything nicer.
On 10 Jan 2016, at 22:22, Allan Odgaard mailinglist@textmate.org wrote:
A workaround would be to use a scope selector like: `text.html.markdown attr`.
Since we always have attributes in the scope, we’re matching a bit more than just the root scope, and thus will win over the default action, but it isn’t an ideal solution, right now though I can’t find of anything nicer.
That works perfectly, thanks Allan.
Mike McQuaid http://mikemcquaid.com