Creating & intsalling a simple .sublime-syntax file for Sublime Text 3

我是研究僧i 提交于 2019-12-13 17:24:06

问题


I'm trying to define a very basic .sublime-syntax syntax-highlight file for Sublime Text 3.

I'm basing it on the first example in the Sublime Text 3 official documentation on Syntax Definitions:

%YAML 1.2
---
name: Z
file_extensions: z
scope: source.c

contexts:
  main:
    - match: \b(if|else|for|while)\b
      scope: keyword.control.c

This file is /Users/justin/Library/Application Support/Sublime Text 3/Packages/User/z.sublime-syntax

(I left the scopes as .c because I thought maybe the ST3 "theme" (e.g. Monokai) wouldn't know how to color "keyword.control.z".)

I restart Sublime Text 3 but in the lower-right language selection, no option for "Z" appears.

What am I doing wrong? Is there a way to ask Sublime if there was a parsing problem? How should I debug this?

Note: I've read this article, which describes TextMate-based syntax files, but that method is out-dated since ST3.

来源:https://stackoverflow.com/questions/41816312/creating-intsalling-a-simple-sublime-syntax-file-for-sublime-text-3

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!