Add a diagnostics accessor #8

Closed
marstamm wants to merge 1 commit from main into main
marstamm commented 2022-07-28 10:50:45 +02:00 (Migrated from github.com)

Similar to the diagnosticCount accessor, provide an interface to get diagnostics from a given state.

Use Case

We want to implement and external Lint panel, similar to the Problems tab in VS-Code, that accumulates all linting messages accross different components. For this, we need a way to access the currently active Diagnostics in the Editor.

Similar to the `diagnosticCount` accessor, provide an interface to get diagnostics from a given state. **Use Case** We want to implement and external Lint panel, similar to the `Problems` tab in VS-Code, that accumulates all linting messages accross different components. For this, we need a way to access the currently active Diagnostics in the Editor.
marijnh commented 2022-07-28 11:43:17 +02:00 (Migrated from github.com)

This will return the diagnostics with their initial positions, though, which may not be accurate when the document has changed in the meantime. For your use case, would defining an update handler that listens for transactions with the setDiagnosticsEffect and pushes them out to your list not also work?

This will return the diagnostics with their *initial* positions, though, which may not be accurate when the document has changed in the meantime. For your use case, would defining an update handler that listens for transactions with the [`setDiagnosticsEffect`](https://codemirror.net/docs/ref/#lint.setDiagnosticsEffect) and pushes them out to your list not also work?
marstamm commented 2022-07-28 12:08:25 +02:00 (Migrated from github.com)

would defining an update handler that listens for transactions with the setDiagnosticsEffect and pushes them out to your list not also work?

Yes, I have not thought about that. I just tried it our and this will solve our problem.

Thank you for your input and the quick response 🏆

> would defining an update handler that listens for transactions with the [setDiagnosticsEffect](https://codemirror.net/docs/ref/#lint.setDiagnosticsEffect) and pushes them out to your list not also work? Yes, I have not thought about that. I just tried it our and this will solve our problem. Thank you for your input and the quick response 🏆

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/lint!8
No description provided.