This repository was archived by the owner on Aug 1, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 464
Agent: automate generation of Kotlin bindings #3142
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Didn't open a draft PR, but I'm going to review this myself tomorrow before tagging for reviews. |
abc5ff8
to
c8ad6a5
Compare
olafurpg
referenced
this pull request
in sourcegraph/scip-typescript
Feb 13, 2024
Companion PRs: * sourcegraph/scip#231 * https://github.com/sourcegraph/cody/pull/3142 Previously, scip-typescript didn't emit any structured information about signatures. This PR solves that problem, which unblocks new exciting use-cases for SCIP. Keeping this PR open for a while since we are not planning to merge signature support to SCIP just yet. For now, the Cody repo can use this branch instead.
olafurpg
referenced
this pull request
in sourcegraph/scip-typescript
Feb 13, 2024
Companion PRs: * sourcegraph/scip#231 * https://github.com/sourcegraph/cody/pull/3142 Previously, scip-typescript didn't emit any structured information about signatures. This PR solves that problem, which unblocks new exciting use-cases for SCIP. Keeping this PR open for a while since we are not planning to merge signature support to SCIP just yet. For now, the Cody repo can use this branch instead.
olafurpg
referenced
this pull request
in sourcegraph/scip-typescript
Feb 13, 2024
Companion PRs: * sourcegraph/scip#231 * https://github.com/sourcegraph/cody/pull/3142 Previously, scip-typescript didn't emit any structured information about signatures. This PR solves that problem, which unblocks new exciting use-cases for SCIP. Keeping this PR open for a while since we are not planning to merge signature support to SCIP just yet. For now, the Cody repo can use this branch instead.
Until now, we have been manually writing Kotlin bindings for the agent protocol. This worked fine when only a small number of people worked on the protocol and the protocol was small, but has become increasingly problematic as more people are actively working on the JetBrains plugin and the size of the Agent protocol has grown. For example, if you make a mistake in the bindings, you may end up spending a long time debugging why something is not working because the error messages can be cryptic. This PR adds a new script to automatically generate Kotlin bindings so that we no longer need to rely on manually written bindings. Simplified, the script works like this: - Index the codebase with a fork of scip-typescript. This fork uses an extension of SCIP that adds `SymbolInformation.signature` (more details here sourcegraph/scip#231). - Use the structured type signatures from the SCIP index, translate it into Kotlin code, and report errors if something in the protocol has no clean translation to Kotlin. - Add the generated code to the Cody repo so that we can closely track what Cody PRs are influencing the protocol, and how they're influencing it.
671063b
to
6392911
Compare
philipp-spiess
approved these changes
Feb 14, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great stuff! The changes on the vscode
side are minuscule and it's very easy to turn this off if it causes problems but even in its current state this is a huge improvement for the work on the JetBrains extension (even if we don't keep the types updated) so let's go
mkondratek
referenced
this pull request
in sourcegraph/jetbrains
Feb 27, 2024
The recent changes to the agent (https://github.com/sourcegraph/cody/pull/3142) broke the API - this is a fix. ## Test plan 1. write @ in the chat 2. the files appear
olafurpg
referenced
this pull request
in sourcegraph/scip-typescript
Jun 12, 2024
Companion PRs: * sourcegraph/scip#231 * https://github.com/sourcegraph/cody/pull/3142 Previously, scip-typescript didn't emit any structured information about signatures. This PR solves that problem, which unblocks new exciting use-cases for SCIP. Keeping this PR open for a while since we are not planning to merge signature support to SCIP just yet. For now, the Cody repo can use this branch instead.
olafurpg
referenced
this pull request
in sourcegraph/scip-typescript
Jun 17, 2024
Companion PRs: * sourcegraph/scip#231 * https://github.com/sourcegraph/cody/pull/3142 Previously, scip-typescript didn't emit any structured information about signatures. This PR solves that problem, which unblocks new exciting use-cases for SCIP. Keeping this PR open for a while since we are not planning to merge signature support to SCIP just yet. For now, the Cody repo can use this branch instead.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Until now, we have been manually writing Kotlin bindings for the agent protocol. This worked fine when only a small number of people worked on the protocol and the protocol was small, but has become increasingly problematic as more people are actively working on the JetBrains plugin and the size of the Agent protocol has grown. For example, if you make a mistake in the bindings, you may end up spending a long time debugging why something is not working because the error messages can be cryptic.
This PR adds a new script to automatically generate Kotlin bindings so that we no longer need to rely on manually written bindings. Simplified, the script works like this:
SymbolInformation.signature
(more details here Add support forSymbolInformation.signature
scip#231).Test plan
Green CI