Skip to content

feat(playground): variable hover card with highlight and inline edit - #11

Merged
arpit-bruno merged 12 commits into
usebruno:mainfrom
sundram-bruno:feat/variable-hover-card
Jul 29, 2026
Merged

feat(playground): variable hover card with highlight and inline edit#11
arpit-bruno merged 12 commits into
usebruno:mainfrom
sundram-bruno:feat/variable-hover-card

Conversation

@sundram-bruno

@sundram-bruno sundram-bruno commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Brings variable highlighting, the hover card and inline editing to the playground request editors. Previously the playground fields had no variable highlighting, no hover card, and no way to inspect or edit a variable in place.

JIRA : BRU-4000

Behavioural changes

  • {{var}} tokens are coloured green (resolved) or red (unresolved) against the active environment, in the request body, URL, and params/headers/form-body cells. Colours update live when the environment is switched.
  • Hovering a {{var}} shows a card with its name, scope badge, resolved value and a copy button. Secret variables stay masked.
  • The value can be edited inline from the card. Enter to save, Shift-Enter for a newline, save on blur, Esc to cancel for environment, collection, folder and request scoped variables.
  • Editing is offered only where the resolver can write to the playground collection, so the docs pages and the environment / collection / folder settings views keep the read-only card.
  • Read-only scopes (process.env, oauth2, $secrets, dynamic), secrets, and typed or multi-variant values are not editable.
  • An edit updates the card, the token highlighting and the request that gets sent, all together; reset reverts to the authored value.

Not included

WebSocket, gRPC and GraphQL requests are unsupported in the playground and keep their existing read-only variable preview.

@sundram-bruno
sundram-bruno force-pushed the feat/variable-hover-card branch 2 times, most recently from 58a5f91 to 9c550fa Compare July 28, 2026 07:04
@sundram-bruno
sundram-bruno marked this pull request as draft July 28, 2026 07:05
Brings the desktop variable experience to the playground request editors.

Behavioural changes:
- `{{var}}` tokens are coloured green (resolved) or red (unresolved) against the
  active environment in the request body, URL, and params/headers/form cells;
  colours update when the environment changes.
- Hovering a `{{var}}` shows a card with its name, scope, resolved value and a
  copy button; secrets stay masked.
- The value can be edited inline from the card (Enter save, Shift-Enter newline,
  blur save, Esc cancel) for environment, collection, folder and request scoped
  string variables. Read-only scopes (process.env, oauth2, $secrets, dynamic),
  secrets and typed/object values are not editable.
- An edit updates the card, the highlighting and the request that is sent
  together; reset reverts to the authored value.

WebSocket, gRPC and GraphQL requests are unsupported in the playground and keep
their existing read-only variable preview.
@sundram-bruno
sundram-bruno force-pushed the feat/variable-hover-card branch from 9c550fa to 13a5b96 Compare July 28, 2026 07:18
- Gate inline editing on a writable resolver, set only where the provider wraps
  the playground collection, so docs and settings surfaces cannot offer an edit
  that would be written to the wrong collection.
- Replace an embedded NUL byte in the repaint signature separator, which made
  CodeEditor.tsx unreadable as text.
- Re-arm the hover-card close once focus leaves the card, so it no longer stays
  open indefinitely after an edit ends.
- Reuse the shared `{{var}}` token regex and `getItemUuid` in place of local
  copies, and derive the empty-value label once.
- Activate the editable value on Space as well as Enter, and give the edit field
  an accessible name.
- Take the hover widget's stacking and shadow from theme tokens.
- Give the input token spans a test id, scope the playground variable page
  object to the playground view, extend the existing variable-card component and
  drive the spec through fixtures.
- Write a variable edit only to the hydrated collection. The base copy's items
  carry no uuid, so an item-scoped write silently missed it while environment and
  collection writes landed in both — an asymmetry with no reader to justify it.
- Skip disabled entries when picking the folder that owns an edited variable, so
  the write is not addressed to a folder the reducer will then skip.
- Re-layout the editor hover card whenever its size changes: Monaco pins the
  widget's top, so the growing edit field otherwise pushed the card down over the
  token it belongs to.
- Cover the editor hover path in e2e: card contents on hover, and the card
  staying clear of its token as the edit field grows.
@sundram-bruno
sundram-bruno marked this pull request as ready for review July 28, 2026 09:07
Comment thread packages/bruno-api-docs/e2e/playwright/pages.fixture.ts
# Conflicts:
#	packages/bruno-api-docs/e2e/components/playground.component.ts
#	packages/bruno-api-docs/src/ui/CodeEditor/CodeEditor.tsx
Comment thread packages/bruno-api-docs/src/ui/CodeEditor/CodeEditor.tsx
Comment thread packages/bruno-api-docs/src/store/slices/playground.ts Outdated
- Pass the hover card into CodeEditor as a render prop so ui/ no longer imports
  from components/, keeping the dependency one-way.
- Write a variable edit to both collection copies again, matching the other
  collection-mutating reducers.
- Cover the remaining inline-edit paths in e2e: Escape discards, blur saves, and
  Shift-Enter inserts a newline.
- Note why the editor token locators match a class rather than a test id.
# Conflicts:
#	packages/bruno-api-docs/src/components/HighlightedInput/HighlightedInput.tsx
#	packages/bruno-api-docs/src/components/Playground/Content/Views/Common/BodyTab.tsx
@arpit-bruno
arpit-bruno merged commit 3f5e618 into usebruno:main Jul 29, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants