Skip to content

Commit e8373c2

Browse files
committed
feat: show informational diagnostic count in the Problems panel title
Info-level (META) diagnostics are listed in the panel but weren't counted in the title, so a file with only suggestions read "0 Problems" above a visible info row. Count them separately and append "(N Info)" when present, e.g. "0 typescript Problems - foo.js (2 Info)". Error/warning counts and the existing title formats are unchanged - the suffix only appears when there are infos.
1 parent cf21727 commit e8373c2

2 files changed

Lines changed: 13 additions & 3 deletions

File tree

src/language/CodeInspection.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ define(function (require, exports, module) {
365365
* @param {boolean} aborted - true if any provider returned a result with the 'aborted' flag set
366366
* @param fileName
367367
*/
368-
function updatePanelTitleAndStatusBar(numProblems, providersReportingProblems, aborted, fileName) {
368+
function updatePanelTitleAndStatusBar(numProblems, numInfos, providersReportingProblems, aborted, fileName) {
369369
$fixAllBtn.addClass("forced-hidden");
370370
var message, tooltip;
371371

@@ -405,6 +405,12 @@ define(function (require, exports, module) {
405405
return;
406406
}
407407

408+
// Info-level diagnostics (e.g. LSP suggestions) are shown as rows but aren't "problems";
409+
// surface their count in the title so "0 Problems" never sits above a visible info row.
410+
if (numInfos > 0) {
411+
message = StringUtils.format(Strings.ERRORS_PANEL_TITLE_INFO_SUFFIX, message, numInfos);
412+
}
413+
408414
$problemsPanel.find(".title").text(message);
409415
tooltip = StringUtils.format(Strings.STATUSBAR_CODE_INSPECTION_TOOLTIP, message);
410416
let iconType = "inspection-errors";
@@ -762,6 +768,7 @@ define(function (require, exports, module) {
762768

763769
if (providerList && providerList.length) {
764770
let numProblems = 0,
771+
numInfos = 0,
765772
aborted = false,
766773
allErrors = [],
767774
html,
@@ -825,7 +832,9 @@ define(function (require, exports, module) {
825832
error.codeSnippet = error.codeSnippet.substr(0, 175); // limit snippet width
826833
}
827834

828-
if (error.type !== Type.META) {
835+
if (error.type === Type.META) {
836+
numInfos++;
837+
} else {
829838
numProblems++;
830839
}
831840

@@ -860,7 +869,7 @@ define(function (require, exports, module) {
860869
.empty()
861870
.append(html); // otherwise scroll pos from previous contents is remembered
862871

863-
updatePanelTitleAndStatusBar(numProblems, providersReportingProblems, aborted,
872+
updatePanelTitleAndStatusBar(numProblems, numInfos, providersReportingProblems, aborted,
864873
path.basename(fullFilePath));
865874
setGotoEnabled(true);
866875

src/nls/root/strings.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,6 +1004,7 @@ define({
10041004
"ERRORS_NO_FILE": "No File Open",
10051005
"ERRORS_PANEL_TITLE_MULTIPLE": "{0} Problems - {1}",
10061006
"ERRORS_PANEL_TITLE_MULTIPLE_FIXABLE": "{0} Problems, {1} Fixable - {2}",
1007+
"ERRORS_PANEL_TITLE_INFO_SUFFIX": "{0} ({1} Info)",
10071008
"SINGLE_ERROR": "1 {0} Problem - {1}",
10081009
"SINGLE_ERROR_FIXABLE": "1 {0} Problem, {1} Fixable - {2}",
10091010
"MULTIPLE_ERRORS": "{0} {1} Problems - {2}",

0 commit comments

Comments
 (0)