Open cristianoc opened 1 year ago
This PR https://github.com/morph-labs/rift/pull/159 adds a command in completions.py
to return symbol completions.
In addition, the IR is extended with a notion of reference and lookup.
References can be expressed as URIs e.g. of this form:
home/user/project/src/main.py
home/user/project/src/main.py#MyClass
home/user/project/src/main.py#MyClass.my_function
Feature: Enhance "@" Autocompletions in Chat with Functions and Classes
Context
We want to extend the "@" autocompletions in the chat to support functions and classes alongside the current support for files and directories.
Proposal
The Intermediate Representation (IR) can be leveraged to add these autocompletions.
List of Symbols for Autocompletion: A command to provide this list can be built atop the current IR. There are some design considerations:
a. Data Format: How should the list of symbols be represented? For instance, given:
The scope used to be a list of strings in a previous version of the proposal but that would be ambiguous for e.g. C++, where "A::" and "A." are two different valid scopes with different meaning.
b. Client-Side UI: Determine how to show potential completions to users and how to represent (and optionally specify) the scope to disambiguate symbols, e.g.,
Outer1.A.foo
vsOuter2.A.foo
.c. Response Format: Decide how to represent a symbol completion as a URL-like entity alongside what's currently done for files/directories. It should be easily parsed back by the server using a standard parser, and ideally, be interpretable (or even generatable) by an llm.
This parses fine with e.g.
urlparse
: