-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Added search to jslint error #3304
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 |
---|---|---|
|
@@ -49,6 +49,7 @@ define(function (require, exports, module) { | |
Resizer = brackets.getModule("utils/Resizer"), | ||
ExtensionUtils = brackets.getModule("utils/ExtensionUtils"), | ||
StatusBar = brackets.getModule("widgets/StatusBar"), | ||
NativeApp = brackets.getModule("utils/NativeApp"), | ||
JSLintTemplate = require("text!htmlContent/bottom-panel.html"), | ||
ResultsTemplate = require("text!htmlContent/results-table.html"); | ||
|
||
|
@@ -153,6 +154,14 @@ define(function (require, exports, module) { | |
EditorManager.focusEditor(); | ||
}); | ||
|
||
$lintResults.find(".lint-url") | ||
.on("click", function (e) { | ||
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 works good like this, but if we want to avoid multiple event listeners and use delegation, you can just move it to the click listener in the table, and add an 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. Good idea! 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 can also do the following:
This is somewhat of a shortcut for Tom's suggestion, as it creates a single event handler that is designated to url handling and safe towards content changes. Additionally, you can keep the url handling separate from the generic click handling, which I think is more readable. 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. Nice, I didn't knew you could do that and I like that idea better. |
||
var reason = $(this).data("reason"); | ||
var url = "https://www.google.com/search?q=" + encodeURIComponent(reason); | ||
NativeApp.openURLInDefaultBrowser(url); | ||
return false; | ||
}); | ||
|
||
$lintResults.show(); | ||
if (JSLINT.errors.length === 1) { | ||
StatusBar.updateIndicator(INDICATOR_ID, true, "jslint-errors", Strings.JSLINT_ERROR_INFORMATION); | ||
|
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.
You should move the search string to
nls/root/string.js
with the other JSLint strings and use it here by the key name.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.
Will do. Thanks!