[PR #7707] [MERGED] feat(client): autocomplete macros in macro fields #7890

Closed
opened 2026-10-24 04:08:32 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7707
Author: @ylli-selmani
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @ylli-selmani

Base: staging ← Head: feat/macro-field-autosuggest-66c36p


📝 Commits (7)

  • a340c04 feat(client): grey in macro names in macro fields
  • 7277027 feat(client): tap the macro suggestion to accept it
  • 535ef6d feat(client): tap the omnibar and Prof. Mari suggestions to accept them
  • fc15270 fix(client): tighten macro ghost tap and sizing
  • 115ccb0 fix(client): address CodeRabbit review on macro completion
  • 5f6c893 Merge remote-tracking branch 'origin/staging' into feat/macro-field-autosuggest-66c36p
  • 7d01126 fix(client): keep the expanded editor's focus effect keyed on open only

📊 Changes

8 files changed (+420 additions, -22 deletions)

View changed files

📝 packages/client/src/components/chat/mari/MariComposer.tsx (+2 -0)
📝 packages/client/src/components/layout/GlobalOmnibar.tsx (+1 -0)
📝 packages/client/src/components/ui/InlineGhostText.tsx (+31 -2)
➕ packages/client/src/components/ui/MacroCompletionGhost.tsx (+188 -0)
📝 packages/client/src/components/ui/MacroTextarea.tsx (+80 -20)
➕ packages/client/src/lib/macro-completion.ts (+67 -0)
📝 packages/client/src/lib/textarea-editing.ts (+13 -0)
➕ scripts/regressions/macro-completion.regression.ts (+38 -0)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7706
Closes #7709

Why this change

Before: in prompt fields you had to type macro names from memory or open the macro reference. On a phone, the omnibar's grey completion couldn't be accepted at all, because phone keyboards have no Tab key.

After: in every field with the macro reference button, typing {{ch greys in ar}}. Tab accepts it, and so does tapping the grey text. Tapping works in the omnibar and the Professor Mari composer too.

What changed

  • lib/macro-completion.ts: builds the candidates from SUPPORTED_MACROS, so new macros complete with no extra work. Plain macros close themselves (char}}), macros with arguments stop at the separator (getvar::, roll:), block openers stop after the keyword (#if ). Placeholders like {{NAME}} and card IDs are skipped.
  • MacroCompletionGhost.tsx: a small hook plus overlay that reuses InlineGhostText. It copies the textarea's computed font and padding, so it lines up in every caller without repeating their classes.
  • MacroTextarea (inline field and expanded editor) wires it in when the macro reference button is shown and the field is editable. Tab accepts through the same native-undo insert as Tab indenting. With no suggestion, Tab indents as before.
  • Tap to accept (#7709): InlineGhostText takes an optional onAccept. The suffix accepts on pointer down without taking focus from the field. On touch screens (pointer-coarse) it gets a faint chip so it reads as tappable. The macro fields, the omnibar and the Mari composer all pass it.
  • The ghost only shows at the end of a line, so it never covers text after the caret.
  • InlineGhostText also takes an optional style.
  • New macro-completion.regression.ts.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Ran: client lint + tsc, pnpm localization:check, pnpm impeccable:check, and the new regression.

Manual verification notes

  • Desktop, in a character's Description: typed {{us, and er}} showed in grey at the caret. Tab gave {{user}}, the field kept focus, and {{ch then suggested ar}}.
  • Phone viewport (390 px, touch): the suggestion shows as a faint chip. Tapping it gave {{user}}, and the field kept focus and stayed in the same place.
  • Phone viewport, omnibar: typed alb, then tapped the ghost edo. The query became albedo and the search box kept focus.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

UI evidence (if applicable)

Screenshots to be added.

4-phone-after-tap pc

🤖 Generated with Claude Code

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features
    • Text areas now suggest macro-name completions as you type. Accept a suggestion with Tab or by tapping the ghost text.
    • Inline suggestions in chat and search can be accepted directly.
  • Bug Fixes
    • Accepted search suggestions now append to the current query rather than replacing it.
    • Macro suggestions are suppressed when accepting them would exceed the text field’s character limit.
    • Chat suggestions cannot be accepted while the composer is busy.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7707 **Author:** [@ylli-selmani](https://github.com/ylli-selmani) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@ylli-selmani](https://github.com/ylli-selmani) **Base:** `staging` ← **Head:** `feat/macro-field-autosuggest-66c36p` --- ### 📝 Commits (7) - [`a340c04`](https://github.com/Pasta-Devs/Marinara-Engine/commit/a340c04c09cdc2ea55ddaf82794a663142a00241) feat(client): grey in macro names in macro fields - [`7277027`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7277027a73bf06b7d3cb61aa6a4b50e4bfb67d06) feat(client): tap the macro suggestion to accept it - [`535ef6d`](https://github.com/Pasta-Devs/Marinara-Engine/commit/535ef6dfe1d20da6bd42293899ea8498b6c14bcb) feat(client): tap the omnibar and Prof. Mari suggestions to accept them - [`fc15270`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fc15270ea86827b25244025689c2be304c813b4f) fix(client): tighten macro ghost tap and sizing - [`115ccb0`](https://github.com/Pasta-Devs/Marinara-Engine/commit/115ccb0b547f35d0509114265442cdd611afb82c) fix(client): address CodeRabbit review on macro completion - [`5f6c893`](https://github.com/Pasta-Devs/Marinara-Engine/commit/5f6c8938f0af990c8e00f06f1fae57f4bffbc7ef) Merge remote-tracking branch 'origin/staging' into feat/macro-field-autosuggest-66c36p - [`7d01126`](https://github.com/Pasta-Devs/Marinara-Engine/commit/7d01126268f31c71a207c4eae57607f42583c9eb) fix(client): keep the expanded editor's focus effect keyed on open only ### 📊 Changes **8 files changed** (+420 additions, -22 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/chat/mari/MariComposer.tsx` (+2 -0) 📝 `packages/client/src/components/layout/GlobalOmnibar.tsx` (+1 -0) 📝 `packages/client/src/components/ui/InlineGhostText.tsx` (+31 -2) ➕ `packages/client/src/components/ui/MacroCompletionGhost.tsx` (+188 -0) 📝 `packages/client/src/components/ui/MacroTextarea.tsx` (+80 -20) ➕ `packages/client/src/lib/macro-completion.ts` (+67 -0) 📝 `packages/client/src/lib/textarea-editing.ts` (+13 -0) ➕ `scripts/regressions/macro-completion.regression.ts` (+38 -0) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #7706 Closes #7709 ## Why this change Before: in prompt fields you had to type macro names from memory or open the macro reference. On a phone, the omnibar's grey completion couldn't be accepted at all, because phone keyboards have no Tab key. After: in every field with the macro reference button, typing `{{ch` greys in `ar}}`. Tab accepts it, and so does tapping the grey text. Tapping works in the omnibar and the Professor Mari composer too. ## What changed - `lib/macro-completion.ts`: builds the candidates from `SUPPORTED_MACROS`, so new macros complete with no extra work. Plain macros close themselves (`char}}`), macros with arguments stop at the separator (`getvar::`, `roll:`), block openers stop after the keyword (`#if `). Placeholders like `{{NAME}}` and card IDs are skipped. - `MacroCompletionGhost.tsx`: a small hook plus overlay that reuses `InlineGhostText`. It copies the textarea's computed font and padding, so it lines up in every caller without repeating their classes. - `MacroTextarea` (inline field and expanded editor) wires it in when the macro reference button is shown and the field is editable. Tab accepts through the same native-undo insert as Tab indenting. With no suggestion, Tab indents as before. - Tap to accept (#7709): `InlineGhostText` takes an optional `onAccept`. The suffix accepts on pointer down without taking focus from the field. On touch screens (`pointer-coarse`) it gets a faint chip so it reads as tappable. The macro fields, the omnibar and the Mari composer all pass it. - The ghost only shows at the end of a line, so it never covers text after the caret. - `InlineGhostText` also takes an optional `style`. - New `macro-completion.regression.ts`. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [x] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Ran: client lint + `tsc`, `pnpm localization:check`, `pnpm impeccable:check`, and the new regression. ### Manual verification notes - Desktop, in a character's Description: typed `{{us`, and `er}}` showed in grey at the caret. Tab gave `{{user}}`, the field kept focus, and `{{ch` then suggested `ar}}`. - Phone viewport (390 px, touch): the suggestion shows as a faint chip. Tapping it gave `{{user}}`, and the field kept focus and stayed in the same place. - Phone viewport, omnibar: typed `alb`, then tapped the ghost `edo`. The query became `albedo` and the search box kept focus. ## Docs and release impact - [x] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) ## UI evidence (if applicable) Screenshots to be added. <img width="720" height="854" alt="4-phone-after-tap" src="https://github.com/user-attachments/assets/d4572cdd-6409-42cb-9aef-5b52f2efa779" /> <img width="857" height="233" alt="pc" src="https://github.com/user-attachments/assets/035fa90b-851b-4e96-882a-0f7eadcc258a" /> 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit ## Summary by CodeRabbit * **New Features** * Text areas now suggest macro-name completions as you type. Accept a suggestion with Tab or by tapping the ghost text. * Inline suggestions in chat and search can be accepted directly. * **Bug Fixes** * Accepted search suggestions now append to the current query rather than replacing it. * Macro suggestions are suppressed when accepting them would exceed the text field’s character limit. * Chat suggestions cannot be accepted while the composer is busy. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:08:32 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7890
No description provided.