Sublime Forum

Push syntax from another package

#1

I have created a package for PEPE Assembly syntax, you can see it here: PEPEasm.

I’m now working on C syntax with this assembly embeded in blocks, for example:

int main() {
    asm {
        MOV R0, 1
    }
    return 0;
}

I want this new package to push the context of the syntax from the other package.
Before I was doing the development using both syntaxes in the Packages/User folder so something like this worked: (in PEPEC.sublime-syntax)

  asm-block:
    - match: 'asm'
      scope: keyword.declaration
      push: Packages/User/PEPEasm.sublime-syntax
      with_prototype:
        - match: '}'
          pop: true

Now I would like for the PEPEC.sublime-syntax to push a syntax file from another package, basically, my PEPEC package would require PEPEasm. This way users can use either plain Assembly, or Assembly embeded with C, and I would not have to repeat code for the Assembly syntax in both packages.

Is there a way to do this? Thank you very much

0 Likes

#2

You can reuse a context from another file by

- include: Packages/User/PEPEC.sublime-syntax#asm-block

push, set, embed follow the same grammar as well.

- include: PEPEC.sublime-syntax#asm-block

may work too. I don’t test it.

0 Likes

#3

My problem is that PEPEasm, aka the syntax I want to push inside PEPEC, is not in Packages/User, it’s an installed Package

0 Likes

#4

I’ve found the solution.

Turns out the name of the repo of your package is what should go into the

Packages//xxx.sublime-syntax

Even if you have a name: key in your syntax!

0 Likes