* Merge fresh plugin-load errors with existing errors, preserving LSP and * plugin-component errors that were recorded by other systems and * deduplicating. Same logic as refreshPlugins()/updatePluginState(), extracted * so refresh.ts doesn't leave those errors stranded.
( existing: PluginError[], fresh: PluginError[], )
| 197 | * so refresh.ts doesn't leave those errors stranded. |
| 198 | */ |
| 199 | function mergePluginErrors( |
| 200 | existing: PluginError[], |
| 201 | fresh: PluginError[], |
| 202 | ): PluginError[] { |
| 203 | const preserved = existing.filter( |
| 204 | e => e.source === 'lsp-manager' || e.source.startsWith('plugin:'), |
| 205 | ) |
| 206 | const freshKeys = new Set(fresh.map(errorKey)) |
| 207 | const deduped = preserved.filter(e => !freshKeys.has(errorKey(e))) |
| 208 | return [...deduped, ...fresh] |
| 209 | } |
| 210 | |
| 211 | function errorKey(e: PluginError): string { |
| 212 | return e.type === 'generic-error' |
no test coverage detected