ricardofbarros / linter-js-standard

Atom linter plugin for JavaScript, using JavaScript Standard Style
https://atom.io/packages/linter-js-standard
MIT License
99 stars 48 forks source link

Assign values to the 'text-editor' key if necessary #190

Closed educcjr closed 7 years ago

educcjr commented 7 years ago

I think this will solve the issue #179.

Whenever a text editor panel is activated, the 'lint' function (lib/linter-js-standard.js) checks if 'text-editor' key has values. But if there isn't any active text editor when Atom starts, the 'activate' function (lib/init.js) won't assign any value to the 'text-editor' key.

Basically the warning would always show up if Atom didn't initialize with an active text editor.

whaaaley commented 7 years ago

thank you so much for this! i can confirm this fix works for me

alexmarles commented 7 years ago

I confirm that this fixes it! Thanks @educcjr !

chibicode commented 7 years ago

Until this is merged by @ricardofbarros, you can install manually:

apm install educcjr/linter-js-standard
sonicdoe commented 7 years ago

I have fixed this in https://github.com/ricardofbarros/linter-js-standard/commit/e51f30bedba39d028431f0ac71bb4f7aed6db5cf.

I have now swapped onDidChangeActivePaneItem() with observeTextEditors() which calls back with a text editor instance even if the active pane is not a text editor (e.g. the tree view). I have chosen this over simply setting { style: { cmd: 'no-style' }, opts: {} } since this would disable linting if, for example, you open a file in a pending tab from the tree view upon opening Atom.

Anyhow, thank you for taking the time to debug this.