Skip to content

Extract IMPORTS/IMPLEMENTS/INHERITS edges (multi-language) #437

Description

@ajianaz

Goal

Extract and store non-CALLS edge types during indexing: IMPORTS, IMPLEMENTS, INHERITS, CHILD_OF.

Context

#429 wires up store_kg_edges() for the edges table but focuses on CALLS only (migration from call_graph). This issue extends extraction to other edge kinds.

Per-Language Extraction Rules

Edge Kind Rust Python TypeScript Go
IMPORTS use crate::foo import foo import { x } from 'y' import "pkg"
IMPLEMENTS impl Trait for Struct class inherits ABC implements Interface interface satisfaction
INHERITS derive(Parent) class Child(Parent) class C extends P struct embedding
CHILD_OF nested mods nested classes namespaces sub-packages

Implementation

  1. Extend src/index/extract.rs per language
  2. Rust: parse use, impl ... for, #[derive]
  3. Python: parse import, from ... import, class X(Y)
  4. TypeScript: parse import, implements, extends
  5. Go: parse import, struct embedding
  6. Store via store_kg_edges() with appropriate EdgeKind

Acceptance

  • SELECT kind, COUNT(*) FROM edges GROUP BY kind shows IMPORTS + IMPLEMENTS
  • cora query "* <- IMPORTS <- main" works after indexing
  • No regression in indexing speed (< 10% overhead)

Depends On

Estimated Effort

1-2 weeks

Metadata

Metadata

Assignees

No one assigned

    Labels

    epic:code-intelligenceEpic: Code intelligence capabilities across toolsfeaturescope:code-intelCode intelligence — indexing, graph, impact analysis

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions