I’m using the linter plugin in an IDE-like UI to display run time errors from the code being edited. This setup is a bit weird compared to the usual linting flow in that, it is more imperative and a result of the code being run rather than an operation that can be run on the code itself.
Right now I’m accomplishing this by using setDiagnostics after retrieving errors. However, the moment the user modifies the document (or even clicks in and alters the selection), the diagnostics will disappear as the linter will rerun. I am working around this by setting a config of { delay: Infinity }. This seems to solve the problem for me.
Couple questions about all this.
Is using the linter plugin for setting code errors like this a good solution? Or does it make more sense to create my own extension?
Is the workaround of setting delay: Infinity a good idea? Or will I run into some unintended consequences and/or break down the line?
this is clearly not a CodeMirror bug per se, but leaving the findings here for anyone else. Once we wrapped all our callbacks in useCallback, we were able to avoid these reconfigure state effects, and solve the issue. I’m guessing by manually creating a linter extension, we avoided the lints being destroyed.