(file)
| 90 | } |
| 91 | |
| 92 | function collectAnnotations(file) { |
| 93 | const annotations = []; |
| 94 | const { session } = file; |
| 95 | const isActiveFile = editorManager.activeFile?.id === file.id; |
| 96 | const state = |
| 97 | isActiveFile && editorManager.editor |
| 98 | ? editorManager.editor.state |
| 99 | : session; |
| 100 | |
| 101 | if (session && typeof session.getAnnotations === "function") { |
| 102 | const aceAnnotations = session.getAnnotations() || []; |
| 103 | for (const item of aceAnnotations) { |
| 104 | if (!item) continue; |
| 105 | const row = normalizeIndex(item.row); |
| 106 | const column = normalizeIndex(item.column); |
| 107 | annotations.push({ |
| 108 | row, |
| 109 | column, |
| 110 | text: item.text || "", |
| 111 | type: normalizeSeverity(item.type), |
| 112 | }); |
| 113 | } |
| 114 | } |
| 115 | |
| 116 | if (state && typeof state.field === "function") { |
| 117 | annotations.push(...readLspAnnotations(state)); |
| 118 | } |
| 119 | |
| 120 | return annotations; |
| 121 | } |
| 122 | |
| 123 | function readLspAnnotations(state) { |
| 124 | const diagnostics = getLspDiagnostics(state); |
no test coverage detected