@@ -475,11 +475,17 @@ define(function (require, exports, module) {
475475 } ;
476476
477477 /**
478- * Adds a file extension to this language.
479- * @param {!string } extension A file extension used by this language
480- * @return {boolean } Whether adding the file extension was successful or not
478+ * Adds one or more file extensions to this language.
479+ * @param {!string|Array.<string> } extension A file extension (or array thereof) used by this language
481480 */
482481 Language . prototype . addFileExtension = function ( extension ) {
482+ if ( Array . isArray ( extension ) ) {
483+ extension . forEach ( this . _addFileExtension . bind ( this ) ) ;
484+ } else {
485+ this . _addFileExtension ( extension ) ;
486+ }
487+ } ;
488+ Language . prototype . _addFileExtension = function ( extension ) {
483489 // Remove a leading dot if present
484490 if ( extension . charAt ( 0 ) === "." ) {
485491 extension = extension . substr ( 1 ) ;
@@ -503,11 +509,47 @@ define(function (require, exports, module) {
503509 } ;
504510
505511 /**
506- * Adds a file name to the language which is used to match files that don't have extensions like "Makefile" for example.
507- * @param {!string } extension An extensionless file name used by this language
508- * @return {boolean } Whether adding the file name was successful or not
512+ * Unregisters one or more file extensions from this language.
513+ * @param {!string|Array.<string> } extension File extension (or array thereof) to stop using for this language
514+ */
515+ Language . prototype . removeFileExtension = function ( extension ) {
516+ if ( Array . isArray ( extension ) ) {
517+ extension . forEach ( this . _removeFileExtension . bind ( this ) ) ;
518+ } else {
519+ this . _removeFileExtension ( extension ) ;
520+ }
521+ } ;
522+ Language . prototype . _removeFileExtension = function ( extension ) {
523+ // Remove a leading dot if present
524+ if ( extension . charAt ( 0 ) === "." ) {
525+ extension = extension . substr ( 1 ) ;
526+ }
527+
528+ // Make checks below case-INsensitive
529+ extension = extension . toLowerCase ( ) ;
530+
531+ var index = this . _fileExtensions . indexOf ( extension ) ;
532+ if ( index !== - 1 ) {
533+ this . _fileExtensions . splice ( index , 1 ) ;
534+
535+ delete _fileExtensionToLanguageMap [ extension ] ;
536+
537+ this . _wasModified ( ) ;
538+ }
539+ } ;
540+
541+ /**
542+ * Adds one or more file names to the language which is used to match files that don't have extensions like "Makefile" for example.
543+ * @param {!string|Array.<string> } extension An extensionless file name (or array thereof) used by this language
509544 */
510545 Language . prototype . addFileName = function ( name ) {
546+ if ( Array . isArray ( name ) ) {
547+ name . forEach ( this . _addFileName . bind ( this ) ) ;
548+ } else {
549+ this . _addFileName ( name ) ;
550+ }
551+ } ;
552+ Language . prototype . _addFileName = function ( name ) {
511553 // Make checks below case-INsensitive
512554 name = name . toLowerCase ( ) ;
513555
@@ -523,7 +565,31 @@ define(function (require, exports, module) {
523565
524566 this . _wasModified ( ) ;
525567 }
526- return true ;
568+ } ;
569+
570+ /**
571+ * Unregisters one or more file names from this language.
572+ * @param {!string|Array.<string> } extension An extensionless file name (or array thereof) used by this language
573+ */
574+ Language . prototype . removeFileName = function ( name ) {
575+ if ( Array . isArray ( name ) ) {
576+ name . forEach ( this . _removeFileName . bind ( this ) ) ;
577+ } else {
578+ this . _removeFileName ( name ) ;
579+ }
580+ } ;
581+ Language . prototype . _removeFileName = function ( name ) {
582+ // Make checks below case-INsensitive
583+ name = name . toLowerCase ( ) ;
584+
585+ var index = this . _fileNames . indexOf ( name ) ;
586+ if ( index !== - 1 ) {
587+ this . _fileNames . splice ( index , 1 ) ;
588+
589+ delete _fileNameToLanguageMap [ name ] ;
590+
591+ this . _wasModified ( ) ;
592+ }
527593 } ;
528594
529595 /**
@@ -779,11 +845,11 @@ define(function (require, exports, module) {
779845 _patchCodeMirror ( ) ;
780846
781847 // Define a custom MIME mode here instead of putting it directly into languages.json
782- // because JSON files must not contain regular expressions. Also, all other modes so
848+ // because JSON files can't contain regular expressions. Also, all other modes so
783849 // far were strings, so we spare us the trouble of allowing more complex mode values.
784850 CodeMirror . defineMIME ( "text/x-brackets-html" , {
785851 "name" : "htmlmixed" ,
786- "scriptTypes" : [ { "matches" : / \/ x - h a n d l e b a r s - t e m p l a t e | \/ x - m u s t a c h e / i,
852+ "scriptTypes" : [ { "matches" : / \/ x - h a n d l e b a r s | \/ x - m u s t a c h e | ^ t e x t \/ h t m l $ / i,
787853 "mode" : null } ]
788854 } ) ;
789855
@@ -805,6 +871,10 @@ define(function (require, exports, module) {
805871 // But for now, we need to associate this madeup "html" mode with our HTML language object.
806872 _setLanguageForMode ( "html" , html ) ;
807873
874+ // Similarly, the php mode uses clike internally for the PHP parts
875+ var php = getLanguage ( "php" ) ;
876+ php . _setLanguageForMode ( "clike" , php ) ;
877+
808878 // The fallback language for unknown modes and file extensions
809879 _fallbackLanguage = getLanguage ( "unknown" ) ;
810880 } ) ;
0 commit comments