Send server contextualization to Copilot extension (#24230)

* Send server contextualization to Copilot extension

* Keep context in editor input

* Remove unnecessary server context and extension service

* Send context when connecting from open editor

* Remove contextualization complete event

* Contextualize editor after connection success

* Minor clean up

* Remove nested then and use async/await

* Create helper function

* Remove unneeded async and add comment

* Encapsulate all context logic in service

* Use void operator to fix floating promise

* Correct return comment
This commit is contained in:
Lewis Sanchez
2023-09-01 09:26:29 -07:00
committed by GitHub
parent e3d0670609
commit 5152823306
12 changed files with 100 additions and 72 deletions

View File

@@ -901,7 +901,7 @@ declare module 'azdata' {
* Copilot for improved suggestions.
* @param provider The provider to register
*/
export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable
export function registerServerContextualizationProvider(provider: contextualization.ServerContextualizationProvider): vscode.Disposable;
}
export namespace designers {
@@ -1783,11 +1783,18 @@ declare module 'azdata' {
}
export namespace contextualization {
export interface GenerateServerContextualizationResult {
/**
* The generated server context.
*/
context: string | undefined;
}
export interface GetServerContextualizationResult {
/**
* An array containing the generated server context.
* The retrieved server context.
*/
context: string[];
context: string | undefined;
}
export interface ServerContextualizationProvider extends DataProvider {
@@ -1795,7 +1802,7 @@ declare module 'azdata' {
* Generates server context.
* @param ownerUri The URI of the connection to generate context for.
*/
generateServerContextualization(ownerUri: string): void;
generateServerContextualization(ownerUri: string): Thenable<GenerateServerContextualizationResult>;
/**
* Gets server context, which can be in the form of create scripts but is left up each provider.