Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Remember linter collapsed #11641

Merged
merged 3 commits into from
Sep 11, 2015
Merged
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
8 changes: 6 additions & 2 deletions src/htmlContent/problems-panel-table.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
<tbody>
{{#reportList}}
<tr class="inspector-section">
<td colspan="3"><span class="disclosure-triangle expanded"></span>{{providerName}} ({{results.length}})</td>
<td colspan="3">
<span class="disclosure-triangle {{#isExpanded}}expanded{{/isExpanded}}"></span>
<input type="hidden" value="{{providerName}}" />
{{providerName}} ({{results.length}})
</td>
</tr>
{{#results}}
<tr>
<tr class="{{display}}">
<td class="line-number" data-character="{{pos.ch}}">{{friendlyLine}}</td>
<td class="line-text">{{message}}</td>
<td class="line-snippet">{{codeSnippet}}</td>
Expand Down
20 changes: 17 additions & 3 deletions src/language/CodeInspection.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ define(function (require, exports, module) {
// Augment error objects with additional fields needed by Mustache template
results.forEach(function (inspectionResult) {
var provider = inspectionResult.provider;
var isExpanded = prefs.get(provider.name + ".collapsed") !== false;

if (inspectionResult.result) {
inspectionResult.result.errors.forEach(function (error) {
Expand All @@ -428,6 +429,9 @@ define(function (require, exports, module) {
if (error.type !== Type.META) {
numProblems++;
}

// Hide the errors when the provider is collapsed.
error.display = isExpanded ? "" : "forced-hidden";
});

// if the code inspector was unable to process the whole file, we keep track to show a different status
Expand All @@ -437,6 +441,7 @@ define(function (require, exports, module) {

if (inspectionResult.result.errors.length) {
allErrors.push({
isExpanded: isExpanded,
providerName: provider.name,
results: inspectionResult.result.errors
});
Expand Down Expand Up @@ -655,11 +660,20 @@ define(function (require, exports, module) {

// This is a inspector title row, expand/collapse on click
if ($selectedRow.hasClass("inspector-section")) {
// Clicking the inspector title section header collapses/expands result rows
$selectedRow.nextUntil(".inspector-section").toggle();

var $triangle = $(".disclosure-triangle", $selectedRow);
var isExpanded = $triangle.hasClass("expanded");

// Clicking the inspector title section header collapses/expands result rows
if (isExpanded) {
$selectedRow.nextUntil(".inspector-section").addClass("forced-hidden");
} else {
$selectedRow.nextUntil(".inspector-section").removeClass("forced-hidden");
}
$triangle.toggleClass("expanded");

var providerName = $selectedRow.find("input[type='hidden']").val();
prefs.set(providerName + ".collapsed", !isExpanded);
prefs.save();
} else {
// This is a problem marker row, show the result on click
// Grab the required position data
Expand Down