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 18, 2023
1 parent c7c8ee7 commit a2eb8fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
17 changes: 6 additions & 11 deletions lib/Linting.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,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 @@ -267,7 +265,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 @@ -496,12 +497,6 @@ Linting.prototype._setButtonState = function(state, errors, warnings) {

Linting.prototype._updateButton = function() {

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

return;
}

var errors = 0,
warnings = 0;

Expand All @@ -525,7 +520,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 @@ -779,7 +779,7 @@ describe('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 a2eb8fb

Please sign in to comment.