MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / collectAnnotations

Function collectAnnotations

src/pages/problems/problems.js:92–121  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

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);

Callers 1

ProblemsFunction · 0.85

Calls 3

normalizeIndexFunction · 0.85
normalizeSeverityFunction · 0.85
readLspAnnotationsFunction · 0.85

Tested by

no test coverage detected