MCPcopy Index your code
hub / github.com/Acode-Foundation/Acode / fileHasProblems

Function fileHasProblems

src/lib/editorManager.js:2760–2791  ·  view source on GitHub ↗

* Toggles the visibility of the problem button based on the presence of annotations in the files.

(file)

Source from the content-addressed store, hash-verified

2758 * Toggles the visibility of the problem button based on the presence of annotations in the files.
2759 */
2760 function fileHasProblems(file) {
2761 const state = getDiagnosticStateForFile(file);
2762 if (!state) return false;
2763
2764 const session = file.session;
2765 if (session && typeof session.getAnnotations === "function") {
2766 try {
2767 const annotations = session.getAnnotations() || [];
2768 if (annotations.length) return true;
2769 } catch (error) {
2770 warnRecoverable(
2771 "Failed to read editor annotations while checking problems.",
2772 error,
2773 "read-annotations",
2774 );
2775 }
2776 }
2777
2778 if (typeof state.field !== "function") return false;
2779 try {
2780 const diagnostics = getLspDiagnostics(state);
2781 return diagnostics.length > 0;
2782 } catch (error) {
2783 warnRecoverable(
2784 "Failed to read LSP diagnostics while checking problems.",
2785 error,
2786 "read-lsp-diagnostics",
2787 );
2788 }
2789
2790 return false;
2791 }
2792
2793 function toggleProblemButton() {
2794 const { showSideButtons } = appSettings.value;

Callers 1

toggleProblemButtonFunction · 0.85

Calls 3

getLspDiagnosticsFunction · 0.90
warnRecoverableFunction · 0.85

Tested by

no test coverage detected