# Code intelligence

IDE-grade navigation for LaTeX: go to definition, find references, project-wide rename, hover cards, math preview, and the document outline.

Oleafly indexes the whole project, including every `\label`, citation key, custom macro, theorem, glossary entry, and the `\input` graph connecting your files. That index powers navigation across files.

Shortcuts show macOS keys. On Windows and Linux, read ⌘ as Ctrl.

## Go to definition: F12 or ⌘-click

Put the cursor on a `\ref`, a `\cite` key, a custom macro, a `\begin{env}` for an environment you defined, or a glossary term, and press F12 (or hold ⌘ and click it). The editor jumps to where it's defined, opening the defining file if it's elsewhere in the project.

Pressing F12 while already on a definition flips to finding its references, the same convention IDEs use.

## Find references: ⇧F12

Shift+F12 lists every use of the symbol in the **References** panel in the left rail: one row per occurrence with the file, line, and a preview, and a "def" badge on the definition itself. Click a row to jump. It's the fastest way to answer "can I delete this label?" or "where did I cite this paper?"

## Rename symbol: F2

F2 renames a label, citation key, macro, theorem, glossary entry, or environment across the entire project in one step: the open file updates live, other files are rewritten on disk, and the index rebuilds. If the new name already exists, the rename is blocked before it can create a collision, and a toast reports how many edits landed in how many files.

Renaming `fig:overview` to `fig:architecture` and having all six `\ref`s follow is a two-second operation.

## Hover cards

Hover any symbol and a card explains it:

- On a **reference**: the symbol kind, source preview, and location. After a successful LaTeX build, supported references also show the compiled number and page.
- On a **definition**: how many references it has across the project.
- On anything **unresolved**: a clear "Unresolved" label, which is your earliest warning of a typo'd `\ref` or a missing `.bib` entry.

Hold ⌘ (Ctrl) while hovering and clickable symbols underline like links, click to jump.

## Math preview on hover

Hover over inline `$…$`, `\(…\)`, or display `\[…\]` math to render it with KaTeX without compiling. Display math uses display style. A broken expression shows its error.

## The Outline panel

Below the file tree, the **Outline** panel shows your document's structure: sections indented by level, plus `\input` includes, across all files. Items from other files carry a filename badge. Click anything to jump straight to it. For a thesis split across a dozen chapter files, this is the table of contents you navigate by.

The panel divider between the tree and the outline drags to resize.

## Where the toolbar and menu fit

All three navigation commands also live in the editor toolbar's **Code intelligence** menu (the braces icon) and the right-click menu, so they're discoverable before the shortcuts become muscle memory.

## The AI sees the same index

The [AI assistant](/docs/ai-chat/) has a `project_map` tool built on this same index: the outline, labels, citations, macros, file graph, and any unresolved references. When you ask it about "the methodology section," it can actually find it.
