feat(editor): copyable diagnostics + hover tooltip + quick fixes
Three operator-UX gaps closed in one pass — the diagnostic
strip stayed plain Text (no copy), the wavy underline gave no
hover tooltip (had to read the strip), and there was no way to
act on an issue without leaving the editor.
- **Selectable + copyable strip**. Both the header summary
and the per-row issue message are now SelectableText. Per-
row Copy button (compact icon) lives next to the message;
header carries a 'Copy all' that copies every issue as
'L7: <message>' lines. Trackpad-only operators no longer
have to use the system selection gesture.
- **Hover tooltip on the wavy underline**. The controller
attaches TextSpan.onEnter / onExit handlers to every
issue-overlapping leaf and publishes IssueHoverRequest via
a ValueNotifier. FlowEditorPage listens and inserts an
OverlayEntry tooltip card near the cursor. Card carries
its own MouseRegion that cancels the dismiss timer so the
operator can slide INTO it to click the action buttons.
- **Quick fixes for the two most common issues**:
· 'Unknown capability X' → InstallCapabilityFix (delegated
to host via the new onInstallCapability callback). On
success, controller.setAvailableCapabilities + reanalyze
clear the issue automatically.
· 'Unknown type Y' with a Levenshtein-distance-≤2 match
→ ReplaceLineValueFix. Applied by the editor itself:
line is mutated, key + indent preserved, comment
preserved, then reanalyze.
Distance > 2 stays unfixed — pushing 'zonglefax' to 'bytes'
would be worse than no suggestion.
New public surface (exported from the package):
- QuickFix sealed base + InstallCapabilityFix + ReplaceLineValueFix
- InstallCapabilityCallback typedef
- IssueHoverRequest + IssueHoverSeverity
- FlowEditorPage.onInstallCapability prop
Tests:
- FlowAnalyzer attaches InstallCapabilityFix to capability
issues
- FlowAnalyzer suggests the closest valid type for typos
- FlowAnalyzer emits no fix when the typo is too far
All 33 editor tests green. Bumped to 0.17.0.
Signed-off-by: flemming-it <sf@flemming.it>
This commit is contained in:
parent
1b50924e16
commit
f43c1ac6cf
7 changed files with 884 additions and 198 deletions
|
|
@ -26,6 +26,14 @@ export 'src/editor_style.dart'
|
|||
show FaiEditorStyle, EditorCanvasBackdrop, EditorPanelStyle;
|
||||
export 'src/flow_editor_page.dart' show FlowEditorPage;
|
||||
export 'src/l10n.dart' show FlowEditorLocale;
|
||||
export 'src/quick_fix.dart'
|
||||
show
|
||||
InstallCapabilityCallback,
|
||||
QuickFix,
|
||||
InstallCapabilityFix,
|
||||
ReplaceLineValueFix,
|
||||
IssueHoverRequest,
|
||||
IssueHoverSeverity;
|
||||
export 'src/run_driver.dart'
|
||||
show
|
||||
FlowRunDriver,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue