├── README.md
├── elm-mode.js
├── elm-package.json
├── html
├── elm-package.json
└── output-panel.html
├── main.js
├── modules
├── Strings.js
├── elm-package.json
└── info-panel.js
├── nls
├── Strings.js
└── root
│ └── Strings.js
├── node
└── command.js
├── package.json
└── styles
└── style.css
/README.md:
--------------------------------------------------------------------------------
1 | [PROJECT MOVED](https://github.com/tommot348/elm-brackets)
2 |
3 | This extension is now maintained by [tommot348](https://github.com/tommot348) and has been moved here https://github.com/tommot348/elm-brackets
4 |
5 |
6 | elm-brackets
7 | ============
8 |
9 | Elm support for brackets.
10 |
11 | Currently support:
12 | - Syntax highlight
13 | - Simple file build with output panel
14 |
15 | Next:
16 | - Code linting http://blog.brackets.io/2013/10/07/new-linting-api/?lang=en
17 | - Jump to error
18 | - Compile error in gutter
19 |
20 |
--------------------------------------------------------------------------------
/elm-mode.js:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2012-2013 Evan Czaplicki
3 |
4 | All rights reserved.
5 |
6 | Redistribution and use in source and binary forms, with or without
7 | modification, are permitted provided that the following conditions are met:
8 |
9 | * Redistributions of source code must retain the above copyright
10 | notice, this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above
13 | copyright notice, this list of conditions and the following
14 | disclaimer in the documentation and/or other materials provided
15 | with the distribution.
16 |
17 | * Neither the name of Evan Czaplicki nor the names of other
18 | contributors may be used to endorse or promote products derived
19 | from this software without specific prior written permission.
20 |
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 | */
33 |
34 | define(function (require, exports) {
35 | "use strict";
36 |
37 | var cm = brackets.getModule("thirdparty/CodeMirror2/lib/codemirror");
38 |
39 | cm.defineMode("elm", function() {
40 |
41 | function switchState(source, setState, f) {
42 | setState(f);
43 | return f(source, setState);
44 | }
45 |
46 | // These should all be Unicode extended, as per the Haskell 2010 report
47 | var smallRE = /[a-z_]/;
48 | var largeRE = /[A-Z]/;
49 | var digitRE = /[0-9]/;
50 | var hexitRE = /[0-9A-Fa-f]/;
51 | var octitRE = /[0-7]/;
52 | var idRE = /[a-z_A-Z0-9\']/;
53 | var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:\u03BB\u2192]/;
54 | var specialRE = /[(),;[\]`{}]/;
55 | var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
56 |
57 | function normal(interpolate) {
58 | return function (source, setState) {
59 | if (source.eatWhile(whiteCharRE)) {
60 | return null;
61 | }
62 |
63 | var ch = source.next();
64 | if (specialRE.test(ch)) {
65 | if (ch == '{' && source.eat('-')) {
66 | var t = "comment";
67 | if (source.eat('#')) {
68 | t = "meta";
69 | }
70 | return switchState(source, setState, ncomment(t, 1));
71 | }
72 | if (interpolate && ch == '}' && source.eat('}')) {
73 | return switchState(source, setState, markdown);
74 | }
75 | if (ch == '[' &&
76 | source.eat('m') && source.eat('a') && source.eat('r') && source.eat('k') &&
77 | source.eat('d') && source.eat('o') && source.eat('w') && source.eat('n') &&
78 | source.eat('|')) {
79 | setState(markdown);
80 | return null;
81 | }
82 | return null;
83 | }
84 |
85 | if (ch == '\'') {
86 | if (source.eat('\\')) {
87 | source.next(); // should handle other escapes here
88 | }
89 | else {
90 | source.next();
91 | }
92 | if (source.eat('\'')) {
93 | return "string";
94 | }
95 | return "error";
96 | }
97 |
98 | if (ch == '"') {
99 | return switchState(source, setState, stringLiteral);
100 | }
101 |
102 | if (largeRE.test(ch)) {
103 | source.eatWhile(idRE);
104 | if (source.eat('.')) {
105 | return "qualifier";
106 | }
107 | return "variable-2";
108 | }
109 |
110 | if (smallRE.test(ch)) {
111 | var isDef = source.pos === 1;
112 | source.eatWhile(idRE);
113 | return isDef ? "variable-3" : "variable";
114 | }
115 |
116 | if (digitRE.test(ch)) {
117 | if (ch == '0') {
118 | if (source.eat(/[xX]/)) {
119 | source.eatWhile(hexitRE); // should require at least 1
120 | return "integer";
121 | }
122 | if (source.eat(/[oO]/)) {
123 | source.eatWhile(octitRE); // should require at least 1
124 | return "number";
125 | }
126 | }
127 | source.eatWhile(digitRE);
128 | var t = "number";
129 | if (source.eat('.')) {
130 | t = "number";
131 | source.eatWhile(digitRE); // should require at least 1
132 | }
133 | if (source.eat(/[eE]/)) {
134 | t = "number";
135 | source.eat(/[-+]/);
136 | source.eatWhile(digitRE); // should require at least 1
137 | }
138 | return t;
139 | }
140 |
141 | if (symbolRE.test(ch)) {
142 | if (ch == '-' && source.eat(/-/)) {
143 | source.eatWhile(/-/);
144 | if (!source.eat(symbolRE)) {
145 | source.skipToEnd();
146 | return "comment";
147 | }
148 | }
149 | source.eatWhile(symbolRE);
150 | return "builtin";
151 | }
152 |
153 | return "error";
154 | }
155 | }
156 |
157 | function ncomment(type, nest) {
158 | if (nest == 0) {
159 | return normal(false);
160 | }
161 | return function(source, setState) {
162 | var currNest = nest;
163 | while (!source.eol()) {
164 | var ch = source.next();
165 | if (ch == '{' && source.eat('-')) {
166 | ++currNest;
167 | }
168 | else if (ch == '-' && source.eat('}')) {
169 | --currNest;
170 | if (currNest == 0) {
171 | setState(normal(false));
172 | return type;
173 | }
174 | }
175 | }
176 | setState(ncomment(type, currNest));
177 | return type;
178 | }
179 | }
180 |
181 | function markdown(source, setState) {
182 | while (!source.eol()) {
183 | var ch = source.next();
184 | if (ch == '{' && source.eat('{')) {
185 | setState(normal(true));
186 | return "string";
187 | }
188 | if (ch == '|' && source.eat(']')) {
189 | setState(normal(false));
190 | return null;
191 | }
192 | }
193 | setState(markdown);
194 | return "string";
195 | }
196 |
197 | function stringLiteral(source, setState) {
198 | while (!source.eol()) {
199 | var ch = source.next();
200 | if (ch == '"') {
201 | setState(normal(false));
202 | return "string";
203 | }
204 | if (ch == '\\') {
205 | if (source.eol() || source.eat(whiteCharRE)) {
206 | setState(stringGap);
207 | return "string";
208 | }
209 | if (source.eat('&')) {
210 | }
211 | else {
212 | source.next(); // should handle other escapes here
213 | }
214 | }
215 | }
216 | setState(normal(false));
217 | return "error";
218 | }
219 |
220 | function stringGap(source, setState) {
221 | if (source.eat('\\')) {
222 | return switchState(source, setState, stringLiteral);
223 | }
224 | source.next();
225 | setState(normal(false));
226 | return "error";
227 | }
228 |
229 |
230 | var wellKnownWords = (function() {
231 | var wkw = {};
232 |
233 | var keywords = [
234 | "as", "case", "class", "data", "default", "deriving", "do", "else", "export", "foreign",
235 | "hiding", "jsevent", "if", "import", "in", "infix", "infixl", "infixr", "instance", "let",
236 | "module", "newtype", "of", "open", "then", "type", "where", "_",
237 | "..", "|", ":", "=", "\\", "\"", "->", "<-", "\u2192", "\u03BB", "port"
238 | ];
239 |
240 | for (var i = keywords.length; i--;) {
241 | wkw[keywords[i]] = "keyword";
242 | }
243 |
244 | return wkw;
245 | })();
246 |
247 |
248 |
249 | return {
250 | startState: function () { return { f: normal(false) }; },
251 | copyState: function (s) { return { f: s.f }; },
252 |
253 | token: function(stream, state) {
254 | var t = state.f(stream, function(s) { state.f = s; });
255 | var w = stream.current();
256 | return (wellKnownWords.hasOwnProperty(w)) ? wellKnownWords[w] : t;
257 | }
258 | };
259 |
260 | });
261 | });
--------------------------------------------------------------------------------
/elm-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0",
3 | "summary": "helpful summary of your project, less than 80 characters",
4 | "repository": "https://github.com/USER/PROJECT.git",
5 | "license": "BSD3",
6 | "source-directories": [
7 | "."
8 | ],
9 | "exposed-modules": [],
10 | "dependencies": {
11 | "elm-lang/core": "1.0.0 <= v < 2.0.0"
12 | }
13 | }
--------------------------------------------------------------------------------
/html/elm-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0",
3 | "summary": "helpful summary of your project, less than 80 characters",
4 | "repository": "https://github.com/USER/PROJECT.git",
5 | "license": "BSD3",
6 | "source-directories": [
7 | "."
8 | ],
9 | "exposed-modules": [],
10 | "dependencies": {
11 | "elm-lang/core": "1.0.0 <= v < 2.0.0"
12 | }
13 | }
--------------------------------------------------------------------------------
/html/output-panel.html:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/main.js:
--------------------------------------------------------------------------------
1 | define(function (require, exports, module) {
2 | "use strict";
3 |
4 |
5 | var CommandManager = brackets.getModule("command/CommandManager"),
6 | Menus = brackets.getModule("command/Menus");
7 |
8 | var DocumentManager = brackets.getModule("document/DocumentManager");
9 |
10 | var ExtensionUtils = brackets.getModule("utils/ExtensionUtils");
11 |
12 | var NodeDomain = brackets.getModule("utils/NodeDomain"),
13 | ShellDomain = new NodeDomain("elmDomain",
14 | ExtensionUtils.getModulePath(module,
15 | "node/command"));
16 |
17 | ExtensionUtils.loadStyleSheet(module, "styles/style.css");
18 |
19 | var InfoPanel = require("modules/Info-Panel").InfoPanel;
20 | var panel = new InfoPanel();
21 | panel.init();
22 | panel.show();
23 |
24 | var buffer = "";
25 | $(ShellDomain).on("stdout", function(evt, data) {
26 | buffer += data;
27 | panel.updateStatus("Success");
28 | });
29 |
30 | $(ShellDomain).on("stderr", function(evt, data) {
31 | buffer += data;
32 | panel.updateStatus("Error");
33 | });
34 |
35 | $(ShellDomain).on("finished", function(evt, data) {
36 | panel.appendOutput(buffer);
37 | buffer = "";
38 | });
39 |
40 |
41 | $(ShellDomain).on("clear", function() {
42 |
43 | });
44 |
45 |
46 |
47 | function handleBuild() {
48 | var curOpenDir = DocumentManager.getCurrentDocument().file._parentPath;
49 | var curOpenFile = DocumentManager.getCurrentDocument().file._path;
50 | CommandManager.execute("file.saveAll");
51 | ShellDomain.exec("execute",
52 | "elm-make --yes " + curOpenFile,
53 | curOpenDir,
54 | brackets.platform === "win",
55 | "cmd.exe");
56 | }
57 |
58 |
59 | var build = "elm.buid"; // package-style naming to avoid collisions
60 | CommandManager.register("elm-make current file", build, handleBuild);
61 |
62 | var menu = Menus.addMenu("Elm","foobarcode.elm");
63 | menu.addMenuItem(build);
64 |
65 |
66 | require("elm-mode");
67 |
68 | var LanguageManager = brackets.getModule("language/LanguageManager");
69 |
70 | LanguageManager.defineLanguage("elm", {
71 | name: "Elm",
72 | mode: "elm",
73 | fileExtensions: ["elm"],
74 | blockComment: ["{-", "-}"],
75 | lineComment: ["--"]
76 | });
77 | });
--------------------------------------------------------------------------------
/modules/Strings.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a
5 | * copy of this software and associated documentation files (the "Software"),
6 | * to deal in the Software without restriction, including without limitation
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | * and/or sell copies of the Software, and to permit persons to whom the
9 | * Software is furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | *
22 | */
23 |
24 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
25 | /*global define */
26 |
27 | define(function (require, exports, module) {
28 | "use strict";
29 |
30 | module.exports = require("i18n!nls/Strings");
31 |
32 | });
--------------------------------------------------------------------------------
/modules/elm-package.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "1.0.0",
3 | "summary": "helpful summary of your project, less than 80 characters",
4 | "repository": "https://github.com/USER/PROJECT.git",
5 | "license": "BSD3",
6 | "source-directories": [
7 | "."
8 | ],
9 | "exposed-modules": [],
10 | "dependencies": {
11 | "elm-lang/core": "1.0.0 <= v < 2.0.0"
12 | }
13 | }
--------------------------------------------------------------------------------
/modules/info-panel.js:
--------------------------------------------------------------------------------
1 | /* All functions related to panel and status */
2 | define(function (require, exports) {
3 |
4 | var WorkspaceManager = brackets.getModule("view/WorkspaceManager"),
5 | CommandManager = brackets.getModule("command/CommandManager"),
6 | PreferencesManager = brackets.getModule('preferences/PreferencesManager');
7 |
8 | var ExtensionStrings = require("./Strings");
9 |
10 | var preferences = PreferencesManager.getExtensionPrefs(ExtensionStrings.EXTENSION_PREFS);
11 |
12 | function InfoPanel() {
13 | this.panelElement = null;
14 | this.panelContentElement = null;
15 | this.panel = null;
16 | this.status = null;
17 | }
18 |
19 | InfoPanel.prototype.init = function() {
20 | var self = this;
21 | var infoPanelHtml = require("text!../html/output-panel.html");
22 | var debug = CommandManager.get(ExtensionStrings.DEBUG_ID);
23 |
24 | this.panelElement = $(infoPanelHtml);
25 | this.panelContentElement = $('.table tbody', this.panelElement);
26 |
27 | this.panel = WorkspaceManager.createBottomPanel(
28 | ExtensionStrings.PANEL_ID,
29 | this.panelElement);
30 |
31 | $("#status-language").before(''
34 | + ExtensionStrings.INACTIVE_MSG
35 | + '
');
36 |
37 | this.status = $('#brackets-build-sys-status');
38 |
39 | CommandManager.register(ExtensionStrings.SHOW_PANEL, ExtensionStrings.SHOW_PANEL_ID, function () {
40 | self.toggle();
41 | });
42 |
43 | $('.close', this.panelElement).on('click', function() {
44 | self.hide();
45 | });
46 |
47 | $('.build', this.panelElement).on('click', function() {
48 | CommandManager.execute (ExtensionStrings.BUILD_ID);
49 | });
50 |
51 | $('.run', this.panelElement).on('click', function() {
52 | CommandManager.execute (ExtensionStrings.RUN_ID);
53 | });
54 |
55 | $('.config', this.panelElement).on('click', function() {
56 | CommandManager.execute (ExtensionStrings.CONFIG_ID);
57 | });
58 |
59 | $('.clear', this.panelElement).on('click', function() {
60 | self.clear();
61 | });
62 |
63 | this.status.on('click', function () {
64 | self.toggle();
65 | });
66 |
67 | };
68 |
69 | InfoPanel.prototype.show = function() {
70 | this.panel.show();
71 | CommandManager.get(ExtensionStrings.SHOW_PANEL_ID).setChecked(true);
72 | preferences.set('showPanel', true);
73 | preferences.save();
74 | };
75 |
76 | InfoPanel.prototype.hide = function() {
77 | this.panel.hide();
78 | CommandManager.get(ExtensionStrings.SHOW_PANEL_ID).setChecked(false);
79 | preferences.set('showPanel', false);
80 | preferences.save();
81 | };
82 |
83 | InfoPanel.prototype.toggle = function () {
84 | var isShown = preferences.get('showPanel');
85 |
86 | if (isShown)
87 | this.hide();
88 | else
89 | this.show();
90 | }
91 |
92 | InfoPanel.prototype.clear = function() {
93 | $(this.panelContentElement).html("");
94 | $(this.status).attr("class", ExtensionStrings.INACTIVE).attr("title", "Build System Status").text(ExtensionStrings.INACTIVE_MSG);
95 | };
96 |
97 | InfoPanel.prototype.appendText = function(text) {
98 | var currentHtml = $(this.panelContentElement).html();
99 | $(this.panelContentElement).html(currentHtml + text);
100 | this.scrollToBottom();
101 | };
102 |
103 | InfoPanel.prototype.appendOutput = function(text) {
104 | var currentHtml = $(this.panelContentElement).html();
105 |
106 | $(this.panelContentElement).html(currentHtml
107 | + ""
108 | + text
109 | + " | |
");
110 |
111 | this.scrollToBottom();
112 | };
113 |
114 | InfoPanel.prototype.scrollToBottom = function() {
115 | this.panelElement[0].scrollTop = this.panelElement[0].scrollHeight;
116 | };
117 |
118 | InfoPanel.prototype.setTitle = function(title) {
119 | $('.title', this.panelElement).html(ExtensionStrings.EXTENSION_NAME + " — " + title);
120 | };
121 |
122 | InfoPanel.prototype.updateStatus = function(status) {
123 | this.status.attr("class", status);
124 | if (status == "Inactive")
125 | this.status.text(ExtensionStrings.INACTIVE_MSG);
126 | else this.status.text(status);
127 | };
128 |
129 | exports.InfoPanel = InfoPanel;
130 | });
--------------------------------------------------------------------------------
/nls/Strings.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a
5 | * copy of this software and associated documentation files (the "Software"),
6 | * to deal in the Software without restriction, including without limitation
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | * and/or sell copies of the Software, and to permit persons to whom the
9 | * Software is furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | *
22 | */
23 |
24 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
25 | /*global define */
26 |
27 | define(function (require, exports, module) {
28 |
29 | 'use strict';
30 |
31 | module.exports = {
32 | root: true
33 | };
34 | });
35 |
--------------------------------------------------------------------------------
/nls/root/Strings.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (c) 2012 Adobe Systems Incorporated. All rights reserved.
3 | *
4 | * Permission is hereby granted, free of charge, to any person obtaining a
5 | * copy of this software and associated documentation files (the "Software"),
6 | * to deal in the Software without restriction, including without limitation
7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 | * and/or sell copies of the Software, and to permit persons to whom the
9 | * Software is furnished to do so, subject to the following conditions:
10 | *
11 | * The above copyright notice and this permission notice shall be included in
12 | * all copies or substantial portions of the Software.
13 | *
14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 | * DEALINGS IN THE SOFTWARE.
21 | *
22 | */
23 |
24 | // English - root strings
25 |
26 | /*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
27 | /*global define */
28 |
29 | define({
30 | // Extension
31 | "EXTENSION_NAME" : "Brackets Build System",
32 | "EXTENSION_PREFS" : "ai.brackets-build-system",
33 |
34 | // General
35 | "DOMAIN_NAME" : "extension.commandline.node",
36 |
37 | // Build Menu
38 | "Auto" : "Automatic",
39 | "BUILD" : "Build",
40 | "RUN" : "Run",
41 | "BUILD_RUN" : "Build and Run",
42 | "DEBUG_MODE" : "Debug Mode",
43 | "AUTO_CLEAR" : "Auto Clear",
44 | "SAVE_ON_BUILD" : "Save All on Build",
45 | "SHOW_PANEL" : "Show Results",
46 | "CONFIG" : "Configuration...",
47 | "SETTINGS" : "Settings...",
48 |
49 | // Build Panel
50 | "CLEAR" : "Clear",
51 |
52 | // Configuration Dialog
53 | "CONFIG_MSG" : "You must restart Brackets after changing this file.",
54 |
55 | // Status
56 | "INACTIVE" : "Inactive",
57 | "INACTIVE_MSG" : "No Build",
58 | "PROGRESS" : "Progressing",
59 | // Complete status
60 | "NO_OUTPUT" : "Finished",
61 | "ERROR" : "Error",
62 |
63 | // ID's
64 | "BASIC_ID" : "extension.brackets-builder",
65 | "MENU_ID" : "extension.brackets-builder.menu.id",
66 | "AUTO_ID" : "extension.brackets-builder.run.auto",
67 | "BUILD_ID" : "extension.brackets-builder.run.build",
68 | "RUN_ID" : "extension.brackets-builder.run.runCmd",
69 | "BUILD_RUN_ID" : "extension.brackets-builder.run.build-runCmd",
70 | "DEBUG_MODE_ID" : "extension.brackets-builder.menu.debug.id",
71 | "AUTO_CLEAR_ID" : "extension.brackets-builder.panel.clear.id",
72 | "SAVE_ON_BUILD_ID" : "extension.brackets-builder.menu.save.id",
73 | "SHOW_PANEL_ID" : "extension.brackets-builder.panel.show.id",
74 | "CONFIG_ID" : "extension.brackets-builder.configure.id",
75 | "SETTINGS_ID" : "",
76 | "PANEL_ID" : "brackets-build-sys-panel",
77 | });
78 |
--------------------------------------------------------------------------------
/node/command.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | "use strict";
3 |
4 | var _domainManager,
5 | child;
6 |
7 | function _execute(cmd, cwd, isWin, shell) {
8 |
9 | var spawn = require("child_process").spawn,
10 | args,
11 | enddir = cwd,
12 | tempdir;
13 |
14 | cmd = cmd.trim();
15 |
16 | if (isWin) {
17 | args = ["/c", cmd];
18 | cmd = shell;
19 | }
20 | else {
21 | args = ["-c", cmd];
22 | cmd = shell;
23 | }
24 |
25 | child = spawn(cmd, args, { cwd: cwd, env: process.env });
26 |
27 | child.stdout.on("data", function (data) {
28 | _domainManager.emitEvent("elmDomain", "stdout", data.toString());
29 | });
30 |
31 | child.stderr.on("data", function (data) {
32 | _domainManager.emitEvent("elmDomain", "stderr", data.toString());
33 | });
34 |
35 | child.on('exit', function (code) {
36 | _domainManager.emitEvent("elmDomain", "finished");
37 | });
38 |
39 | child.on('error', function (error) {
40 | _domainManager.emitEvent("elmDomain", "finished");
41 | });
42 |
43 | }
44 |
45 | /**
46 | * Initializes the test domain with several test commands.
47 | * @param {DomainManager} domainManager The DomainManager for the server
48 | */
49 | function _init(domainManager) {
50 |
51 | if (!domainManager.hasDomain("elmDomain")) {
52 | domainManager.registerDomain("elmDomain", {major: 0, minor: 12});
53 | }
54 |
55 | domainManager.registerCommand(
56 | "elmDomain", // domain name
57 | "execute", // command name
58 | _execute, // command handler function
59 | true, // isAsync
60 | "Execute the given command and return the results to the UI",
61 | [{
62 | name: "cmd",
63 | type: "string",
64 | description: "The command to be executed"
65 | },
66 | {
67 | name: "cwd",
68 | type: "string",
69 | description: "Directory in which the command is executed"
70 | },
71 | {
72 | name: "isWin",
73 | type: "boolean",
74 | description: "Is Windows System ?"
75 | },
76 | {
77 | name: "shell",
78 | type: "string",
79 | description: "Path of the Shell used to execute the commands"
80 | }]
81 | );
82 |
83 | domainManager.registerEvent("elmDomain",
84 | "stdout",
85 | [{name: "data", type: "string"}]);
86 |
87 | domainManager.registerEvent("elmDomain",
88 | "stderr",
89 | [{name: "err", type: "string"}]);
90 |
91 | domainManager.registerEvent("elmDomain",
92 | "finished",
93 | []);
94 |
95 | domainManager.registerEvent("elmDomain",
96 | "close",
97 | [{name: "enddir", type: "string"}]);
98 |
99 | domainManager.registerEvent("elmDomain",
100 | "clear",
101 | []);
102 |
103 | _domainManager = domainManager;
104 | }
105 |
106 | exports.init = _init;
107 |
108 | }());
109 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "foobarcode.elm",
3 | "title": "Elm support for Brackets",
4 | "description": "Syntax highlight and current file build with console output.",
5 | "homepage": "https://github.com/lepinay/elm-brackets",
6 | "version": "1.2.0",
7 | "author": "FooBarCode (http://foobarcode.me)",
8 | "license": "MIT",
9 | "engines": {
10 | "brackets": ">=1.1.0"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/styles/style.css:
--------------------------------------------------------------------------------
1 | #brackets-build-sys-status {
2 | transition: background-color 0.5s;
3 | display: block;
4 | }
5 |
6 | #brackets-build-sys-status.Inactive {
7 |
8 | }
9 |
10 | #brackets-build-sys-status.Inactive:hover {
11 | background-color: rgba(0, 0, 0, 0.03);
12 | }
13 |
14 | #brackets-build-sys-status.Finished {
15 | background-color: rgba(145, 204, 65, 0.7);
16 | }
17 |
18 | #brackets-build-sys-status.Finished:hover {
19 | background-color: rgba(145, 204, 65, 0.4);
20 | }
21 |
22 | #brackets-build-sys-status.Error {
23 | background-color: rgba(247, 70, 135, 0.7);
24 | }
25 |
26 | #brackets-build-sys-status.Error:hover {
27 | background-color: rgba(247, 70, 135, 0.4);
28 | }
29 |
30 | #brackets-build-sys-status.Progressing {
31 | background-color: rgba(120, 178, 242, 0.7);
32 | }
33 |
34 | #brackets-build-sys-status.Progressing:hover {
35 | background-color: rgba(120, 178, 242, 0.4);
36 | }
37 |
38 | #brackets-build-sys-panel .tools {
39 | position: absolute;
40 | bottom: 1.5px;
41 | right: 50px;
42 | }
43 |
44 | .build-sys-output .build-sys-output-text {
45 | margin: 0;
46 | padding: 0 0 0 20px;
47 | color: inherit;
48 | background-color: transparent;
49 | border: none;
50 | /*border-left: 3px solid rgba(128, 128, 128, 0.6);*/
51 | border-radius: 0;
52 | }
--------------------------------------------------------------------------------