The Structure View / symbol outline panel extracts symbols from the current file using regex patterns instead of using the tree-sitter AST that is already being parsed for syntax highlighting. This means the outline is incomplete, has false positives, misses many symbols, and can't navigate to them reliably.
For example, in a TypeScript file, a class method defined inside an expression, an arrow function stored in a variable, or a type alias will often be missed entirely. In Python, decorated functions or nested class methods will be skipped. The regex approach does not generalize well and every new language requires manual regex work.
What needs to happen
Since tree-sitter already parses the file buffer in cpp/src/editor_buffer.cpp, add a new IPC call (something like editor.symbols) that walks the syntax tree and returns a flat or nested list of named declaration nodes:
- Function/method declarations
- Class declarations
- Variable/const declarations that bind function values
- Type/interface declarations
- For Python: decorated functions and class bodies
- For Rust: impl blocks, struct/enum declarations
The outline panel should use this data instead of the regex extraction. Each symbol entry should include its line number so clicking it scrolls the editor to that position.
Files likely involved
cpp/src/editor_buffer.cpp -- new AST walk to extract symbol nodes
app/frontend/src/components/StructureView.tsx (or wherever the outline renders) -- replace regex extraction with the IPC result
- IPC bridge to wire the new backend call
Acceptance criteria
- Structure view shows functions, classes, types, and variables for JS/TS/TSX files without false positives
- Clicking a symbol in the outline scrolls the editor to that line
- The outline updates live as the user edits the file
- At minimum covers JS, TS, TSX, Python, Rust, Go, C, C++
The Structure View / symbol outline panel extracts symbols from the current file using regex patterns instead of using the tree-sitter AST that is already being parsed for syntax highlighting. This means the outline is incomplete, has false positives, misses many symbols, and can't navigate to them reliably.
For example, in a TypeScript file, a class method defined inside an expression, an arrow function stored in a variable, or a type alias will often be missed entirely. In Python, decorated functions or nested class methods will be skipped. The regex approach does not generalize well and every new language requires manual regex work.
What needs to happen
Since tree-sitter already parses the file buffer in
cpp/src/editor_buffer.cpp, add a new IPC call (something likeeditor.symbols) that walks the syntax tree and returns a flat or nested list of named declaration nodes:The outline panel should use this data instead of the regex extraction. Each symbol entry should include its line number so clicking it scrolls the editor to that position.
Files likely involved
cpp/src/editor_buffer.cpp-- new AST walk to extract symbol nodesapp/frontend/src/components/StructureView.tsx(or wherever the outline renders) -- replace regex extraction with the IPC resultAcceptance criteria