CodeEditApp / CodeEdit

📝 CodeEdit App for macOS – Elevate your code editing experience. Open source, free forever.

Home Page:https://codeedit.app

Repository from Github https://github.comCodeEditApp/CodeEditRepository from Github https://github.comCodeEditApp/CodeEdit

✨ Diagnostic Manager

austincondiff opened this issue · comments

Description

Introduce a DiagnosticManager responsible for managing and publishing diagnostics (e.g., build errors, linter warnings, language server issues) grouped by file. This manager will serve as the single source of truth for diagnostics across the editor, and its contents will drive visual components such as the Issue Navigator and Line Annotations.

Requirements

  • Create a DiagnosticManager class conforming to ObservableObject
  • Store diagnostics as a flat list or grouped by file:
    @Published var issues: [DiagnosticIssue]
  • Define a DiagnosticIssue model:
    struct DiagnosticIssue: Identifiable, Hashable {
        let id: UUID = UUID()
        let file: URL
        let line: Int
        let column: Int?
        let message: String
        let severity: Severity
        let source: String?
        let fixItSuggestion: String?
    
        enum Severity {
            case error, warning, info, live
        }
    }
  • Add convenience accessors:
    var issuesByFile: [URL: [DiagnosticIssue]]
    func issues(for file: URL) -> [DiagnosticIssue]
  • Add a way to update issues by file, e.g.:
    func setIssues(_ issues: [DiagnosticIssue], for file: URL)
    func clearIssues(for file: URL)

Additional Context

This manager will be used by multiple parts of the app, including the Issue Navigator and Line Annotations. It should be reactive and efficient, allowing UI components to automatically update when diagnostics change.

Future extensions may include filtering, debouncing updates, or supporting different diagnostics sources (build system, LSP, etc.).

Related Issues

Hi!, could you assign me to work on this one, thank you!

I sure can! But we might need to clarify a few things first.

@FastestMolasses has been working on #354 and may be a good resource, but it looks like he has done a few things already in the way of diagnostics in PR #2006. Any insight here?

@Kihron is working on #2015 so he might be good to sync up with as well.

All of you, please include any relevant details here so we can all be on the same page so we don't redo any work or step on each others toes. Thanks!

Thanks for assigning me this work. @austincondiff

I’ll review @FastestMolasses’s work in #354 and PR #2006, plus @Kihron’s work in #2015 to understand what’s already implemented and avoid duplication.

Once I’ve analyzed the existing diagnostic infrastructure, I’ll post my findings here and coordinate with both contributors before starting implementation.

@FastestMolasses @Kihron - Let’s sync up to make sure our work aligns!

commented

Hi @beltradini, the #2006 PR will effectively complete all remaining items for this issue so no more work is going to be needed on this front. We appreciate your effort, there are a lot of other issues that need contributors if you are up for it!