Skip to content

Commit

Permalink
feat: eagerly validate
Browse files Browse the repository at this point in the history
Always validate, indicate results in overlay. Toggle overlays on button
click.
  • Loading branch information
nikku committed Jul 21, 2023
1 parent ea1018f commit 18c4f4d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
19 changes: 7 additions & 12 deletions lib/Linting.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ export default function Linting(
'linting.configChanged',
'linting.toggle'
], LOW_PRIORITY, function(e) {
if (self.isActive()) {
self.update();
}
self.update();
});

eventBus.on('linting.toggle', function(event) {
Expand Down Expand Up @@ -269,7 +267,10 @@ Linting.prototype.update = function() {
add = assign(add, update);

self._clearOverlays();
self._createIssues(add);

if (self.isActive()) {
self._createIssues(add);
}

self._issues = newIssues;

Expand Down Expand Up @@ -516,7 +517,7 @@ Linting.prototype._setButtonState = function(issues) {
var label = this._translate(
(errors || warnings)
? '{errors} Errors, {warnings} Warnings'
: 'Toggle Linting',
: 'No Issues',
{
errors: String(errors),
warnings: String(warnings),
Expand Down Expand Up @@ -548,12 +549,6 @@ Linting.prototype._setButtonState = function(issues) {

Linting.prototype._updateButton = function() {

if (!this.isActive()) {
this._setButtonState('inactive', 0, 0);

return;
}

var errors = 0,
warnings = 0,
infos = 0;
Expand Down Expand Up @@ -582,7 +577,7 @@ Linting.prototype._createButton = function() {
var self = this;

this._button = domify(
'<button class="bjsl-button bjsl-button-inactive" title="' + this._translate('Toggle linting') + '"></button>'
'<button class="bjsl-button bjsl-button-inactive" title="' + this._translate('Toggle linting overlays') + '"></button>'
);

this._button.addEventListener('click', function() {
Expand Down
2 changes: 1 addition & 1 deletion test/spec/LintingSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -702,7 +702,7 @@ describe('linting - i18n', function() {
document.body.appendChild(el);

const translations = {
'Toggle linting': 'Перемкнути перевірку',
'Toggle linting overlays': 'Перемкнути перевірку',
'Process is missing end event': 'У процеса відсутня завершальна подія',
'{errors} Errors, {warnings} Warnings': '{errors} помилок, {warnings} попередженнь'
};
Expand Down

0 comments on commit 18c4f4d

Please sign in to comment.