Skip to content

fix(script): show a command's help beside the Script pane, clear of the script - #3529

Merged
jgregoriorincon merged 2 commits into
opengeos:mainfrom
jgregoriorincon:fix/3525-script-help-beside
Dec 1, 2026
Merged

jgregoriorincon merged 2 commits into
opengeos:mainfrom
jgregoriorincon:fix/3525-script-help-beside

Conversation

@jgregoriorincon

@jgregoriorincon jgregoriorincon commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

While a command's parameters are typed in the Script panel, its help floated under the line (or over it), covering the script being written. It now goes beside the panel:

  • On the side of the panel with more room, level with the line where the command's { is, narrower than usual where that is all there is (never under 200 points wide).
  • It stays put as the cursor moves along a line that wraps. With that line scrolled out of the script box, it is level with the box's top.
  • Near the bottom of the window it moves up to fit; taller than the window, it takes the window's height and scrolls.
  • A function's signature inside an expression goes to the same place.

With no room on either side (a full-width panel, a narrow window) it is placed by the cursor as before. Expression boxes outside the Script panel and the suggestion list are unchanged. No new state or strings. It reaches the desktop and web apps, which share the Script pane; the touch interface has none.

Trade-offs: the help covers a strip of the map while parameters are typed (Escape closes it, as before), and it is farther from the cursor.

Testing

  • New tests, seen failing before the change: help_goes_beside_its_pane (placement table), a_commands_help_goes_beside_the_script_pane, a_calls_signature_goes_beside_the_script_pane.
  • cargo fmt --check, cargo clippy with -D warnings, doctests, the layer check and the schema check pass.
  • cargo nextest on the workspace: 11,849 passed, 8 failed, all outside this change and failing locally without it (7 in rustgis-geolibre, and smoke::line_strokes_editor_edits_one_class).
  • Replayed with ui_shot, before and after, for a command's help and for a function's signature.

UI evidence

A long command help in a script: before, it covers the lines below the cursor; after, the whole script stays in view.

(image 1)

The same for a function's signature inside an expression:

(image 2)

Related issue

Closes #3525

Summary by CodeRabbit

  • New Features
    • Script help popups now appear beside the editor when there’s enough room, aligned with the edited line. They choose the side with more available space and stay within the screen; when neither side has enough room, they remain near the cursor.
  • Documentation
    • Updated the user guide to describe where parameter help appears.

@coderabbitai

coderabbitai Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Help popups can appear beside the Script pane, aligned with the edited line. Placement selects the side with more room, limits popup width, and clamps vertical placement to the screen. If beside-pane placement is unavailable, help uses the existing cursor-line placement.

Changes: Script Help Placement

Layer / File(s) Summary
Beside-pane placement logic
crates/ui-egui/src/completion.rs
Tip::show accepts an optional pane and tries to place help beside it, aligned with the help’s starting line. If no pane is supplied or there is insufficient room, it uses cursor-line placement. beside selects the roomier side, caps width, and clamps vertical placement. Tests cover side selection, width limits, and vertical positioning.
Script pane integration
crates/ui-egui/src/scriptcomplete.rs, crates/ui-egui/src/exprcomplete.rs, docs/user-guide/analysis.md
Script help popups receive the UI clip rectangle. UI tests cover command help beside left- and right-docked panes, wrapped and scrolled lines, and function signatures. The expression completion caller passes no pane. The user guide describes beside-pane placement and the cursor fallback.

Estimated code review effort: 2 (Simple) | ~15 minutes

Change: Bug fix · Severity of issue fixed: Medium

Sequence Diagram(s)

sequenceDiagram
  participant ScriptHint
  participant TipShow
  participant Beside
  ScriptHint->>TipShow: pass clipped pane rectangle
  TipShow->>Beside: request beside-pane placement
  Beside-->>TipShow: position and available size, or no placement
  TipShow-->>ScriptHint: beside-pane placement or cursor-line fallback
Loading

Possibly related PRs

  • opengeos/RustGIS#2515: Changes signature-tip placement in the shared completion code, which this PR also updates.
  • opengeos/RustGIS#2092: Introduces the shared Tip<K> completion path used by the Script pane and modified here.

Suggested reviewers: mavrick-f, deniial00

Merge Risk: Minimal · up to e4bf8

Command help and function signatures now appear beside the Script pane when there is room, and fall back to cursor placement otherwise. No actionable merge-blocking risk remains. Only a possible one-frame visual overlap while resizing is unconfirmed.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the fix and its main change: command help in the Script pane moves beside the pane, clear of the script. It matches the raw summary and the objectives. Its length (78 characters) is at…
Linked Issues check Passed Issue #3525 requires command help in the Script panel to appear beside the panel, level with the edited line, so the script stays in view. The whole-PR diff of crates/ui-egui/src/completion.rs (merg…
Out of Scope Changes check Passed The changed areas tie to the #3525 fix. completion.rs holds the placement logic, the Tip::show signature change, and the unit test. exprcomplete.rs passes None for the new parameter, so expres…
Description check Passed The author describes the change clearly: command help and function signatures in the Script panel move beside the panel, with the placement rules, fallback behavior, and trade-offs stated. The Summary…
Full details: Title check

Explanation

The title names the fix and its main change: command help in the Script pane moves beside the pane, clear of the script. It matches the raw summary and the objectives. Its length (78 characters) is at the upper end of a concise title but still readable. The title follows the conventional commit prefix style.

Full details: Linked Issues check

Explanation

Issue #3525 requires command help in the Script panel to appear beside the panel, level with the edited line, so the script stays in view. The whole-PR diff of crates/ui-egui/src/completion.rs (merge base to head) implements this. The new beside(pane, line, size, screen) picks the side with more room, caps width at HELP_WIDTH, returns None below HELP_MIN_WIDTH, and clamps the vertical position to the screen. Tip::show takes pane: Option&lt;egui::Rect&gt; and tries beside first, anchored at the start line of the help, so it stays put on wrapped lines. It falls back to the existing cursor placement when beside returns None or no pane is given. The unit test help_goes_beside_its_pane checks the side choice, narrowing, the minimum width, the full-width fallback, moving up, and taller-than-window scrolling. I checked its expected values against the beside arithmetic and they are consistent. The summary states that scriptcomplete.rs passes the Script pane rect and adds integration tests for command help and function signatures. I did not re-read that file in this pass. The author reports the tests were seen failing before the change and that they pass now. I did not execute the tests. Only #3525 applies; parent-level details are not required.

Full details: Out of Scope Changes check

Explanation

The changed areas tie to the #3525 fix. completion.rs holds the placement logic, the Tip::show signature change, and the unit test. exprcomplete.rs passes None for the new parameter, so expression boxes outside the Script pane keep their behavior. scriptcomplete.rs wires the pane rect into command help and function signatures, and its tests cover the same fix. docs/user-guide/analysis.md changes the Script pane description to match the new placement. The function-signature placement uses the same Tip mechanism, so it follows from the shared change. I found no unrelated changes. I did not re-read scriptcomplete.rs, exprcomplete.rs, or the docs diff in this pass. Those assessments rest on the summary and the previous review.

Full details: Description check

Explanation

The author describes the change clearly: command help and function signatures in the Script panel move beside the panel, with the placement rules, fallback behavior, and trade-offs stated. The Summary section is complete. The Testing section lists new tests, validation commands, and a workspace nextest result with the failures attributed to unrelated tests. The UI evidence section includes before and after screenshots referenced as image 1 and image 2, so the UI requirement is met. The Related issue section links #3525. The template's Summary, Testing, UI evidence, and Related issue sections are all present and substantively filled in. The only weakness is that the image placeholders have no visible attachments in the text, so the reviewer must confirm that the images were uploaded.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

A rabbit sees the help pop beside the pane,
The edited line stays easy to retain.
It checks both sides for room to spare,
Then keeps the popup within the screen’s care.
If neither side can fit it in,
The cursor-line placement steps back in.
The rabbit hops, pleased with the view.

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: c8ae37e6-2fce-4907-9bf4-8b134d17ffbc
Commits

Reviewing files that changed from the base of the PR and between 3528157 and e4bf8d4.

Files selected for processing: 3

  • crates/ui-egui/src/completion.rs
  • crates/ui-egui/src/scriptcomplete.rs
  • docs/user-guide/analysis.md

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

Comment thread crates/ui-egui/src/completion.rs Resolved
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Code review

I read the diff, the surrounding Tip::show, hint and script_pane code, the new tests, and the staged AGENTS.md. I could not build or run the tests (no shell here), so the checks below are by reading only. There are no earlier review threads on this PR, so I did not leave any earlier concerns alone.

I checked the placement arithmetic in beside by hand against each assertion in help_goes_beside_its_pane, and all of them hold. The expression boxes pass None, so they keep their old behaviour; Tip::show has no other callers. Rules that apply to this change (no unwrap, no timers in tests, no new strings, wasm-safe code, no command or schema change) are met.

Bugs

  • None found.

Security

  • None found.

Performance

  • None found. The added work runs in the UI frame and is a few rectangle calculations.

Quality

  • Help can float away from the cursor in multi-line commands (medium confidence; inline comment posted on completion.rs:308). beside is given the { or ( line, not the cursor. The visibility check only uses the cursor, and visible is the whole text area rather than the script box's scroll viewport. Once the box scrolls past the {, the help can sit above the pane while the cursor is at the bottom. The fix is to pass the viewport and clamp or fall back.
  • First-frame size uses the full width (low confidence, one frame only). completion.rs:305 builds the default size from the screen-based width, not from the narrower width beside may return. On the left side that places the first frame too far left. The next frame corrects it through request_repaint, so the effect is a flicker.
  • No test for the narrow fallback inside Tip::show. help_goes_beside_its_pane covers beside returning None, but the integration tests only use a wide window, so the fallback to cursor placement is not exercised through show.
  • Tip::show doc comment (completion.rs:266-269) has broken line wrapping and reads awkwardly.
  • docs/user-guide/analysis.md:1909-1912 reflows a paragraph, and one line runs well past the surrounding lines' length.

AGENTS.md

  • No breaks found. The change adds no command, parameter or string, so command-surface.txt, the translation catalogs and the schema are unaffected.

Change size

Compared: the whole PR against main (merge base 8f98761 to PR head 3528157).

Measure Value
Files changed 4 (added 0, modified 4, removed 0, renamed 0)
Size before 596.8 KB
Size after 603.3 KB
Total size change +6.5 KB
Path Before After Change
crates/ui-egui/src/completion.rs 98.9 KB 102.2 KB +3.3 KB
crates/ui-egui/src/scriptcomplete.rs 208.1 KB 211.2 KB +3.1 KB
docs/user-guide/analysis.md 207.6 KB 207.7 KB +104 B
crates/ui-egui/src/exprcomplete.rs 82.2 KB 82.2 KB +6 B

@github-actions

github-actions Bot commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

📖 Docs preview

Item Value
Preview https://preview.rustgis.app/pr-3529/
Web app https://preview.rustgis.app/pr-3529/app/
Commit e4bf8d4

GitHub Pages takes a minute or two to publish a new commit. Newer commits from the fork aren't published until a maintainer adds the preview label (once per commit).

Comment thread crates/ui-egui/src/completion.rs Resolved
@github-actions

github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

Code review

I found no bugs, security problems or AGENTS.md violations in this diff. I could not run cargo xtask ci, clippy or the new tests because I have no shell here, so the checks below are by reading the code.

Bugs: None confirmed.

Security: None found. The diff adds no parsing, I/O or command surface.

Performance: None found. The added work is a few rect calculations per frame, and ui.clip_rect() is cheap.

Quality:

  • crates/ui-egui/src/completion.rs:77: on the left side, the x position uses last frame's drawn size. When help first appears, that size is the full-width estimate, so the first frame can leave a gap before the repaint corrects it. One-frame glitch, low to medium confidence. Posted inline.
  • docs/user-guide/analysis.md around line 1912: the rewrapped paragraph leaves a short line ("the list of its keys not"). Nit, not posted inline.

AGENTS.md: Checked against the rules that apply to this change:

  • No unwrap, expect, panic! or unsafe in non-test code. The test helpers use unwrap, which is allowed in tests.
  • No new strings, so no tl! or i18n work is needed.
  • No command, parameter, project format or schema change, so the command snapshot and schema/ need no update.
  • The egui popup code is shared by desktop and web, so there is no wasm32 branch to mirror.
  • The PR body names the surfaces it reaches (desktop, web, no touch interface). I did not verify the screenshots.

Twins checked:

  • Tip::show has two callers: exprcomplete.rs:406 passes None and keeps its old placement, and scriptcomplete.rs:1599 and :1607 pass the pane. The only scriptcomplete::hint caller is analysispane.rs:2547.
  • The new pane parameter's call sites are all accounted for.

Earlier concerns: I left 1 alone. The thread on completion.rs:308 (help placed by a scrolled-out { line) is resolved and outdated. The author's reply says the fix is in e4bf8d4, and the code at completion.rs:307 implements it.

Change size

Compared with the base branch: the whole PR against main (merge base 8f98761 to PR head e4bf8d4).

Measure Value
Files changed 4 (added 0, modified 4, removed 0, renamed 0)
Size before 596.8 KB
Size after 604.6 KB
Total size change +7.8 KB
Path Before After Change
crates/ui-egui/src/scriptcomplete.rs 208.1 KB 212.3 KB +4.3 KB
crates/ui-egui/src/completion.rs 98.9 KB 102.3 KB +3.4 KB
docs/user-guide/analysis.md 207.6 KB 207.7 KB +104 B
crates/ui-egui/src/exprcomplete.rs 82.2 KB 82.2 KB +6 B

@jgregoriorincon

Copy link
Copy Markdown
Contributor Author

On the other points of the review summaries, both left as they are:

  • Fallback through Tip::show: the Script completion tests draw the pane at the whole window width, where beside returns None, so they go through that fallback.
  • The short line in analysis.md renders the same; left to keep the diff to the changed sentence.

@jgregoriorincon
jgregoriorincon added this pull request to the merge queue Dec 1, 2026
Merged via the queue into opengeos:main with commit 0a03240 Dec 1, 2026
30 checks passed
@jgregoriorincon
jgregoriorincon deleted the fix/3525-script-help-beside branch December 1, 2026 12:41
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.

[Bug]: A command's help in the Script panel covers the script being written

1 participant