|
20 | 20 | if (cM && mode) { |
21 | 21 | cM.setOption("mode",mode); |
22 | 22 | } else if (cM && fileName) { |
23 | | - fileName.indexOf('.js')>0 ? cM.setOption("mode","javascript") |
24 | | - : fileName.indexOf('.coffee')>0 ? cM.setOption("mode","coffeescript") |
25 | | - : fileName.indexOf('.rb')>0 ? cM.setOption("mode","ruby") |
26 | | - : fileName.indexOf('.py')>0 ? cM.setOption("mode","python") |
27 | | - : fileName.indexOf('.css')>0 ? cM.setOption("mode","css") |
28 | | - : fileName.indexOf('.less')>0 ? cM.setOption("mode","less") |
29 | | - : fileName.indexOf('.md')>0 ? cM.setOption("mode","markdown") |
30 | | - : fileName.indexOf('.xml')>0 ? cM.setOption("mode","xml") |
| 23 | + fileName.indexOf('.js')>0 ? cM.setOption("mode","text/javascript") |
| 24 | + : fileName.indexOf('.coffee')>0 ? cM.setOption("mode","text/x-coffeescript") |
| 25 | + : fileName.indexOf('.rb')>0 ? cM.setOption("mode","text/x-ruby") |
| 26 | + : fileName.indexOf('.py')>0 ? cM.setOption("mode","text/x-python") |
| 27 | + : fileName.indexOf('.css')>0 ? cM.setOption("mode","text/css") |
| 28 | + : fileName.indexOf('.less')>0 ? cM.setOption("mode","text/x-less") |
| 29 | + : fileName.indexOf('.md')>0 ? cM.setOption("mode","text/x-markdown") |
| 30 | + : fileName.indexOf('.xml')>0 ? cM.setOption("mode","application/xml") |
31 | 31 | : fileName.indexOf('.sql')>0 ? cM.setOption("mode","text/x-mysql") // also text/x-sql, text/x-mariadb, text/x-cassandra or text/x-plsql |
32 | | - : fileName.indexOf('.erl')>0 ? cM.setOption("mode","erlang") |
33 | | - : fileName.indexOf('.yaml')>0 ? cM.setOption("mode","yaml") |
| 32 | + : fileName.indexOf('.erl')>0 ? cM.setOption("mode","text/x-erlang") |
| 33 | + : fileName.indexOf('.yaml')>0 ? cM.setOption("mode","text/x-yaml") |
34 | 34 | : fileName.indexOf('.java')>0 ? cM.setOption("mode","text/x-java") |
35 | | - : fileName.indexOf('.jl')>0 ? cM.setOption("mode","julia") |
| 35 | + : fileName.indexOf('.jl')>0 ? cM.setOption("mode","text/x-julia") |
| 36 | + : fileName.indexOf('.c')>0 ? cM.setOption("mode","text/x-csrc") |
| 37 | + : fileName.indexOf('.cpp')>0 ? cM.setOption("mode","text/x-c++src") |
| 38 | + : fileName.indexOf('.cs')>0 ? cM.setOption("mode","text/x-csharp") |
| 39 | + : fileName.indexOf('.go')>0 ? cM.setOption("mode","text/x-go") |
| 40 | + : fileName.indexOf('.lua')>0 ? cM.setOption("mode","text/x-lua") |
| 41 | + : fileName.indexOf('.pl')>0 ? cM.setOption("mode","text/x-perl") |
| 42 | + : fileName.indexOf('.rs')>0 ? cM.setOption("mode","text/x-rustsrc") |
| 43 | + : fileName.indexOf('.scss')>0 ? cM.setOption("mode","text/x-sass") |
36 | 44 | : cM.setOption("mode","application/x-httpd-php"); |
37 | 45 | } |
38 | 46 | } |
|
41 | 49 | top.ICEcoder.lineCommentToggleSub = function(cM, cursorPos, linePos, lineContent, lCLen, adjustCursor) { |
42 | 50 | var startLine, endLine, commentChar; |
43 | 51 |
|
44 | | - if (["JavaScript","CoffeeScript","PHP","Python","Ruby","CSS","SQL","Erlang","Julia","Java","YAML"].indexOf(top.ICEcoder.caretLocType)>-1) { |
| 52 | + if (["JavaScript","CoffeeScript","PHP","Python","Ruby","CSS","SQL","Erlang","Julia","Java","YAML","C","C++","C#","Go","Lua","Perl","Rust","Sass"].indexOf(top.ICEcoder.caretLocType)>-1) { |
45 | 53 | if (cM.somethingSelected()) { |
46 | | - if (["Ruby","Python","Erlang","Julia","YAML"].indexOf(top.ICEcoder.caretLocType)>-1) { |
| 54 | + if (["Ruby","Python","Erlang","Julia","YAML","Perl"].indexOf(top.ICEcoder.caretLocType)>-1) { |
47 | 55 | commentChar = top.ICEcoder.caretLocType == "Erlang" ? "%" : "#"; |
48 | 56 | startLine = cM.getCursor(true).line; |
49 | 57 | endLine = cM.getCursor().line; |
|
52 | 60 | ? commentChar + cM.getLine(i) |
53 | 61 | : cM.getLine(i).slice(1,cM.getLine(i).length)); |
54 | 62 | } |
| 63 | + } else if (["Lua"].indexOf(top.ICEcoder.caretLocType)>-1) { |
| 64 | + cM.replaceSelection(cM.getSelection().slice(0,4)!="--[[" |
| 65 | + ? "--[[" + cM.getSelection() + "]]" |
| 66 | + : cM.getSelection().slice(4,cM.getSelection().length-2)); |
55 | 67 | } else { |
56 | 68 | cM.replaceSelection(cM.getSelection().slice(0,2)!="/*" |
57 | 69 | ? "/*" + cM.getSelection() + "*/" |
|
63 | 75 | ? "/*" + lineContent + "*/" |
64 | 76 | : lineContent.slice(2,lCLen).slice(0,lCLen-4)); |
65 | 77 | if (lineContent.slice(0,2)=="/*") {adjustCursor = -adjustCursor}; |
66 | | - } else if (["Ruby","Python","Erlang","Julia","YAML"].indexOf(top.ICEcoder.caretLocType)>-1) { |
| 78 | + } else if (["Ruby","Python","Erlang","Julia","YAML","Perl"].indexOf(top.ICEcoder.caretLocType)>-1) { |
67 | 79 | commentChar = top.ICEcoder.caretLocType == "Erlang" ? "%" : "#"; |
68 | 80 | cM.setLine(linePos, lineContent.slice(0,1)!=commentChar |
69 | 81 | ? commentChar + lineContent |
70 | 82 | : lineContent.slice(1,lCLen)); |
71 | 83 | adjustCursor = 1; |
72 | 84 | if (lineContent.slice(0,1)==commentChar) {adjustCursor = -adjustCursor}; |
| 85 | + } else if (["Lua"].indexOf(top.ICEcoder.caretLocType)>-1) { |
| 86 | + cM.setLine(linePos, lineContent.slice(0,2)!="--" |
| 87 | + ? "--" + lineContent |
| 88 | + : lineContent.slice(2,lCLen)); |
| 89 | + if (lineContent.slice(0,2)=="//") {adjustCursor = -adjustCursor}; |
73 | 90 | } else { |
74 | 91 | cM.setLine(linePos, lineContent.slice(0,2)!="//" |
75 | 92 | ? "//" + lineContent |
|
97 | 114 | top.ICEcoder.getNestLocationSub = function(nestCheck, fileName) { |
98 | 115 | var events; |
99 | 116 |
|
100 | | - if (["js","coffee","css","less","sql","erl","yaml","java","jl"].indexOf(fileName.split(".")[1])<0 && |
| 117 | + if (["js","coffee","css","less","sql","erl","yaml","java","jl","c","cpp","cs","go","lua","pl","rs","scss"].indexOf(fileName.split(".")[1])<0 && |
101 | 118 | (nestCheck.indexOf("include(")==-1)&&(nestCheck.indexOf("include_once(")==-1)) { |
102 | 119 |
|
103 | 120 | // Then for all the array items, output as the nest display |
|
122 | 139 | cM = top.ICEcoder.getcMInstance(); |
123 | 140 | nestOK = true; |
124 | 141 | fileName = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]; |
125 | | - if (cM && fileName && ["js","coffee","css","less","sql","erl","yaml","java","jl"].indexOf(fileName.split(".")[1])==-1) { |
| 142 | + if (cM && fileName && ["js","coffee","css","less","sql","erl","yaml","java","jl","c","cpp","cs","go","lua","pl","rs","scss"].indexOf(fileName.split(".")[1])==-1) { |
126 | 143 | nestOK = cM.getTokenAt({line:cM.lineCount(),ch:cM.lineInfo(cM.lineCount()-1).text.length}).className != "error" ? true : false; |
127 | 144 | } |
128 | 145 | top.ICEcoder.nestValid.style.background = nestOK ? "#0b0" : "#f00"; |
|
157 | 174 | else if (fileName.indexOf(".yaml")>0) {caretLocType="YAML"} |
158 | 175 | else if (fileName.indexOf(".java")>0) {caretLocType="Java"} |
159 | 176 | else if (fileName.indexOf(".erl")>0) {caretLocType="Erlang"} |
160 | | - else if (fileName.indexOf(".jl")>0) {caretLocType="Julia"}; |
| 177 | + else if (fileName.indexOf(".jl")>0) {caretLocType="Julia"} |
| 178 | + else if (fileName.indexOf(".c")>0 && fileName.indexOf(".cpp")<0 && fileName.indexOf(".cs")<0) {caretLocType="C"} |
| 179 | + else if (fileName.indexOf(".cpp")>0) {caretLocType="C++"} |
| 180 | + else if (fileName.indexOf(".cs")>0) {caretLocType="C#"} |
| 181 | + else if (fileName.indexOf(".go")>0) {caretLocType="Go"} |
| 182 | + else if (fileName.indexOf(".lua")>0) {caretLocType="Lua"} |
| 183 | + else if (fileName.indexOf(".pl")>0) {caretLocType="Perl"} |
| 184 | + else if (fileName.indexOf(".rs")>0) {caretLocType="Rust"} |
| 185 | + else if (fileName.indexOf(".scss")>0) {caretLocType="Sass"}; |
161 | 186 | } |
162 | 187 |
|
163 | 188 | top.ICEcoder.caretLocType = caretLocType; |
|
0 commit comments