Validate CodeMirror modes

This commit is contained in:
Joshua Peek
2016-09-23 14:47:49 -07:00
parent 0406a5b326
commit 855f1a1f86
5 changed files with 21 additions and 6 deletions

3
.gitmodules vendored
View File

@@ -791,3 +791,6 @@
[submodule "vendor/grammars/language-babel"] [submodule "vendor/grammars/language-babel"]
path = vendor/grammars/language-babel path = vendor/grammars/language-babel
url = https://github.com/github-linguist/language-babel url = https://github.com/github-linguist/language-babel
[submodule "vendor/CodeMirror"]
path = vendor/CodeMirror
url = https://github.com/codemirror/CodeMirror

View File

@@ -402,6 +402,9 @@ module Linguist
# Public: Get CodeMirror mode # Public: Get CodeMirror mode
# #
# Maps to a directory in the `mode/` source code.
# https://github.com/codemirror/CodeMirror/tree/master/mode
#
# Examples # Examples
# #
# # => "nil" # # => "nil"

View File

@@ -1083,7 +1083,7 @@ Ecere Projects:
- ".epj" - ".epj"
tm_scope: source.json tm_scope: source.json
ace_mode: json ace_mode: json
codemirror_mode: json codemirror_mode: javascript
codemirror_mime_mode: application/json codemirror_mime_mode: application/json
language_id: 98 language_id: 98
Eiffel: Eiffel:
@@ -1632,7 +1632,7 @@ HTML:
type: markup type: markup
tm_scope: text.html.basic tm_scope: text.html.basic
ace_mode: html ace_mode: html
codemirror_mode: html codemirror_mode: htmlembedded
codemirror_mime_mode: text/html codemirror_mime_mode: text/html
color: "#e44b23" color: "#e44b23"
aliases: aliases:
@@ -2118,7 +2118,7 @@ KiCad:
Kit: Kit:
type: markup type: markup
ace_mode: html ace_mode: html
codemirror_mode: html codemirror_mode: htmlembedded
codemirror_mime_mode: text/html codemirror_mime_mode: text/html
extensions: extensions:
- ".kit" - ".kit"
@@ -2133,7 +2133,7 @@ Kotlin:
- ".kts" - ".kts"
tm_scope: source.Kotlin tm_scope: source.Kotlin
ace_mode: text ace_mode: text
codemirror_mode: kotlin codemirror_mode: clike
codemirror_mime_mode: text/x-kotlin codemirror_mime_mode: text/x-kotlin
language_id: 189 language_id: 189
LFE: LFE:
@@ -2419,7 +2419,7 @@ MTML:
- ".mtml" - ".mtml"
tm_scope: text.html.basic tm_scope: text.html.basic
ace_mode: html ace_mode: html
codemirror_mode: html codemirror_mode: htmlembedded
codemirror_mime_mode: text/html codemirror_mime_mode: text/html
language_id: 218 language_id: 218
MUF: MUF:
@@ -4262,7 +4262,7 @@ TypeScript:
- ".tsx" - ".tsx"
tm_scope: source.ts tm_scope: source.ts
ace_mode: typescript ace_mode: typescript
codemirror_mode: typescript codemirror_mode: javascript
codemirror_mime_mode: text/x-typescript codemirror_mime_mode: text/x-typescript
language_id: 378 language_id: 378
Unified Parallel C: Unified Parallel C:

View File

@@ -452,6 +452,14 @@ class TestLanguage < Minitest::Test
assert missing.empty?, message assert missing.empty?, message
end end
def test_valid_codemirror_mode
Language.all.each do |language|
if mode = language.codemirror_mode
assert File.exist?(File.expand_path("../../vendor/CodeMirror/mode/#{mode}", __FILE__)), "#{mode} isn't a valid CodeMirror mode"
end
end
end
def test_all_popular_languages_exist def test_all_popular_languages_exist
popular = YAML.load(File.read(File.expand_path("../../lib/linguist/popular.yml", __FILE__))) popular = YAML.load(File.read(File.expand_path("../../lib/linguist/popular.yml", __FILE__)))

1
vendor/CodeMirror vendored Submodule

Submodule vendor/CodeMirror added at 562e8eff5b