Skip to content

Conversation

@mkh-user
Copy link
Member

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

Summary of Changes

Added ability to modes to change indentation settings (not yet) with feature of custom or locked settings.

Related Items

Technical Details & Testing

  • Some new properties for modes are available to define indentation settings
  • A new experimental Checkbox option type for submenus is available (used in added options)
  • All related menus and menu translations were updated (missing translations were added by Microsoft Copilot as fallback)

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

  • Bug Fixes

    • Fixed typos in menu labels and clarified fallback messages.
  • New Features

    • Per-mode indentation settings (type and size) exposed and controllable.
    • New indentation actions: convert to spaces/tabs, remove all indents, auto-indent new lines, lock indentation, reset mode indentation.
    • Submenus now support checkbox items.
  • UI/UX Improvements

    • Consolidated indentation options under Format > Indentation; bottom bar shows current indent type and size.
  • Documentation

    • Updated menus and modes docs to reflect new indentation options and wording.

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

@mkh-user mkh-user linked an issue Nov 24, 2025 that may be closed by this pull request
3 tasks
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 24, 2025

📝 Walkthrough

Walkthrough

Adds per-mode indentation fields to TextForgeMode and EditorAPI, new EditorAPI signals and functions for managing per-mode/global indentation, UI/menu entries and bottom-bar control to view/change indentation (including lock/reset), action scripts for lock/reset, and theme adjustments for the bottom bar.

Changes

Cohort / File(s) Summary
Mode declarations
core/classes/text_forge_mode.gd
Added public enum INDENT_TYPE and public members indent_type: INDENT_TYPE and indent_size: int to expose mode indentation defaults.
Editor API & indentation logic
core/scripts/editor_api.gd
Added signal indentation_settings_updated(use_space: bool, indent_size: int), var custom_mode_indentations := {}, and functions update_indentation_settings(use_mode := true), reset_to_mode_indentation_settings(), change_indentation_type(use_spaces: bool), change_indent_size(indent_size: int). Integrates per-mode overrides, persistence, and emits updates on relevant lifecycle events.
UI: menu data
data/main_ui.ini
Renamed indention_submenuindentation_submenu, migrated/renamed indentation menu keys from menu.edit.* to menu.format.indentation.*, corrected "Evulate" → "Evaluate", added convert/to-spaces/tabs, remove indents, auto-indent new lines, lock indentation, reset mode indentation, and consolidated Format menu entry.
Bottom-bar control & scene
core/main.tscn, core/scripts/indentation_settings_label.gd, core/scripts/indentation_settings_label.gd.uid
Added BottomBar IndentationSettings MenuButton with script; script subscribes to indentation_settings_updated, updates label ("Spaces (N)" / "Tabs (N)"), handles user actions to change type/size, and triggers EditorAPI calls. Scene load_steps incremented and layout offsets adjusted.
Action scripts
action_scripts/lock_indentation_settings.gd, action_scripts/lock_indentation_settings.gd.uid, action_scripts/reset_mode_indentation.gd, action_scripts/reset_mode_indentation.gd.uid
New CheckableActionScript to persist lock_indentation_settings and an ActionScript to reset current mode indentation (validates mode id and calls EditorAPI.reset_to_mode_indentation_settings()).
Main runtime changes
core/main.gd
Fixed typo in OptionTypes enum text, extended _create_submenu to support checkbox items for non-root submenus, and replaced direct editor property assignments with Global.get_editor_api().update_indentation_settings(false).
Theme
data/themes/dark.tres
Added BottomBarLabel properties: base_type, colors/font_color, and font_sizes/font_size.
Docs & changelog
docs/menus.md, docs/modes.md, CHANGELOG.md
Updated docs to refer to "Indentation" submenu and describe new options (auto-indent new lines, lock, reset, per-mode settings). Added changelog entry for mode-driven indentation settings.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UI as BottomBar / Menu
    participant Editor as EditorAPI
    participant Mode as TextForgeMode

    Note over Mode,Editor: Modes expose indent_type & indent_size
    Mode->>Editor: provide indent_type & indent_size on load
    Editor->>UI: emit indentation_settings_updated(use_space, indent_size)
    UI->>User: display label ("Spaces (N)" / "Tabs (N)")
    User->>UI: choose option (spaces/tabs/edit size/lock/reset)
    UI->>Editor: call change_indentation_type / change_indent_size / reset_to_mode_indentation_settings
    Editor->>Editor: update custom_mode_indentations or global setting and persist
    Editor-->>UI: emit indentation_settings_updated(updated values)
    UI-->>User: reflect updated label/state
Loading

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Add indentation configuration from modes' clearly and concisely describes the main change: adding the ability for modes to configure indentation settings.
Linked Issues check ✅ Passed All acceptance criteria from issue #135 are satisfied: modes define indentation via new INDENT_TYPE enum and indent_size/indent_type properties [#135]; custom per-mode indentation settings are stored and restored via custom_mode_indentations [#135]; users can lock settings via lock_indentation_settings.gd [#135]; reset functionality implemented via reset_mode_indentation.gd [#135].
Out of Scope Changes check ✅ Passed All changes are aligned with issue #135: new INDENT_TYPE enum and indentation properties in TextForgeMode, EditorAPI functions for managing per-mode indentation, UI components for indentation settings, menu reorganization to support indentation features, and documentation updates. No out-of-scope 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 135-indentation-configuration-from-modes

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.

@mkh-user mkh-user self-assigned this Nov 24, 2025
@mkh-user mkh-user moved this from Needs Review to In Progress in Release: Text Forge 1.0 Nov 24, 2025
@mkh-user mkh-user added this to the Text Forge 0.2 milestone Nov 24, 2025
coderabbitai[bot]

This comment was marked as resolved.

@mkh-user mkh-user marked this pull request as ready for review November 24, 2025 11:31
@coderabbitai coderabbitai bot added the action scripts Official action scripts or action scripts features label Nov 24, 2025
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.

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.

- Fix spelling and hyphenation issues in Indentation submenu documentation.
- Fix spelling errors in the new Indentation Settings section.

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@mkh-user mkh-user merged commit a26b76d into Main Nov 24, 2025
2 checks passed
@mkh-user mkh-user deleted the 135-indentation-configuration-from-modes branch November 24, 2025 12:20
@github-project-automation github-project-automation bot moved this from In Progress to Completed in Release: Text Forge 1.0 Nov 24, 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

Projects

Status: Completed

Development

Successfully merging this pull request may close these issues.

Indentation configuration from modes

2 participants