Skip to content

✨ Line Annotations #297

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
austincondiff opened this issue Apr 2, 2025 · 0 comments
Open

✨ Line Annotations #297

austincondiff opened this issue Apr 2, 2025 · 0 comments

Comments

@austincondiff
Copy link
Collaborator

austincondiff commented Apr 2, 2025

Description

Implement the visual display system for Line Annotations in the source editor. These annotations should appear directly beneath relevant lines of code and visually communicate messages such as errors, warnings, or informational notes.

Requirements

  • Add support for displaying annotations below lines in the source editor
  • An annotation should include:
    • A severity icon (error, warning, info)
    • A short descriptive message
  • Multiple annotations should be stackable if they occur on the same line
  • Styling should reflect severity (e.g., color, icon)
  • Annotations should update cleanly when the underlying data model changes (insert, remove, update)
  • Annotations should avoid disrupting layout:
    • Automatically shrink if needed to preserve line spacing.
    • If the message is truncated, allow users to click the annotation to reveal a popover with the full message.
      • This popover should scroll with the editor and remain positioned relative to its line.
      • If the line scrolls out of view and the annotation is expanded, the popover should remain visible—docked to the top or bottom edge of the editor—until dismissed.

Implementation Details

  • The expanded popover view (when multiple annotations exist or a message is truncated) may be called AnnotationAggregatedDropdownView, similar to what is used in other macOS editors.
  • The source editor (CodeEditSourceEditor) will accept a new property:
     annotations: Set<LineAnnotation>
  • LineAnnotation is a lightweight data model that represents a message to display beneath a specific line:
    struct LineAnnotation: Hashable, Identifiable {
        let id: UUID = UUID()
        let line: Int
        let column: Int
        let severity: Severity
        let text: String
    }
    
    enum Severity {
        case error, warning, info, live
    }
  • The editor should group annotations by line internally and render them accordingly.

Additional Context

This is the foundational work for visual feedback in the editor. Future issues will introduce the system for feeding issues into the annotations (e.g., from builds, linters, or language servers) via an issue manager.

This feature is a key part of improving the editing experience by surfacing issues contextually, and sets the stage for deeper diagnostic and development tooling integration.

Related Issues

Screenshots

Warning
image

Warning Expanded
image

Error
image

Multiple Errors
image

Multiple Errors Expanded
image

@austincondiff austincondiff converted this from a draft issue Apr 2, 2025
@austincondiff austincondiff changed the title Line Messages Line Annotations Apr 2, 2025
@austincondiff austincondiff changed the title Line Annotations ✨ Line Annotations Apr 2, 2025
@austincondiff austincondiff moved this from 🆕 New to 📋 Todo in CodeEdit Project Apr 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Todo
Development

No branches or pull requests

1 participant