Repository navigation
Add simple lint on save support (closes #21) - #68
Conversation
|
Fwiw, I've been using this PR for the last few days, and have one major UX tweak I'd like to make. Hiding lint state until save is fine unless you're trying to fix a bunch of linting errors at once, and then it becomes annoying to have to re-save every time you change something. I think a good tweak to this feature might be to enable lint-on-type if you have the Problems pane open, since if you're actively looking at errors, you probably don't want them to disappear as you edit. I don't know if other VSCode linters have done anything like this, would be neat to standardize on a UX going forward. (otoh, while this is an issue, I still think this feature is pretty great as-is, as someone who finds linting-while-editing distracting enough that I would have completely opted out of in-editor linting without it!) |
|
Thanks, I'll look into this PR as soon as I'm back from vacation. |
|
Regarding clearing the diagnostics on content change. While the idea is good. Other language services like Php or Go that do validate on save do not clear the diagnostics on content change so I think tslint should be consistent and I'll remove this behaviour we can consider surfacing this behaviour behind a setting. |
|
I've published a new version of the tslint extension. Thanks again for the PR 🌹 |
I found constant linting updates really distracting while writing code, so I went ahead and implemented this. It uses the same setting format that the built-in PHP linter extension uses:
My first pass at this actually removed the 200ms delay on validation when in onSave mode, but I ran into a couple annoying problems:
onDidChangeContentis fired afteronDidOpenand would clear the validation state on openonDidChangeContentandonDidSavewould be fired around the same time if I quickly saved after making a chance, and this lead to a common race condition where the state would get cleared after a save.I couldn't think of a better way to avoid these issues without tracking a lot of extra state, and figured the 200ms delay is long enough that I don't think you'd ever see a race condition but short enough that it isn't painful.