Synchronize lints between two views

Hey! I’ve set up two synced EditorViews as described in the split view tutorial. Now, I want them to share lint diagnostics, with one view providing them and the other view (“follower view”) being passed the decorations as a state effect.

When using @codemirror/lint, I need to add a linter plugin to both views. So far, I’ve spotted two ways of having the views share their lints:

  1. Throw an exception in the follower view’s linting handler, e.g. linter(() => {throw "no"}). This works, but prints the error on the console.
  2. Patch @codemirror/lint to optionally omit the lintPlugin from the linter’s extension array for the follower view. This also works, but I don’t necessarily want to maintain such a patch.

What would be a clean way to do this?

I don’t think it’s necessary to include the lint extension in the follower—setDiagnostics will automatically inject the necessary extensions when you use it.