Skip to content

feat(scope): expand multilang lexical resolution - #24

Open
odvcencio wants to merge 1 commit into
mainfrom
codex/multilang-scope-resolution
Open

feat(scope): expand multilang lexical resolution#24
odvcencio wants to merge 1 commit into
mainfrom
codex/multilang-scope-resolution

Conversation

@odvcencio

Copy link
Copy Markdown
Owner

Summary

  • resolve nested parameter, declarator, and pattern bindings for Rust, Java, and C++ scope queries
  • normalize source-level import declarations into the names they actually introduce, including aliases and grouped imports
  • support TypeScript/JavaScript and Python destructuring through the same binding extractor
  • keep loop, condition, and catch bindings inside their lexical lifetime instead of leaking them into later statements
  • prevent package symbols from unrelated language families leaking into polyglot-directory scope reports
  • include the indexed language in CLI and MCP scope responses

Why

canopy search scope and gts_scope are high-leverage agent surfaces, but their lexical results were strongest in Go and only partial elsewhere. This makes the existing structural index useful at cursor position across more of Canopy's grammar fleet without introducing a separate scope engine or database.

Validation

  • GOWORK=off go test ./...
  • GOWORK=off go vet ./...
  • GOWORK=off go test -race ./internal/scope ./internal/mcp ./cmd/canopy
  • canopy analyze check internal/scope --max-cyclomatic 15 --no-cache
  • canopy graph dead internal/scope --no-cache --count (0)
  • live CLI checks for Rust, Java, and C++ scope reports, including a mixed-language directory

Risk

The change is additive for JSON consumers (language) and corrects previously over-broad symbol visibility. Import parsing intentionally omits wildcard and C/C++ include spellings because they do not introduce a single lexical binding.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant