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

2 min lesson

Cmd/Ctrl+K on a selection

Practice Inline Edit on one real case. Check the result before moving on.

Check your understanding

Complete the practice "Rewrite one helper with Inline Edit without touching its callers".

Outcome: The test passes "Hello, World!" to `toSlug` and gets hello-world. The diff contains only the four selected lines. No caller or import changed.

Rewrite one helper with Inline Edit without touching its callers
Cmd/Ctrl+K on a selection
SayThe slug helper keeps punctuation it should remove. The fix lives in its four-line body.
DoSelect only 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 with the selected code.
SeeThe diff rewrites only those four lines. The exported signature and both call sites 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.
SeeThe test passes "Hello, World!" to toSlug and gets hello-world. The diff contains only the four selected lines. No caller or import changed.
Learn more

Optional practice

Test yourself on Cmd/Ctrl+K on a selection

QWhat should be true when you finish the Inline Edit practice?

Finish the check to continue.