-
Notifications
You must be signed in to change notification settings - Fork 0
disable-lint-thimble #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: disable-lint
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,8 +98,9 @@ define(function (require, exports, module) { | |
| WORD_WRAP = "wordWrap", | ||
| INDENT_LINE_COMMENT = "indentLineComment", | ||
| ALLOW_JAVASCRIPT = "allowJavaScript", | ||
| ALLOW_LINT = "interactive-linter", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need any of the changes to this file, you can revert all this. |
||
| AUTO_UPDATE = "autoUpdate"; | ||
|
|
||
|
|
||
| var cmOptions = {}; | ||
|
|
||
|
|
@@ -129,7 +130,9 @@ define(function (require, exports, module) { | |
| cmOptions[TAB_SIZE] = "tabSize"; | ||
| cmOptions[USE_TAB_CHAR] = "indentWithTabs"; | ||
| cmOptions[WORD_WRAP] = "lineWrapping"; | ||
| cmOptions[ALLOW_JAVASCRIPT] = "allowJavaScript"; | ||
| cmOptions[ALLOW_JAVASCRIPT] = "interactive-linter"; | ||
| cmOptions[ALLOW_LINT] = "allowLint"; | ||
|
|
||
|
|
||
| PreferencesManager.definePreference(CLOSE_BRACKETS, "boolean", true, { | ||
| description: Strings.DESCRIPTION_CLOSE_BRACKETS | ||
|
|
@@ -213,14 +216,17 @@ define(function (require, exports, module) { | |
| PreferencesManager.definePreference(WORD_WRAP, "boolean", true, { | ||
| description: Strings.DESCRIPTION_WORD_WRAP | ||
| }); | ||
|
|
||
| PreferencesManager.definePreference(INDENT_LINE_COMMENT, "boolean", false, { | ||
| description: Strings.DESCRIPTION_INDENT_LINE_COMMENT | ||
| }); | ||
|
|
||
| PreferencesManager.definePreference(ALLOW_JAVASCRIPT, "boolean", true, { | ||
| description: Strings.DESCRIPTION_ALLOW_JAVASCRIPT | ||
| }); | ||
| PreferencesManager.definePreference(ALLOW_LINT, "boolean", true, { | ||
| description: Strings.DESCRIPTION_ALLOW_LINT | ||
| }); | ||
|
|
||
| PreferencesManager.definePreference(AUTO_UPDATE, "boolean", true, { | ||
| description: Strings.DESCRIPTION_AUTO_UPDATE | ||
|
|
@@ -350,7 +356,7 @@ define(function (require, exports, module) { | |
|
|
||
| // To track which pane the editor is being attached to if it's a full editor | ||
| this._paneId = null; | ||
|
|
||
| // To track the parent editor ( host editor at that time of creation) of an inline editor | ||
| this._hostEditor = null; | ||
|
|
||
|
|
@@ -416,6 +422,7 @@ define(function (require, exports, module) { | |
| lineWiseCopyCut : currentOptions[LINEWISE_COPY_CUT], | ||
| lineWrapping : currentOptions[WORD_WRAP], | ||
| allowJavaScript : currentOptions[ALLOW_JAVASCRIPT], | ||
| allowLint : currentOptions[ALLOW_LINT], | ||
| matchBrackets : { maxScanLineLength: 50000, maxScanLines: 1000 }, | ||
| matchTags : { bothTags: true }, | ||
| scrollPastEnd : !range && currentOptions[SCROLL_PAST_END], | ||
|
|
@@ -1022,7 +1029,7 @@ define(function (require, exports, module) { | |
| this._codeMirror.on("focus", function () { | ||
| self._focused = true; | ||
| self.trigger("focus", self); | ||
|
|
||
| }); | ||
|
|
||
| this._codeMirror.on("blur", function () { | ||
|
|
@@ -2552,7 +2559,7 @@ define(function (require, exports, module) { | |
|
|
||
| /** | ||
| * Sets lineCommentIndent option. | ||
| * | ||
| * | ||
| * @param {boolean} value | ||
| * @param {string=} fullPath Path to file to get preference for | ||
| * @return {boolean} true if value was valid | ||
|
|
@@ -2561,7 +2568,7 @@ define(function (require, exports, module) { | |
| var options = fullPath && {context: fullPath}; | ||
| return PreferencesManager.set(INDENT_LINE_COMMENT, value, options); | ||
| }; | ||
|
|
||
| /** | ||
| * Returns true if word wrap is enabled for the specified or current file | ||
| * @param {string=} fullPath Path to file to get preference for | ||
|
|
@@ -2570,7 +2577,7 @@ define(function (require, exports, module) { | |
| Editor.getIndentLineComment = function (fullPath) { | ||
| return PreferencesManager.get(INDENT_LINE_COMMENT, _buildPreferencesContext(fullPath)); | ||
| }; | ||
|
|
||
| Editor.setAllowJavaScript = function (value, fullPath) { | ||
| var options = fullPath && {context: fullPath}; | ||
| return PreferencesManager.set(ALLOW_JAVASCRIPT, value, options); | ||
|
|
@@ -2580,6 +2587,15 @@ define(function (require, exports, module) { | |
| return PreferencesManager.get(ALLOW_JAVASCRIPT, _buildPreferencesContext(fullPath)); | ||
| }; | ||
|
|
||
| Editor.setAllowLint = function (value, fullPath) { | ||
| var options = fullPath && {context: fullPath}; | ||
| return PreferencesManager.set(ALLOW_LINT, value, options); | ||
| }; | ||
|
|
||
| Editor.getAllowLint = function (fullPath) { | ||
| return PreferencesManager.get(ALLOW_LINT, _buildPreferencesContext(fullPath)); | ||
| }; | ||
|
|
||
| /** | ||
| * Runs callback for every Editor instance that currently exists | ||
| * @param {!function(!Editor)} callback | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,6 +37,7 @@ define(function (require, exports, module) { | |
| STYLE_ACTIVE_LINE = "styleActiveLine", | ||
| WORD_WRAP = "wordWrap", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't need any of these changes. |
||
| ALLOW_JAVASCRIPT = "allowJavaScript", | ||
| ALLOW_LINT = "allowLint", | ||
| CLOSE_BRACKETS = "closeBrackets", | ||
| AUTO_UPDATE = "autoUpdate"; | ||
|
|
||
|
|
@@ -50,6 +51,7 @@ define(function (require, exports, module) { | |
| _optionMapping[STYLE_ACTIVE_LINE] = Commands.TOGGLE_ACTIVE_LINE; | ||
| _optionMapping[WORD_WRAP] = Commands.TOGGLE_WORD_WRAP; | ||
| _optionMapping[ALLOW_JAVASCRIPT] = Commands.TOGGLE_ALLOW_JAVASCRIPT; | ||
| _optionMapping[ALLOW_LINT] = Commands.TOGGLE_ALLOW_LINT ; | ||
| _optionMapping[CLOSE_BRACKETS] = Commands.TOGGLE_CLOSE_BRACKETS; | ||
| _optionMapping[AUTO_UPDATE] = Commands.TOGGLE_AUTO_UPDATE; | ||
|
|
||
|
|
@@ -104,6 +106,7 @@ define(function (require, exports, module) { | |
|
|
||
| // XXXBramble | ||
| CommandManager.registerInternal(Commands.TOGGLE_ALLOW_JAVASCRIPT, _getToggler(ALLOW_JAVASCRIPT)); | ||
| CommandManager.registerInternal(Commands.TOGGLE_ALLOW_LINT, _getToggler(ALLOW_LINT)); | ||
| CommandManager.registerInternal(Commands.TOGGLE_AUTO_UPDATE, _getToggler(AUTO_UPDATE)); | ||
|
|
||
| AppInit.htmlReady(_init); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,6 +99,14 @@ define(function (require, exports, module) { | |
| PreferencesManager.set("allowJavaScript", false); | ||
| PostMessageTransport.reload(); | ||
| break; | ||
| case "BRAMBLE_ENABLE_LINT": | ||
| PreferencesManager.set("allowLint", true); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You have to set this for the proper pref in your extension: PreferencesManager.getExtensionPrefs("interactive-linter").set("enabled" true);I think. Test that. |
||
| PostMessageTransport.reload(); | ||
| break; | ||
| case "BRAMBLE_DISABLE_LINT": | ||
| PreferencesManager.set("allowLint", false); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing here. |
||
| PostMessageTransport.reload(); | ||
| break; | ||
| case "BRAMBLE_ENABLE_INSPECTOR": | ||
| MouseManager.enableInspector(); | ||
| break; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -125,14 +125,22 @@ define(function (require, exports, module) { | |
| wordWrap: PreferencesManager.get("wordWrap") | ||
| }); | ||
| }); | ||
|
|
||
| // Listen for changes to allow javascript | ||
| PreferencesManager.on("change", "allowJavaScript", function () { | ||
| sendEvent({ | ||
| type: "bramble:allowJavaScriptChange", | ||
| allowJavaScript: PreferencesManager.get("allowJavaScript") | ||
| }); | ||
| }); | ||
| // Listen for changes to allow javascript | ||
| var Lint = PreferencesManager.getExtensionPrefs("interactive-linter"); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| Lint.on("change", "allowLint", function () { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is wrong. Check out https://github.com/mozilla/brackets/pull/702/files which is pretty similar to what you're doing. |
||
| sendEvent({ | ||
| type: "bramble:allowLintChange", | ||
| allowLint: PreferencesManager.get("enabled") | ||
| }); | ||
| }); | ||
|
|
||
| //Listen for changes to auto update | ||
| PreferencesManager.on("change", "autoUpdate", function () { | ||
|
|
@@ -174,6 +182,7 @@ define(function (require, exports, module) { | |
| theme: Theme.getTheme(), | ||
| wordWrap: PreferencesManager.get("wordWrap"), | ||
| allowJavaScript: PreferencesManager.get("allowJavaScript"), | ||
| allowLint: PreferencesManager.getExtensionPrefs("interactive-linter").get("enabled"), | ||
| autoUpdate: PreferencesManager.get("autoUpdate") | ||
| }); | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need this file changed.