Skip to lesson
Exit
Inline Edit with Cmd/Ctrl+K1 / 1

2 min lesson

Cmd/Ctrl+K on a selection

Complete "Cmd/Ctrl+K on a selection". Check the final state against the lesson before you move on.

Check your understanding

Run this practice: Inline edit — rewrite one helper without touching its callers.

Outcome: toSlug("Hello, World!") returns hello-world, and the diff touched only the four selected lines, so the boundary held.

Inline edit — rewrite one helper without touching its callers
Cmd/Ctrl+K on a selection
SayThe slug helper keeps punctuation it shouldn't, and the fix lives in its four lines.
DoSelect just the body of toSlug, not the whole file or the imports above it.
TypeStrip characters that aren't a letter, number, or hyphen. Keep the return type and the function name.
DoPress on the selection.
DoCompare the proposed patch against what you highlighted.
SeeThe diff rewrites only those four lines; the exported signature and both call sites above stay untouched.
SayNothing outside the selection needs to change, so this stays in inline edit instead of going to Agent.
DoAccept the patch.
DoRun the slug unit test to confirm the edited path still works.
SeetoSlug("Hello, World!") returns hello-world, and the diff touched only the four selected lines, so the boundary held.
Learn more

Optional practice

Practice: Cmd/Ctrl+K on a selection

QYou've applied it. What actually proves the work is done, not just a plausible answer?

Finish the check to continue.