Skip to content

Conversation

@simonhollis
Copy link

Summary

Implements support for the enclosing_range field in SCIP occurrences, enabling IDE features like:

  • Call hierarchies (determining symbol references within function bodies)
    • Symbol outline/breadcrumbs (showing path from cursor to file root)
    • Expand selection (selecting nearest enclosing AST node)
    • Highlight range (indicating AST expression boundaries for hovers)

Changes

1. Updated SCIP Dependency

Updated schema to SCIP commit 9d5796159c97c3b107355c424f6c06fb1a0ea01c
which includes:

  • The enclosing_range field definition in the protobuf schema
  • The add_enclosing_range() API for populating individual values

2. Extended Indexer API

Added clang::SourceRange enclosingRange parameter (with default
empty value) to:

  • TuIndexer::saveDefinition()
  • TuIndexer::saveReference()
  • TuIndexer::saveOccurrence()
  • TuIndexer::saveOccurrenceImpl()

3. Implemented Range Population

Modified saveOccurrenceImpl() to populate the enclosing_range
field:

  • Format: [startLine-1, startColumn-1, [endLine-1], endColumn-1]
  • Uses 0-based coordinates as per SCIP specification
  • Omits endLine if range is single-line
  • Only populates when valid range is provided

enabling IDE features like:
- Call hierarchies (determining symbol references within function
  bodies)
  - Symbol outline/breadcrumbs (showing path from cursor to file root)
  - Expand selection (selecting nearest enclosing AST node)
  - Highlight range (indicating AST expression boundaries for hovers)

  ## Changes

  ### 1. Updated SCIP Dependency

  Updated to SCIP commit `9d5796159c97c3b107355c424f6c06fb1a0ea01c`
  which includes:
  - The `enclosing_range` field definition in the protobuf schema
  - The `add_enclosing_range()` API for populating individual values

  ### 2. Extended Indexer API

  Added `clang::SourceRange enclosingRange` parameter (with default
  empty value) to:
  - `TuIndexer::saveDefinition()`
  - `TuIndexer::saveReference()`
  - `TuIndexer::saveOccurrence()`
  - `TuIndexer::saveOccurrenceImpl()`

  ### 3. Implemented Range Population

  Modified `saveOccurrenceImpl()` to populate the `enclosing_range`
  field:
  - Format: `[startLine-1, startColumn-1, [endLine-1], endColumn-1]`
  - Uses 0-based coordinates as per SCIP specification
  - Omits endLine if range is single-line
  - Only populates when valid range is provided
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