Skip to content

Commit 2ab677b

Browse files
committed
chore: ux improve for fix problem, fix wrench gutter and panel icon
1 parent 2b69711 commit 2ab677b

2 files changed

Lines changed: 34 additions & 4 deletions

File tree

src/language/CodeInspection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,7 @@ define(function (require, exports, module) {
780780
numProblems++;
781781
}
782782

783-
error.iconClass = _getIconClassForType(error.type);
783+
error.iconClass = _getIconClassForType(error.type, error.fix && error.fix.id);
784784

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

test/spec/CodeInspection-integ-test.js

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,8 +528,8 @@ define(function (require, exports, module) {
528528
expect(marks[0].className).toBe("editor-text-fragment-warn");
529529
});
530530

531-
it("should show warning gutter icon on line in editor", async function () {
532-
let codeInspector = createCodeInspector("javascript linter", failLintResult());
531+
async function _testWarningIcon(lintResult, expectedClass) {
532+
let codeInspector = createCodeInspector("javascript linter", lintResult);
533533
CodeInspection.register("javascript", codeInspector);
534534

535535
await awaitsForDone(SpecRunnerUtils.openProjectFiles(["errors.js"]), "open test file", 5000);
@@ -538,7 +538,37 @@ define(function (require, exports, module) {
538538
let marks = EditorManager.getActiveEditor().getGutterMarker(1, CodeInspection.CODE_INSPECTION_GUTTER);
539539
expect(marks.title).toBe('\nSome errors here and there at column: 4');
540540
marks = $(marks);
541-
expect(marks.find('span').hasClass('line-icon-problem_type_warning')).toBeTrue();
541+
expect(marks.find('span').hasClass(expectedClass)).toBeTrue();
542+
return marks;
543+
}
544+
545+
it("should show warning gutter icon on line in editor", async function () {
546+
await _testWarningIcon(failLintResult(), 'line-icon-problem_type_warning');
547+
});
548+
549+
it("should show fix icon in gutter for warning on line in editor", async function () {
550+
const marks = await _testWarningIcon(failLintResult(true), 'line-icon-problem_type_warning');
551+
expect(marks.find('span').hasClass('fa-wrench')).toBeTrue();
552+
const $problemLineInPanel = CodeInspection.scrollToProblem(1);
553+
expect($problemLineInPanel.find("i").hasClass("fa-wrench")).toBeTrue();
554+
});
555+
556+
it("should show fix icon in gutter for error on line in editor", async function () {
557+
const errorResult = failLintResult(true);
558+
errorResult.errors[0].type = CodeInspection.Type.ERROR;
559+
const marks = await _testWarningIcon(errorResult, 'line-icon-problem_type_error');
560+
expect(marks.find('span').hasClass('fa-wrench')).toBeTrue();
561+
const $problemLineInPanel = CodeInspection.scrollToProblem(1);
562+
expect($problemLineInPanel.find("i").hasClass("fa-wrench")).toBeTrue();
563+
});
564+
565+
it("should show fix icon in gutter and panel for info on line in editor", async function () {
566+
const errorResult = failLintResult(true);
567+
errorResult.errors[0].type = CodeInspection.Type.META;
568+
const marks = await _testWarningIcon(errorResult, 'line-icon-problem_type_info');
569+
expect(marks.find('span').hasClass('fa-wrench')).toBeTrue();
570+
const $problemLineInPanel = CodeInspection.scrollToProblem(1);
571+
expect($problemLineInPanel.find("i").hasClass("fa-wrench")).toBeTrue();
542572
});
543573

544574
it("should not show codeinspection gutter on unsupported languages", async function () {

0 commit comments

Comments
 (0)