Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 247d711

Browse files
committed
A few small tweaks to language mappings:
* Recognize a wider variety of HTML templates embedded in script tags * Remove generic "clike" language declaration that no files map to - seems unneeded, and clutters the dropdown in PR #6409 * Add missing commenting syntax to Scala language * Automatically filter out a variety of common binary file types from Find in Files (it already checks isBinary) - note that this does not affect Mac, where all binary file IO fails automatically. Helps reduce bugs like #6091. Leaves the ProjectManager.isBinary() API in place for now, since it also excludes files from Quick Open and other getAllFiles() clients that don't yet check isBinary via LanguageManager. * Fix incorrect code in Find in Files that only narrowly avoids creating bugs where filtered-out files are incorrectly added to search results.
1 parent e7f4758 commit 247d711

3 files changed

Lines changed: 15 additions & 11 deletions

File tree

src/language/LanguageManager.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -770,11 +770,11 @@ define(function (require, exports, module) {
770770
_patchCodeMirror();
771771

772772
// Define a custom MIME mode here instead of putting it directly into languages.json
773-
// because JSON files must not contain regular expressions. Also, all other modes so
773+
// because JSON files can't contain regular expressions. Also, all other modes so
774774
// far were strings, so we spare us the trouble of allowing more complex mode values.
775775
CodeMirror.defineMIME("text/x-brackets-html", {
776776
"name": "htmlmixed",
777-
"scriptTypes": [{"matches": /\/x-handlebars-template|\/x-mustache/i,
777+
"scriptTypes": [{"matches": /\/x-handlebars|\/x-mustache|^text\/html$/i,
778778
"mode": null}]
779779
});
780780

src/language/languages.json

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,6 @@
120120
"lineComment": ["//"]
121121
},
122122

123-
"clike": {
124-
"name": "clike",
125-
"mode": "clike",
126-
"blockComment": ["/*", "*/"],
127-
"lineComment": ["//", "#"]
128-
},
129-
130123
"java": {
131124
"name": "Java",
132125
"mode": ["clike", "text/x-java"],
@@ -138,7 +131,9 @@
138131
"scala": {
139132
"name": "Scala",
140133
"mode": ["clike", "text/x-scala"],
141-
"fileExtensions": ["scala", "sbt"]
134+
"fileExtensions": ["scala", "sbt"],
135+
"blockComment": ["/*", "*/"],
136+
"lineComment": ["//"]
142137
},
143138

144139
"coffeescript": {
@@ -242,5 +237,12 @@
242237
"name": "Audio",
243238
"fileExtensions": ["mp3", "wav", "aif", "aiff", "ogg"],
244239
"isBinary": true
240+
},
241+
242+
"binary": {
243+
"name": "Other Binary",
244+
"fileExtensions": ["svgz", "jsz", "zip", "gz", "htmz", "htmlz", "rar", "tar", "exe", "bin", "dll", "pdb", "lib", "obj", "so", "a", "dylib",
245+
"pdf", "psd", "ai", "tif", "tiff", "mpg", "mpeg", "avi", "flv", "mp4", "ttf", "otf", "woff"],
246+
"isBinary": true
245247
}
246248
}

src/search/FindInFiles.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,9 @@ define(function (require, exports, module) {
751751
var inWorkingSet = DocumentManager.getWorkingSet().some(function (wsFile) {
752752
return wsFile.fullPath === file.fullPath;
753753
});
754-
return inWorkingSet;
754+
if (!inWorkingSet) {
755+
return false;
756+
}
755757
}
756758
}
757759
// In the initial search, this is passed as a getAllFiles() filter

0 commit comments

Comments
 (0)