Closed Gelio closed 3 years ago
Hmm, that's not a bad plan, but there is a little complication: it's possible that an appropriate config may be missing for one file, but exist for another. So, it needs to pause validations on a per-file basis.
I've got an idea - I'll find some time to give it a try in the next couple days.
Valid point, makes sense š Sure thing, thanks for putting the effort
Hey @Gelio, I just released v1.2.3 that should solve this issue, and #17. Let me know if it works for you!
Great news, thanks! I'm taking time off till the end of the week, so I'll try it out next weekend, hopefully. Thanks again! I appreciate it š
I gave v1.2.3 a try and #17 is fixed, but we seem to have regressed with https://github.com/bmatcuk/stylelint-lsp/pull/18 š I inspected the problem since I figured it may be easier for me with neovim LSP already configured, and raised #21 with the fix š
After the problem mentioned in #21 is solved, the overall fix for this issue is working great - the errors about the configuration not being provided are not repeated anymore š Thanks!
I confirm that the problem is solved in v1.2.4 š
I have stylelint-lsp enabled and running inside neovim (using neovim LSP) whenever working on CSS, JS, TS files. The stylelint-lsp is enabled even if the project does not have stylelint configured. This introduces unnecessary work and errors in my lsp.log, because when running the
validate
function (which callsstylelint.lint
in the end):https://github.com/Gelio/stylelint-lsp/blob/bd989a5ae55d72701531bed1908c6546df3aa203/src/validate.ts#L192
possible errors are not caught. I have raised a PR (https://github.com/bmatcuk/stylelint-lsp/pull/18) that adds error handling, but we could do better and don't run stylelint's
lint
function if stylelint is not configured.One idea I had would be to catch the error that
lint
rejects with, and if it's an error about the configuration being missing, pause anyvalidate
requests until the config file watcher notifies that the config has changed:https://github.com/Gelio/stylelint-lsp/blob/bd989a5ae55d72701531bed1908c6546df3aa203/src/validate.ts#L274-L282
I could try to help out and implement it, if you'd like :slightly_smiling_face: