Sublime Text 2 中怎樣查找scope的名稱

在Sublime Text 2中新增一個snippet時須要在配置文件中輸入scope節點的值來限制snippet使用的語法範圍(做用域),這個scope的值能夠經過如下方法得到:
  1. 進入包所在目錄,若是不知道目錄位置,能夠在編輯器內選「Preferences」-->「Browse Packages」菜單,在彈出的對話框裏就能看到包所在路徑:
  1. 進入對應的包內找到擴展名爲「tmLanguage」的文件,打開它,從文件內查找「scopeName」這個串,找到後,緊跟其後的「string」節點內的值就是此語言對應的scope名稱。
好比如今要找JSP語言對應的scope名稱,那麼進入包所在目錄後再進入「Java」目錄,這個目錄裏能夠找到名爲「Java Server Pages (JSP).tmLanguage」的文件,打開它查找「scopeName」這個串,你會看到如下內容:
那麼由此可知「text.html.jsp」就是scope的名稱了。
 
如下是部分scope名稱列表:
 

語言(語法)php

Scope名稱css

ActionScripthtml

source.actionscript.2java

ActionScript 3python

source.actionscript.3jquery

Antc++

text.xml.antsql

AppleScriptshell

source.applescriptjson

ASP

source.asp

Batch File

source.dosbatch

Bibtex

text.bibtex

C

source.c

C#

source.cs

C++

source.c++

camlp4

source.camlp4.ocaml

Clojure

source.clojure

CoffeeScript

source.coffee

CSS

source.css

D

source.d

Diff

source.diff

DOT

source.dot

Emmet

source.zen.5a454e6772616d6d6172

Erlang

source.erlang

Go

source.go

Groovy

source.groovy

Haskell

source.haskell

Hex

source.hex

HTML

text.html.basic

HTML (ASP)

text.html.asp

HTML (Erlang)

text.html.erlang.yaws

HTML (Rails)

text.html.ruby

HTML (Tcl)

text.html.tcl

HTML5

text.html.basic

Java

source.java

Java Server Pages (JSP)

text.html.jsp

JavaDoc

text.html.javadoc

JavaProperties

source.java-props

JavaScript

source.js

JavaScript (Rails)

source.js.rails

jQuery (JavaScript)

source.js.jquery

JSON

source.json

LaTeX

text.tex.latex

LaTeX Beamer

text.tex.latex.beamer

LaTeX Log

text.log.latex

LaTeX Memoir

text.tex.latex.memoir

Lisp

source.lisp

Literate Haskell

text.tex.latex.haskell

Lua

source.lua

Makefile

source.makefile

Markdown

text.html.markdown

Matlab

source.matlab

MultiMarkdown

text.html.markdown.multimarkdown

MXML

text.xml.mxml

NAnt Build File

source.nant-build

Objective-C

source.objc

Objective-C++

source.objc++

OCaml

source.ocaml

OCamllex

source.ocamllex

OCamlyacc

source.ocamlyacc

Perl

source.perl

PHP

source.php

Plain text

text.plain

Python

source.python

R

source.r

R Console

source.r-console

Rd (R Documentation)

text.tex.latex.rd

RegExp

source.regexp

Regular Expressions (Python)

source.regexp.python

reStructuredText

text.restructuredtext

Ruby

source.ruby

Ruby Haml

text.haml

Ruby on Rails

source.ruby.rails

Scala

source.scala

SFTP Output Panel

output.sftp

Shell Script (Bash)

source.shell

SQL

source.sql

SQL (Rails)

source.sql.ruby

Tasks

text.todo

Tcl

source.tcl

TeX

text.tex

TeX Math

text.tex.math

Textile

text.html.textile

XML

text.xml

XSL

text.xml.xsl

YAML

source.yaml

相關文章
相關標籤/搜索