Skip to content

Conversation

@mkh-user
Copy link
Member

@mkh-user mkh-user commented Nov 27, 2025

Summary of Changes

Provides a simple system to add, remove, explore and use bookmarks as described in #26. Adds custom bookmark icon and color, save and load for bookmarks in EditorAPI, and a new Bookmarks panel.

Related Items

Technical Details & Testing

Uses internal bookmark support for CodeEdit in Godot, with connections to core (for unsaved changes trigger) and bookmarks panel (to show and interact with bookmarks). In panel, user can see number and text for each bookmarked line and Go To and Remove options are available for each bookmark.

In #26, bookmarks could have optional labels, but we checked this and it led to many complexities and functional errors, so we decided to replace it with the line content. Now, the content of the bookmarked line is displayed as its label.

Checklist

  • Linked all relevant issues/PRs/discussions
  • Code follows project style and guidelines
  • Self-reviewed and tested thoroughly
  • Documentation updated (if applicable)
  • No new warnings or errors introduced
  • Relevant changes added to CHANGELOG

Summary by CodeRabbit

  • New Features

    • Gutter-click bookmarks with a bookmarks panel, bookmark item UI, GoTo/Remove actions, Toggle Bookmark and Remove All Bookmarks actions
    • Per-file bookmark persistence with automatic restore and editor refresh
    • Menu entries for Bookmarks, Toggle Bookmark, and Remove All Bookmarks
  • Bug Fixes / Improvements

    • Clears bookmarks on file close and refreshes editor state
    • Refined unsaved-change indicator and widened caret-position popup area
  • Style

    • Added bookmark icon and theme styling
  • Tests

    • Unit tests covering editor bookmarking and bookmarks panel/item UI
  • Documentation

    • Menus updated to reflect bookmark actions and gutter-click behavior

✏️ Tip: You can customize this high-level summary in your review settings.

@mkh-user mkh-user added the triage Awaiting initial review, classification, or prioritization by maintainers label Nov 27, 2025
@mkh-user mkh-user linked an issue Nov 27, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

📝 Walkthrough

Walkthrough

Adds persistent per-file bookmarks: gutter-click toggles bookmarks; bookmark persistence saved/loaded via EditorAPI; new BookmarksPanel and BookmarkItemPanel UI; actions for open/toggle/remove-all bookmarks; theme/assets and tests added; Signals and close action updated to clear/refresh bookmarks.

Changes

Cohort / File(s) Summary
Action scripts (bookmarks & related)
action_scripts/bookmarks.gd, action_scripts/toggle_bookmark.gd, action_scripts/remove_all_bookmarks.gd, action_scripts/close.gd
New actions to open bookmarks, toggle selection bookmarks, and remove all bookmarks; close.gd now clears editor bookmarked lines and emits type_timer_timeout.
Editor core & API
core/scripts/editor.gd, core/scripts/editor_api.gd, core/autoload/signals.gd, core/main.gd, core/main.tscn
Gutter-click handling (gutter 0) to toggle bookmarks; added _save_bookmarks() / _load_bookmarks() and integrated into save/load flows with persistence to Project/Settings; added open_bookmarks_panel signal; unsaved-change indicator logic adjusted; scene signal connections/margins updated.
Bookmarks UI (panel & item)
data/panels/bookmarks/panel.gd, data/panels/bookmarks/panel.tscn, data/panels/bookmarks/panel.cfg, data/panels/bookmarks/panel.gd.uid, data/panels/bookmarks/item_panel.gd, data/panels/bookmarks/item_panel.tscn, data/panels/bookmarks/item_panel.gd.uid
New BookmarksPanel and BookmarkItemPanel: UI list showing line numbers/text with GoTo and Remove; panel syncs with editor bookmarks and updates items dynamically.
Assets & theme
assets/bookmark.svg.import, assets/goto.svg.import, data/panels/bookmarks/icon.png.import, data/themes/dark.tres
New import configs for bookmark/goto/icon assets; theme updated with bookmark icon, CodeEdit bookmark color/icon, and a StyleBoxFlat for the bookmark panel.
Project config & new-project init
action_scripts/scenes/new_project.gd
Initializes files.bookmarks as an empty Dictionary when creating a new project.
Tests & test runner config
tests/* (new tests under tests/action_scripts/close_test.gd, tests/core/scripts/editor_api_test.gd, tests/core/scripts/editor_test.gd, tests/data/panels/bookmarks/*_test.gd) and .uid files; addons/gdUnit4/GdUnitRunner.cfg
New GdUnit tests covering actions, Editor/editor_api bookmark methods, gutter/bookmark behavior, bookmark panel/item UI; test runner config and UID files added.
Changelog & docs
CHANGELOG.md, docs/menus.md
Changelog entry for bookmarks; docs updated to include bookmark menu items and note about gutter-click toggling.

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant User
    participant Editor
    participant EditorAPI
    participant Settings
    participant BookmarkPanel

    User->>Editor: click gutter (line)
    Editor->>Editor: _on_gutter_clicked(line,gutter)\ntoggle bookmark state
    Editor->>BookmarkPanel: emit gutter_clicked / request update
    Editor->>Editor: emit type_timer_timeout

    Note over Editor,EditorAPI: Save flow
    Editor->>EditorAPI: save_file()
    EditorAPI->>EditorAPI: _save_bookmarks()
    EditorAPI->>Settings: write bookmarks dict

    Note over Editor,EditorAPI: Load flow
    Editor->>EditorAPI: load_file()
    EditorAPI->>Settings: read bookmarks dict
    EditorAPI->>Editor: _load_bookmarks() (mark lines)
    Editor->>BookmarkPanel: emit type_timer_timeout / request update

    User->>BookmarkPanel: press goto / remove
    BookmarkPanel->>Editor: navigate_to_line / clear_bookmark
Loading

Possibly related PRs

  • Refactor singletons #109 — Modifies core/autoload/signals.gd; touches the same signal API surface that now includes open_bookmarks_panel.

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Implement Bookmarks' is concise, directly related to the main change, and clearly summarizes the primary feature added in this changeset.
Linked Issues check ✅ Passed The PR implements all core objectives from issue #26: users can add/remove bookmarks via gutter clicks [core/scripts/editor.gd], bookmarks persist via save/load mechanisms [core/scripts/editor_api.gd], bookmarks display in gutter and a dedicated panel [data/panels/bookmarks/], and bookmarks don't interfere with file content. Optional labels were replaced with line content as documented.
Out of Scope Changes check ✅ Passed All changes are directly scoped to bookmark functionality: bookmark actions [action_scripts/bookmarks.gd, toggle_bookmark.gd, remove_all_bookmarks.gd], editor integration [core/scripts/editor.gd, editor_api.gd], UI panel [data/panels/bookmarks/], persistence [core/scripts/editor_api.gd], signal infrastructure [core/autoload/signals.gd], and comprehensive test coverage. No unrelated modifications detected.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 26-bookmark

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai bot added action scripts Official action scripts or action scripts features feature: Navigation Improves movement across UI sections, files, or project structure labels Nov 27, 2025
@mkh-user mkh-user removed the triage Awaiting initial review, classification, or prioritization by maintainers label Nov 27, 2025
@mkh-user mkh-user self-assigned this Nov 27, 2025
@mkh-user mkh-user moved this from Needs Review to In Progress in Release: Text Forge 1.0 Nov 27, 2025
@mkh-user mkh-user added this to the Text Forge 0.2 milestone Nov 27, 2025
coderabbitai[bot]

This comment was marked as resolved.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@coderabbitai

This comment was marked as outdated.

@coderabbitai

This comment was marked as resolved.

mkh-user and others added 3 commits November 27, 2025 14:58
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
coderabbitai[bot]

This comment was marked as resolved.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
coderabbitai[bot]

This comment was marked as resolved.

@text-forge text-forge deleted a comment from coderabbitai bot Nov 27, 2025
@text-forge text-forge deleted a comment from coderabbitai bot Nov 27, 2025
@mkh-user

This comment was marked as resolved.

@coderabbitai

This comment was marked as resolved.

@mkh-user
Copy link
Member Author

@coderabbitai generate docstrings

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

✅ Actions performed

Initiated docstring generation; will generate only if new commits exist.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

Caution

Docstrings generation - FAILED

No docstrings were generated.

coderabbitai[bot]

This comment was marked as resolved.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@mkh-user mkh-user merged commit cd52d2f into Main Nov 27, 2025
2 checks passed
@mkh-user mkh-user deleted the 26-bookmark branch November 27, 2025 16:29
@github-project-automation github-project-automation bot moved this from In Progress to Completed in Release: Text Forge 1.0 Nov 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action scripts Official action scripts or action scripts features feature: Navigation Improves movement across UI sections, files, or project structure

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

Bookmark

2 participants