A
A
aibb2020-06-21 13:09:21
Sublime Text
aibb, 2020-06-21 13:09:21

How to override meta.preprocessor in sublime text 3?

I'm doing custom syntax in Sublime and I've come across the fact that I don't want to override include from the meta.preprocessor area.
I do it like this:

- match: "^\\s*(#)\\s*\\b(include)\\b"
      captures:
        1: meta.preprocessor.is3
        2: keyword.control.include.is3


But in the end, only the include command itself is highlighted, the hash is not highlighted. Full config:
%YAML 1.2
---

name: IS3
file_extensions:
  - st3
  - sc3
scope: source.is3
contexts:
  main:

    - match: '"'
      scope: punctuation.definition.string.begin.is3
      push: double_quoted_string

    - match: '//'
      scope: punctuation.definition.comment.is3
      push: line_comment

    - match: '\b(include|define|new|SetHandler|If|Else|For|While|Endif|Endfor|Endwhile|break|continue|return|Try|Endtry|Catch|Endcatch|Var|EndVar|Sub|EndSub|EndScript)\b'
      scope: keyword.control.is3

    # Numbers
    - match: '\b(-)?[0-9.]+\b'
      scope: constant.numeric.is3
    - match: \b(exception|string|Int|Float|String|Variant|Object|Message|void|message)\b
      scope: storage.type
    - match: \b(struct|endstruct)\b
      scope: entity.name.struct

    - match: 'declspec|constructor'
      scope: entity.name.function.constructor
    - match: 'declspec|destructor|handler'
      scope: entity.name.function.destructor
    - match: ''
      scope: entity.name.function

    - match: "^\\s*(#)\\s*\\b(include)\\b"
      captures:
        1: meta.preprocessor.is3
        2: keyword.control.include.is3




  double_quoted_string:
    - meta_scope: string.quoted.double.is3
    - match: '\\.'
      scope: constant.character.escape.is3
    - match: '"'
      scope: punctuation.definition.string.end.is3
      pop: true

  line_comment:
    - meta_scope: comment.line.is3
    - match: $
      pop: true

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question