Editing and imports
Navigate Mojo source and add correct module imports.
Edit native Mojo source#
Open .mojo files to use highlighting, folding, structure, navigation, and inspections. Use Go to Declaration, Find Usages, and Rename on symbols rather than text replacement when changing names used across modules.
Inspections identify unresolved names, duplicate definitions, unused bindings/imports, wildcard imports, and syntax errors. Compiler-backed diagnostics depend on the configured SDK and language server; compare with a real build for authoritative validation.
Import a public symbol#
Place the caret on an unresolved public function or type and press Alt+Enter. Select the proposed import. If several modules export the name, choose the intended module explicitly.
The import comes from the symbol’s actual module and preserves headers and docstrings. Standard-library fixes need discoverable sources from the SDK, local cache, or Stdlib source path. A genuinely unknown name has no valid import to propose.
Check the result#
Navigate through the inserted import, use the symbol, and run the file with the selected SDK. Undo the edit if you selected the wrong module. Reformat with either the SDK formatter or built-in formatter according to the project style.
Manual for version 2026.1.12 · Reviewed