Sublime Forum

[Syntax] My custom syntax isn't an option

#1

I am trying to create a custom syntax file but it won’t show up in the list of options or using Set Syntax.

I have just started so this is my file currently:

C:\Users\Leuu\AppData\Roaming\Sublime Text 3\Packages\User\test-syntax.sublime-syntax

%YAML 1.2
---
name: Test Syntax
file_extensions: [txt]
scope: source.celeste-dialog

contexts:
  main:
    
    # Numbers
    - match: '\b(-)?[0-9.]+\b'
      scope: constant.numeric.test-syntax

    comments:
        - match: "#"
          scope: comment.line.number-sign.test-syntax
1 Like

#2

Assuming that your syntax matches what you pasted in here (and that the triple-backtick on the end is part of a code block and not the syntax), your issue is that the indent on the comments context is wrong; it should be at the same indent level as main.

if you save the file as you have it here and check the Sublime console, you see this message:

error parsing lexer: Packages/User/test-syntax.sublime-syntax: Error trying to parse sublime-syntax: end of map not found in Packages\User\test-syntax.sublime-syntax:14:5
generating syntax summary

Changing the indent on the comments context fixes the problem.

1 Like

#3

Oh so if there is an error it wont let me chose it, alright thx :3

0 Likes