I am attempting to create a custom Code Mirror Mode for integration with Adobe Brackets code editor.
Currently, I am able to highlight {{code}}, but I am looking to utilize Code Mirror simple mode as it is easier for me to comprehend.
The code for my Brackets extension (main.js) is as follows:
define(function (require, exports, module) {
'use strict';
var LanguageManager = brackets.getModule("language/LanguageManager");
CodeMirror.defineMode("laravelblade", function (config, parserConfig) {
var mustacheOverlay = {
token: function (stream, state) {
var ch;
//Highlight Comments {{-- --}}
if (stream.match("{{--")) {
while ((ch = stream.next()) != null)
if (ch == "}" && stream.next() == "}") break;
stream.eat("}");
return "comment";
}
//--
//Highlight {{ $var }}
...
};
return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "php"), mustacheOverlay);
});
LanguageManager.defineLanguage("laravelblade", {
"name": "Laravel Blade",
"mode": "laravelblade",
"fileExtensions": ["blade.php"],
"blockComment": ["{{--", "--}}"]
});
});
Could someone provide me with a straightforward example using Code Mirror's simple mode? I have gone through the Codemirror documentation and attempted to follow the examples, but I am unable to make them work seamlessly with Brackets syntax highlighting. Thank you for any assistance.
Edit: The current code functions properly, but I aim to achieve the same outcome using Code Mirror simple mode.
Although I adapted this code to suit my requirements, I am struggling to implement a new Code Mirror mode for Brackets from scratch. It is possible that I overlooked something important in the process...