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

Commit

Permalink
A few small tweaks to language mappings:
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
peterflynn committed Mar 21, 2014
1 parent e7f4758 commit 247d711
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/language/LanguageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -770,11 +770,11 @@ define(function (require, exports, module) {
_patchCodeMirror();

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

Expand Down
18 changes: 10 additions & 8 deletions src/language/languages.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,6 @@
"lineComment": ["//"]
},

"clike": {
"name": "clike",
"mode": "clike",
"blockComment": ["/*", "*/"],
"lineComment": ["//", "#"]
},

"java": {
"name": "Java",
"mode": ["clike", "text/x-java"],
Expand All @@ -138,7 +131,9 @@
"scala": {
"name": "Scala",
"mode": ["clike", "text/x-scala"],
"fileExtensions": ["scala", "sbt"]
"fileExtensions": ["scala", "sbt"],
"blockComment": ["/*", "*/"],
"lineComment": ["//"]
},

"coffeescript": {
Expand Down Expand Up @@ -242,5 +237,12 @@
"name": "Audio",
"fileExtensions": ["mp3", "wav", "aif", "aiff", "ogg"],
"isBinary": true
},

"binary": {
"name": "Other Binary",
"fileExtensions": ["svgz", "jsz", "zip", "gz", "htmz", "htmlz", "rar", "tar", "exe", "bin", "dll", "pdb", "lib", "obj", "so", "a", "dylib",
"pdf", "psd", "ai", "tif", "tiff", "mpg", "mpeg", "avi", "flv", "mp4", "ttf", "otf", "woff"],
"isBinary": true
}
}
4 changes: 3 additions & 1 deletion src/search/FindInFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,9 @@ define(function (require, exports, module) {
var inWorkingSet = DocumentManager.getWorkingSet().some(function (wsFile) {
return wsFile.fullPath === file.fullPath;
});
return inWorkingSet;
if (!inWorkingSet) {
return false;
}
}
}
// In the initial search, this is passed as a getAllFiles() filter
Expand Down

0 comments on commit 247d711

Please sign in to comment.