Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/ext/modelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ var supportedModes = {
Assembly_ARM32:["s"],
Assembly_x86:["asm|a"],
Astro: ["astro"],
AppleScript: ["applescript|scpt"],
AutoHotKey: ["ahk"],
Basic: ["bas|bak"],
BatchFile: ["bat|cmd"],
Expand All @@ -102,6 +103,7 @@ var supportedModes = {
Csound_Document: ["csd"],
Csound_Orchestra: ["orc"],
Csound_Score: ["sco"],
CSP: ["csp"],
CSS: ["css"],
CSV: ["csv"],
Curly: ["curly"],
Expand Down Expand Up @@ -200,6 +202,7 @@ var supportedModes = {
PHP_Laravel_blade: ["blade.php"],
Pig: ["pig"],
PLSQL: ["plsql"],
Plain_Text: ["txt|text"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plain_Text: ["txt|text"] overlaps with the existing Text: ["txt"] entry (line 230 of upstream modelist.js).

getModeForPath iterates modes in insertion order (line 16). Because Plain_Text is inserted alphabetically near "Pl…" while Text lives much later, any .txt file that previously resolved
to mode id ace/mode/text will now resolve to ace/mode/plain_text. Functionally these are near-equivalent (plain_text.js extends TextMode with the same TextHighlightRules), but it's a
public-behavior change for .txt files: the returned mode.mode string changes, which any external consumer keying off the mode id would see.

Powershell: ["ps1"],
Praat: ["praat|praatscript|psc|proc"],
Prisma: ["prisma"],
Expand All @@ -215,6 +218,7 @@ var supportedModes = {
Razor: ["cshtml|asp"],
RDoc: ["Rd"],
Red: ["red|reds"],
Redshift: ["redshift"],
RHTML: ["Rhtml"],
Robot: ["robot|resource"],
RST: ["rst"],
Expand Down Expand Up @@ -304,4 +308,4 @@ for (var name in supportedModes) {

exports.getModeForPath = getModeForPath;
exports.modes = modes;
exports.modesByName = modesByName;
exports.modesByName = modesByName;
17 changes: 17 additions & 0 deletions src/ext/modelist_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"use strict";

var assert = require("assert");
var modelist = require("./modelist");

module.exports = {
"test modelist includes existing syntax modes": function() {
["applescript", "csp", "plain_text", "redshift"].forEach(function(name) {
var mode = modelist.modesByName[name];
assert.ok(mode, name + " should be present in modesByName");
assert.equal(mode.mode, "ace/mode/" + name);
assert.ok(modelist.modes.indexOf(mode) !== -1, name + " should be present in modes");
});
}
};

require("../test/run")(module);
Loading