Merge branch 'vmg/tmscopes' into cache-bustin

Conflicts:
	lib/linguist/version.rb
This commit is contained in:
Arfon Smith
2014-10-13 20:21:31 -05:00
4 changed files with 32 additions and 1 deletions

View File

@@ -321,6 +321,11 @@ module Linguist
language ? language.lexer : Pygments::Lexer.find_by_name('Text only') language ? language.lexer : Pygments::Lexer.find_by_name('Text only')
end end
# Internal: Get the TextMate compatible scope for the blob
def tm_scope
language && language.tm_scope
end
# Public: Highlight syntax of blob # Public: Highlight syntax of blob
# #
# options - A Hash of options (defaults to {}) # options - A Hash of options (defaults to {})

View File

@@ -290,6 +290,16 @@ module Linguist
@lexer = Pygments::Lexer.find_by_name(attributes[:lexer] || name) || @lexer = Pygments::Lexer.find_by_name(attributes[:lexer] || name) ||
raise(ArgumentError, "#{@name} is missing lexer") raise(ArgumentError, "#{@name} is missing lexer")
@tm_scope = attributes[:tm_scope] || begin
context = case @type
when :data, :markup, :prose
'text'
when :programming, nil
'source'
end
"#{context}.#{@name.downcase}"
end
@ace_mode = attributes[:ace_mode] @ace_mode = attributes[:ace_mode]
@wrap = attributes[:wrap] || false @wrap = attributes[:wrap] || false
@@ -363,6 +373,11 @@ module Linguist
# Returns the Lexer # Returns the Lexer
attr_reader :lexer attr_reader :lexer
# Public: Get the name of a TextMate-compatible scope
#
# Returns the scope
attr_reader :tm_scope
# Public: Get Ace mode # Public: Get Ace mode
# #
# Examples # Examples
@@ -564,6 +579,7 @@ module Linguist
:type => options['type'], :type => options['type'],
:aliases => options['aliases'], :aliases => options['aliases'],
:lexer => options['lexer'], :lexer => options['lexer'],
:tm_scope => options['tm_scope'],
:ace_mode => options['ace_mode'], :ace_mode => options['ace_mode'],
:wrap => options['wrap'], :wrap => options['wrap'],
:group_name => options['group'], :group_name => options['group'],

View File

@@ -83,6 +83,7 @@ ATS:
ActionScript: ActionScript:
type: programming type: programming
lexer: ActionScript 3 lexer: ActionScript 3
tm_scope: source.actionscript.3
color: "#e3491a" color: "#e3491a"
search_term: as3 search_term: as3
aliases: aliases:
@@ -282,6 +283,7 @@ C:
C#: C#:
type: programming type: programming
ace_mode: csharp ace_mode: csharp
tm_scope: source.cs
search_term: csharp search_term: csharp
color: "#178600" color: "#178600"
aliases: aliases:
@@ -411,6 +413,7 @@ Clojure:
CoffeeScript: CoffeeScript:
type: programming type: programming
tm_scope: source.coffee
ace_mode: coffee ace_mode: coffee
color: "#244776" color: "#244776"
aliases: aliases:
@@ -453,6 +456,7 @@ ColdFusion CFC:
Common Lisp: Common Lisp:
type: programming type: programming
tm_scope: source.lisp
color: "#3fb68b" color: "#3fb68b"
aliases: aliases:
- lisp - lisp
@@ -648,6 +652,7 @@ Elm:
Emacs Lisp: Emacs Lisp:
type: programming type: programming
lexer: Common Lisp lexer: Common Lisp
tm_scope: source.lisp
color: "#c065db" color: "#c065db"
aliases: aliases:
- elisp - elisp
@@ -932,6 +937,7 @@ Groovy Server Pages:
HTML: HTML:
type: markup type: markup
tm_scope: text.html.basic
ace_mode: html ace_mode: html
aliases: aliases:
- xhtml - xhtml
@@ -1158,6 +1164,7 @@ Java Server Pages:
JavaScript: JavaScript:
type: programming type: programming
tm_scope: source.js
ace_mode: javascript ace_mode: javascript
color: "#f1e05a" color: "#f1e05a"
aliases: aliases:
@@ -1569,6 +1576,7 @@ ObjDump:
Objective-C: Objective-C:
type: programming type: programming
tm_scope: source.objc
color: "#438eff" color: "#438eff"
aliases: aliases:
- obj-c - obj-c
@@ -1669,6 +1677,7 @@ PAWN:
PHP: PHP:
type: programming type: programming
tm_scope: text.html.php
ace_mode: php ace_mode: php
color: "#4F5D95" color: "#4F5D95"
extensions: extensions:
@@ -2089,6 +2098,7 @@ SQF:
SQL: SQL:
type: data type: data
tm_scope: source.sql
ace_mode: sql ace_mode: sql
extensions: extensions:
- .sql - .sql

View File

@@ -1,3 +1,3 @@
module Linguist module Linguist
VERSION = "3.2.2b1" VERSION = "3.3.0.b2"
end end