-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
V1 new client extension API, for inline edits + document code (#3445)
Co-authored-by: Dominic Cooney <dominic.cooney@sourcegraph.com> Co-authored-by: Beatrix Woo <abeatrix@sourcegraph.com>
- Loading branch information
1 parent
ea284a2
commit 5356bb5
Showing
33 changed files
with
874 additions
and
501 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
7 changes: 7 additions & 0 deletions
7
...in/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EditCommands_CodeParams.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport") | ||
package com.sourcegraph.cody.protocol_generated | ||
|
||
data class EditCommands_CodeParams( | ||
val params: ParamsParams? = null, | ||
) | ||
|
This file contains 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
5 changes: 5 additions & 0 deletions
5
...indings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/FixupTaskID.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport") | ||
package com.sourcegraph.cody.protocol_generated | ||
|
||
typealias FixupTaskID = String // One of: | ||
|
7 changes: 7 additions & 0 deletions
7
...tlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/GetFoldingRangeParams.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport") | ||
package com.sourcegraph.cody.protocol_generated | ||
|
||
data class GetFoldingRangeParams( | ||
val uri: String? = null, | ||
) | ||
|
7 changes: 7 additions & 0 deletions
7
...tlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/GetFoldingRangeResult.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport") | ||
package com.sourcegraph.cody.protocol_generated | ||
|
||
data class GetFoldingRangeResult( | ||
val ranges: List<Range>? = null, | ||
) | ||
|
7 changes: 7 additions & 0 deletions
7
...ndings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ParamsParams.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
@file:Suppress("FunctionName", "ClassName", "unused", "EnumEntryName", "UnusedImport") | ||
package com.sourcegraph.cody.protocol_generated | ||
|
||
data class ParamsParams( | ||
val instruction: String? = null, | ||
) | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import type { FixupFile } from '../../vscode/src/non-stop/FixupFile' | ||
import type { FixupTask, FixupTaskID } from '../../vscode/src/non-stop/FixupTask' | ||
import type { FixupActor, FixupFileCollection } from '../../vscode/src/non-stop/roles' | ||
import type { FixupControlApplicator } from '../../vscode/src/non-stop/strategies' | ||
import { type Agent, errorToCodyError } from './agent' | ||
import type { EditTask } from './protocol-alias' | ||
|
||
export class AgentFixupControls implements FixupControlApplicator { | ||
constructor( | ||
private readonly fixups: FixupActor & FixupFileCollection, | ||
private readonly notify: typeof Agent.prototype.notify | ||
) {} | ||
|
||
public accept(id: FixupTaskID): void { | ||
const task = this.fixups.taskForId(id) | ||
if (task) { | ||
this.fixups.accept(task) | ||
} | ||
} | ||
|
||
public undo(id: FixupTaskID): void { | ||
const task = this.fixups.taskForId(id) | ||
if (task) { | ||
this.fixups.undo(task) | ||
} | ||
} | ||
|
||
public cancel(id: FixupTaskID): void { | ||
const task = this.fixups.taskForId(id) | ||
if (task) { | ||
this.fixups.cancel(task) | ||
} | ||
} | ||
|
||
// FixupControlApplicator | ||
|
||
didUpdateTask(task: FixupTask): void { | ||
this.notify('editTask/didUpdate', AgentFixupControls.serialize(task)) | ||
} | ||
didDeleteTask(task: FixupTask): void { | ||
this.notify('editTask/didDelete', AgentFixupControls.serialize(task)) | ||
} | ||
|
||
visibleFilesWithTasksMaybeChanged(files: readonly FixupFile[]): void {} | ||
|
||
dispose() {} | ||
|
||
public static serialize(task: FixupTask): EditTask { | ||
return { | ||
id: task.id, | ||
state: task.state, | ||
error: errorToCodyError(task.error), | ||
selectionRange: task.selectionRange, | ||
} | ||
} | ||
} |
This file contains 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
Oops, something went wrong.