[TxMt] Re: Bundle snippets scope selector -- excluding scope?

Harald Lapp harald.lapp at gmail.com
Thu Dec 5 21:51:36 UTC 2013


2013/12/5 Allan Odgaard <mailinglist at textmate.org>:
> On 5 Dec 2013, at 4:45, Harald Lapp wrote:
>
> [...]
>
> So far we’ve considered it the responsibility of the bundle item, to limit
> itself to the proper scope.
>
> I see how this can get tedious, because effectively all code snippets should
> have “- (string | comment)”, although for strings, some languages can have
> embedded code in strings, so we need a more complex scope selector there,
> and likewise for HTML (ensuring that they only fire when in a “proper” HTML
> scope, not embedded code or commments).
>
> I don’t see an obvious way to specify a “reset” because I don’t think you
> want to reset everything, e.g. we have an isoD⇥ snippet that I would still
> want in documentation comments.
>
> So I think what is needed is to declare that certain scopes are “context
> switches” (source, text, comment, string) and then allow a scope selector to
> “anchor” the match against the “current” context.
>
> Though having to specify an anchor marker in the scope selector does not fix
> the issue gracefully, as we’d need to add it to pretty much all scope
> selectors, so perhaps this should actually be implicit (if the scope
> selector starts with one of the scopes that is considered a “context
> switch”), but with a way to not anchor the snippet.

thanks very much for your detailed answer. i now see myself, that
things aren't as easy as i thought. the "context switch" thing sounds
very good, in the meantime i'll maybe use the macro-workaround.

thanks again for your help,
harald


More information about the textmate mailing list