Skip to content

Editor: Go to Definition and Go to References are no-ops #69

Description

@KrisPowers

F12 (Go to Definition) and Shift+F12 (Go to References) both show up in the editor's right-click context menu and in the Edit menu, but pressing either one does nothing at all. The FullscreenIDE.tsx code acknowledges these are no-ops.

These are arguably the two most important navigation features in a code editor. Without them, understanding unfamiliar code requires manually searching (Ctrl+F) and scrolling.

What needs to happen

There are a few directions to consider:

  1. Simple grep-based approach (low effort): When the user presses F12 on a symbol, search the project files for the definition pattern (e.g., function foo, const foo =, class Foo, def foo) and jump to the first result. Not perfect, but far better than nothing.

  2. Tree-sitter based approach (medium effort): Since we already parse the file with tree-sitter, we can find the symbol name at the cursor, then search across open files for matching declaration nodes.

  3. LSP integration (high effort): Full language server support would make this accurate and complete. This is the correct long-term solution but is a large undertaking.

For a first pass, a regex/grep approach that covers the most common patterns would already be very useful.

Files likely involved

  • app/frontend/src/fullscreen/FullscreenIDE.tsx -- command handlers
  • app/frontend/src/components/GpuEditor.tsx -- needs a "get symbol at cursor" API
  • cpp/src/search.cpp -- could extend the existing content search for definition lookup

Acceptance criteria

  • F12 on a function/class/const name navigates to the declaration in the same file or another open file
  • Shift+F12 shows a list of locations where the symbol is used
  • If nothing is found, show a small "No definition found" notice rather than silently doing nothing

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions