Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Integrate VSCode Cody with server-side Context API#4840

Merged
rafax merged 21 commits into
mainfrom
rg/context_api_boilerplate
Jul 18, 2024
Merged

Integrate VSCode Cody with server-side Context API#4840
rafax merged 21 commits into
mainfrom
rg/context_api_boilerplate

Conversation

@rafax

@rafax rafax commented Jul 11, 2024

Copy link
Copy Markdown
Contributor

This PR adds the Client-side integration of https://github.com/sourcegraph/sourcegraph/pull/63789 for VSCode:

  • GraphQL queries, types and client methods
  • ContextAPIClient class mapping VSCode objects to GraphQL
  • wiring of ContextAPIClient to existing code

Currently, for all added backend calls:

  • all remote RPC are guarded by a feature flag
  • results of RPCs are not used by integrating call
  • calls are not awaited (to avoid slowing down interactions)

Related to AI-128.

Test plan

  • tested locally -> works with local and sourcegraph.com backend

@rafax rafax requested a review from a team July 17, 2024 19:48
@rafax rafax marked this pull request as ready for review July 17, 2024 19:48
type LogEventResponse = unknown

interface ChatIntentResponse {
chatIntent: {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need these outer objects? (same in RankContextResponse)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is caused by how GraphQL serializes stuff (it has it's own outer wrapper with a single property, and we unpack the inner response?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, didn't know that.

/**
* Experimental API.
*/
export interface InputContextItem {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you don't put Input in the name do we have a conflict with another type? It seems a bit awkwardly named TBH.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a clash between a type ContextItem and input ContextItem in GraphQL, but both of those are new types, so if you think that makes sense, I can use input ContextItem (i.e. this one) and something else for output (ContextItemResult? CodyContextItem? ContextDocument?)

Comment thread vscode/src/chat/chat-view/ChatController.ts
Comment thread lib/shared/src/sourcegraph-api/graphql/client.ts Outdated
Comment thread vscode/src/chat/context/contextAPIClient.ts Outdated
@rafax rafax requested review from a team and janhartman July 18, 2024 08:02
@rafax rafax changed the title Rg/context api boilerplate Integrate VSCode Cody with server-side Context API Jul 18, 2024
@rafax rafax merged commit b2398fc into main Jul 18, 2024
@rafax rafax deleted the rg/context_api_boilerplate branch July 18, 2024 10:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants