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

Commit

Permalink
Merge pull request #7346 from adobe/nj/issue-7268
Browse files Browse the repository at this point in the history
Return LESS/SCSS language instead of CSS language when in a LESS/SCSS file
  • Loading branch information
peterflynn committed Mar 29, 2014
2 parents c8670b3 + edd0c2f commit 8c6d382
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/extensions/default/LESSSupport/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,11 @@ define(function (require, exports, module) {
fileExtensions: ["less"],
blockComment: ["/*", "*/"],
lineComment: ["//"]
}).done(function (lessLanguage) {
// Hack to make it so that when we see a "css" mode inside a LESS file,
// we know that it's really LESS. Ideally we would have a way to get the
// actual mime type from CodeMirror, so we know what mode configuration is
// in use (see #7345).
lessLanguage._setLanguageForMode("css", lessLanguage);
});
});
4 changes: 4 additions & 0 deletions src/language/LanguageManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,10 @@ define(function (require, exports, module) {
// Similarly, the php mode uses clike internally for the PHP parts
var php = getLanguage("php");
php._setLanguageForMode("clike", php);

// Similar hack to the above for dealing with SCSS/CSS.
var scss = getLanguage("scss");
scss._setLanguageForMode("css", scss);

// The fallback language for unknown modes and file extensions
_fallbackLanguage = getLanguage("unknown");
Expand Down

0 comments on commit 8c6d382

Please sign in to comment.