崇高的文字:将符号添加到新的语言定义中(语法突出显示) [英] Sublime text: Adding symbols to a new language definition (syntax highlighting)

查看:142
本文介绍了崇高的文字:将符号添加到新的语言定义中(语法突出显示)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在崇高的文字2中用语法突出显示了一种不太熟悉的语言(Cadence SKILL).

I have written syntax highlighting for a slightly unfamiliar language (Cadence SKILL) in sublime text 2.

它的工作原理很吸引人,但是我错过了CTRL + R的功能,该功能可以通过易于访问的方式在当前文件中定位所有符号(函数).

Its working like a charm, however I miss the feature of CTRL + R , which locates all the symbols (functions) in the present file in an easily accessible way.

任何人都可以建议如何告诉Sublime Text在哪里寻找函数(过程)声明的模式吗?

Can anyone please suggest how to tell Sublime Text where to look for a pattern of function (procedure) declaration?

谢谢!

推荐答案

看看Default/Symbol List.tmPreferences.您可以创建此首选项文件并指定要包含在符号列表中的范围.您可能还需要查看Java/Symbol List <some specifier>.tmPreferences以获得特定于语言的符号列表的示例.或者,您可以确保要包含的内容的范围为entity.name.functionentity.name.type.

Take a look at Default/Symbol List.tmPreferences. You can create this preference file and specify scopes to include in the symbol list. You may also want to look at Java/Symbol List <some specifier>.tmPreferences for examples of a language specific symbol list. Alternatively, you can ensure the things that you want to include have the scope entity.name.function or entity.name.type.

修改

您将需要查看您的配色方案文件.这些文件是Plist,因此您可能想使用 PlistJsonConverter 之类的文件来使其更具可读性(尽管这更多是个人喜好).在此文件中,您将看到许多词典条目.这些条目的关键之一是范围.当找到由您的语言定义定义的匹配范围时.您还将看到一个设置"键,该键定义有关颜色,字体样式等的详细信息.由于需要不同的颜色,因此需要应用不同的范围.您将需要定义一个自定义的符号列表"首选项文件,以便正确包含所有内容.以下是来自Java包的信息.

You will need to look at your color scheme file. These files are Plist, so you may want to use something like PlistJsonConverter to make it a little more readable (though this is more of a personal preference). In this file, you will see a number of dictionary entries. One of the keys to these entries is scope. When a matching scope is found as defined by your language definition. You will also see a "settings" key that defines details about color, font style, etc. Since you want different colors, you will need to apply different scopes. You will need to define a custom Symbol List preference file so everything gets included properly. The following is from the Java package.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>name</key>
    <string>Symbol List: Classes</string>
    <key>scope</key>
    <string>source.java meta.class meta.class.identifier</string>
    <key>settings</key>
    <dict>
        <key>showInSymbolList</key>
        <integer>1</integer>
    </dict>
    <key>uuid</key>
    <string>22E489AE-989E-4A76-9C18-89944CF5013D</string>
</dict>
</plist>

您将定义要应用于列表中的条目的范围.

You will define whatever scopes are being applied to the entries you want to appear in the list.

这篇关于崇高的文字:将符号添加到新的语言定义中(语法突出显示)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆