> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lsproxy.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Find all symbols that are referenced from a given symbol's definition

> The input position must point to a symbol (e.g. function name, class name, variable name).
Returns all symbols referenced within that symbol's implementation, categorized into:
- Workspace symbols (with their definitions)
- External symbols (built-in functions like 'len', 'print' or from external libraries)
- Symbols that couldn't be found

e.g. for a function definition in `main.py`:
```python
@log_execution_time     # Reference to decorator
def process_user():     # <-- Input position here
    user = User()       # Reference to User class
    print("Done")       # Reference to built-in function
```
This would return:
- Workspace symbols: [
    log_execution_time (with definition from decorators.py),
    User (with definition from models.py)
  ]
- External symbols: print (Python built-in)



## OpenAPI

````yaml openapi.json post /symbol/find-referenced-symbols
openapi: 3.1.0
info:
  title: lsproxy
  description: ''
  license:
    name: Apache-2.0
    url: https://www.apache.org/licenses/LICENSE-2.0
  version: 0.2.1
servers:
  - url: http://localhost:4444/v1
    description: API server v1
security:
  - bearer_auth: []
tags:
  - name: lsproxy-api
    description: LSP Proxy API
paths:
  /symbol/find-referenced-symbols:
    post:
      tags:
        - symbol
      summary: Find all symbols that are referenced from a given symbol's definition
      description: >-
        The input position must point to a symbol (e.g. function name, class
        name, variable name).

        Returns all symbols referenced within that symbol's implementation,
        categorized into:

        - Workspace symbols (with their definitions)

        - External symbols (built-in functions like 'len', 'print' or from
        external libraries)

        - Symbols that couldn't be found


        e.g. for a function definition in `main.py`:

        ```python

        @log_execution_time     # Reference to decorator

        def process_user():     # <-- Input position here
            user = User()       # Reference to User class
            print("Done")       # Reference to built-in function
        ```

        This would return:

        - Workspace symbols: [
            log_execution_time (with definition from decorators.py),
            User (with definition from models.py)
          ]
        - External symbols: print (Python built-in)
      operationId: find_referenced_symbols
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetReferencedSymbolsRequest'
        required: true
      responses:
        '200':
          description: Referenced symbols retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReferencedSymbolsResponse'
        '400':
          description: Bad request
        '500':
          description: Internal server error
components:
  schemas:
    GetReferencedSymbolsRequest:
      type: object
      description: >-
        Request to get all symbols that are referenced from a symbol at the
        given position, either

        focusing on function calls, or more permissively finding all references


        The input position must point to a symbol (e.g. function name, class
        name, variable name).

        The response will include all symbols that are referenced from that
        input symbol.

        For example, if the position points to a function name, the response
        will include

        all symbols referenced within that function's implementation.
      required:
        - identifier_position
      properties:
        full_scan:
          type: boolean
          description: >-
            Whether to use the more permissive rules to find referenced symbols.
            This will be not just

            code that is executed but also things like type hints and chained
            indirection.

            Defaults to false.
          example: false
        identifier_position:
          $ref: '#/components/schemas/FilePosition'
          description: The identifier position of the symbol to find references within
    ReferencedSymbolsResponse:
      type: object
      description: >-
        Response containing symbols referenced from the requested position


        The symbols are categorized into:

        - workspace_symbols: References to symbols that were found and have
        definitions in the workspace

        - external_symbols: References to symbols from outside the workspace
        (built-in functions, external libraries)

        - not_found: References where the symbol definition could not be found
      required:
        - workspace_symbols
        - external_symbols
        - not_found
      properties:
        external_symbols:
          type: array
          items:
            $ref: '#/components/schemas/Identifier'
        not_found:
          type: array
          items:
            $ref: '#/components/schemas/Identifier'
        workspace_symbols:
          type: array
          items:
            $ref: '#/components/schemas/ReferenceWithSymbolDefinitions'
    FilePosition:
      type: object
      description: A position within a specific file in the workspace
      required:
        - path
        - position
      properties:
        path:
          type: string
          description: Path to the file, relative to the workspace root
          example: src/main.py
        position:
          $ref: '#/components/schemas/Position'
          description: Position within the file
    Identifier:
      type: object
      required:
        - name
        - file_range
      properties:
        file_range:
          $ref: '#/components/schemas/FileRange'
        kind:
          type:
            - string
            - 'null'
        name:
          type: string
    ReferenceWithSymbolDefinitions:
      type: object
      description: >-
        A reference to a symbol along with its definition(s) found in the
        workspace


        e.g. for a reference to `User` in `main.py`:

        ```python

        user = User("John", 30)

        _______^

        ```

        This would contain:

        - The reference location and name ("User" at line 0)

        - The symbol definition(s) (e.g. "class User" in models.py)
      required:
        - reference
        - definitions
      properties:
        definitions:
          type: array
          items:
            $ref: '#/components/schemas/Symbol'
        reference:
          $ref: '#/components/schemas/Identifier'
    Position:
      type: object
      description: A position within a text document, using 0-based indexing
      required:
        - line
        - character
      properties:
        character:
          type: integer
          format: int32
          description: 0-indexed character index within the line.
          example: 5
          minimum: 0
        line:
          type: integer
          format: int32
          description: 0-indexed line number.
          example: 10
          minimum: 0
    FileRange:
      type: object
      description: A range within a specific file, defined by start and end positions
      required:
        - path
        - range
      properties:
        path:
          type: string
          description: The path to the file.
          example: src/main.py
        range:
          $ref: '#/components/schemas/Range'
          description: The range within the file
    Symbol:
      type: object
      required:
        - name
        - kind
        - identifier_position
        - file_range
      properties:
        file_range:
          $ref: '#/components/schemas/FileRange'
          description: The full range of the symbol.
        identifier_position:
          $ref: '#/components/schemas/FilePosition'
          description: The start position of the symbol's identifier.
        kind:
          type: string
          description: The kind of the symbol (e.g., function, class).
          example: class
        name:
          type: string
          description: The name of the symbol.
          example: User
    Range:
      type: object
      required:
        - start
        - end
      properties:
        end:
          $ref: '#/components/schemas/Position'
          description: The end position of the range.
        start:
          $ref: '#/components/schemas/Position'
          description: The start position of the range.
  securitySchemes:
    bearer_auth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````