Peek at a VS Code definition or open it as an editor

F12 opens a definition and Option-F12 peeks at one when language support is available. Choose whether the inspection should replace your current view.

Scope
Visual Studio Code · Current vendor documentation checked 3 November 2026; no running-app compatibility test is claimed.
Keyboard and customization
Documented Mac defaults; punctuation and function keys depend on keyboard layout and hardware.. User bindings, app versions, focused controls and installed extensions can change a command. Inspect the active app menu or its shortcut editor when a listed combination differs.
Review basis
Documentation reviewed 2026-11-03 by Codex — primary-documentation and editorial review; no hands-on runtime test. These bindings were not tested in a running app for this guide.

Use peek for a short inspection

A definition can answer a small question without becoming the next editing destination. A peek view keeps more of the original context available while you inspect the symbol. If you intend to make a sustained edit in the definition, opening it as an editor can be the clearer choice.

Check which definition was resolved

A symbol can have several relevant declarations or implementations, and language tooling determines the presented result. Read the file path and surrounding code before acting. If navigation is unavailable, confirm the language service and project configuration rather than assuming the symbol has no definition anywhere.

Return through navigation history

When you open a definition and later want the original call site, use editor navigation history to return. This is separate from undoing code edits. Try the workflow in a small project first, and remember that the physical function keys can require Fn depending on the Mac’s keyboard settings.

Documented commands for this workflow

Scroll the table sideways to see every column.

ActionKeysWhen to use it
Open the definitionF12Uses the current language provider’s definition information. ↗
Peek at the definitionOption-F12Offers an inline inspection context where supported. ↗
Open a definition beside the current editorCommand-K, then F12A chord useful when both locations should stay visible. ↗

Sources and corrections

Found a mismatch? Email pashaseenainc@gmail.com with your app version, macOS version, keyboard layout and the command. Please leave personal document names out.

Keep going

Right there when you need it.

Keep a compact shortcut reference in your Mac’s menu bar.

Explore the native Mac app