Snippet Scope Exclusion

I’ve been setting up snippets for writing LaTeX in atom, but haven’t found a way to exclude snippets from certain scopes while keeping them in others. For instance, I want some snippets to only trigger when I’m not currently in math mode. Specifically, math mode in LaTeX takes on the scopes .text.tex.latex and .string.other.math. I want some snippets that activate in LaTeX files, but not when the scope also matches .string.other.math. Is there any way to accomplish this?

As far as I know, snippet scopes work largely like normal CSS selectors (even though they’re not cascading). That means you can use the not() pseudo-class to exclude scopes, e.g. .text.html:not(.text.html.php)

So using the scopes I mentioned in the previous bit, with the suggestion you made, I tried both .text.tex.latex:not(.string.other.math) and .text.tex.latex:not(.text.tex.latex.string.other.math), to no avail. I then re-checked the scope of the environments again using Log Cursor Scope from the command palette, and tried .text.tex.latex:not(.text.tex.latex.string.other.math.tex), which also didn’t work. Any other ideas?

This seems to be a case study for using “profiles” (i.e. switching Atom to work in certain ways).

Search discussions on profiles. For example you might toggle different snippets files for other configurations to reflect different “profiles”.

I looked into what you’ve linked for profiles, but I’m not sure if this would actually help for my particular case. The idea is that I would be editing one file, which has two scopes, an outer scope and an inner scope which is contained in the outer scope. The goal is to be able to have some snippets trigger when I’m in the outer scope but not in the inner scope. The current way things are working is that I am able to trigger context-specific snippets when I’m in the inner scope and not outer, but not vice versa. I’m not sure if profiles would be best for this sort of rapid swapping back and forth several times within a few lines of code.

Sometimes I resort to using Atom in a toolchain with Sublime Text.
It is quite easy to pass Atom absolute file path to Sublime through process-palette command line. Both editors remain in sync with the common file. Sublime offers multiple scopes.

این پست صرفا یک تست است.

این پست صرفا یک Test است.