lsp: Optimize diagnostics handling
Currently if a server sends a lot of diagnostics Kate becomes close to unsable. One such server is the dart-analyzer which for some reason is very eager about scanning every possible thing it can find in whatever directory you are.
This patch includes some optimizations which makes the handling of diagnostics a lot faster.
Also, cache the KTextEditor::Attributes and reuse them so that kate doesn't eat up too much memory in case a doc has a lot of diagnostics.
With this MR
- Switching docs when you have a lot of diagnostics is much faster (due to uniform row heights)
- Closing docs is much faster (rows are removed in groups, instead of just being hidden and staying in the model forever)
- Handling of tons of diagnostics is much faster as we early out on top level item instead of checking each item
All changes are in separate commits
Edited by Waqar Ahmed