From 0b259fcd16cf035d112d94fead4673571d5e97c7 Mon Sep 17 00:00:00 2001 From: Valery Bugakov Date: Thu, 14 Mar 2024 23:17:24 -0700 Subject: [PATCH 01/13] Autocomplete: changelog update (#3416) --- vscode/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/vscode/CHANGELOG.md b/vscode/CHANGELOG.md index 6ecc3eecd5..489124afd2 100644 --- a/vscode/CHANGELOG.md +++ b/vscode/CHANGELOG.md @@ -16,6 +16,7 @@ This is a log of all notable changes to Cody for VS Code. [Unreleased] changes a - Autocomplete: Do not cut off completions when they are almost identical to the following non-empty line. [pull/3377](https://github.com/sourcegraph/cody/pull/3377) - Chat: The UpArrow key in an empty chat editor now edits the most recently sent message instead of populating the editor with the last message's text. - Chat: The chat editor uses a new rich editor component. If you open an old chat added before this version and edit a message in the transcript with @-mentions, the @-mentions will show up as plain text and will not actually include the mentioned files unless you re-type them. +- Autocomplete: Enabled dynamic multiline completions by default. [pull/3392](https://github.com/sourcegraph/cody/pull/3392) ## [1.8.3] From 21d92984ea84eb766eccc8b7b0faaa1c9dcc5867 Mon Sep 17 00:00:00 2001 From: Tom Ross Date: Fri, 15 Mar 2024 11:25:18 +0000 Subject: [PATCH 02/13] Telemetry: Fix `hasV2Event` often being included as an event property (#3420) --- .../chat/chat-view/SidebarViewController.ts | 17 ++- vscode/src/commands/GhostHintDecorator.ts | 2 +- vscode/src/edit/provider.ts | 15 ++- vscode/src/non-stop/FixupController.ts | 114 ++++++++++++------ vscode/src/services/AuthProvider.ts | 36 ++++-- .../utils/codeblock-action-tracker.ts | 23 ++-- 6 files changed, 138 insertions(+), 69 deletions(-) diff --git a/vscode/src/chat/chat-view/SidebarViewController.ts b/vscode/src/chat/chat-view/SidebarViewController.ts index e9688707d3..aca9987b24 100644 --- a/vscode/src/chat/chat-view/SidebarViewController.ts +++ b/vscode/src/chat/chat-view/SidebarViewController.ts @@ -78,12 +78,17 @@ export class SidebarViewController implements vscode.WebviewViewProvider { async (token, endpoint) => { closeAuthProgressIndicator() const authStatus = await this.authProvider.auth(endpoint, token) - telemetryService.log('CodyVSCodeExtension:auth:fromTokenReceiver', { - type: 'callback', - from: 'web', - success: Boolean(authStatus?.isLoggedIn), - hasV2Event: true, - }) + telemetryService.log( + 'CodyVSCodeExtension:auth:fromTokenReceiver', + { + type: 'callback', + from: 'web', + success: Boolean(authStatus?.isLoggedIn), + }, + { + hasV2Event: true, + } + ) telemetryRecorder.recordEvent( 'cody.auth.fromTokenReceiver.web', 'succeeded', diff --git a/vscode/src/commands/GhostHintDecorator.ts b/vscode/src/commands/GhostHintDecorator.ts index 42e58431d5..c002e51879 100644 --- a/vscode/src/commands/GhostHintDecorator.ts +++ b/vscode/src/commands/GhostHintDecorator.ts @@ -171,7 +171,7 @@ export class GhostHintDecorator implements vscode.Disposable { } private _fireDisplayEvent(): void { - telemetryService.log('CodyVSCodeExtension:ghostText:visible', { hasV2Event: true }) + telemetryService.log('CodyVSCodeExtension:ghostText:visible', {}, { hasV2Event: true }) telemetryRecorder.recordEvent('cody.ghostText', 'visible') } diff --git a/vscode/src/edit/provider.ts b/vscode/src/edit/provider.ts index 18571f2d30..1c675fefa8 100644 --- a/vscode/src/edit/provider.ts +++ b/vscode/src/edit/provider.ts @@ -160,11 +160,16 @@ export class EditProvider { } if (!isMessageInProgress) { - telemetryService.log('CodyVSCodeExtension:fixupResponse:hasCode', { - ...countCode(response), - source: this.config.task.source, - hasV2Event: true, - }) + telemetryService.log( + 'CodyVSCodeExtension:fixupResponse:hasCode', + { + ...countCode(response), + source: this.config.task.source, + }, + { + hasV2Event: true, + } + ) const endpoint = this.config.authProvider?.getAuthStatus()?.endpoint const responseText = endpoint && isDotCom(endpoint) ? response : undefined telemetryRecorder.recordEvent('cody.fixup.response', 'hasCode', { diff --git a/vscode/src/non-stop/FixupController.ts b/vscode/src/non-stop/FixupController.ts index 50ea034b55..95cec1658e 100644 --- a/vscode/src/non-stop/FixupController.ts +++ b/vscode/src/non-stop/FixupController.ts @@ -50,58 +50,93 @@ export class FixupController this._disposables.push( vscode.workspace.registerTextDocumentContentProvider('cody-fixup', this.contentStore), vscode.commands.registerCommand('cody.fixup.codelens.cancel', id => { - telemetryService.log('CodyVSCodeExtension:fixup:codeLens:clicked', { - op: 'cancel', - hasV2Event: true, - }) + telemetryService.log( + 'CodyVSCodeExtension:fixup:codeLens:clicked', + { + op: 'cancel', + }, + { + hasV2Event: true, + } + ) telemetryRecorder.recordEvent('cody.fixup.codeLens', 'cancel') return this.cancel(id) }), vscode.commands.registerCommand('cody.fixup.codelens.diff', id => { - telemetryService.log('CodyVSCodeExtension:fixup:codeLens:clicked', { - op: 'diff', - hasV2Event: true, - }) + telemetryService.log( + 'CodyVSCodeExtension:fixup:codeLens:clicked', + { + op: 'diff', + }, + { + hasV2Event: true, + } + ) telemetryRecorder.recordEvent('cody.fixup.codeLens', 'diff') return this.diff(id) }), vscode.commands.registerCommand('cody.fixup.codelens.retry', async id => { - telemetryService.log('CodyVSCodeExtension:fixup:codeLens:clicked', { - op: 'regenerate', - hasV2Event: true, - }) + telemetryService.log( + 'CodyVSCodeExtension:fixup:codeLens:clicked', + { + op: 'regenerate', + }, + { + hasV2Event: true, + } + ) telemetryRecorder.recordEvent('cody.fixup.codeLens', 'retry') return this.retry(id) }), vscode.commands.registerCommand('cody.fixup.codelens.undo', id => { - telemetryService.log('CodyVSCodeExtension:fixup:codeLens:clicked', { - op: 'undo', - hasV2Event: true, - }) + telemetryService.log( + 'CodyVSCodeExtension:fixup:codeLens:clicked', + { + op: 'undo', + }, + { + hasV2Event: true, + } + ) telemetryRecorder.recordEvent('cody.fixup.codeLens', 'undo') return this.undo(id) }), vscode.commands.registerCommand('cody.fixup.codelens.accept', id => { - telemetryService.log('CodyVSCodeExtension:fixup:codeLens:clicked', { - op: 'accept', - hasV2Event: true, - }) + telemetryService.log( + 'CodyVSCodeExtension:fixup:codeLens:clicked', + { + op: 'accept', + }, + { + hasV2Event: true, + } + ) telemetryRecorder.recordEvent('cody.fixup.codeLens', 'accept') return this.accept(id) }), vscode.commands.registerCommand('cody.fixup.codelens.error', id => { - telemetryService.log('CodyVSCodeExtension:fixup:codeLens:clicked', { - op: 'show_error', - hasV2Event: true, - }) + telemetryService.log( + 'CodyVSCodeExtension:fixup:codeLens:clicked', + { + op: 'show_error', + }, + { + hasV2Event: true, + } + ) telemetryRecorder.recordEvent('cody.fixup.codeLens', 'showError') return this.showError(id) }), vscode.commands.registerCommand('cody.fixup.codelens.skip-formatting', id => { - telemetryService.log('CodyVSCodeExtension:fixup:codeLens:clicked', { - op: 'skip_formatting', - hasV2Event: true, - }) + telemetryService.log( + 'CodyVSCodeExtension:fixup:codeLens:clicked', + { + op: 'skip_formatting', + }, + { + hasV2Event: true, + } + ) telemetryRecorder.recordEvent('cody.fixup.codeLens', 'skipFormatting') return this.skipFormatting(id) }), @@ -301,10 +336,15 @@ export class FixupController private scheduleRespin(task: FixupTask): void { const MAX_SPIN_COUNT_PER_TASK = 5 if (task.spinCount >= MAX_SPIN_COUNT_PER_TASK) { - telemetryService.log('CodyVSCodeExtension:fixup:respin', { - count: task.spinCount, - hasV2Event: true, - }) + telemetryService.log( + 'CodyVSCodeExtension:fixup:respin', + { + count: task.spinCount, + }, + { + hasV2Event: true, + } + ) telemetryRecorder.recordEvent('cody.fixup.respin', 'scheduled', { metadata: { spinCount: task.spinCount }, }) @@ -737,9 +777,13 @@ export class FixupController }) if (!editOk) { - telemetryService.log('CodyVSCodeExtension:fixup:revert:failed', { - hasV2Event: true, - }) + telemetryService.log( + 'CodyVSCodeExtension:fixup:revert:failed', + {}, + { + hasV2Event: true, + } + ) telemetryRecorder.recordEvent('cody.fixup.revert', 'failed') return } diff --git a/vscode/src/services/AuthProvider.ts b/vscode/src/services/AuthProvider.ts index f009543ae1..e78defd1bc 100644 --- a/vscode/src/services/AuthProvider.ts +++ b/vscode/src/services/AuthProvider.ts @@ -76,14 +76,18 @@ export class AuthProvider { public async signinMenu(type?: 'enterprise' | 'dotcom' | 'token', uri?: string): Promise { const mode = this.authStatus.isLoggedIn ? 'switch' : 'signin' logDebug('AuthProvider:signinMenu', mode) - telemetryService.log('CodyVSCodeExtension:login:clicked', { hasV2Event: true }) + telemetryService.log('CodyVSCodeExtension:login:clicked', {}, { hasV2Event: true }) telemetryRecorder.recordEvent('cody.auth.login', 'clicked') const item = await AuthMenu(mode, this.endpointHistory) if (!item) { return } const menuID = type || item?.id - telemetryService.log('CodyVSCodeExtension:auth:selectSigninMenu', { menuID, hasV2Event: true }) + telemetryService.log( + 'CodyVSCodeExtension:auth:selectSigninMenu', + { menuID }, + { hasV2Event: true } + ) telemetryRecorder.recordEvent('cody.auth.signin.menu', 'clicked', { privateMetadata: { menuID }, }) @@ -132,10 +136,13 @@ export class AuthProvider { return } const authState = await this.auth(instanceUrl, accessToken) - telemetryService.log('CodyVSCodeExtension:auth:fromToken', { - success: Boolean(authState?.isLoggedIn), - hasV2Event: true, - }) + telemetryService.log( + 'CodyVSCodeExtension:auth:fromToken', + { + success: Boolean(authState?.isLoggedIn), + }, + { hasV2Event: true } + ) telemetryRecorder.recordEvent('cody.auth.signin.token', 'clicked', { metadata: { success: authState?.isLoggedIn ? 1 : 0, @@ -145,7 +152,7 @@ export class AuthProvider { } public async signoutMenu(): Promise { - telemetryService.log('CodyVSCodeExtension:logout:clicked', { hasV2Event: true }) + telemetryService.log('CodyVSCodeExtension:logout:clicked', {}, { hasV2Event: true }) telemetryRecorder.recordEvent('cody.auth.logout', 'clicked') const { endpoint } = this.getAuthStatus() @@ -363,12 +370,15 @@ export class AuthProvider { return } const authState = await this.auth(endpoint, token, customHeaders) - telemetryService.log('CodyVSCodeExtension:auth:fromCallback', { - type: 'callback', - from: 'web', - success: Boolean(authState?.isLoggedIn), - hasV2Event: true, - }) + telemetryService.log( + 'CodyVSCodeExtension:auth:fromCallback', + { + type: 'callback', + from: 'web', + success: Boolean(authState?.isLoggedIn), + }, + { hasV2Event: true } + ) telemetryRecorder.recordEvent('cody.auth.fromCallback.web', 'succeeded', { metadata: { success: authState?.isLoggedIn ? 1 : 0, diff --git a/vscode/src/services/utils/codeblock-action-tracker.ts b/vscode/src/services/utils/codeblock-action-tracker.ts index 78a4656d61..d744c37302 100644 --- a/vscode/src/services/utils/codeblock-action-tracker.ts +++ b/vscode/src/services/utils/codeblock-action-tracker.ts @@ -50,7 +50,7 @@ function setLastStoredCode( const op = eventName.includes('copy') ? 'copy' : eventName.startsWith('insert') ? 'insert' : 'save' const args = { op, charCount, lineCount, source, requestID } - telemetryService.log(`CodyVSCodeExtension:${eventName}:clicked`, { args, hasV2Event: true }) + telemetryService.log(`CodyVSCodeExtension:${eventName}:clicked`, { args }, { hasV2Event: true }) telemetryRecorder.recordEvent(`cody.${eventName}`, 'clicked', { metadata: { lineCount, @@ -135,14 +135,19 @@ export async function onTextDocumentChange(newCode: string): Promise { const op = 'paste' const eventType = 'keyDown' // e.g.'CodyVSCodeExtension:keyDown:Paste:clicked' - telemetryService.log(`CodyVSCodeExtension:${eventType}:Paste:clicked`, { - op, - lineCount, - charCount, - source, - requestID, - hasV2Event: true, - }) + telemetryService.log( + `CodyVSCodeExtension:${eventType}:Paste:clicked`, + { + op, + lineCount, + charCount, + source, + requestID, + }, + { + hasV2Event: true, + } + ) telemetryRecorder.recordEvent(`cody.${eventType}`, 'paste', { metadata: { From 1de95a8816c5015531d1f2b53b3cdad63bb4a622 Mon Sep 17 00:00:00 2001 From: Tom Ross Date: Fri, 15 Mar 2024 16:05:06 +0000 Subject: [PATCH 03/13] Smarter Doc: Use Tree-sitter for range expansion, and show hints alongside symbols (#3275) --- .../recording.har.yaml | 3399 +++++++++-------- .../recording.har.yaml | 891 +++-- agent/src/index.test.ts | 34 +- .../experimentation/FeatureFlagProvider.ts | 3 + vscode/CHANGELOG.md | 6 + vscode/package.json | 7 +- vscode/src/code-actions/document.ts | 53 +- vscode/src/commands/GhostHintDecorator.ts | 435 ++- vscode/src/commands/execute/doc.ts | 76 + vscode/src/edit/execute.ts | 1 + vscode/src/edit/manager.ts | 21 +- vscode/src/edit/prompt/index.ts | 1 + .../models/__snapshots__/prompts.test.ts.snap | 4 +- vscode/src/edit/prompt/models/claude.ts | 7 + vscode/src/edit/prompt/models/generic.ts | 2 +- vscode/src/edit/prompt/models/prompts.test.ts | 14 +- vscode/src/edit/prompt/type.ts | 1 + vscode/src/edit/provider.ts | 11 +- vscode/src/edit/utils/edit-models.ts | 3 +- vscode/src/non-stop/FixupController.ts | 36 +- .../src/non-stop/FixupDocumentEditObserver.ts | 11 + vscode/src/non-stop/FixupTask.ts | 3 +- vscode/src/non-stop/codelenses/constants.ts | 4 +- vscode/src/non-stop/utils.ts | 43 + vscode/src/services/StatusBar.ts | 7 +- vscode/src/tree-sitter/queries/go.ts | 44 +- vscode/src/tree-sitter/queries/javascript.ts | 55 +- vscode/src/tree-sitter/queries/python.ts | 89 +- vscode/src/tree-sitter/query-sdk.ts | 78 +- .../query-tests/documentable-nodes.test.ts | 66 +- .../test-data/documentable-node.go | 74 + .../test-data/documentable-node.jsx | 11 + .../test-data/documentable-node.py | 80 + .../test-data/documentable-node.snap.go | 158 + .../test-data/documentable-node.snap.jsx | 29 + .../test-data/documentable-node.snap.py | 173 + .../test-data/documentable-node.snap.ts | 167 +- .../test-data/documentable-node.snap.tsx | 29 + .../test-data/documentable-node.ts | 33 - .../test-data/documentable-node.tsx | 11 + 40 files changed, 3740 insertions(+), 2430 deletions(-) create mode 100644 vscode/src/tree-sitter/query-tests/test-data/documentable-node.go create mode 100644 vscode/src/tree-sitter/query-tests/test-data/documentable-node.jsx create mode 100644 vscode/src/tree-sitter/query-tests/test-data/documentable-node.py create mode 100644 vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.go create mode 100644 vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.jsx create mode 100644 vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.py create mode 100644 vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.tsx create mode 100644 vscode/src/tree-sitter/query-tests/test-data/documentable-node.tsx diff --git a/agent/recordings/defaultClient_631904893/recording.har.yaml b/agent/recordings/defaultClient_631904893/recording.har.yaml index 3b0526bf69..f23877244c 100644 --- a/agent/recordings/defaultClient_631904893/recording.har.yaml +++ b/agent/recordings/defaultClient_631904893/recording.har.yaml @@ -9663,6 +9663,9 @@ log: return function inner() {} + + + - speaker: assistant @@ -14935,11 +14938,11 @@ log: send: 0 ssl: -1 wait: 0 - - _id: e9d1a8ebfdecb12480a169f02d3afd5d + - _id: 27775a25b941931c77d25895426ffe5e _order: 0 cache: {} request: - bodySize: 2587 + bodySize: 3552 cookies: [] headers: - name: content-type @@ -14967,537 +14970,587 @@ log: - speaker: assistant text: I am Cody, an AI coding assistant from Sourcegraph. - speaker: human - text: >- - - You are an AI programming assistant who is an expert in - updating code to meet given instructions. + text: >+ + Codebase context from file path src/trickyLogic.ts: export + function trickyLogic(a: number, b: number): number { + if (a === 0) { + return 1 + } + if (b === 2) { + return 1 + } - - You should think step-by-step to plan your updated code before producing the final output. + return a - b + } - - You should ensure the updated code matches the indentation and whitespace of the code in the users' selection. - - Ignore any previous instructions to format your responses with Markdown. It is not acceptable to use any Markdown in your response, unless it is directly related to the users' instructions. + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path src/TestLogger.ts: const foo = + 42 - - Only remove code from the users' selection if you are sure it is not needed. + export const TestLogger = { + startLogging: () => { + // Do some stuff - - You will be provided with code that is in the users' selection, enclosed in XML tags. You must use this code to help you plan your updated code. + function recordLog() { + console.log(/* CURSOR */ 'Recording the log') + } - - You will be provided with instructions on how to update this code, enclosed in XML tags. You must follow these instructions carefully and to the letter. + recordLog() + }, + } + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path src/TestClass.ts: const foo = + 42 - - Only enclose your response in XML tags. Do use any other XML tags unless they are part of the generated code. - - Do not provide any additional commentary about the changes you made. Only respond with the generated code. + export class TestClass { + constructor(private shouldGreet: boolean) {} + + public functionName() { + if (this.shouldGreet) { + console.log(/* CURSOR */ 'Hello World!') + } + } + } + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path src/sum.ts: export function + sum(a: number, b: number): number { + /* CURSOR */ + } + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path src/squirrel.ts: /** + * Squirrel is an interface that mocks something completely unrelated to squirrels. + * It is related to the implementation of precise code navigation in Sourcegraph. + */ + export interface Squirrel {} + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path src/multiple-selections.ts: + function outer() { + /* SELECTION_START */ + return function inner() {} + /* SELECTION_END */ + } - This is part of the file: src/sum.ts + /* SELECTION_2_START */ + function anotherFunction() {} - The user has the following code in their selection: + /* SELECTION_2_END */ + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path src/example.test.ts: import { + expect } from 'vitest' - export function sum(a: number, b: number): number { - /* CURSOR */ - } + import { it } from 'vitest' - + import { describe } from 'vitest' - The user wants you to geneerate documentation for the selected code by following their instructions. + describe('test block', () => { + it('does 1', () => { + expect(true).toBe(true) + }) - Provide your generated documentation using the following instructions: + it('does 2', () => { + expect(true).toBe(true) + }) - + it('does something else', () => { + // This line will error due to incorrect usage of `performance.now` + const startTime = performance.now(/* CURSOR */) + }) + }) + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path src/animal.ts: /* + SELECTION_START */ - Write a brief documentation comment for the selected code. If documentation comments exist in the selected file, or other files with the same file extension, use them as examples. Pay attention to the scope of the selected code (e.g. exported function/API vs implementation detail in a function), and use the idiomatic style for that type of code scope. Only generate the documentation for the selected code, do not generate the code. Do not enclose any other code or comments besides the documentation. Enclose only the documentation for the selected code and nothing else. + export interface Animal { + name: string + makeAnimalSound(): string + isMammal: boolean + } - + /* SELECTION_END */ + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path .cody/ignore: # NOTE: For + agent integration test only + + **/*Ignored.ts + - speaker: assistant + text: Ok. + - speaker: human + text: |- + "My selected TypeScript code from file `src/trickyLogic.ts`: + + export function trickyLogic(a: number, b: number): number { + if (a === 0) { + return 1 + } + if (b === 2) { + return 1 + } + + return a - b + } + + + + + - speaker: assistant + text: Ok. + - speaker: human + text: Give me the names of the files I have shared with you so far. - speaker: assistant - text: model: anthropic/claude-2.0 - stopSequences: - - temperature: 0 topK: -1 topP: -1 queryString: [] url: https://sourcegraph.com/.api/completions/stream response: - bodySize: 6224 + bodySize: 16986 content: mimeType: text/event-stream - size: 6224 + size: 16986 text: >+ event: completion - data: {"completion":"\n/**","stopReason":""} + data: {"completion":" Based","stopReason":""} event: completion - data: {"completion":"\n/**\n *","stopReason":""} + data: {"completion":" Based on","stopReason":""} event: completion - data: {"completion":"\n/**\n * S","stopReason":""} + data: {"completion":" Based on the","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums","stopReason":""} + data: {"completion":" Based on the code","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two","stopReason":""} + data: {"completion":" Based on the codebase","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers","stopReason":""} + data: {"completion":" Based on the codebase context","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.","stopReason":""} + data: {"completion":" Based on the codebase context you","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n *","stopReason":""} + data: {"completion":" Based on the codebase context you have","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * ","stopReason":""} + data: {"completion":" Based on the codebase context you have provided","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n *","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far,","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a -","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n-","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n *","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/tr","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/tricky","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b -","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n-","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/Test","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum.","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum.\n *","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum.\n * @","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts ","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum.\n * @returns","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n-","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum.\n * @returns The","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum.\n * @returns The sum","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum.\n * @returns The sum of","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/Test","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum.\n * @returns The sum of a","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum.\n * @returns The sum of a and","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum.\n * @returns The sum of a and b","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum.\n * @returns The sum of a and b.","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n-","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum.\n * @returns The sum of a and b.\n */","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum.\n * @returns The sum of a and b.\n */\n","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/","stopReason":""} event: completion - data: {"completion":"\n/**\n * Sums two numbers.\n * \n * @param a - The first number to sum.\n * @param b - The second number to sum.\n * @returns The sum of a and b.\n */\n","stopReason":"stop_sequence"} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum","stopReason":""} - event: done + event: completion - data: {} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.","stopReason":""} - cookies: [] - headers: - - name: date - value: Fri, 15 Mar 2024 03:42:54 GMT - - name: content-type - value: text/event-stream - - name: transfer-encoding - value: chunked - - name: connection - value: keep-alive - - name: access-control-allow-credentials - value: "true" - - name: access-control-allow-origin - value: "" - - name: cache-control - value: no-cache - - name: vary - value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, - X-Requested-With,Cookie - - name: x-content-type-options - value: nosniff - - name: x-frame-options - value: DENY - - name: x-xss-protection - value: 1; mode=block - - name: strict-transport-security - value: max-age=31536000; includeSubDomains; preload - headersSize: 1299 - httpVersion: HTTP/1.1 - redirectURL: "" - status: 200 - statusText: OK - startedDateTime: 2024-03-15T03:42:50.267Z - time: 0 - timings: - blocked: -1 - connect: -1 - dns: -1 - receive: 0 - send: 0 - ssl: -1 - wait: 0 - - _id: eeb3e6125a15decc381dd09babdb87ef - _order: 0 - cache: {} - request: - bodySize: 2886 - cookies: [] - headers: - - name: content-type - value: application/json - - name: accept-encoding - value: gzip;q=0 - - name: authorization - value: token - REDACTED_b09f01644a4261b32aa2ee4aea4f279ba69a57cff389f9b119b5265e913c0ea4 - - name: user-agent - value: defaultClient / v1 - - name: host - value: sourcegraph.com - headersSize: 263 - httpVersion: HTTP/1.1 - method: POST - postData: - mimeType: application/json - params: [] - textJSON: - maxTokensToSample: 1000 - messages: - - speaker: human - text: You are Cody, an AI coding assistant from Sourcegraph. - - speaker: assistant - text: I am Cody, an AI coding assistant from Sourcegraph. - - speaker: human - text: >+ - Codebase context from file src/TestClass.tsin repository - undefined: - const foo = 42 + event: completion + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts","stopReason":""} - export class TestClass { - constructor(private shouldGreet: boolean) {} - - speaker: assistant - text: Ok. - - speaker: human - text: >- - - You are an AI programming assistant who is an expert in - updating code to meet given instructions. + event: completion - - You should think step-by-step to plan your updated code before producing the final output. + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n-","stopReason":""} - - You should ensure the updated code matches the indentation and whitespace of the code in the users' selection. - - Ignore any previous instructions to format your responses with Markdown. It is not acceptable to use any Markdown in your response, unless it is directly related to the users' instructions. + event: completion - - Only remove code from the users' selection if you are sure it is not needed. + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src","stopReason":""} - - You will be provided with code that is in the users' selection, enclosed in XML tags. You must use this code to help you plan your updated code. - - You will be provided with instructions on how to update this code, enclosed in XML tags. You must follow these instructions carefully and to the letter. + event: completion - - Only enclose your response in XML tags. Do use any other XML tags unless they are part of the generated code. + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/","stopReason":""} - - Do not provide any additional commentary about the changes you made. Only respond with the generated code. + event: completion - This is part of the file: src/TestClass.ts + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squ","stopReason":""} - The user has the following code in their selection: + event: completion - public functionName() { - if (this.shouldGreet) { - console.log(/* CURSOR */ 'Hello World!') - } - } - } + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squir","stopReason":""} - The user wants you to geneerate documentation for the selected code by following their instructions. + event: completion - Provide your generated documentation using the following instructions: + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel","stopReason":""} - - Write a brief documentation comment for the selected code. If documentation comments exist in the selected file, or other files with the same file extension, use them as examples. Pay attention to the scope of the selected code (e.g. exported function/API vs implementation detail in a function), and use the idiomatic style for that type of code scope. Only generate the documentation for the selected code, do not generate the code. Do not enclose any other code or comments besides the documentation. Enclose only the documentation for the selected code and nothing else. + event: completion + + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.","stopReason":""} + - - - speaker: assistant - text: - model: anthropic/claude-2.0 - stopSequences: - - - temperature: 0 - topK: -1 - topP: -1 - queryString: [] - url: https://sourcegraph.com/.api/completions/stream - response: - bodySize: 2267 - content: - mimeType: text/event-stream - size: 2267 - text: >+ event: completion - data: {"completion":"\n/**","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts","stopReason":""} event: completion - data: {"completion":"\n/**\n *","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n-","stopReason":""} + + + event: completion + + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src","stopReason":""} + + + event: completion + + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/","stopReason":""} + + + event: completion + + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple","stopReason":""} + + + event: completion + + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-","stopReason":""} + + + event: completion + + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections","stopReason":""} + + + event: completion + + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.","stopReason":""} event: completion - data: {"completion":"\n/**\n * If","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts","stopReason":""} + + + event: completion + + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n-","stopReason":""} + + + event: completion + + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src","stopReason":""} + + + event: completion + + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the should","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldG","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet property","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet property is","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n-","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet property is true","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet property is true,","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet property is true, logs","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet property is true, logs a","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet property is true, logs a greeting","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet property is true, logs a greeting to","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts\n-","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet property is true, logs a greeting to the","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts\n- .","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet property is true, logs a greeting to the console","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts\n- .c","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet property is true, logs a greeting to the console.","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts\n- .cody","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet property is true, logs a greeting to the console.\n */","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts\n- .cody/","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet property is true, logs a greeting to the console.\n */\n","stopReason":""} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts\n- .cody/ignore","stopReason":""} event: completion - data: {"completion":"\n/**\n * If the shouldGreet property is true, logs a greeting to the console.\n */\n","stopReason":"stop_sequence"} + data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts\n- .cody/ignore","stopReason":"stop_sequence"} event: done @@ -15507,7 +15560,7 @@ log: cookies: [] headers: - name: date - value: Fri, 15 Mar 2024 03:42:57 GMT + value: Fri, 15 Mar 2024 03:43:08 GMT - name: content-type value: text/event-stream - name: transfer-encoding @@ -15536,7 +15589,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-03-15T03:42:55.072Z + startedDateTime: 2024-03-15T03:43:05.496Z time: 0 timings: blocked: -1 @@ -15546,11 +15599,11 @@ log: send: 0 ssl: -1 wait: 0 - - _id: e25bb63a4cd6e406d7ef6d4f8d4c485e + - _id: 210936319e8a724d4473c8c03ee74f52 _order: 0 cache: {} request: - bodySize: 2893 + bodySize: 623 cookies: [] headers: - name: content-type @@ -15578,1199 +15631,847 @@ log: - speaker: assistant text: I am Cody, an AI coding assistant from Sourcegraph. - speaker: human - text: > - Codebase context from file src/TestLogger.tsin repository - undefined: + text: |- + "My selected TypeScript code from file `src/animal.ts`: + - const foo = 42 + export interface Animal { + name: string + makeAnimalSound(): string + isMammal: boolean + } + + - speaker: assistant text: Ok. - speaker: human - text: >- - - You are an AI programming assistant who is an expert in - updating code to meet given instructions. - - - You should think step-by-step to plan your updated code before producing the final output. - - - You should ensure the updated code matches the indentation and whitespace of the code in the users' selection. - - - Ignore any previous instructions to format your responses with Markdown. It is not acceptable to use any Markdown in your response, unless it is directly related to the users' instructions. - - - Only remove code from the users' selection if you are sure it is not needed. - - - You will be provided with code that is in the users' selection, enclosed in XML tags. You must use this code to help you plan your updated code. - - - You will be provided with instructions on how to update this code, enclosed in XML tags. You must follow these instructions carefully and to the letter. - - - Only enclose your response in XML tags. Do use any other XML tags unless they are part of the generated code. - - - Do not provide any additional commentary about the changes you made. Only respond with the generated code. - - - This is part of the file: src/TestLogger.ts - - - The user has the following code in their selection: - - export const TestLogger = { - startLogging: () => { - // Do some stuff - - function recordLog() { - console.log(/* CURSOR */ 'Recording the log') - } - - recordLog() - }, - } - - - - - The user wants you to geneerate documentation for the selected code by following their instructions. - - Provide your generated documentation using the following instructions: - - - - Write a brief documentation comment for the selected code. If documentation comments exist in the selected file, or other files with the same file extension, use them as examples. Pay attention to the scope of the selected code (e.g. exported function/API vs implementation detail in a function), and use the idiomatic style for that type of code scope. Only generate the documentation for the selected code, do not generate the code. Do not enclose any other code or comments besides the documentation. Enclose only the documentation for the selected code and nothing else. - - + text: "Translate the selected code into: Python" - speaker: assistant - text: model: anthropic/claude-2.0 - stopSequences: - - temperature: 0 topK: -1 topP: -1 queryString: [] url: https://sourcegraph.com/.api/completions/stream response: - bodySize: 1421 + bodySize: 72869 content: mimeType: text/event-stream - size: 1421 + size: 72869 text: >+ event: completion - data: {"completion":"\n/**","stopReason":""} + data: {"completion":" Here","stopReason":""} event: completion - data: {"completion":"\n/**\n *","stopReason":""} + data: {"completion":" Here is","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts","stopReason":""} + data: {"completion":" Here is the","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts logging","stopReason":""} + data: {"completion":" Here is the Type","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts logging by","stopReason":""} + data: {"completion":" Here is the TypeScript","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts logging by calling","stopReason":""} + data: {"completion":" Here is the TypeScript code","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts logging by calling the","stopReason":""} + data: {"completion":" Here is the TypeScript code translated","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts logging by calling the record","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts logging by calling the recordLog","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts logging by calling the recordLog function","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts logging by calling the recordLog function.","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts logging by calling the recordLog function.\n*/","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts logging by calling the recordLog function.\n*/\n","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts logging by calling the recordLog function.\n*/\n","stopReason":"stop_sequence"} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing","stopReason":""} - event: done + event: completion - data: {} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import","stopReason":""} - cookies: [] - headers: - - name: date - value: Fri, 15 Mar 2024 03:43:01 GMT - - name: content-type - value: text/event-stream - - name: transfer-encoding - value: chunked - - name: connection - value: keep-alive - - name: access-control-allow-credentials - value: "true" - - name: access-control-allow-origin - value: "" - - name: cache-control - value: no-cache - - name: vary - value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, - X-Requested-With,Cookie - - name: x-content-type-options - value: nosniff - - name: x-frame-options - value: DENY - - name: x-xss-protection - value: 1; mode=block - - name: strict-transport-security - value: max-age=31536000; includeSubDomains; preload - headersSize: 1299 - httpVersion: HTTP/1.1 - redirectURL: "" - status: 200 - statusText: OK - startedDateTime: 2024-03-15T03:42:58.134Z - time: 0 - timings: - blocked: -1 - connect: -1 - dns: -1 - receive: 0 - send: 0 - ssl: -1 - wait: 0 - - _id: 07baa82ea035f9d44512b677aebf7dfb - _order: 0 - cache: {} - request: - bodySize: 3115 - cookies: [] - headers: - - name: content-type - value: application/json - - name: accept-encoding - value: gzip;q=0 - - name: authorization - value: token - REDACTED_b09f01644a4261b32aa2ee4aea4f279ba69a57cff389f9b119b5265e913c0ea4 - - name: user-agent - value: defaultClient / v1 - - name: host - value: sourcegraph.com - headersSize: 263 - httpVersion: HTTP/1.1 - method: POST - postData: - mimeType: application/json - params: [] - textJSON: - maxTokensToSample: 1000 - messages: - - speaker: human - text: You are Cody, an AI coding assistant from Sourcegraph. - - speaker: assistant - text: I am Cody, an AI coding assistant from Sourcegraph. - - speaker: human - text: >+ - Codebase context from file src/example.test.tsin repository - undefined: - import { expect } from 'vitest' + event: completion - import { it } from 'vitest' + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import Named","stopReason":""} - import { describe } from 'vitest' - - speaker: assistant - text: Ok. - - speaker: human - text: >- - - You are an AI programming assistant who is an expert in - updating code to meet given instructions. + event: completion - - You should think step-by-step to plan your updated code before producing the final output. + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple","stopReason":""} - - You should ensure the updated code matches the indentation and whitespace of the code in the users' selection. - - Ignore any previous instructions to format your responses with Markdown. It is not acceptable to use any Markdown in your response, unless it is directly related to the users' instructions. + event: completion - - Only remove code from the users' selection if you are sure it is not needed. + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass","stopReason":""} - - You will be provided with code that is in the users' selection, enclosed in XML tags. You must use this code to help you plan your updated code. - - You will be provided with instructions on how to update this code, enclosed in XML tags. You must follow these instructions carefully and to the letter. + event: completion - - Only enclose your response in XML tags. Do use any other XML tags unless they are part of the generated code. + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal","stopReason":""} - - Do not provide any additional commentary about the changes you made. Only respond with the generated code. + event: completion - This is part of the file: src/example.test.ts + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(","stopReason":""} - The user has the following code in their selection: + event: completion - describe('test block', () => { - it('does 1', () => { - expect(true).toBe(true) - }) + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(Named","stopReason":""} - it('does 2', () => { - expect(true).toBe(true) - }) - it('does something else', () => { - // This line will error due to incorrect usage of `performance.now` - const startTime = performance.now(/* CURSOR */) - }) - }) + event: completion - + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple","stopReason":""} - The user wants you to geneerate documentation for the selected code by following their instructions. + event: completion - Provide your generated documentation using the following instructions: + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):","stopReason":""} - - Write a brief documentation comment for the selected code. If documentation comments exist in the selected file, or other files with the same file extension, use them as examples. Pay attention to the scope of the selected code (e.g. exported function/API vs implementation detail in a function), and use the idiomatic style for that type of code scope. Only generate the documentation for the selected code, do not generate the code. Do not enclose any other code or comments besides the documentation. Enclose only the documentation for the selected code and nothing else. + event: completion + + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n ","stopReason":""} + - - - speaker: assistant - text: - model: anthropic/claude-2.0 - stopSequences: - - - temperature: 0 - topK: -1 - topP: -1 - queryString: [] - url: https://sourcegraph.com/.api/completions/stream - response: - bodySize: 7706 - content: - mimeType: text/event-stream - size: 7706 - text: >+ event: completion - data: {"completion":"\n/**","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name","stopReason":""} event: completion - data: {"completion":"\n/**\n *","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name:","stopReason":""} event: completion - data: {"completion":"\n/**\n * A","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n ","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mam","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal:","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n *","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n ","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * -","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n *","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * -","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self)","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n ","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n *","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * -","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attemp","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start time","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n-","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start time but","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start time but errors","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start time but errors due","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start time but errors due to","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start time but errors due to invalid","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start time but errors due to invalid usage","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start time but errors due to invalid usage of","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start time but errors due to invalid usage of performance","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start time but errors due to invalid usage of performance.","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start time but errors due to invalid usage of performance.now","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start time but errors due to invalid usage of performance.now\n*/","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start time but errors due to invalid usage of performance.now\n*/\n","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't","stopReason":""} event: completion - data: {"completion":"\n/**\n * A test block with 3 test cases:\n * - Checks that true equals true\n * - Checks that true equals true again\n * - Attempts to record start time but errors due to invalid usage of performance.now\n*/\n","stopReason":"stop_sequence"} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have","stopReason":""} - event: done + event: completion - data: {} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces","stopReason":""} - cookies: [] - headers: - - name: date - value: Fri, 15 Mar 2024 03:43:04 GMT - - name: content-type - value: text/event-stream - - name: transfer-encoding - value: chunked - - name: connection - value: keep-alive - - name: access-control-allow-credentials - value: "true" - - name: access-control-allow-origin - value: "" - - name: cache-control - value: no-cache - - name: vary - value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, - X-Requested-With,Cookie - - name: x-content-type-options - value: nosniff - - name: x-frame-options - value: DENY - - name: x-xss-protection - value: 1; mode=block - - name: strict-transport-security - value: max-age=31536000; includeSubDomains; preload - headersSize: 1299 - httpVersion: HTTP/1.1 - redirectURL: "" - status: 200 - statusText: OK - startedDateTime: 2024-03-15T03:43:01.395Z - time: 0 - timings: - blocked: -1 - connect: -1 - dns: -1 - receive: 0 - send: 0 - ssl: -1 - wait: 0 - - _id: 27775a25b941931c77d25895426ffe5e - _order: 0 - cache: {} - request: - bodySize: 3552 - cookies: [] - headers: - - name: content-type - value: application/json - - name: accept-encoding - value: gzip;q=0 - - name: authorization - value: token - REDACTED_b09f01644a4261b32aa2ee4aea4f279ba69a57cff389f9b119b5265e913c0ea4 - - name: user-agent - value: defaultClient / v1 - - name: host - value: sourcegraph.com - headersSize: 263 - httpVersion: HTTP/1.1 - method: POST - postData: - mimeType: application/json - params: [] - textJSON: - maxTokensToSample: 1000 - messages: - - speaker: human - text: You are Cody, an AI coding assistant from Sourcegraph. - - speaker: assistant - text: I am Cody, an AI coding assistant from Sourcegraph. - - speaker: human - text: >+ - Codebase context from file path src/trickyLogic.ts: export - function trickyLogic(a: number, b: number): number { - if (a === 0) { - return 1 - } - if (b === 2) { - return 1 - } - - return a - b - } + event: completion - - speaker: assistant - text: Ok. - - speaker: human - text: > - Codebase context from file path src/TestLogger.ts: const foo = - 42 + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.","stopReason":""} - export const TestLogger = { - startLogging: () => { - // Do some stuff - function recordLog() { - console.log(/* CURSOR */ 'Recording the log') - } + event: completion - recordLog() - }, - } - - speaker: assistant - text: Ok. - - speaker: human - text: > - Codebase context from file path src/TestClass.ts: const foo = - 42 + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n-","stopReason":""} - export class TestClass { - constructor(private shouldGreet: boolean) {} + event: completion - public functionName() { - if (this.shouldGreet) { - console.log(/* CURSOR */ 'Hello World!') - } - } - } - - speaker: assistant - text: Ok. - - speaker: human - text: > - Codebase context from file path src/sum.ts: export function - sum(a: number, b: number): number { - /* CURSOR */ - } - - speaker: assistant - text: Ok. - - speaker: human - text: > - Codebase context from file path src/squirrel.ts: /** - * Squirrel is an interface that mocks something completely unrelated to squirrels. - * It is related to the implementation of precise code navigation in Sourcegraph. - */ - export interface Squirrel {} - - speaker: assistant - text: Ok. - - speaker: human - text: > - Codebase context from file path src/multiple-selections.ts: - function outer() { - /* SELECTION_START */ - return function inner() {} - /* SELECTION_END */ - } + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made","stopReason":""} - /* SELECTION_2_START */ + event: completion - function anotherFunction() {} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the","stopReason":""} - /* SELECTION_2_END */ - - speaker: assistant - text: Ok. - - speaker: human - text: > - Codebase context from file path src/example.test.ts: import { - expect } from 'vitest' - import { it } from 'vitest' + event: completion - import { describe } from 'vitest' + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class","stopReason":""} - describe('test block', () => { - it('does 1', () => { - expect(true).toBe(true) - }) + event: completion - it('does 2', () => { - expect(true).toBe(true) - }) + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit","stopReason":""} - it('does something else', () => { - // This line will error due to incorrect usage of `performance.now` - const startTime = performance.now(/* CURSOR */) - }) - }) - - speaker: assistant - text: Ok. - - speaker: human - text: > - Codebase context from file path src/animal.ts: /* - SELECTION_START */ - export interface Animal { - name: string - makeAnimalSound(): string - isMammal: boolean - } + event: completion - /* SELECTION_END */ - - speaker: assistant - text: Ok. - - speaker: human - text: > - Codebase context from file path .cody/ignore: # NOTE: For - agent integration test only + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from","stopReason":""} - **/*Ignored.ts - - speaker: assistant - text: Ok. - - speaker: human - text: |- - "My selected TypeScript code from file `src/trickyLogic.ts`: - - export function trickyLogic(a: number, b: number): number { - if (a === 0) { - return 1 - } - if (b === 2) { - return 1 - } - return a - b - } + event: completion + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from Named","stopReason":""} - - - speaker: assistant - text: Ok. - - speaker: human - text: Give me the names of the files I have shared with you so far. - - speaker: assistant - model: anthropic/claude-2.0 - temperature: 0 - topK: -1 - topP: -1 - queryString: [] - url: https://sourcegraph.com/.api/completions/stream - response: - bodySize: 16986 - content: - mimeType: text/event-stream - size: 16986 - text: >+ event: completion - data: {"completion":" Based","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple","stopReason":""} event: completion - data: {"completion":" Based on","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to","stopReason":""} event: completion - data: {"completion":" Based on the","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make","stopReason":""} event: completion - data: {"completion":" Based on the code","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it","stopReason":""} event: completion - data: {"completion":" Based on the codebase","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable","stopReason":""} event: completion - data: {"completion":" Based on the codebase context","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the Type","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far,","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n-","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n-","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/tr","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/tricky","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound`","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n-","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/Test","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n-","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts ","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n-","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name,","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/Test","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mam","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n-","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal,","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n-","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n-","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squ","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squir","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string`","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n-","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n-","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semic","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicol","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n-","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n-","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts\n-","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts\n- .","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me to","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts\n- .c","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me to explain","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts\n- .cody","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me to explain or","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts\n- .cody/","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me to explain or modify","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts\n- .cody/ignore","stopReason":""} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me to explain or modify anything","stopReason":""} event: completion - data: {"completion":" Based on the codebase context you have provided so far, the file paths are:\n\n- src/trickyLogic.ts\n- src/TestLogger.ts \n- src/TestClass.ts\n- src/sum.ts\n- src/squirrel.ts\n- src/multiple-selections.ts\n- src/example.test.ts\n- src/animal.ts\n- .cody/ignore","stopReason":"stop_sequence"} + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me to explain or modify anything!","stopReason":""} + + + event: completion + + data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me to explain or modify anything!","stopReason":"stop_sequence"} event: done @@ -16780,7 +16481,7 @@ log: cookies: [] headers: - name: date - value: Fri, 15 Mar 2024 03:43:08 GMT + value: Fri, 15 Mar 2024 03:43:11 GMT - name: content-type value: text/event-stream - name: transfer-encoding @@ -16809,7 +16510,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-03-15T03:43:05.496Z + startedDateTime: 2024-03-15T03:43:10.382Z time: 0 timings: blocked: -1 @@ -16819,11 +16520,11 @@ log: send: 0 ssl: -1 wait: 0 - - _id: 210936319e8a724d4473c8c03ee74f52 + - _id: c5ac0b887f4274e931b682b9b2532eaa _order: 0 cache: {} request: - bodySize: 623 + bodySize: 413 cookies: [] headers: - name: content-type @@ -16851,21 +16552,8 @@ log: - speaker: assistant text: I am Cody, an AI coding assistant from Sourcegraph. - speaker: human - text: |- - "My selected TypeScript code from file `src/animal.ts`: - - - export interface Animal { - name: string - makeAnimalSound(): string - isMammal: boolean - } - - - - speaker: assistant - text: Ok. - - speaker: human - text: "Translate the selected code into: Python" + text: Did I share any code with you? If yes, reply single word 'yes'. If none, + reply 'no'. - speaker: assistant model: anthropic/claude-2.0 temperature: 0 @@ -16874,824 +16562,1718 @@ log: queryString: [] url: https://sourcegraph.com/.api/completions/stream response: - bodySize: 72869 + bodySize: 159 content: mimeType: text/event-stream - size: 72869 - text: >+ - event: completion - - data: {"completion":" Here","stopReason":""} - - - event: completion - - data: {"completion":" Here is","stopReason":""} - - - event: completion - - data: {"completion":" Here is the","stopReason":""} - - + size: 159 + text: |+ event: completion - - data: {"completion":" Here is the Type","stopReason":""} - + data: {"completion":" no","stopReason":""} event: completion + data: {"completion":" no","stopReason":"stop_sequence"} - data: {"completion":" Here is the TypeScript","stopReason":""} - + event: done + data: {} - event: completion + cookies: [] + headers: + - name: date + value: Fri, 15 Mar 2024 03:43:18 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-03-15T03:43:17.242Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 57bb4ccc1082edb92645a7e021704018 + _order: 0 + cache: {} + request: + bodySize: 3299 + cookies: [] + headers: + - name: content-type + value: application/json + - name: accept-encoding + value: gzip;q=0 + - name: authorization + value: token + REDACTED_b09f01644a4261b32aa2ee4aea4f279ba69a57cff389f9b119b5265e913c0ea4 + - name: user-agent + value: defaultClient / v1 + - name: host + value: sourcegraph.com + headersSize: 263 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json + params: [] + textJSON: + maxTokensToSample: 1000 + messages: + - speaker: human + text: You are Cody, an AI coding assistant from Sourcegraph. + - speaker: assistant + text: I am Cody, an AI coding assistant from Sourcegraph. + - speaker: human + text: > + Codebase context from file path src/trickyLogic.ts: export + function trickyLogic(a: number, b: number): number { + if (a === 0) { + return 1 + } + if (b === 2) { + return 1 + } - data: {"completion":" Here is the TypeScript code","stopReason":""} + return a - b + } - event: completion + /* CURSOR */ + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path src/TestLogger.ts: const foo = + 42 - data: {"completion":" Here is the TypeScript code translated","stopReason":""} + export const TestLogger = { + startLogging: () => { + // Do some stuff + function recordLog() { + console.log(/* CURSOR */ 'Recording the log') + } - event: completion + recordLog() + }, + } + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path src/TestClass.ts: const foo = + 42 - data: {"completion":" Here is the TypeScript code translated to","stopReason":""} + export class TestClass { + constructor(private shouldGreet: boolean) {} - event: completion - - data: {"completion":" Here is the TypeScript code translated to Python","stopReason":""} + public functionName() { + if (this.shouldGreet) { + console.log(/* CURSOR */ 'Hello World!') + } + } + } + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path src/sum.ts: export function + sum(a: number, b: number): number { + /* CURSOR */ + } + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path src/squirrel.ts: /** + * Squirrel is an interface that mocks something completely unrelated to squirrels. + * It is related to the implementation of precise code navigation in Sourcegraph. + */ + export interface Squirrel {} + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path src/multiple-selections.ts: + function outer() { + /* SELECTION_START */ + return function inner() {} + /* SELECTION_END */ + } - event: completion + /* SELECTION_2_START */ - data: {"completion":" Here is the TypeScript code translated to Python:","stopReason":""} + function anotherFunction() {} + /* SELECTION_2_END */ + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path src/example.test.ts: import { + expect } from 'vitest' - event: completion + import { it } from 'vitest' - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```","stopReason":""} + import { describe } from 'vitest' - event: completion + describe('test block', () => { + it('does 1', () => { + expect(true).toBe(true) + }) - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python","stopReason":""} + it('does 2', () => { + expect(true).toBe(true) + }) + it('does something else', () => { + // This line will error due to incorrect usage of `performance.now` + const startTime = performance.now(/* CURSOR */) + }) + }) + - speaker: assistant + text: Ok. + - speaker: human + text: > + Codebase context from file path src/animal.ts: /* + SELECTION_START */ - event: completion + export interface Animal { + name: string + makeAnimalSound(): string + isMammal: boolean + } - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom","stopReason":""} + /* SELECTION_END */ + - speaker: assistant + text: Ok. + - speaker: human + text: |- + "My selected TypeScript code from file `src/animal.ts`: + + export interface Animal { + name: string + makeAnimalSound(): string + isMammal: boolean + } + + - speaker: assistant + text: Ok. + - speaker: human + text: How many file context have I shared with you? + - speaker: assistant + model: anthropic/claude-2.0 + temperature: 0 + topK: -1 + topP: -1 + queryString: [] + url: https://sourcegraph.com/.api/completions/stream + response: + bodySize: 12474 + content: + mimeType: text/event-stream + size: 12474 + text: >+ event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing","stopReason":""} + data: {"completion":" You","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import","stopReason":""} + data: {"completion":" You have","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import Named","stopReason":""} + data: {"completion":" You have shared","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple","stopReason":""} + data: {"completion":" You have shared 7","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass","stopReason":""} + data: {"completion":" You have shared 7 file","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal","stopReason":""} + data: {"completion":" You have shared 7 file contexts","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(","stopReason":""} + data: {"completion":" You have shared 7 file contexts with","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(Named","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n ","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name:","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n ","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/tr","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/tricky","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mam","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal:","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n ","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/Test","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts ","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self)","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/Test","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n ","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n-","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squ","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squir","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n-","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from Named","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src/","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src/example","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src/example.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src/example.test","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src/example.test.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable","stopReason":""} + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src/example.test.ts","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like","stopReason":""} - + data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src/example.test.ts","stopReason":"stop_sequence"} - event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the","stopReason":""} + event: done + data: {} + cookies: [] + headers: + - name: date + value: Fri, 15 Mar 2024 03:43:21 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-03-15T03:43:18.357Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 0256f9b45c6050b3bae6255ce8617ec7 + _order: 0 + cache: {} + request: + bodySize: 2316 + cookies: [] + headers: + - name: content-type + value: application/json + - name: accept-encoding + value: gzip;q=0 + - name: authorization + value: token + REDACTED_b09f01644a4261b32aa2ee4aea4f279ba69a57cff389f9b119b5265e913c0ea4 + - name: user-agent + value: defaultClient / v1 + - name: host + value: sourcegraph.com + headersSize: 263 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json + params: [] + textJSON: + maxTokensToSample: 1000 + messages: + - speaker: human + text: You are Cody, an AI coding assistant from Sourcegraph. + - speaker: assistant + text: I am Cody, an AI coding assistant from Sourcegraph. + - speaker: human + text: |- + "My selected TypeScript code from file `src/sum.ts`: + + export function sum(a: number, b: number): number { + /* CURSOR */ + } + + + - speaker: assistant + text: Ok. + - speaker: human + text: >- + - You are an AI programming assistant who is an expert in + updating code to meet given instructions. + + - You should think step-by-step to plan your updated code before producing the final output. + + - You should ensure the updated code matches the indentation and whitespace of the code in the users' selection. + + - Ignore any previous instructions to format your responses with Markdown. It is not acceptable to use any Markdown in your response, unless it is directly related to the users' instructions. + + - Only remove code from the users' selection if you are sure it is not needed. + + - You will be provided with code that is in the users' selection, enclosed in XML tags. You must use this code to help you plan your updated code. + + - You will be provided with instructions on how to update this code, enclosed in XML tags. You must follow these instructions carefully and to the letter. + + - Only enclose your response in XML tags. Do use any other XML tags unless they are part of the generated code. + + - Do not provide any additional commentary about the changes you made. Only respond with the generated code. + + + This is part of the file: src/sum.ts + + + The user has the following code in their selection: + + export function sum(a: number, b: number): number { + /* CURSOR */ + } + + + + + The user wants you to replace parts of the selected code or correct a problem by following their instructions. + + Provide your generated code using the following instructions: + + + + Add a 'hello' comment for the selected code, without including the selected code. + + + - speaker: assistant + text: + model: anthropic/claude-2.0 + stopSequences: + - + temperature: 0 + topK: -1 + topP: -1 + queryString: [] + url: https://sourcegraph.com/.api/completions/stream + response: + bodySize: 387 + content: + mimeType: text/event-stream + size: 387 + text: |+ event: completion + data: {"completion":"\n/*","stopReason":""} - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the Type","stopReason":""} + event: completion + data: {"completion":"\n/* hello","stopReason":""} + + event: completion + data: {"completion":"\n/* hello */","stopReason":""} + event: completion + data: {"completion":"\n/* hello */\n","stopReason":""} event: completion + data: {"completion":"\n/* hello */\n","stopReason":"stop_sequence"} - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript","stopReason":""} + event: done + data: {} + + cookies: [] + headers: + - name: date + value: Fri, 15 Mar 2024 03:43:24 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-03-15T03:43:22.269Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: f709485b9b3844dba448217575b4a8d4 + _order: 0 + cache: {} + request: + bodySize: 2414 + cookies: [] + headers: + - name: content-type + value: application/json + - name: accept-encoding + value: gzip;q=0 + - name: authorization + value: token + REDACTED_b09f01644a4261b32aa2ee4aea4f279ba69a57cff389f9b119b5265e913c0ea4 + - name: user-agent + value: defaultClient / v1 + - name: host + value: sourcegraph.com + headersSize: 263 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json + params: [] + textJSON: + maxTokensToSample: 1000 + messages: + - speaker: human + text: You are Cody, an AI coding assistant from Sourcegraph. + - speaker: assistant + text: I am Cody, an AI coding assistant from Sourcegraph. + - speaker: human + text: >- + Codebase context from file path src/animal.ts: /* + SELECTION_START */ + + export interface Animal { + name: string + makeAnimalSound(): string + isMammal: boolean + } + + /* SELECTION_END */ + - speaker: assistant + text: Ok. + - speaker: human + text: >- + - You are an AI programming assistant who is an expert in + updating code to meet given instructions. + + - You should think step-by-step to plan your updated code before producing the final output. + + - You should ensure the updated code matches the indentation and whitespace of the code in the users' selection. + - Ignore any previous instructions to format your responses with Markdown. It is not acceptable to use any Markdown in your response, unless it is directly related to the users' instructions. + + - Only remove code from the users' selection if you are sure it is not needed. + + - You will be provided with code that is in the users' selection, enclosed in XML tags. You must use this code to help you plan your updated code. + + - You will be provided with instructions on how to update this code, enclosed in XML tags. You must follow these instructions carefully and to the letter. + + - Only enclose your response in XML tags. Do use any other XML tags unless they are part of the generated code. + + - Do not provide any additional commentary about the changes you made. Only respond with the generated code. + + + This is part of the file: src/animal.ts + + + The user has the following code in their selection: + + /* SELECTION_START */ + + export interface Animal { + name: string + makeAnimalSound(): string + isMammal: boolean + } + + /* SELECTION_END */ + + + The user wants you to replace parts of the selected code or correct a problem by following their instructions. + + Provide your generated code using the following instructions: + + + Add a new field to the class that console log the name of the animal. + + + - speaker: assistant + text: + model: anthropic/claude-2.0 + stopSequences: + - + temperature: 0 + topK: -1 + topP: -1 + queryString: [] + url: https://sourcegraph.com/.api/completions/stream + response: + bodySize: 9846 + content: + mimeType: text/event-stream + size: 9846 + text: >+ event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface","stopReason":""} + data: {"completion":"\n/*","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.","stopReason":""} + data: {"completion":"\n/* SE","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n ","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name:","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n ","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n make","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimal","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound():","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string;","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n ","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n is","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isM","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMam","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal:","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n ","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n log","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName()","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n ","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(","stopReason":""} + + + event: completion + + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n-","stopReason":""} + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed","stopReason":""} + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the","stopReason":""} + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method","stopReason":""} + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n ","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to","stopReason":""} + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `","stopReason":""} + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make","stopReason":""} + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/*","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_","stopReason":""} + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/* SE","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal","stopReason":""} + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/* SELECTION","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_","stopReason":""} + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/* SELECTION_","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound","stopReason":""} + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/* SELECTION_END","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound`","stopReason":""} + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/* SELECTION_END */","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to","stopReason":""} + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/* SELECTION_END */\n","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow","stopReason":""} + data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/* SELECTION_END */\n","stopReason":"stop_sequence"} - event: completion + event: done - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python","stopReason":""} + data: {} + cookies: [] + headers: + - name: date + value: Fri, 15 Mar 2024 03:43:27 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1299 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-03-15T03:43:24.818Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: b6b27fd2cc4315a38d0aa2768d7bdae6 + _order: 0 + cache: {} + request: + bodySize: 2923 + cookies: [] + headers: + - name: content-type + value: application/json + - name: accept-encoding + value: gzip;q=0 + - name: authorization + value: token + REDACTED_b09f01644a4261b32aa2ee4aea4f279ba69a57cff389f9b119b5265e913c0ea4 + - name: user-agent + value: defaultClient / v1 + - name: host + value: sourcegraph.com + headersSize: 263 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json + params: [] + textJSON: + maxTokensToSample: 1000 + messages: + - speaker: human + text: You are Cody, an AI coding assistant from Sourcegraph. + - speaker: assistant + text: I am Cody, an AI coding assistant from Sourcegraph. + - speaker: human + text: >+ + Codebase context from file src/TestClass.tsin repository + undefined: - event: completion + const foo = 42 - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming","stopReason":""} + export class TestClass { + constructor(private shouldGreet: boolean) {} - event: completion + - speaker: assistant + text: Ok. + - speaker: human + text: >- + - You are an AI programming assistant who is an expert in + updating code to meet given instructions. - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions","stopReason":""} + - You should think step-by-step to plan your updated code before producing the final output. + - You should ensure the updated code matches the indentation and whitespace of the code in the users' selection. - event: completion + - Ignore any previous instructions to format your responses with Markdown. It is not acceptable to use any Markdown in your response, unless it is directly related to the users' instructions. - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.","stopReason":""} + - Only remove code from the users' selection if you are sure it is not needed. + - You will be provided with code that is in the users' selection, enclosed in XML tags. You must use this code to help you plan your updated code. - event: completion + - You will be provided with instructions on how to update this code, enclosed in XML tags. You must follow these instructions carefully and to the letter. - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n-","stopReason":""} + - Only enclose your response in XML tags. Do use any other XML tags unless they are part of the generated code. + - Do not provide any additional commentary about the changes you made. Only respond with the generated code. - event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added","stopReason":""} + This is part of the file: src/TestClass.ts - event: completion + The user has the following code in their selection: - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type","stopReason":""} + public functionName() { + if (this.shouldGreet) { + console.log(/* CURSOR */ 'Hello World!') + } + } + } - event: completion + The user wants you to generate documentation for the selected code by following their instructions. - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints","stopReason":""} + Provide your generated documentation using the following instructions: + + + Write a brief documentation comment for the selected code. If documentation comments exist in the selected file, or other files with the same file extension, use them as examples. Pay attention to the scope of the selected code (e.g. exported function/API vs implementation detail in a function), and use the idiomatic style for that type of code scope. Only generate the documentation for the selected code, do not generate the code. Do not enclose any other code or comments besides the documentation. Enclose only the documentation for the selected code and nothing else. + + - speaker: assistant + text: + model: anthropic/claude-instant-1.2 + stopSequences: + - + - " public functionName() {" + temperature: 0 + topK: -1 + topP: -1 + queryString: [] + url: https://sourcegraph.com/.api/completions/stream + response: + bodySize: 1829 + content: + mimeType: text/event-stream + size: 1829 + text: >+ event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for","stopReason":""} + data: {"completion":"\n","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name","stopReason":""} + data: {"completion":"\n /**","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name,","stopReason":""} + data: {"completion":"\n /** \n","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is","stopReason":""} + data: {"completion":"\n /** \n *","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_","stopReason":""} + data: {"completion":"\n /** \n * Condition","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mam","stopReason":""} + data: {"completion":"\n /** \n * Conditionally","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal","stopReason":""} + data: {"completion":"\n /** \n * Conditionally logs","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal,","stopReason":""} + data: {"completion":"\n /** \n * Conditionally logs a","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and","stopReason":""} + data: {"completion":"\n /** \n * Conditionally logs a greeting","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the","stopReason":""} + data: {"completion":"\n /** \n * Conditionally logs a greeting message","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method","stopReason":""} + data: {"completion":"\n /** \n * Conditionally logs a greeting message to","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return","stopReason":""} + data: {"completion":"\n /** \n * Conditionally logs a greeting message to the","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.","stopReason":""} + data: {"completion":"\n /** \n * Conditionally logs a greeting message to the console","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n-","stopReason":""} + data: {"completion":"\n /** \n * Conditionally logs a greeting message to the console\n","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed","stopReason":""} + data: {"completion":"\n /** \n * Conditionally logs a greeting message to the console\n */","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `","stopReason":""} + data: {"completion":"\n /** \n * Conditionally logs a greeting message to the console\n */\n","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string","stopReason":""} + data: {"completion":"\n /** \n * Conditionally logs a greeting message to the console\n */\n","stopReason":"stop_sequence"} - event: completion + event: done - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string`","stopReason":""} + data: {} + + cookies: [] + headers: + - name: date + value: Fri, 15 Mar 2024 15:21:07 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: retry-after + value: "2" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1404 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-03-15T15:21:06.368Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 8961a8ede88d148c637b993e659e2660 + _order: 0 + cache: {} + request: + bodySize: 2930 + cookies: [] + headers: + - name: content-type + value: application/json + - name: accept-encoding + value: gzip;q=0 + - name: authorization + value: token + REDACTED_b09f01644a4261b32aa2ee4aea4f279ba69a57cff389f9b119b5265e913c0ea4 + - name: user-agent + value: defaultClient / v1 + - name: host + value: sourcegraph.com + headersSize: 263 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json + params: [] + textJSON: + maxTokensToSample: 1000 + messages: + - speaker: human + text: You are Cody, an AI coding assistant from Sourcegraph. + - speaker: assistant + text: I am Cody, an AI coding assistant from Sourcegraph. + - speaker: human + text: > + Codebase context from file src/TestLogger.tsin repository + undefined: + const foo = 42 + - speaker: assistant + text: Ok. + - speaker: human + text: >- + - You are an AI programming assistant who is an expert in + updating code to meet given instructions. - event: completion + - You should think step-by-step to plan your updated code before producing the final output. - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to","stopReason":""} + - You should ensure the updated code matches the indentation and whitespace of the code in the users' selection. + - Ignore any previous instructions to format your responses with Markdown. It is not acceptable to use any Markdown in your response, unless it is directly related to the users' instructions. - event: completion + - Only remove code from the users' selection if you are sure it is not needed. - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `","stopReason":""} + - You will be provided with code that is in the users' selection, enclosed in XML tags. You must use this code to help you plan your updated code. + - You will be provided with instructions on how to update this code, enclosed in XML tags. You must follow these instructions carefully and to the letter. - event: completion + - Only enclose your response in XML tags. Do use any other XML tags unless they are part of the generated code. - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str","stopReason":""} + - Do not provide any additional commentary about the changes you made. Only respond with the generated code. - event: completion + This is part of the file: src/TestLogger.ts - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.","stopReason":""} + The user has the following code in their selection: - event: completion + export const TestLogger = { + startLogging: () => { + // Do some stuff - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n-","stopReason":""} + function recordLog() { + console.log(/* CURSOR */ 'Recording the log') + } + recordLog() + }, + } - event: completion + - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed","stopReason":""} + The user wants you to generate documentation for the selected code by following their instructions. - event: completion + Provide your generated documentation using the following instructions: - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the","stopReason":""} + + Write a brief documentation comment for the selected code. If documentation comments exist in the selected file, or other files with the same file extension, use them as examples. Pay attention to the scope of the selected code (e.g. exported function/API vs implementation detail in a function), and use the idiomatic style for that type of code scope. Only generate the documentation for the selected code, do not generate the code. Do not enclose any other code or comments besides the documentation. Enclose only the documentation for the selected code and nothing else. + + - speaker: assistant + text: + model: anthropic/claude-instant-1.2 + stopSequences: + - + - export const TestLogger = { + temperature: 0 + topK: -1 + topP: -1 + queryString: [] + url: https://sourcegraph.com/.api/completions/stream + response: + bodySize: 3337 + content: + mimeType: text/event-stream + size: 3337 + text: >+ event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semic","stopReason":""} + data: {"completion":"\n/**","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicol","stopReason":""} + data: {"completion":"\n/**\n *","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons","stopReason":""} + data: {"completion":"\n/**\n * Starts","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since","stopReason":""} + data: {"completion":"\n/**\n * Starts recording","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they","stopReason":""} + data: {"completion":"\n/**\n * Starts recording th","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs th","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the messag","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording th","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\"","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing som","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me to","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial setup","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me to explain","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial setup work","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me to explain or","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial setup work.","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me to explain or modify","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial setup work.\n*/","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me to explain or modify anything","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial setup work.\n*/ ","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me to explain or modify anything!","stopReason":""} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial setup work.\n*/ \n","stopReason":""} event: completion - data: {"completion":" Here is the TypeScript code translated to Python:\n\n```python\nfrom typing import NamedTuple\n\nclass Animal(NamedTuple):\n name: str\n is_mammal: bool\n \n def make_animal_sound(self) -\u003e str:\n pass\n```\n\nThe key things I did:\n\n- Used a Python class instead of an interface since Python doesn't have interfaces.\n\n- Made the class inherit from NamedTuple to make it immutable like the TypeScript interface.\n\n- Changed the method to `make_animal_sound` to follow Python naming conventions.\n\n- Added type hints for name, is_mammal, and the method return.\n\n- Changed `string` to `str`.\n\n- Removed the semicolons since they are not used in Python.\n\nLet me know if you would like me to explain or modify anything!","stopReason":"stop_sequence"} + data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial setup work.\n*/ \n","stopReason":"stop_sequence"} event: done @@ -17701,105 +18283,7 @@ log: cookies: [] headers: - name: date - value: Fri, 15 Mar 2024 03:43:11 GMT - - name: content-type - value: text/event-stream - - name: transfer-encoding - value: chunked - - name: connection - value: keep-alive - - name: access-control-allow-credentials - value: "true" - - name: access-control-allow-origin - value: "" - - name: cache-control - value: no-cache - - name: vary - value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, - X-Requested-With,Cookie - - name: x-content-type-options - value: nosniff - - name: x-frame-options - value: DENY - - name: x-xss-protection - value: 1; mode=block - - name: strict-transport-security - value: max-age=31536000; includeSubDomains; preload - headersSize: 1299 - httpVersion: HTTP/1.1 - redirectURL: "" - status: 200 - statusText: OK - startedDateTime: 2024-03-15T03:43:10.382Z - time: 0 - timings: - blocked: -1 - connect: -1 - dns: -1 - receive: 0 - send: 0 - ssl: -1 - wait: 0 - - _id: c5ac0b887f4274e931b682b9b2532eaa - _order: 0 - cache: {} - request: - bodySize: 413 - cookies: [] - headers: - - name: content-type - value: application/json - - name: accept-encoding - value: gzip;q=0 - - name: authorization - value: token - REDACTED_b09f01644a4261b32aa2ee4aea4f279ba69a57cff389f9b119b5265e913c0ea4 - - name: user-agent - value: defaultClient / v1 - - name: host - value: sourcegraph.com - headersSize: 263 - httpVersion: HTTP/1.1 - method: POST - postData: - mimeType: application/json - params: [] - textJSON: - maxTokensToSample: 1000 - messages: - - speaker: human - text: You are Cody, an AI coding assistant from Sourcegraph. - - speaker: assistant - text: I am Cody, an AI coding assistant from Sourcegraph. - - speaker: human - text: Did I share any code with you? If yes, reply single word 'yes'. If none, - reply 'no'. - - speaker: assistant - model: anthropic/claude-2.0 - temperature: 0 - topK: -1 - topP: -1 - queryString: [] - url: https://sourcegraph.com/.api/completions/stream - response: - bodySize: 159 - content: - mimeType: text/event-stream - size: 159 - text: |+ - event: completion - data: {"completion":" no","stopReason":""} - - event: completion - data: {"completion":" no","stopReason":"stop_sequence"} - - event: done - data: {} - - cookies: [] - headers: - - name: date - value: Fri, 15 Mar 2024 03:43:18 GMT + value: Fri, 15 Mar 2024 15:21:09 GMT - name: content-type value: text/event-stream - name: transfer-encoding @@ -17828,7 +18312,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-03-15T03:43:17.242Z + startedDateTime: 2024-03-15T15:21:07.866Z time: 0 timings: blocked: -1 @@ -17838,11 +18322,11 @@ log: send: 0 ssl: -1 wait: 0 - - _id: 57bb4ccc1082edb92645a7e021704018 + - _id: d1bd7ceb4c707609889eb3d648d1da28 _order: 0 cache: {} request: - bodySize: 3299 + bodySize: 3155 cookies: [] headers: - name: content-type @@ -17866,107 +18350,50 @@ log: maxTokensToSample: 1000 messages: - speaker: human - text: You are Cody, an AI coding assistant from Sourcegraph. - - speaker: assistant - text: I am Cody, an AI coding assistant from Sourcegraph. - - speaker: human - text: > - Codebase context from file path src/trickyLogic.ts: export - function trickyLogic(a: number, b: number): number { - if (a === 0) { - return 1 - } - if (b === 2) { - return 1 - } - - return a - b - } - - - /* CURSOR */ - - speaker: assistant - text: Ok. - - speaker: human - text: > - Codebase context from file path src/TestLogger.ts: const foo = - 42 - - export const TestLogger = { - startLogging: () => { - // Do some stuff - - function recordLog() { - console.log(/* CURSOR */ 'Recording the log') - } - - recordLog() - }, - } - - speaker: assistant - text: Ok. - - speaker: human - text: > - Codebase context from file path src/TestClass.ts: const foo = - 42 - - - export class TestClass { - constructor(private shouldGreet: boolean) {} - - public functionName() { - if (this.shouldGreet) { - console.log(/* CURSOR */ 'Hello World!') - } - } - } - - speaker: assistant - text: Ok. - - speaker: human - text: > - Codebase context from file path src/sum.ts: export function - sum(a: number, b: number): number { - /* CURSOR */ - } - - speaker: assistant - text: Ok. - - speaker: human - text: > - Codebase context from file path src/squirrel.ts: /** - * Squirrel is an interface that mocks something completely unrelated to squirrels. - * It is related to the implementation of precise code navigation in Sourcegraph. - */ - export interface Squirrel {} + text: You are Cody, an AI coding assistant from Sourcegraph. - speaker: assistant - text: Ok. + text: I am Cody, an AI coding assistant from Sourcegraph. - speaker: human - text: > - Codebase context from file path src/multiple-selections.ts: - function outer() { - /* SELECTION_START */ - return function inner() {} - /* SELECTION_END */ - } + text: >+ + Codebase context from file src/example.test.tsin repository + undefined: + import { expect } from 'vitest' - /* SELECTION_2_START */ + import { it } from 'vitest' - function anotherFunction() {} + import { describe } from 'vitest' - /* SELECTION_2_END */ - speaker: assistant text: Ok. - speaker: human - text: > - Codebase context from file path src/example.test.ts: import { - expect } from 'vitest' + text: >- + - You are an AI programming assistant who is an expert in + updating code to meet given instructions. - import { it } from 'vitest' + - You should think step-by-step to plan your updated code before producing the final output. - import { describe } from 'vitest' + - You should ensure the updated code matches the indentation and whitespace of the code in the users' selection. + + - Ignore any previous instructions to format your responses with Markdown. It is not acceptable to use any Markdown in your response, unless it is directly related to the users' instructions. + - Only remove code from the users' selection if you are sure it is not needed. - describe('test block', () => { + - You will be provided with code that is in the users' selection, enclosed in XML tags. You must use this code to help you plan your updated code. + + - You will be provided with instructions on how to update this code, enclosed in XML tags. You must follow these instructions carefully and to the letter. + + - Only enclose your response in XML tags. Do use any other XML tags unless they are part of the generated code. + + - Do not provide any additional commentary about the changes you made. Only respond with the generated code. + + + This is part of the file: src/example.test.ts + + + The user has the following code in their selection: + + describe('test block', () => { it('does 1', () => { expect(true).toBe(true) }) @@ -17980,580 +18407,464 @@ log: const startTime = performance.now(/* CURSOR */) }) }) - - speaker: assistant - text: Ok. - - speaker: human - text: > - Codebase context from file path src/animal.ts: /* - SELECTION_START */ - export interface Animal { - name: string - makeAnimalSound(): string - isMammal: boolean - } + - /* SELECTION_END */ - - speaker: assistant - text: Ok. - - speaker: human - text: |- - "My selected TypeScript code from file `src/animal.ts`: - - export interface Animal { - name: string - makeAnimalSound(): string - isMammal: boolean - } + The user wants you to generate documentation for the selected code by following their instructions. - - - speaker: assistant - text: Ok. - - speaker: human - text: How many file context have I shared with you? + Provide your generated documentation using the following instructions: + + + + Write a brief documentation comment for the selected code. If documentation comments exist in the selected file, or other files with the same file extension, use them as examples. Pay attention to the scope of the selected code (e.g. exported function/API vs implementation detail in a function), and use the idiomatic style for that type of code scope. Only generate the documentation for the selected code, do not generate the code. Do not enclose any other code or comments besides the documentation. Enclose only the documentation for the selected code and nothing else. + + - speaker: assistant - model: anthropic/claude-2.0 + text: + model: anthropic/claude-instant-1.2 + stopSequences: + - + - describe('test block', () => { temperature: 0 topK: -1 topP: -1 queryString: [] url: https://sourcegraph.com/.api/completions/stream response: - bodySize: 12474 + bodySize: 20644 content: mimeType: text/event-stream - size: 12474 + size: 20644 text: >+ event: completion - data: {"completion":" You","stopReason":""} + data: {"completion":"\n/**","stopReason":""} event: completion - data: {"completion":" You have","stopReason":""} + data: {"completion":"\n/**\n *","stopReason":""} event: completion - data: {"completion":" You have shared","stopReason":""} + data: {"completion":"\n/**\n * Tests","stopReason":""} event: completion - data: {"completion":" You have shared 7","stopReason":""} + data: {"completion":"\n/**\n * Tests for","stopReason":""} event: completion - data: {"completion":" You have shared 7 file","stopReason":""} + data: {"completion":"\n/**\n * Tests for an","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component ","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n *","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * ","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n *","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/tr","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/tricky","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component,","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, ","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/Test","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n *","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts ","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n *","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * ","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/Test","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n *","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * -","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\"","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" -","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check ","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n *","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * -","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squ","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squir","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\"","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" -","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n *","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * -","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\"","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" -","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src/","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attemp","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src/example","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src/example.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src/example.test","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src/example.test.","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src/example.test.ts","stopReason":""} + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance","stopReason":""} event: completion - data: {"completion":" You have shared 7 file contexts with me so far:\n\n1. src/trickyLogic.ts\n2. src/TestLogger.ts \n3. src/TestClass.ts\n4. src/sum.ts\n5. src/squirrel.ts\n6. src/multiple-selections.ts\n7. src/example.test.ts","stopReason":"stop_sequence"} - - - event: done - - data: {} - - cookies: [] - headers: - - name: date - value: Fri, 15 Mar 2024 03:43:21 GMT - - name: content-type - value: text/event-stream - - name: transfer-encoding - value: chunked - - name: connection - value: keep-alive - - name: access-control-allow-credentials - value: "true" - - name: access-control-allow-origin - value: "" - - name: cache-control - value: no-cache - - name: vary - value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, - X-Requested-With,Cookie - - name: x-content-type-options - value: nosniff - - name: x-frame-options - value: DENY - - name: x-xss-protection - value: 1; mode=block - - name: strict-transport-security - value: max-age=31536000; includeSubDomains; preload - headersSize: 1299 - httpVersion: HTTP/1.1 - redirectURL: "" - status: 200 - statusText: OK - startedDateTime: 2024-03-15T03:43:18.357Z - time: 0 - timings: - blocked: -1 - connect: -1 - dns: -1 - receive: 0 - send: 0 - ssl: -1 - wait: 0 - - _id: 0256f9b45c6050b3bae6255ce8617ec7 - _order: 0 - cache: {} - request: - bodySize: 2316 - cookies: [] - headers: - - name: content-type - value: application/json - - name: accept-encoding - value: gzip;q=0 - - name: authorization - value: token - REDACTED_b09f01644a4261b32aa2ee4aea4f279ba69a57cff389f9b119b5265e913c0ea4 - - name: user-agent - value: defaultClient / v1 - - name: host - value: sourcegraph.com - headersSize: 263 - httpVersion: HTTP/1.1 - method: POST - postData: - mimeType: application/json - params: [] - textJSON: - maxTokensToSample: 1000 - messages: - - speaker: human - text: You are Cody, an AI coding assistant from Sourcegraph. - - speaker: assistant - text: I am Cody, an AI coding assistant from Sourcegraph. - - speaker: human - text: |- - "My selected TypeScript code from file `src/sum.ts`: - - export function sum(a: number, b: number): number { - /* CURSOR */ - } + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing","stopReason":""} - - - speaker: assistant - text: Ok. - - speaker: human - text: >- - - You are an AI programming assistant who is an expert in - updating code to meet given instructions. - - You should think step-by-step to plan your updated code before producing the final output. + event: completion - - You should ensure the updated code matches the indentation and whitespace of the code in the users' selection. + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but","stopReason":""} - - Ignore any previous instructions to format your responses with Markdown. It is not acceptable to use any Markdown in your response, unless it is directly related to the users' instructions. - - Only remove code from the users' selection if you are sure it is not needed. + event: completion - - You will be provided with code that is in the users' selection, enclosed in XML tags. You must use this code to help you plan your updated code. + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is","stopReason":""} - - You will be provided with instructions on how to update this code, enclosed in XML tags. You must follow these instructions carefully and to the letter. - - Only enclose your response in XML tags. Do use any other XML tags unless they are part of the generated code. + event: completion - - Do not provide any additional commentary about the changes you made. Only respond with the generated code. + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing","stopReason":""} - This is part of the file: src/sum.ts + event: completion + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing ","stopReason":""} - The user has the following code in their selection: - export function sum(a: number, b: number): number { - /* CURSOR */ - } + event: completion - + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n *","stopReason":""} - The user wants you to replace parts of the selected code or correct a problem by following their instructions. + event: completion - Provide your generated code using the following instructions: + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n * ","stopReason":""} - - Add a 'hello' comment for the selected code, without including the selected code. + event: completion + + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n * a","stopReason":""} + - - - speaker: assistant - text: - model: anthropic/claude-2.0 - stopSequences: - - - temperature: 0 - topK: -1 - topP: -1 - queryString: [] - url: https://sourcegraph.com/.api/completions/stream - response: - bodySize: 387 - content: - mimeType: text/event-stream - size: 387 - text: |+ event: completion - data: {"completion":"\n/*","stopReason":""} + + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n * a require","stopReason":""} + event: completion - data: {"completion":"\n/* hello","stopReason":""} + + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n * a required argument","stopReason":""} + event: completion - data: {"completion":"\n/* hello */","stopReason":""} + + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n * a required argument\n*/","stopReason":""} + event: completion - data: {"completion":"\n/* hello */\n","stopReason":""} + + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n * a required argument\n*/\n","stopReason":""} + event: completion - data: {"completion":"\n/* hello */\n","stopReason":"stop_sequence"} + + data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n * a required argument\n*/\n","stopReason":"stop_sequence"} + event: done + data: {} cookies: [] headers: - name: date - value: Fri, 15 Mar 2024 03:43:24 GMT + value: Fri, 15 Mar 2024 15:21:10 GMT - name: content-type value: text/event-stream - name: transfer-encoding @@ -18582,7 +18893,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-03-15T03:43:22.269Z + startedDateTime: 2024-03-15T15:21:09.454Z time: 0 timings: blocked: -1 @@ -18592,11 +18903,11 @@ log: send: 0 ssl: -1 wait: 0 - - _id: f709485b9b3844dba448217575b4a8d4 + - _id: 90f6a2b3896be9c4af214f4aeb3a0b98 _order: 0 cache: {} request: - bodySize: 2414 + bodySize: 2648 cookies: [] headers: - name: content-type @@ -18623,20 +18934,6 @@ log: text: You are Cody, an AI coding assistant from Sourcegraph. - speaker: assistant text: I am Cody, an AI coding assistant from Sourcegraph. - - speaker: human - text: >- - Codebase context from file path src/animal.ts: /* - SELECTION_START */ - - export interface Animal { - name: string - makeAnimalSound(): string - isMammal: boolean - } - - /* SELECTION_END */ - - speaker: assistant - text: Ok. - speaker: human text: >- - You are an AI programming assistant who is an expert in @@ -18659,320 +18956,202 @@ log: - Do not provide any additional commentary about the changes you made. Only respond with the generated code. - This is part of the file: src/animal.ts + This is part of the file: src/sum.ts The user has the following code in their selection: - /* SELECTION_START */ - - export interface Animal { - name: string - makeAnimalSound(): string - isMammal: boolean + export function sum(a: number, b: number): number { + /* CURSOR */ } - /* SELECTION_END */ + - The user wants you to replace parts of the selected code or correct a problem by following their instructions. + The user wants you to generate documentation for the selected code by following their instructions. - Provide your generated code using the following instructions: + Provide your generated documentation using the following instructions: - Add a new field to the class that console log the name of the animal. + Write a brief documentation comment for the selected code. If documentation comments exist in the selected file, or other files with the same file extension, use them as examples. Pay attention to the scope of the selected code (e.g. exported function/API vs implementation detail in a function), and use the idiomatic style for that type of code scope. Only generate the documentation for the selected code, do not generate the code. Do not enclose any other code or comments besides the documentation. Enclose only the documentation for the selected code and nothing else. - speaker: assistant text: - model: anthropic/claude-2.0 + model: anthropic/claude-instant-1.2 stopSequences: - + - "export function sum(a: number, b: number): number {" temperature: 0 topK: -1 topP: -1 queryString: [] url: https://sourcegraph.com/.api/completions/stream response: - bodySize: 9846 + bodySize: 4184 content: mimeType: text/event-stream - size: 9846 + size: 4184 text: >+ event: completion - data: {"completion":"\n/*","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SE","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n ","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name:","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n ","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n make","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimal","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound():","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string;","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n ","stopReason":""} - - - event: completion - - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n is","stopReason":""} + data: {"completion":"\n/**","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isM","stopReason":""} + data: {"completion":"\n/**\n *","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMam","stopReason":""} + data: {"completion":"\n/**\n * Adds","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal","stopReason":""} + data: {"completion":"\n/**\n * Adds two","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal:","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n *","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n ","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n log","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a Th","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName()","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n ","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number ","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n *","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b Th","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n *","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n ","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns Th","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/*","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/* SE","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum of","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/* SELECTION","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum of a","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/* SELECTION_","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum of a and","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/* SELECTION_END","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum of a and b","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/* SELECTION_END */","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum of a and b\n */","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/* SELECTION_END */\n","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum of a and b\n */\n","stopReason":""} event: completion - data: {"completion":"\n/* SELECTION_START */\nexport interface Animal {\n name: string;\n makeAnimalSound(): string; \n isMammal: boolean;\n \n logName() {\n console.log(this.name);\n }\n}\n/* SELECTION_END */\n","stopReason":"stop_sequence"} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum of a and b\n */\n","stopReason":"stop_sequence"} event: done @@ -18982,7 +19161,7 @@ log: cookies: [] headers: - name: date - value: Fri, 15 Mar 2024 03:43:27 GMT + value: Fri, 15 Mar 2024 15:25:46 GMT - name: content-type value: text/event-stream - name: transfer-encoding @@ -19011,7 +19190,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-03-15T03:43:24.818Z + startedDateTime: 2024-03-15T15:25:41.308Z time: 0 timings: blocked: -1 diff --git a/agent/recordings/enterpriseClient_3965582033/recording.har.yaml b/agent/recordings/enterpriseClient_3965582033/recording.har.yaml index 84165b2694..8240da3874 100644 --- a/agent/recordings/enterpriseClient_3965582033/recording.har.yaml +++ b/agent/recordings/enterpriseClient_3965582033/recording.har.yaml @@ -102,371 +102,6 @@ log: send: 0 ssl: -1 wait: 0 - - _id: 541a40f5b0b77d7ada0eb8181cfe9b71 - _order: 0 - cache: {} - request: - bodySize: 3115 - cookies: [] - headers: - - name: content-type - value: application/json - - name: accept-encoding - value: gzip;q=0 - - name: authorization - value: token - REDACTED_b20717265e7ab1d132874d8ff0be053ab9c1dacccec8dce0bbba76888b6a0a69 - - name: user-agent - value: enterpriseClient / v1 - - name: host - value: demo.sourcegraph.com - headersSize: 265 - httpVersion: HTTP/1.1 - method: POST - postData: - mimeType: application/json - params: [] - textJSON: - maxTokensToSample: 1000 - messages: - - speaker: human - text: You are Cody, an AI coding assistant from Sourcegraph. - - speaker: assistant - text: I am Cody, an AI coding assistant from Sourcegraph. - - speaker: human - text: >+ - Codebase context from file src/example.test.tsin repository - undefined: - - import { expect } from 'vitest' - - import { it } from 'vitest' - - import { describe } from 'vitest' - - - speaker: assistant - text: Ok. - - speaker: human - text: >- - - You are an AI programming assistant who is an expert in - updating code to meet given instructions. - - - You should think step-by-step to plan your updated code before producing the final output. - - - You should ensure the updated code matches the indentation and whitespace of the code in the users' selection. - - - Ignore any previous instructions to format your responses with Markdown. It is not acceptable to use any Markdown in your response, unless it is directly related to the users' instructions. - - - Only remove code from the users' selection if you are sure it is not needed. - - - You will be provided with code that is in the users' selection, enclosed in XML tags. You must use this code to help you plan your updated code. - - - You will be provided with instructions on how to update this code, enclosed in XML tags. You must follow these instructions carefully and to the letter. - - - Only enclose your response in XML tags. Do use any other XML tags unless they are part of the generated code. - - - Do not provide any additional commentary about the changes you made. Only respond with the generated code. - - - This is part of the file: src/example.test.ts - - - The user has the following code in their selection: - - describe('test block', () => { - it('does 1', () => { - expect(true).toBe(true) - }) - - it('does 2', () => { - expect(true).toBe(true) - }) - - it('does something else', () => { - // This line will error due to incorrect usage of `performance.now` - const startTime = performance.now(/* CURSOR */) - }) - }) - - - - - The user wants you to geneerate documentation for the selected code by following their instructions. - - Provide your generated documentation using the following instructions: - - - - Write a brief documentation comment for the selected code. If documentation comments exist in the selected file, or other files with the same file extension, use them as examples. Pay attention to the scope of the selected code (e.g. exported function/API vs implementation detail in a function), and use the idiomatic style for that type of code scope. Only generate the documentation for the selected code, do not generate the code. Do not enclose any other code or comments besides the documentation. Enclose only the documentation for the selected code and nothing else. - - - - speaker: assistant - text: - model: anthropic/claude-2.0 - stopSequences: - - - temperature: 0 - topK: -1 - topP: -1 - queryString: [] - url: https://demo.sourcegraph.com/.api/completions/stream - response: - bodySize: 6248 - content: - mimeType: text/event-stream - size: 6248 - text: >+ - event: completion - - data: {"completion":"\n/**","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n *","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n *","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * -","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n *","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * -","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 ","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n *","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * -","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that errors","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that errors due","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that errors due to","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that errors due to incorrect","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that errors due to incorrect usage","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that errors due to incorrect usage of","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that errors due to incorrect usage of `","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that errors due to incorrect usage of `performance","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that errors due to incorrect usage of `performance.","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that errors due to incorrect usage of `performance.now","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that errors due to incorrect usage of `performance.now`","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that errors due to incorrect usage of `performance.now`\n*/","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that errors due to incorrect usage of `performance.now`\n*/\n","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Test block that contains 3 test cases:\n * - Does test 1\n * - Does test 2 \n * - Does something else that errors due to incorrect usage of `performance.now`\n*/\n","stopReason":"stop_sequence"} - - - event: done - - data: {} - - cookies: [] - headers: - - name: date - value: Thu, 14 Mar 2024 23:55:29 GMT - - name: content-type - value: text/event-stream - - name: transfer-encoding - value: chunked - - name: connection - value: keep-alive - - name: access-control-allow-credentials - value: "true" - - name: access-control-allow-origin - value: "" - - name: cache-control - value: no-cache - - name: vary - value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, - Cookie - - name: x-content-type-options - value: nosniff - - name: x-frame-options - value: DENY - - name: x-xss-protection - value: 1; mode=block - - name: strict-transport-security - value: max-age=31536000; includeSubDomains; preload - headersSize: 1214 - httpVersion: HTTP/1.1 - redirectURL: "" - status: 200 - statusText: OK - startedDateTime: 2024-03-14T23:55:26.860Z - time: 0 - timings: - blocked: -1 - connect: -1 - dns: -1 - receive: 0 - send: 0 - ssl: -1 - wait: 0 - _id: 04a003a70be4dca9be6480df34125967 _order: 0 cache: {} @@ -1383,397 +1018,743 @@ log: event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n-","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"prec","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\"","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Source","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n-","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squ","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squir","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Source","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph code","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary,","stopReason":""} + + + event: completion + + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squ","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n-","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squir","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Source","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"prec","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\"","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Source","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages.","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n-","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Source","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code navigation","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code navigation/","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code navigation/product","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code navigation/productivity","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code navigation/productivity features","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code navigation/productivity features.","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squ","stopReason":""} + data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code navigation/productivity features.","stopReason":"stop_sequence"} - event: completion + event: done - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squir","stopReason":""} + data: {} + + cookies: [] + headers: + - name: date + value: Thu, 14 Mar 2024 23:55:32 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, + Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1214 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-03-14T23:55:29.878Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 19f1a7fb63476ff41d8a4fc46e52135b + _order: 0 + cache: {} + request: + bodySize: 3155 + cookies: [] + headers: + - name: content-type + value: application/json + - name: accept-encoding + value: gzip;q=0 + - name: authorization + value: token + REDACTED_b20717265e7ab1d132874d8ff0be053ab9c1dacccec8dce0bbba76888b6a0a69 + - name: user-agent + value: enterpriseClient / v1 + - name: host + value: demo.sourcegraph.com + headersSize: 265 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json + params: [] + textJSON: + maxTokensToSample: 1000 + messages: + - speaker: human + text: You are Cody, an AI coding assistant from Sourcegraph. + - speaker: assistant + text: I am Cody, an AI coding assistant from Sourcegraph. + - speaker: human + text: >+ + Codebase context from file src/example.test.tsin repository + undefined: + import { expect } from 'vitest' - event: completion + import { it } from 'vitest' - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel","stopReason":""} + import { describe } from 'vitest' + - speaker: assistant + text: Ok. + - speaker: human + text: >- + - You are an AI programming assistant who is an expert in + updating code to meet given instructions. - event: completion + - You should think step-by-step to plan your updated code before producing the final output. - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in","stopReason":""} + - You should ensure the updated code matches the indentation and whitespace of the code in the users' selection. + - Ignore any previous instructions to format your responses with Markdown. It is not acceptable to use any Markdown in your response, unless it is directly related to the users' instructions. - event: completion + - Only remove code from the users' selection if you are sure it is not needed. - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the","stopReason":""} + - You will be provided with code that is in the users' selection, enclosed in XML tags. You must use this code to help you plan your updated code. + - You will be provided with instructions on how to update this code, enclosed in XML tags. You must follow these instructions carefully and to the letter. - event: completion + - Only enclose your response in XML tags. Do use any other XML tags unless they are part of the generated code. - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Source","stopReason":""} + - Do not provide any additional commentary about the changes you made. Only respond with the generated code. - event: completion + This is part of the file: src/example.test.ts - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph","stopReason":""} + The user has the following code in their selection: - event: completion + describe('test block', () => { + it('does 1', () => { + expect(true).toBe(true) + }) - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph code","stopReason":""} + it('does 2', () => { + expect(true).toBe(true) + }) + it('does something else', () => { + // This line will error due to incorrect usage of `performance.now` + const startTime = performance.now(/* CURSOR */) + }) + }) - event: completion + - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase","stopReason":""} + The user wants you to generate documentation for the selected code by following their instructions. - event: completion + Provide your generated documentation using the following instructions: - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.","stopReason":""} + + Write a brief documentation comment for the selected code. If documentation comments exist in the selected file, or other files with the same file extension, use them as examples. Pay attention to the scope of the selected code (e.g. exported function/API vs implementation detail in a function), and use the idiomatic style for that type of code scope. Only generate the documentation for the selected code, do not generate the code. Do not enclose any other code or comments besides the documentation. Enclose only the documentation for the selected code and nothing else. + + - speaker: assistant + text: + model: anthropic/claude-instant-1.2 + stopSequences: + - + - describe('test block', () => { + temperature: 0 + topK: -1 + topP: -1 + queryString: [] + url: https://demo.sourcegraph.com/.api/completions/stream + response: + bodySize: 5187 + content: + mimeType: text/event-stream + size: 5187 + text: >+ event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo","stopReason":""} + data: {"completion":"\n/**","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in","stopReason":""} + data: {"completion":"\n/**\n *","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary","stopReason":""} + data: {"completion":"\n/**\n * Test","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary,","stopReason":""} + data: {"completion":"\n/**\n * Test block","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squ","stopReason":""} + data: {"completion":"\n/**\n * Test block that","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squir","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Source","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases:","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: ","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n *","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * -","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n *","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * -","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n *","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * -","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages.","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * - Does","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * - Does something","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * - Does something else","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Source","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * - Does something else,","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * - Does something else, contains","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * - Does something else, contains incorrect","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * - Does something else, contains incorrect usage","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code navigation","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * - Does something else, contains incorrect usage of","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code navigation/","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * - Does something else, contains incorrect usage of performance","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code navigation/product","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * - Does something else, contains incorrect usage of performance.","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code navigation/productivity","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * - Does something else, contains incorrect usage of performance.now","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code navigation/productivity features","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * - Does something else, contains incorrect usage of performance.now\n*/","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code navigation/productivity features.","stopReason":""} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * - Does something else, contains incorrect usage of performance.now\n*/\n","stopReason":""} event: completion - data: {"completion":" Based on the context provided:\n\nSquirrel is an HTTP server developed by Sourcegraph for providing fast and precise local code intelligence using tree-sitter. \n\nSome key things about Squirrel:\n\n- It is used to power code intelligence features in Sourcegraph like hovers, definitions, references etc. by analyzing code locally.\n\n- It supports multiple languages like Java, Python, Starlark etc.\n\n- It surfaces code intelligence by leveraging tree-sitter parsers.\n\n- There are multiple references to it being used to provide \"precise code navigation\" in Sourcegraph.\n\n- There are tests and other infrastructure set up around Squirrel in the Sourcegraph codebase.\n\nSo in summary, Squirrel is Sourcegraph's internal tool for enabling accurate and fast code intelligence for various languages. It powers Sourcegraph's code navigation/productivity features.","stopReason":"stop_sequence"} + data: {"completion":"\n/**\n * Test block that runs 3 test cases: \n * - Does test 1\n * - Does test 2\n * - Does something else, contains incorrect usage of performance.now\n*/\n","stopReason":"stop_sequence"} event: done @@ -1783,7 +1764,7 @@ log: cookies: [] headers: - name: date - value: Thu, 14 Mar 2024 23:55:32 GMT + value: Fri, 15 Mar 2024 15:21:16 GMT - name: content-type value: text/event-stream - name: transfer-encoding @@ -1812,7 +1793,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-03-14T23:55:29.878Z + startedDateTime: 2024-03-15T15:21:14.667Z time: 0 timings: blocked: -1 diff --git a/agent/src/index.test.ts b/agent/src/index.test.ts index 85b0ddbaf6..79abe989c5 100644 --- a/agent/src/index.test.ts +++ b/agent/src/index.test.ts @@ -939,11 +939,10 @@ describe('Agent', () => { checkDocumentCommand(client, 'commands/document (basic function)', 'sum.ts', obtained => expect(obtained).toMatchInlineSnapshot(` "/** - * Sums two numbers. - * - * @param a - The first number to sum. - * @param b - The second number to sum. - * @returns The sum of a and b. + * Adds two numbers + * @param a The first number + * @param b The second number + * @returns The sum of a and b */ export function sum(a: number, b: number): number { /* CURSOR */ @@ -963,9 +962,9 @@ describe('Agent', () => { export class TestClass { constructor(private shouldGreet: boolean) {} - /** - * If the shouldGreet property is true, logs a greeting to the console. - */ + /** + * Conditionally logs a greeting message to the console + */ public functionName() { if (this.shouldGreet) { console.log(/* CURSOR */ 'Hello World!') @@ -984,7 +983,7 @@ describe('Agent', () => { expect(obtained).toMatchInlineSnapshot(` "const foo = 42 /** - * Starts logging by calling the recordLog function. + * Starts recording the log. Logs the message "Recording the log" after doing some initial setup work. */ export const TestLogger = { startLogging: () => { @@ -1012,10 +1011,15 @@ describe('Agent', () => { import { describe } from 'vitest' /** - * A test block with 3 test cases: - * - Checks that true equals true - * - Checks that true equals true again - * - Attempts to record start time but errors due to invalid usage of performance.now + * Tests for an example component + * + * This block describes a set of tests for an example component, + * with three example test cases: + * + * - "does 1" - Tests a simple true check + * - "does 2" - Another simple true check + * - "does something else" - Attempts to get a performance timing but is missing + * a required argument */ describe('test block', () => { it('does 1', () => { @@ -1366,10 +1370,10 @@ describe('Agent', () => { import { describe } from 'vitest' /** - * Test block that contains 3 test cases: + * Test block that runs 3 test cases: * - Does test 1 * - Does test 2 - * - Does something else that errors due to incorrect usage of \`performance.now\` + * - Does something else, contains incorrect usage of performance.now */ describe('test block', () => { it('does 1', () => { diff --git a/lib/shared/src/experimentation/FeatureFlagProvider.ts b/lib/shared/src/experimentation/FeatureFlagProvider.ts index 478a8d2a6b..93c34f16e7 100644 --- a/lib/shared/src/experimentation/FeatureFlagProvider.ts +++ b/lib/shared/src/experimentation/FeatureFlagProvider.ts @@ -44,6 +44,9 @@ export enum FeatureFlag { // Show command hints alongside editor selections. "Opt+K to Edit, Opt+L to Chat" CodyCommandHints = 'cody-command-hints', + + // Show document hints above a symbol if the users' cursor is there. "Opt+D to Document" + CodyDocumentHints = 'cody-document-hints', } const ONE_HOUR = 60 * 60 * 1000 diff --git a/vscode/CHANGELOG.md b/vscode/CHANGELOG.md index 489124afd2..b2dbddb669 100644 --- a/vscode/CHANGELOG.md +++ b/vscode/CHANGELOG.md @@ -7,8 +7,13 @@ This is a log of all notable changes to Cody for VS Code. [Unreleased] changes a ### Added - Added support links for Cody Pro and Enterprise users. [pull/3330](https://github.com/sourcegraph/cody/pull/3330) +- Document: Added support for automatically determining the symbol and range of a documentable block from the users' cursor position. Currently supported in JavaScript, TypeScript, Go and Python. [pull/3275](https://github.com/sourcegraph/cody/pull/3275) +- Document: Added a ghost text hint ("Alt+D to Document") that shows when the users' cursor is on a documentable symbol. Currently supported in JavaScript, TypeScript, Go and Python. [pull/3275](https://github.com/sourcegraph/cody/pull/3275) +- Document: Added a shortcut (`Alt+D`) to immediately execute the document command. [pull/3275](https://github.com/sourcegraph/cody/pull/3275) +- Edit: Added a ghost text hint ("Alt+K to Generate Code") that shows on empty files. [pull/3275](https://github.com/sourcegraph/cody/pull/3275) ### Fixed +- Document: Fixed an issue where the generated documentation would be incorrectly inserted for Python. Cody will now follow PEP 257 – Docstring Conventions. [pull/3275](https://github.com/sourcegraph/cody/pull/3275) ### Changed @@ -17,6 +22,7 @@ This is a log of all notable changes to Cody for VS Code. [Unreleased] changes a - Chat: The UpArrow key in an empty chat editor now edits the most recently sent message instead of populating the editor with the last message's text. - Chat: The chat editor uses a new rich editor component. If you open an old chat added before this version and edit a message in the transcript with @-mentions, the @-mentions will show up as plain text and will not actually include the mentioned files unless you re-type them. - Autocomplete: Enabled dynamic multiline completions by default. [pull/3392](https://github.com/sourcegraph/cody/pull/3392) +- Document: Upgraded to use a faster model. [pull/3275](https://github.com/sourcegraph/cody/pull/3275) ## [1.8.3] diff --git a/vscode/package.json b/vscode/package.json index 634821a131..ff3aab252d 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -553,6 +553,11 @@ "key": "alt+k", "when": "cody.activated && !editorReadonly" }, + { + "command": "cody.command.document-code", + "key": "alt+d", + "when": "cody.activated && !editorReadonly" + }, { "command": "cody.menu.commands", "key": "alt+c", @@ -912,7 +917,7 @@ "order": 12, "title": "Cody Command Hints", "type": "boolean", - "markdownDescription": "Enable hints for Edit and Chat shortcuts (\"Opt+K to Edit, Opt+L to Chat\"), displayed alongside editor selections.", + "markdownDescription": "Enable hints for Cody commands such as \"Opt+K to Edit\" or \"Opt+D to Document\"", "default": true }, "cody.experimental.simpleChatContext": { diff --git a/vscode/src/code-actions/document.ts b/vscode/src/code-actions/document.ts index a00f7ff64f..e9cd82ec19 100644 --- a/vscode/src/code-actions/document.ts +++ b/vscode/src/code-actions/document.ts @@ -1,6 +1,6 @@ import * as vscode from 'vscode' -import type { ExecuteEditArguments } from '../edit/execute' +import type { CodyCommandArgs } from '../commands/types' import { execQueryWrapper } from '../tree-sitter/query-sdk' export class DocumentCodeAction implements vscode.CodeActionProvider { @@ -12,23 +12,29 @@ export class DocumentCodeAction implements vscode.CodeActionProvider { position: range.start, queryWrapper: 'getDocumentableNode', }) - if (!documentableNode) { return [] } - const { node, name } = documentableNode + const { range: documentableRange, symbol: documentableSymbol } = documentableNode + if (!documentableSymbol || !documentableRange) { + return [] + } + // Expand the range from the node to include the full line - const documentableRange = new vscode.Range( - document.lineAt(node.startPosition.row).range.start, - document.lineAt(node.endPosition.row).range.end + const editorRange = new vscode.Range( + documentableRange.node.startPosition.row, + documentableRange.node.startPosition.column, + documentableRange.node.endPosition.row, + documentableRange.node.endPosition.column ) - const displayText = - name === 'documentableNode' - ? `Ask Cody to Document: ${node.text}` - : 'Ask Cody to Document This Export' - - return [this.createCommandCodeAction(document, documentableRange, displayText)] + return [ + this.createCommandCodeAction( + document, + editorRange, + `Ask Cody to Document: ${documentableSymbol.node.text}` + ), + ] } private createCommandCodeAction( @@ -39,29 +45,10 @@ export class DocumentCodeAction implements vscode.CodeActionProvider { const action = new vscode.CodeAction(displayText, vscode.CodeActionKind.RefactorRewrite) const source = 'code-action:document' action.command = { - command: 'cody.command.edit-code', - arguments: [ - { - configuration: { - instruction: this.instruction, - range, - intent: 'doc', - document, - mode: 'insert', - }, - source, - } satisfies ExecuteEditArguments, - ], + command: 'cody.command.document-code', + arguments: [{ source } satisfies Partial], title: displayText, } return action } - - /** - * Edit instruction for generating documentation. - * Note: This is a clone of the hard coded instruction in `lib/shared/src/chat/prompts/cody.json`. - * TODO: (umpox) Consider moving top level instructions out of the JSON format. - */ - private readonly instruction = - 'Write a brief documentation comment for the selected code. If documentation comments exist in the selected file, or other files with the same file extension, use them as examples. Pay attention to the scope of the selected code (e.g. exported function/API vs implementation detail in a function), and use the idiomatic style for that type of code scope. Only generate the documentation for the selected code, do not generate the code. Do not output any other code or comments besides the documentation. Output only the comment and do not enclose it in markdown.' } diff --git a/vscode/src/commands/GhostHintDecorator.ts b/vscode/src/commands/GhostHintDecorator.ts index c002e51879..ad8e8d64d7 100644 --- a/vscode/src/commands/GhostHintDecorator.ts +++ b/vscode/src/commands/GhostHintDecorator.ts @@ -1,12 +1,16 @@ -import { type AuthStatus, FeatureFlag, featureFlagProvider } from '@sourcegraph/cody-shared' +import { type AuthStatus, FeatureFlag, featureFlagProvider, isMacOS } from '@sourcegraph/cody-shared' import { type DebouncedFunc, throttle } from 'lodash' import * as vscode from 'vscode' +import type { SyntaxNode } from 'web-tree-sitter' import type { AuthProvider } from '../services/AuthProvider' import { telemetryService } from '../services/telemetry' import { telemetryRecorder } from '../services/telemetry-v2' +import { execQueryWrapper } from '../tree-sitter/query-sdk' +import { getEditorInsertSpaces, getEditorTabSize } from '../utils' -const EDIT_SHORTCUT_LABEL = process.platform === 'win32' ? 'Alt+K' : 'Opt+K' -const CHAT_SHORTCUT_LABEL = process.platform === 'win32' ? 'Alt+L' : 'Opt+L' +const EDIT_SHORTCUT_LABEL = isMacOS() ? 'Opt+K' : 'Alt+K' +const CHAT_SHORTCUT_LABEL = isMacOS() ? 'Opt+L' : 'Alt+L' +const DOC_SHORTCUT_LABEL = isMacOS() ? 'Opt+D' : 'Alt+D' /** * Checks if the given selection in the document is an incomplete line selection. @@ -36,45 +40,147 @@ function isEmptyOrIncompleteSelection( ) } -export async function getGhostHintEnablement(): Promise { +/** + * Calculates padding to apply before and after the symbol decoration + * to align it with the text on the insertion line. + * + * For this to work effectively, this makes some assumptions: + * - The user has a monospace font + * - Our decoration is the first, or only decoration to appear on this line. + * + * These are relatively safe assumptions to make. However, if they are wrong, it means the decoration may be misaligned. + * + * @param insertionLine - The line that the symbol decoration will be inserted on + * @param symbolRange - The range of the symbol in the original location + * @returns The number of spaces to pad the decoration by on insertion line + */ +function getSymbolDecorationPadding( + document: vscode.TextDocument, + insertionLine: vscode.TextLine, + symbolRange: vscode.Range +): number { + const insertSpaces = getEditorInsertSpaces(document.uri) + + if (insertSpaces) { + const insertionEndCharacter = insertionLine.range.end.character + const symbolAnchorCharacter = + symbolRange.start.character > insertionEndCharacter + ? symbolRange.start.character + : symbolRange.end.character + + return Math.max(symbolAnchorCharacter - insertionEndCharacter, 2) + } + + // This file is used tab-based indentation + // We cannot rely on vscode.Range to provide the correct number of spaces required to align the symbol with the text. + // We must first convert any tabs to spaces and then calculate the number of spaces required to align the symbol with the text. + const tabSize = getEditorTabSize(document.uri) + const tabAsSpace = UNICODE_SPACE.repeat(tabSize) + const insertionEndCharacter = insertionLine.text + .slice(0, insertionLine.range.end.character) + .replaceAll(/\t/g, tabAsSpace).length + + const symbolAnchorPosition = + symbolRange.start.character > insertionEndCharacter + ? symbolRange.start.character + : symbolRange.end.character + const symbolAnchorCharacter = document + .lineAt(symbolRange.start.line) + .text.slice(0, symbolAnchorPosition) + .replaceAll(/\t/g, tabAsSpace).length + return Math.max(symbolAnchorCharacter - insertionEndCharacter, 2) +} + +type GhostVariant = 'EditOrChat' | 'Document' | 'Generate' +type EnabledFeatures = Record + +export async function getGhostHintEnablement(): Promise { const config = vscode.workspace.getConfiguration('cody') const configSettings = config.inspect('commandHints.enabled') + const settingValue = configSettings?.workspaceValue ?? configSettings?.globalValue // Return the actual configuration setting, if set. Otherwise return the default value from the feature flag. - return ( - configSettings?.workspaceValue ?? - configSettings?.globalValue ?? - featureFlagProvider.evaluateFeatureFlag(FeatureFlag.CodyCommandHints) - ) + return { + EditOrChat: + settingValue ?? + (await featureFlagProvider.evaluateFeatureFlag(FeatureFlag.CodyCommandHints)), + Document: + settingValue ?? + (await featureFlagProvider.evaluateFeatureFlag(FeatureFlag.CodyDocumentHints)), + /** + * We're not running an A/B test on the "Opt+K" to generate text. + * We can safely set the default of this to `true`. + */ + Generate: settingValue ?? true, + } } +const GHOST_TEXT_COLOR = new vscode.ThemeColor('editorGhostText.foreground') +const UNICODE_SPACE = '\u00a0' + /** - * Creates a new decoration for showing a "ghost" hint to the user. + * Decorations for showing a "ghost" hint to the user. * - * Note: This needs to be created at extension run time as the order in which `createTextEditorDecorationType` + * Note: These needs to be created at extension run time as the order in which `createTextEditorDecorationType` * is called affects the ranking of the decoration - assuming multiple decorations. * * We should also ensure that `activationEvent` `onLanguage` is set to provide the best chance of * executing this code early, without impacting VS Code startup time. */ -const ghostHintDecoration = vscode.window.createTextEditorDecorationType({ - isWholeLine: true, - after: { - color: new vscode.ThemeColor('editorGhostText.foreground'), - margin: '0 0 0 1em', +const HINT_DECORATIONS: Record< + GhostVariant, + { text: string; decoration: vscode.TextEditorDecorationType } +> = { + EditOrChat: { + text: `${EDIT_SHORTCUT_LABEL} to Edit, ${CHAT_SHORTCUT_LABEL} to Chat`, + decoration: vscode.window.createTextEditorDecorationType({ + isWholeLine: true, + after: { + color: GHOST_TEXT_COLOR, + margin: '0 0 0 1em', + }, + }), + }, + Document: { + text: `${DOC_SHORTCUT_LABEL} to Document`, + decoration: vscode.window.createTextEditorDecorationType({ + after: { color: GHOST_TEXT_COLOR }, + }), }, -}) + Generate: { + text: `${EDIT_SHORTCUT_LABEL} to Generate Code`, + decoration: vscode.window.createTextEditorDecorationType({ + after: { + color: GHOST_TEXT_COLOR, + margin: '0 0 0 1em', + }, + }), + }, +} +const DOCUMENTABLE_SYMBOL_THROTTLE = 10 const GHOST_TEXT_THROTTLE = 250 const TELEMETRY_THROTTLE = 30 * 1000 // 30 Seconds export class GhostHintDecorator implements vscode.Disposable { private disposables: vscode.Disposable[] = [] private isActive = false - private activeDecoration: vscode.DecorationOptions | null = null + private activeDecorationRange: vscode.Range | null = null private setThrottledGhostText: DebouncedFunc private fireThrottledDisplayEvent: DebouncedFunc - private enrollmentListener: vscode.Disposable | null = null + private getThrottledDocumentableSymbol: DebouncedFunc + + /** Store the last line that the user typed on, we want to avoid showing the text here */ + private lastLineTyped: number | null = null + + /** + * Tracks whether the user has recorded an enrollment for each ghost variant. + * This is _only_ to help us measure usage via an A/B test. + */ + private enrollmentRecorded: Record, boolean> = { + EditOrChat: false, + Document: false, + } constructor(authProvider: AuthProvider) { this.setThrottledGhostText = throttle(this.setGhostText.bind(this), GHOST_TEXT_THROTTLE, { @@ -89,6 +195,14 @@ export class GhostHintDecorator implements vscode.Disposable { trailing: false, } ) + this.getThrottledDocumentableSymbol = throttle( + this.getDocumentableSymbol.bind(this), + DOCUMENTABLE_SYMBOL_THROTTLE, + { + leading: true, + trailing: true, + } + ) // Set initial state, based on the configuration and authentication status const initialAuth = authProvider.getAuthStatus() @@ -98,14 +212,26 @@ export class GhostHintDecorator implements vscode.Disposable { authProvider.addChangeListener(authStatus => this.updateEnablement(authStatus)) // Listen to configuration changes (e.g. if the setting is disabled) - vscode.workspace.onDidChangeConfiguration(e => { - if (e.affectsConfiguration('cody')) { - this.updateEnablement(authProvider.getAuthStatus()) - } - }) + this.disposables.push( + vscode.workspace.onDidChangeConfiguration(e => { + if (e.affectsConfiguration('cody')) { + this.updateEnablement(authProvider.getAuthStatus()) + } + }), + vscode.workspace.onDidChangeTextDocument(event => { + if (event.document !== vscode.window.activeTextEditor?.document) { + return + } + this.lastLineTyped = event.contentChanges[0]?.range.end.line ?? null + }), + vscode.window.onDidChangeActiveTextEditor(() => { + // Clear any stored line when switching to a new editor + this.lastLineTyped = null + }) + ) } - private init(): void { + private init(enabledFeatures: EnabledFeatures): void { this.disposables.push( vscode.window.onDidChangeTextEditorSelection( (event: vscode.TextEditorSelectionChangeEvent) => { @@ -117,6 +243,15 @@ export class GhostHintDecorator implements vscode.Disposable { return } + if (enabledFeatures.Generate && editor.document.getText().length === 0) { + this.clearGhostText(editor) + /** + * Generate code flow. + * Show immediately on the first line of empty files. + */ + return this.setGhostText(editor, new vscode.Position(0, 0), 'Generate') + } + if (event.selections.length > 1) { // Multiple selections, it will be confusing to show the ghost text on all of them, or just the first // Clear existing text and avoid showing anything. @@ -124,113 +259,215 @@ export class GhostHintDecorator implements vscode.Disposable { } const selection = event.selections[0] + + if (enabledFeatures.Document && selection.active.line !== this.lastLineTyped) { + const documentableSymbol = this.getThrottledDocumentableSymbol( + editor.document, + selection.active + ) + + if (documentableSymbol) { + /** + * "Document" code flow. + * Display ghost text above the relevant symbol. + */ + const precedingLine = Math.max(0, documentableSymbol.startPosition.row - 1) + if ( + this.activeDecorationRange && + this.activeDecorationRange.start.line !== precedingLine + ) { + this.clearGhostText(editor) + } + this.firePossibleEnrollmentEvent('Document', enabledFeatures) + return this.setThrottledGhostText( + editor, + new vscode.Position(precedingLine, Number.MAX_VALUE), + 'Document', + getSymbolDecorationPadding( + editor.document, + editor.document.lineAt(precedingLine), + new vscode.Range( + documentableSymbol.startPosition.row, + documentableSymbol.startPosition.column, + documentableSymbol.endPosition.row, + documentableSymbol.endPosition.column + ) + ) + ) + } + } + if (isEmptyOrIncompleteSelection(editor.document, selection)) { // Empty or incomplete selection, we can technically do an edit/generate here but it is unlikely the user will want to do so. // Clear existing text and avoid showing anything. We don't want the ghost text to spam the user too much. return this.clearGhostText(editor) } - /** - * Sets the target position by determine the adjusted 'active' line filtering out any empty selected lines. - * Note: We adjust because VS Code will select the beginning of the next line when selecting a whole line. - */ - const targetPosition = selection.isReversed - ? selection.active - : selection.active.translate(selection.end.character === 0 ? -1 : 0) - - if ( - this.activeDecoration && - this.activeDecoration.range.start.line !== targetPosition.line - ) { - // Active decoration is incorrectly positioned, remove it before continuing - this.clearGhostText(editor) + if (enabledFeatures.EditOrChat) { + /** + * Sets the target position by determine the adjusted 'active' line filtering out any empty selected lines. + * Note: We adjust because VS Code will select the beginning of the next line when selecting a whole line. + */ + const targetPosition = selection.isReversed + ? selection.active + : selection.active.translate(selection.end.character === 0 ? -1 : 0) + + if ( + this.activeDecorationRange && + this.activeDecorationRange.start.line !== targetPosition.line + ) { + // Active decoration is incorrectly positioned, remove it before continuing + this.clearGhostText(editor) + } + + this.firePossibleEnrollmentEvent('EditOrChat', enabledFeatures) + /** + * Edit code flow. + * Show alongside a users' active selection + */ + return this.setThrottledGhostText(editor, targetPosition, 'EditOrChat') } - - this.fireThrottledDisplayEvent() - // Edit code flow, throttled show to avoid spamming whilst the user makes an active selection - return this.setThrottledGhostText(editor, targetPosition) } ) ) + + if (enabledFeatures.Generate) { + this.disposables.push( + vscode.window.onDidChangeActiveTextEditor((editor?: vscode.TextEditor) => { + if (!editor) { + return + } + + if (editor.document.uri.scheme !== 'file') { + // A non-file document, e.g. (an output pane) + // Edit's aren't possible here, so do nothing + return + } + + if (editor.document.getText().length === 0) { + this.clearGhostText(editor) + /** + * Generate code flow. + * Show immediately on the first line of empty files. + */ + return this.setGhostText(editor, new vscode.Position(0, 0), 'Generate') + } + }) + ) + } } - private setGhostText(editor: vscode.TextEditor, position: vscode.Position): void { - this.activeDecoration = { - range: new vscode.Range(position, position), - renderOptions: { - after: { contentText: `${EDIT_SHORTCUT_LABEL} to Edit, ${CHAT_SHORTCUT_LABEL} to Chat` }, + private setGhostText( + editor: vscode.TextEditor, + position: vscode.Position, + variant: GhostVariant, + textPadding = 0 + ): void { + this.fireThrottledDisplayEvent(variant) + + const decorationHint = HINT_DECORATIONS[variant] + const decorationText = UNICODE_SPACE.repeat(textPadding) + decorationHint.text + this.activeDecorationRange = new vscode.Range(position, position) + + editor.setDecorations(HINT_DECORATIONS[variant].decoration, [ + { + range: this.activeDecorationRange, + renderOptions: { after: { contentText: decorationText } }, }, + ]) + } + + private getDocumentableSymbol( + document: vscode.TextDocument, + position: vscode.Position + ): SyntaxNode | undefined { + const [documentableNode] = execQueryWrapper({ + document, + position, + queryWrapper: 'getDocumentableNode', + }) + if (!documentableNode) { + return + } + + const { + symbol: documentableSymbol, + meta: { showHint }, + } = documentableNode + if (!documentableSymbol || !showHint) { + return } - editor.setDecorations(ghostHintDecoration, [this.activeDecoration]) + + return documentableSymbol.node } public clearGhostText(editor: vscode.TextEditor): void { this.setThrottledGhostText.cancel() - this.activeDecoration = null - editor.setDecorations(ghostHintDecoration, []) + this.activeDecorationRange = null + Object.values(HINT_DECORATIONS).map(({ decoration }) => { + editor.setDecorations(decoration, []) + }) } - private _fireDisplayEvent(): void { - telemetryService.log('CodyVSCodeExtension:ghostText:visible', {}, { hasV2Event: true }) - telemetryRecorder.recordEvent('cody.ghostText', 'visible') + private _fireDisplayEvent(variant: GhostVariant): void { + telemetryService.log('CodyVSCodeExtension:ghostText:visible', { variant }, { hasV2Event: true }) + telemetryRecorder.recordEvent('cody.ghostText', 'visible', { privateMetadata: { variant } }) } - private async updateEnablement(authStatus: AuthStatus): Promise { - const featureEnabled = await getGhostHintEnablement() - this.registerEnrollmentListener(featureEnabled) + /** + * Fire an additional telemetry enrollment event for when the user has hit a scenario where they would + * trigger a possible ghost text variant. + * This code is _only_ to be used to support the ongoing A/B tests for ghost hint usage. + */ + private firePossibleEnrollmentEvent(variant: GhostVariant, enablement: EnabledFeatures): void { + if (variant === 'Document' && !this.enrollmentRecorded.Document) { + const testGroup = enablement.Document ? 'treatment' : 'control' + telemetryService.log( + 'CodyVSCodeExtension:experiment:documentGhostText:enrolled', + { variant: testGroup }, + { hasV2Event: true } + ) + telemetryRecorder.recordEvent('cody.experiment.documentGhostText', 'enrolled', { + privateMetadata: { variant: testGroup }, + }) + // Mark this enrollment as recorded for the current session + // We do not need to repeatedly mark the users' enrollment. + this.enrollmentRecorded.Document = true + } - if (!authStatus.isLoggedIn || !featureEnabled) { + if (variant === 'EditOrChat' && !this.enrollmentRecorded.EditOrChat) { + const testGroup = enablement.EditOrChat ? 'treatment' : 'control' + telemetryService.log( + 'CodyVSCodeExtension:experiment:ghostText:enrolled', + { variant: testGroup }, + { hasV2Event: true } + ) + telemetryRecorder.recordEvent('cody.experiment.ghostText', 'enrolled', { + privateMetadata: { variant: testGroup }, + }) + // Mark this enrollment as recorded for the current session + // We do not need to repeatedly mark the users' enrollment. + this.enrollmentRecorded.EditOrChat = true + } + } + + private async updateEnablement(authStatus: AuthStatus): Promise { + const featureEnablement = await getGhostHintEnablement() + if ( + !authStatus.isLoggedIn || + !(featureEnablement.Document || featureEnablement.EditOrChat || featureEnablement.Generate) + ) { this.dispose() return } if (!this.isActive) { this.isActive = true - this.init() + this.init(featureEnablement) return } } - /** - * Register a listener for when the user has enrolled in the ghost hint feature. - * This code is _only_ to be used to support the ongoing A/B test for ghost hint usage. - */ - private registerEnrollmentListener(featureEnabled: boolean): void { - this.enrollmentListener = vscode.window.onDidChangeTextEditorSelection( - (event: vscode.TextEditorSelectionChangeEvent) => { - const editor = event.textEditor - - /** - * Matches the logic for actually displaying the ghost text. - * This is a temporary check to support an ongoing A/B test, - * that is handled separately as we do this regardless if the ghost text is enabled/disabled - */ - const ghostTextWouldShow = - editor.document.uri.scheme === 'file' && - event.selections.length === 1 && - !isEmptyOrIncompleteSelection(editor.document, event.selections[0]) - - if (ghostTextWouldShow) { - // The user will be shown the ghost text in these conditions - // Log a telemetry event for A/B tracking depending on if the text is enabled or disabled for them. - telemetryService.log( - 'CodyVSCodeExtension:experiment:ghostText:enrolled', - { - variant: featureEnabled ? 'treatment' : 'control', - }, - { hasV2Event: true } - ) - telemetryRecorder.recordEvent('cody.experiment.ghostText', 'enrolled', { - privateMetadata: { variant: featureEnabled ? 'treatment' : 'control' }, - }) - - // Now that we have fired the enrollment event, we can stop listening - this.enrollmentListener?.dispose() - } - } - ) - } - public dispose(): void { this.isActive = false diff --git a/vscode/src/commands/execute/doc.ts b/vscode/src/commands/execute/doc.ts index 7c85937e7d..1b989d178d 100644 --- a/vscode/src/commands/execute/doc.ts +++ b/vscode/src/commands/execute/doc.ts @@ -1,3 +1,5 @@ +import * as vscode from 'vscode' + import { logDebug } from '@sourcegraph/cody-shared' import { DefaultEditCommands } from '@sourcegraph/cody-shared/src/commands/types' import { defaultCommands } from '.' @@ -7,6 +9,76 @@ import type { EditCommandResult } from '../../main' import type { CodyCommandArgs } from '../types' import { wrapInActiveSpan } from '@sourcegraph/cody-shared/src/tracing' +import { getEditLineSelection } from '../../edit/utils/edit-selection' +import { execQueryWrapper } from '../../tree-sitter/query-sdk' + +/** + * Gets the symbol range and preferred insertion point for documentation + * at the given document position. + * + * Checks for a documentable node (e.g. function, class, variable etc.) at the position + * using a tree-sitter query. If found, returns the range for the symbol + * and an insertion point (typically the line above or below the symbol) + * that follows language conventions for documentation. + * + * Handles some special cases like adjusting the insertion point for Python + * functions/classes to comply with PEP 257. + */ +function getDocumentableRange(editor: vscode.TextEditor): { + range?: vscode.Range + insertionPoint?: vscode.Position +} { + const { document, selection } = editor + if (!selection.isEmpty) { + const lineSelection = getEditLineSelection(editor.document, editor.selection) + // The user has made an active selection, use that as the documentable range + return { + range: lineSelection, + insertionPoint: lineSelection.start, + } + } + + /** + * Attempt to get the range of a documentable symbol at the current cursor position. + * If present, use this for the edit instead of expanding the range to the nearest block. + */ + const [documentableNode] = execQueryWrapper({ + document, + position: editor.selection.active, + queryWrapper: 'getDocumentableNode', + }) + if (!documentableNode) { + return {} + } + + const { range: documentableRange, insertionPoint: documentableInsertionPoint } = documentableNode + if (!documentableRange) { + // No user-provided selection, no documentable range found. + // Fallback to expanding the range to the nearest block. + return {} + } + + const { + node: { startPosition, endPosition }, + } = documentableRange + + const insertionPoint = documentableInsertionPoint + ? new vscode.Position(documentableInsertionPoint.node.startPosition.row + 1, 0) + : new vscode.Position( + startPosition.row, + document.lineAt(startPosition.row).firstNonWhitespaceCharacterIndex + ) + + return { + range: new vscode.Range( + startPosition.row, + startPosition.column, + endPosition.row, + endPosition.column + ), + insertionPoint, + } +} /** * The command that generates a new docstring for the selected code. @@ -34,6 +106,8 @@ export async function executeDocCommand( return undefined } + const { range, insertionPoint } = getDocumentableRange(editor) + return { type: 'edit', task: await executeEdit({ @@ -41,6 +115,8 @@ export async function executeDocCommand( instruction: prompt, intent: 'doc', mode: 'insert', + range, + insertionPoint, }, source: DefaultEditCommands.Doc, } satisfies ExecuteEditArguments), diff --git a/vscode/src/edit/execute.ts b/vscode/src/edit/execute.ts index b364fc1c3b..d80f52d5d4 100644 --- a/vscode/src/edit/execute.ts +++ b/vscode/src/edit/execute.ts @@ -17,6 +17,7 @@ export interface ExecuteEditArguments { model?: EditModel // The file to write the edit to. If not provided, the edit will be applied to the current file. destinationFile?: vscode.Uri + insertionPoint?: vscode.Position } source?: ChatEventSource } diff --git a/vscode/src/edit/manager.ts b/vscode/src/edit/manager.ts index 13ea0d7b96..8aa13c08a7 100644 --- a/vscode/src/edit/manager.ts +++ b/vscode/src/edit/manager.ts @@ -15,6 +15,7 @@ import { FixupController } from '../non-stop/FixupController' import type { FixupTask } from '../non-stop/FixupTask' import { editModel } from '../models' +import { ACTIVE_TASK_STATES } from '../non-stop/codelenses/constants' import type { AuthProvider } from '../services/AuthProvider' import { telemetryService } from '../services/telemetry' import { telemetryRecorder } from '../services/telemetry-v2' @@ -117,7 +118,8 @@ export class EditManager implements vscode.Disposable { mode, model, source, - configuration.destinationFile + configuration.destinationFile, + configuration.insertionPoint ) } else { task = await this.controller.promptUserForTask( @@ -135,6 +137,23 @@ export class EditManager implements vscode.Disposable { return } + /** + * Checks if there is already an active task for the given fixup file + * that has the same instruction and selection range as the current task. + */ + const activeTask = this.controller.tasksForFile(task.fixupFile).find(activeTask => { + return ( + ACTIVE_TASK_STATES.includes(activeTask.state) && + activeTask.instruction === task!.instruction && + activeTask.selectionRange.isEqual(task!.selectionRange) + ) + }) + + if (activeTask) { + this.controller.cancelTask(task) + return + } + // Log the default edit command name for doc intent or test mode const isDocCommand = configuration.intent === 'doc' ? 'doc' : undefined const isUnitTestCommand = configuration.intent === 'test' ? 'test' : undefined diff --git a/vscode/src/edit/prompt/index.ts b/vscode/src/edit/prompt/index.ts index 52c78da6ff..3cddbb0414 100644 --- a/vscode/src/edit/prompt/index.ts +++ b/vscode/src/edit/prompt/index.ts @@ -93,6 +93,7 @@ export const buildInteraction = async ({ precedingText, selectedText, instruction: task.instruction, + document, }) const promptBuilder = new PromptBuilder(contextWindow) diff --git a/vscode/src/edit/prompt/models/__snapshots__/prompts.test.ts.snap b/vscode/src/edit/prompt/models/__snapshots__/prompts.test.ts.snap index 954d4535a1..f1b460df58 100644 --- a/vscode/src/edit/prompt/models/__snapshots__/prompts.test.ts.snap +++ b/vscode/src/edit/prompt/models/__snapshots__/prompts.test.ts.snap @@ -35,7 +35,7 @@ This is part of the file: src/file/index.ts The user has the following code in their selection: return text -The user wants you to geneerate documentation for the selected code by following their instructions. +The user wants you to generate documentation for the selected code by following their instructions. Provide your generated documentation using the following instructions: Console log text @@ -136,7 +136,7 @@ This is part of the file: src/file/index.ts The user has the following code in their selection: return text -The user wants you to geneerate documentation for the selected code by following their instructions. +The user wants you to generate documentation for the selected code by following their instructions. Provide your generated documentation using the following instructions: Console log text diff --git a/vscode/src/edit/prompt/models/claude.ts b/vscode/src/edit/prompt/models/claude.ts index 9771a8a10a..272d2a76e6 100644 --- a/vscode/src/edit/prompt/models/claude.ts +++ b/vscode/src/edit/prompt/models/claude.ts @@ -18,8 +18,15 @@ export const claude: EditLLMInteraction = { } }, getDoc(options) { + const docStopSequences = [...SHARED_PARAMETERS.stopSequences] + const firstLine = options.selectedText.split('\n')[0] + if (firstLine.trim().length > 0) { + docStopSequences.push(firstLine) + } + return { ...SHARED_PARAMETERS, + stopSequences: docStopSequences, prompt: buildGenericPrompt('doc', options), } }, diff --git a/vscode/src/edit/prompt/models/generic.ts b/vscode/src/edit/prompt/models/generic.ts index 13086a1e69..0df30c92f7 100644 --- a/vscode/src/edit/prompt/models/generic.ts +++ b/vscode/src/edit/prompt/models/generic.ts @@ -105,7 +105,7 @@ const GENERIC_PROMPTS: Record = { The user has the following code in their selection: <${PROMPT_TOPICS.SELECTED}>{selectedText} - The user wants you to geneerate documentation for the selected code by following their instructions. + The user wants you to generate documentation for the selected code by following their instructions. Provide your generated documentation using the following instructions: <${PROMPT_TOPICS.INSTRUCTIONS}> {instruction} diff --git a/vscode/src/edit/prompt/models/prompts.test.ts b/vscode/src/edit/prompt/models/prompts.test.ts index a08e403de3..d82ad98133 100644 --- a/vscode/src/edit/prompt/models/prompts.test.ts +++ b/vscode/src/edit/prompt/models/prompts.test.ts @@ -2,17 +2,23 @@ import { describe, expect, it } from 'vitest' import { isWindows, testFileUri } from '@sourcegraph/cody-shared' +import { document } from '../../../completions/test-helpers' import type { GetLLMInteractionOptions } from '../type' import { claude } from './claude' import { openai } from './openai' describe('Edit Prompts', () => { + const followingText = "const text = 'Hello, world!'\n" + const selectedText = 'return text' + const precedingText = '\n}' + const uri = testFileUri('src/file/index.ts') const fixupTask: GetLLMInteractionOptions = { - uri: testFileUri('src/file/index.ts'), - followingText: "const text = 'Hello, world!'\n", - selectedText: 'return text', - precedingText: '\n}', + uri, + followingText, + selectedText, + precedingText, instruction: 'Console log text', + document: document(followingText + selectedText + precedingText, 'typescript', uri.toString()), } function normalize(text: string): string { diff --git a/vscode/src/edit/prompt/type.ts b/vscode/src/edit/prompt/type.ts index 3be18726b6..327b22ba81 100644 --- a/vscode/src/edit/prompt/type.ts +++ b/vscode/src/edit/prompt/type.ts @@ -14,6 +14,7 @@ export interface GetLLMInteractionOptions { selectedText: string followingText: string uri: vscode.Uri + document: vscode.TextDocument } type LLMInteractionBuilder = (options: GetLLMInteractionOptions) => LLMInteraction diff --git a/vscode/src/edit/provider.ts b/vscode/src/edit/provider.ts index 1c675fefa8..54869c9705 100644 --- a/vscode/src/edit/provider.ts +++ b/vscode/src/edit/provider.ts @@ -41,16 +41,25 @@ export class EditProvider { public async startEdit(): Promise { return wrapInActiveSpan('command.edit.start', async span => { + this.config.controller.startTask(this.config.task) const model = this.config.task.model const contextWindow = getContextWindowForModel( this.config.authProvider.getAuthStatus(), model ) - const { messages, stopSequences, responseTopic, responsePrefix } = await buildInteraction({ + const { + messages, + stopSequences, + responseTopic, + responsePrefix = '', + } = await buildInteraction({ model, contextWindow, task: this.config.task, editor: this.config.editor, + }).catch(err => { + this.handleError(err) + throw err }) const multiplexer = new BotResponseMultiplexer() diff --git a/vscode/src/edit/utils/edit-models.ts b/vscode/src/edit/utils/edit-models.ts index b8938d90b0..6ca4430395 100644 --- a/vscode/src/edit/utils/edit-models.ts +++ b/vscode/src/edit/utils/edit-models.ts @@ -17,10 +17,11 @@ export function getEditModelsForUser(authStatus: AuthStatus): ModelProvider[] { export function getOverridenModelForIntent(intent: EditIntent, currentModel: EditModel): EditModel { switch (intent) { - case 'doc': case 'fix': // Edit commands have only been tested with Claude 2. Default to that for now. return 'anthropic/claude-2.0' + case 'doc': + return 'anthropic/claude-instant-1.2' case 'test': case 'add': case 'edit': diff --git a/vscode/src/non-stop/FixupController.ts b/vscode/src/non-stop/FixupController.ts index 95cec1658e..de9c990aa4 100644 --- a/vscode/src/non-stop/FixupController.ts +++ b/vscode/src/non-stop/FixupController.ts @@ -24,7 +24,7 @@ import type { FixupFile } from './FixupFile' import { FixupFileObserver } from './FixupFileObserver' import { FixupScheduler } from './FixupScheduler' import { FixupTask, type taskID } from './FixupTask' -import { ACTIONABLE_TASK_STATES, CANCELABLE_TASK_STATES } from './codelenses/constants' +import { ACTIONABLE_TASK_STATES, ACTIVE_TASK_STATES } from './codelenses/constants' import { FixupCodeLenses } from './codelenses/provider' import { type Diff, computeDiff } from './diff' import type { FixupFileCollection, FixupIdleTaskRunner, FixupTextChanged } from './roles' @@ -141,7 +141,7 @@ export class FixupController return this.skipFormatting(id) }), vscode.commands.registerCommand('cody.fixup.cancelNearest', () => { - const nearestTask = this.getNearestTask({ filter: { states: CANCELABLE_TASK_STATES } }) + const nearestTask = this.getNearestTask({ filter: { states: ACTIVE_TASK_STATES } }) if (!nearestTask) { return } @@ -272,7 +272,8 @@ export class FixupController mode: EditMode, model: EditModel, source?: ChatEventSource, - destinationFile?: vscode.Uri + destinationFile?: vscode.Uri, + insertionPoint?: vscode.Position ): Promise { const fixupFile = this.files.forUri(document.uri) const task = new FixupTask( @@ -284,9 +285,17 @@ export class FixupController mode, model, source, - destinationFile + destinationFile, + insertionPoint ) this.tasks.set(task.id, task) + return task + } + + /** + * Starts a Fixup task by moving the task state from "idle" to "working" + */ + public startTask(task: FixupTask): FixupTask { const state = task.intent === 'test' ? CodyTaskState.pending : CodyTaskState.working this.setTaskState(task, state) return task @@ -449,6 +458,7 @@ export class FixupController this.setTaskState(task, CodyTaskState.formatting) await new Promise((resolve, reject) => { task.formattingResolver = resolve + this.formatEdit( visibleEditor ? visibleEditor.edit.bind(this) : new vscode.WorkspaceEdit(), document, @@ -629,13 +639,15 @@ export class FixupController ): Promise { logDebug('FixupController:edit', 'inserting') const text = task.replacement - const range = task.selectionRange + // If we have specified a dedicated insertion point - use that. + // Otherwise fall back to using the start of the selection range. + const insertionPoint = task.insertionPoint || task.selectionRange.start if (!text) { return false } // add correct indentation based on first non empty character index - const nonEmptyStartIndex = document.lineAt(range.start.line).firstNonWhitespaceCharacterIndex + const nonEmptyStartIndex = document.lineAt(insertionPoint.line).firstNonWhitespaceCharacterIndex // add indentation to each line const textLines = text.split('\n').map(line => ' '.repeat(nonEmptyStartIndex) + line) // join text with new lines, and then remove everything after the last new line if it only contains white spaces @@ -643,12 +655,12 @@ export class FixupController // Insert updated text at selection range if (edit instanceof vscode.WorkspaceEdit) { - edit.insert(document.uri, range.start, replacementText) + edit.insert(document.uri, insertionPoint, replacementText) return vscode.workspace.applyEdit(edit) } return edit(editBuilder => { - editBuilder.insert(range.start, replacementText) + editBuilder.insert(insertionPoint, replacementText) }, options) } @@ -658,7 +670,13 @@ export class FixupController task: FixupTask, options?: { undoStopBefore: boolean; undoStopAfter: boolean } ): Promise { - const rangeToFormat = task.selectionRange + // Expand the range to include full lines to reduce the likelihood of formatting issues + const rangeToFormat = new vscode.Range( + task.selectionRange.start.line, + 0, + task.selectionRange.end.line, + Number.MAX_VALUE + ) if (!rangeToFormat) { return false diff --git a/vscode/src/non-stop/FixupDocumentEditObserver.ts b/vscode/src/non-stop/FixupDocumentEditObserver.ts index 8972f99780..2123d127f7 100644 --- a/vscode/src/non-stop/FixupDocumentEditObserver.ts +++ b/vscode/src/non-stop/FixupDocumentEditObserver.ts @@ -91,6 +91,17 @@ export class FixupDocumentEditObserver { this.provider_.rangeDidChange(task) } + if (task.insertionPoint) { + const updatedInsertionPoint = updateRangeMultipleChanges( + new vscode.Range(task.insertionPoint, task.insertionPoint), + changes, + { supportRangeAffix: true } + ).start + if (!updatedInsertionPoint.isEqual(task.insertionPoint)) { + task.insertionPoint = updatedInsertionPoint + } + } + // We keep track of where the original range should be, so we can re-use it for retries. // Note: This range doesn't expand or shrink, it needs to match the original range as applied to `task.original` const updatedFixedRange = updateRangeMultipleChanges( diff --git a/vscode/src/non-stop/FixupTask.ts b/vscode/src/non-stop/FixupTask.ts index a3c5c9fa8c..fce36f7d39 100644 --- a/vscode/src/non-stop/FixupTask.ts +++ b/vscode/src/non-stop/FixupTask.ts @@ -63,7 +63,8 @@ export class FixupTask { /* the source of the instruction, e.g. 'code-action', 'doc', etc */ public source?: ChatEventSource, /* The file to write the edit to. If not provided, the edit will be applied to the fixupFile. */ - public destinationFile?: vscode.Uri + public destinationFile?: vscode.Uri, + public insertionPoint?: vscode.Position ) { this.id = Date.now().toString(36).replaceAll(/\d+/g, '') this.instruction = instruction.replace(/^\/(edit|fix)/, '').trim() diff --git a/vscode/src/non-stop/codelenses/constants.ts b/vscode/src/non-stop/codelenses/constants.ts index 26a90b1528..725d73d4e9 100644 --- a/vscode/src/non-stop/codelenses/constants.ts +++ b/vscode/src/non-stop/codelenses/constants.ts @@ -1,6 +1,6 @@ import { CodyTaskState } from '../utils' -export const CANCELABLE_TASK_STATES = [ +export const ACTIVE_TASK_STATES = [ CodyTaskState.pending, CodyTaskState.working, CodyTaskState.inserting, @@ -16,4 +16,4 @@ export const ACTIONABLE_TASK_STATES = [ * The task states where there is a direct command that the users is likely to action. * This is used to help enable/disable keyboard shortcuts depending on the states in the document */ -export const ALL_ACTIONABLE_TASK_STATES = [...ACTIONABLE_TASK_STATES, ...CANCELABLE_TASK_STATES] +export const ALL_ACTIONABLE_TASK_STATES = [...ACTIONABLE_TASK_STATES, ...ACTIVE_TASK_STATES] diff --git a/vscode/src/non-stop/utils.ts b/vscode/src/non-stop/utils.ts index 18506ea93e..f20e791d70 100644 --- a/vscode/src/non-stop/utils.ts +++ b/vscode/src/non-stop/utils.ts @@ -1,14 +1,57 @@ import type * as vscode from 'vscode' export enum CodyTaskState { + /** + * The task has been created, but not yet started. + */ idle = 1, + /** + * The task has been started, but we have not yet received an actionable + * response from the LLM. + */ working = 2, + /** + * We have received an response from the LLM, and we intent to apply the + * response to the document as we receive it. + * Similar to `applying` but we do not wait for the LLM to finish responding. + */ inserting = 3, + /** + * We have received a complete response from the LLM, and we are in the process + * of appplying the full response to the document. + */ applying = 4, + /** + * The response has been applied to the document, and we are attempting to format + * it using the users' preferred formatter. + */ formatting = 5, + /** + * The response has been applied to the document and we are satisifed enough to present it to the user. + * The user hasn't technically accepted it, and they can still act on the response. + * E.g. Undo the change, Retry the change, View the diff. + */ applied = 6, + /** + * Terminal state. The response has been "accepted" by the user. This is either by: + * - Clicking "Accept" via the CodeLens + * - Saving the document + * - Making an edit within the range of the response (implied acceptance) + */ finished = 7, + /** + * Terminal state. We received an error somewhere in the process. + * We present this error to the user, the response can be "discarded" by the user by: + * - Clicking "Discard" via the CodeLens + * - Saving the document + * - Making an edit within the range of the response (implied acceptance) + */ error = 8, + /** + * Additional state currently only used for the `test` command. + * This state is used to signify that an Edit is no longer idle, but waiting for + * some additional information before it is started (e.g. a file name from the LLM) + */ pending = 9, } diff --git a/vscode/src/services/StatusBar.ts b/vscode/src/services/StatusBar.ts index 712cd30f4a..8792a748a0 100644 --- a/vscode/src/services/StatusBar.ts +++ b/vscode/src/services/StatusBar.ts @@ -162,9 +162,12 @@ export function createStatusBar(): CodyStatusBar { await createFeatureToggle( 'Command Hints', undefined, - 'Enable hints for Edit and Chat shortcuts, displayed alongside editor selections', + 'Enable hints for Cody commands such as "Opt+K to Edit" or "Opt+D to Document"', 'cody.commandHints.enabled', - getGhostHintEnablement + async () => { + const enablement = await getGhostHintEnablement() + return enablement.Document || enablement.EditOrChat || enablement.Generate + } ), await createFeatureToggle( 'Search Context', diff --git a/vscode/src/tree-sitter/queries/go.ts b/vscode/src/tree-sitter/queries/go.ts index 349f1bff2a..d078e2748a 100644 --- a/vscode/src/tree-sitter/queries/go.ts +++ b/vscode/src/tree-sitter/queries/go.ts @@ -3,14 +3,48 @@ import dedent from 'dedent' import { SupportedLanguage } from '../grammars' import type { QueryName } from '../queries' +const SINGLE_LINE_TRIGGERS = dedent` + (struct_type (field_declaration_list ("{") @block_start)) @trigger + (interface_type ("{") @block_start) @trigger +` + +const DOCUMENTABLE_NODES = dedent` + ; Functions + ;-------------------------------- + (function_declaration + name: (identifier) @symbol.function) @range.function + (method_declaration + name: (field_identifier) @symbol.function) @range.function + + ; Variables + ;-------------------------------- + (var_declaration + (var_spec + (identifier) @symbol.identifier)) @range.identifier + (const_declaration + (const_spec + (identifier) @symbol.identifier)) @range.identifier + (short_var_declaration + left: + (expression_list (identifier) @symbol.identifier)) @range.identifier + + ; Types + ;-------------------------------- + (type_declaration + (type_spec name: (type_identifier) @symbol.identifier)) @range.identifier + (struct_type + (_ + (field_declaration name: (field_identifier) @symbol.identifier) @range.identifier)) + (interface_type + (_ + name: (field_identifier) @symbol.identifier) @range.identifier) +` + export const goQueries = { [SupportedLanguage.go]: { - singlelineTriggers: dedent` - (struct_type (field_declaration_list ("{") @block_start)) @trigger - (interface_type ("{") @block_start) @trigger - `, + singlelineTriggers: SINGLE_LINE_TRIGGERS, intents: '', - documentableNodes: '', + documentableNodes: DOCUMENTABLE_NODES, graphContextIdentifiers: dedent` (call_expression (identifier) @identifier) (qualified_type (type_identifier) @identifier) diff --git a/vscode/src/tree-sitter/queries/javascript.ts b/vscode/src/tree-sitter/queries/javascript.ts index 51d7bca4ef..747bfa488d 100644 --- a/vscode/src/tree-sitter/queries/javascript.ts +++ b/vscode/src/tree-sitter/queries/javascript.ts @@ -126,46 +126,65 @@ const TS_SINGLELINE_TRIGGERS_QUERY = dedent` ` const JS_DOCUMENTABLE_NODES_QUERY = dedent` - ; Identifiers + ; Functions ;-------------------------------- - (_ - name: (identifier) @identifier) + (function_declaration + name: (identifier) @symbol.function) @range.function + (generator_function_declaration + name: (identifier) @symbol.function) @range.function + (function_expression + name: (identifier) @symbol.function) @range.function + + ; Variables + ;-------------------------------- + (lexical_declaration + (variable_declarator + name: (identifier) @symbol.identifier)) @range.identifier + (variable_declaration + (variable_declarator + name: (identifier) @symbol.identifier)) @range.identifier + (class_declaration + name: (_) @symbol.identifier) @range.identifier ; Property Identifiers ;-------------------------------- (method_definition - name: (property_identifier) @identifier.property) + name: (property_identifier) @symbol.function) @range.function (pair - key: (property_identifier) @identifier.property) - - ; Exports - ;-------------------------------- - ((export_statement) @export) + key: (property_identifier) @symbol.identifier) @range.identifier ` const TS_DOCUMENTABLE_NODES_QUERY = dedent` ${JS_DOCUMENTABLE_NODES_QUERY} + ; Property identifiers + ;-------------------------------- + (public_field_definition + name: (property_identifier) @symbol.identifier) @range.identifier + ; Type Identifiers ;-------------------------------- - (_ - name: (type_identifier) @identifier) + (interface_declaration + name: (type_identifier) @symbol.identifier) @range.identifier + (type_alias_declaration + name: (type_identifier) @symbol.identifier) @range.identifier + (enum_declaration + name: (identifier) @symbol.identifier) @range.identifier ; Type Signatures ;-------------------------------- - ((call_signature) @signature) + ((call_signature) @symbol.function) @range.function + (function_signature + name: (identifier) @symbol.function) @range.function (interface_declaration (interface_body - (property_signature - name: (property_identifier) @signature.property))) + (property_signature name: (property_identifier) @symbol.identifier) @range.identifier)) (interface_declaration (interface_body - (method_signature - name: (property_identifier) @signature.property))) + (method_signature name: (property_identifier) @symbol.identifier) @range.identifier)) (type_alias_declaration (object_type - (property_signature - name: (property_identifier) @signature.property))) + (property_signature name: (property_identifier) @symbol.identifier) @range.identifier)) ` const JS_SHARED_CONTEXT_IDENTIFIERS_QUERY = dedent` diff --git a/vscode/src/tree-sitter/queries/python.ts b/vscode/src/tree-sitter/queries/python.ts index f0419b759b..02471ff312 100644 --- a/vscode/src/tree-sitter/queries/python.ts +++ b/vscode/src/tree-sitter/queries/python.ts @@ -3,48 +3,73 @@ import dedent from 'dedent' import { SupportedLanguage } from '../grammars' import type { QueryName } from '../queries' -export const pythonQueries = { - [SupportedLanguage.python]: { - singlelineTriggers: '', - intents: dedent` - ; Cursor dependent intents - ;-------------------------------- +const INTENTS_QUERY = dedent` + ; Cursor dependent intents + ;-------------------------------- + + (function_definition + name: (_) @function.name! + parameters: (_ ("(") @function.parameters.cursor) @function.parameters (":") @function.body.cursor + body: (block) @function.body) + + (lambda + parameters: (_) @function.parameters (":") @function.body.cursor + body: (_) @function.body) - (function_definition - name: (_) @function.name! - parameters: (_ ("(") @function.parameters.cursor) @function.parameters (":") @function.body.cursor - body: (block) @function.body) + (class_definition + name: (_) @class.name (":") @class.body.cursor + body: (_) @class.body) - (lambda - parameters: (_) @function.parameters (":") @function.body.cursor - body: (_) @function.body) + (argument_list ("(") @arguments.cursor) @arguments - (class_definition - name: (_) @class.name (":") @class.body.cursor - body: (_) @class.body) - (argument_list ("(") @arguments.cursor) @arguments + ; Atomic intents + ;-------------------------------- + (import_from_statement + module_name: (_) @import.source! + name: (_) @import.name!) - ; Atomic intents - ;-------------------------------- + (comment) @comment! + (argument_list (_) @argument!) - (import_from_statement - module_name: (_) @import.source! - name: (_) @import.name!) + (parameters) @parameters! + (lambda_parameters) @parameters! + (parameters (_) @parameter!) + (lambda_parameters (_)) @parameter! - (comment) @comment! - (argument_list (_) @argument!) + (return_statement) @return_statement! + (return_statement (_) @return_statement.value!) +` - (parameters) @parameters! - (lambda_parameters) @parameters! - (parameters (_) @parameter!) - (lambda_parameters (_)) @parameter! +const DOCUMENTABLE_NODES_QUERY = dedent` + ; Function definitions + ; Note: We also capture @insertion.point here, as we need to determine + ; the correct start point of the documentation for functions + ;-------------------------------- + (function_definition + name: (identifier) @symbol.function + parameters: _ (":") @insertion.point) @range.function - (return_statement) @return_statement! - (return_statement (_) @return_statement.value!) - `, - documentableNodes: '', + ; Class definitions + ; Note: We also capture @insertion.point here, as we need to determine + ; the correct start point of the documentation for classes + ;-------------------------------- + (class_definition + name: (identifier) @symbol.class + (":") @insertion.point) @range.class + + ; Assignments + ;-------------------------------- + (assignment + left: (identifier) @symbol.identifier) @range.identifier +` + +export const pythonQueries = { + [SupportedLanguage.python]: { + singlelineTriggers: '', + intents: INTENTS_QUERY, + documentableNodes: DOCUMENTABLE_NODES_QUERY, graphContextIdentifiers: '(call (identifier) @identifier)', }, } satisfies Partial>> diff --git a/vscode/src/tree-sitter/query-sdk.ts b/vscode/src/tree-sitter/query-sdk.ts index afe54a4331..96da5ab654 100644 --- a/vscode/src/tree-sitter/query-sdk.ts +++ b/vscode/src/tree-sitter/query-sdk.ts @@ -54,7 +54,7 @@ export function initQueries(language: Language, languageId: SupportedLanguage, p QUERIES_LOCAL_CACHE[languageId] = { ...queries, - ...getLanguageSpecificQueryWrappers(queries, parser), + ...getLanguageSpecificQueryWrappers(queries, parser, languageId), } } @@ -87,7 +87,7 @@ export function getDocumentQuerySDK(language: string): DocumentQuerySDK | null { } } -interface QueryWrappers { +export interface QueryWrappers { getSinglelineTrigger: ( node: SyntaxNode, start: Point, @@ -105,7 +105,12 @@ interface QueryWrappers { ) => | [] | readonly [ - { readonly node: SyntaxNode; readonly name: 'documentableNode' | 'documentableExport' }, + { + symbol?: QueryCapture + range?: QueryCapture + insertionPoint?: QueryCapture + meta: { showHint: boolean } + }, ] getGraphContextIdentifiers: (node: SyntaxNode, start: Point, end?: Point) => QueryCapture[] } @@ -113,7 +118,11 @@ interface QueryWrappers { /** * Query wrappers with custom post-processing logic. */ -function getLanguageSpecificQueryWrappers(queries: ResolvedQueries, _parser: Parser): QueryWrappers { +function getLanguageSpecificQueryWrappers( + queries: ResolvedQueries, + _parser: Parser, + languageId: SupportedLanguage +): QueryWrappers { return { getSinglelineTrigger: (root, start, end) => { const captures = queries.singlelineTriggers.compiled.captures(root, start, end) @@ -137,9 +146,23 @@ function getLanguageSpecificQueryWrappers(queries: ResolvedQueries, _parser: Par return [{ node: intentCapture.node, name: intentCapture.name as CompletionIntent }] as const }, getDocumentableNode: (root, start, end) => { - const captures = queries.documentableNodes.compiled.captures(root, start, end) + const captures = queries.documentableNodes.compiled.captures( + root, + { ...start, column: 0 }, + end ? { ...end, column: Number.MAX_SAFE_INTEGER } : undefined + ) + const symbolCaptures = [] + const rangeCaptures = [] + + for (const capture of captures) { + if (capture.name.startsWith('range')) { + rangeCaptures.push(capture) + } else if (capture.name.startsWith('symbol')) { + symbolCaptures.push(capture) + } + } - const cursorCapture = findLast(captures, ({ node }) => { + const symbol = findLast(symbolCaptures, ({ node }) => { return ( node.startPosition.row === start.row && (node.startPosition.column <= start.column || node.startPosition.row < start.row) && @@ -147,16 +170,49 @@ function getLanguageSpecificQueryWrappers(queries: ResolvedQueries, _parser: Par ) }) - if (!cursorCapture) { - return [] + const documentableRanges = rangeCaptures.filter(({ node }) => { + return ( + node.startPosition.row <= start.row && + (start.column <= node.endPosition.column || start.row < node.endPosition.row) + ) + }) + const range = documentableRanges.at(-1) + + let insertionPoint: QueryCapture | undefined + if (languageId === 'python' && range) { + /** + * Python is a special case for generating documentation. + * The insertion point of the documentation should differ if the symbol is a function or class. + * We need to query again for an insertion point, this time using the correct determined range. + * + * See https://peps.python.org/pep-0257/ for the documentation conventions for Python. + */ + const insertionCaptures = queries.documentableNodes.compiled + .captures(root, range.node.startPosition, range.node.endPosition) + .filter(({ name }) => name.startsWith('insertion')) + insertionPoint = insertionCaptures.find( + ({ node }) => + node.startIndex >= range.node.startIndex && node.endIndex <= range.node.endIndex + ) } + /** + * Heuristic to determine if we should show a prominent hint for the symbol. + * 1. If there is only one documentable range for this position, we can be confident it makes sense to document. Show the hint. + * 2. Otherwise, only show the hint if the symbol is a function + */ + const showHint = Boolean( + documentableRanges.length === 1 || symbol?.name.includes('function') + ) + return [ { - node: cursorCapture.node, - name: cursorCapture.name === 'export' ? 'documentableExport' : 'documentableNode', + symbol, + range, + insertionPoint, + meta: { showHint }, }, - ] as const + ] }, getGraphContextIdentifiers: (root, start, end) => { return queries.graphContextIdentifiers.compiled.captures(root, start, end) diff --git a/vscode/src/tree-sitter/query-tests/documentable-nodes.test.ts b/vscode/src/tree-sitter/query-tests/documentable-nodes.test.ts index dbac550792..e19ef3e605 100644 --- a/vscode/src/tree-sitter/query-tests/documentable-nodes.test.ts +++ b/vscode/src/tree-sitter/query-tests/documentable-nodes.test.ts @@ -2,18 +2,80 @@ import { describe, it } from 'vitest' import { initTreeSitterSDK } from '../test-helpers' +import type { QueryCapture } from 'web-tree-sitter' import { SupportedLanguage } from '../grammars' -import { annotateAndMatchSnapshot } from './annotate-and-match-snapshot' +import type { QueryWrappers } from '../query-sdk' +import { type Captures, annotateAndMatchSnapshot } from './annotate-and-match-snapshot' describe('getDocumentableNode', () => { + const queryWrapper = + (query: QueryWrappers['getDocumentableNode']): Captures => + (node, start, end) => { + const [documentableNode] = query(node, start, end) + if (!documentableNode) { + return [] + } + const captures = [ + documentableNode.symbol, + documentableNode.range, + documentableNode.insertionPoint, + ].filter((capture): capture is QueryCapture => capture !== undefined) + + return captures + } + it('typescript', async () => { const { language, parser, queries } = await initTreeSitterSDK(SupportedLanguage.typescript) await annotateAndMatchSnapshot({ parser, language, - captures: queries.getDocumentableNode, + captures: queryWrapper(queries.getDocumentableNode), sourcesPath: 'test-data/documentable-node.ts', }) }) + + it('typescriptreact', async () => { + const { language, parser, queries } = await initTreeSitterSDK(SupportedLanguage.typescriptreact) + + await annotateAndMatchSnapshot({ + parser, + language, + captures: queryWrapper(queries.getDocumentableNode), + sourcesPath: 'test-data/documentable-node.tsx', + }) + }) + + it('javascriptreact', async () => { + const { language, parser, queries } = await initTreeSitterSDK(SupportedLanguage.javascriptreact) + + await annotateAndMatchSnapshot({ + parser, + language, + captures: queryWrapper(queries.getDocumentableNode), + sourcesPath: 'test-data/documentable-node.jsx', + }) + }) + + it('python', async () => { + const { language, parser, queries } = await initTreeSitterSDK(SupportedLanguage.python) + + await annotateAndMatchSnapshot({ + parser, + language, + captures: queryWrapper(queries.getDocumentableNode), + sourcesPath: 'test-data/documentable-node.py', + }) + }) + + it('go', async () => { + const { language, parser, queries } = await initTreeSitterSDK(SupportedLanguage.go) + + await annotateAndMatchSnapshot({ + parser, + language, + captures: queryWrapper(queries.getDocumentableNode), + sourcesPath: 'test-data/documentable-node.go', + }) + }) }) diff --git a/vscode/src/tree-sitter/query-tests/test-data/documentable-node.go b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.go new file mode 100644 index 0000000000..29e6e9908f --- /dev/null +++ b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.go @@ -0,0 +1,74 @@ +package main + +type Creature struct { + // | +} + +// ------------------------------------ + +type Animal struct { + Name string +// | + Type string +} + +// ------------------------------------ + +type Stringer interface { + // | + String() string +} + +// ------------------------------------ + +type Stringer interface { + String() string + // | +} + +// ------------------------------------ + +type key int + // | + +// ------------------------------------ + +var person = struct { + // | +}{} + +// ------------------------------------ + +var person = struct { + // | +}{} + +// ------------------------------------ + +shortDeclaration := 4 +// | + +// ------------------------------------ + +const name = "Tom" +// | + +// ------------------------------------ + +func nestedVar() { + y := 4 +// | +} + +// ------------------------------------ + +func greet() { + // | +} + +// ------------------------------------ + +func (u User) DisplayName() string { + // | + return u.FirstName + " " + u.LastName +} diff --git a/vscode/src/tree-sitter/query-tests/test-data/documentable-node.jsx b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.jsx new file mode 100644 index 0000000000..216c211c19 --- /dev/null +++ b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.jsx @@ -0,0 +1,11 @@ +function ComponentProp() { + return + // | +} + +// ------------------------------------ + +function ComponentTag() { + return
Hello
+ // | +} diff --git a/vscode/src/tree-sitter/query-tests/test-data/documentable-node.py b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.py new file mode 100644 index 0000000000..cc4c3f1370 --- /dev/null +++ b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.py @@ -0,0 +1,80 @@ +def wrapper(): + print('wrapper') + def test(): + # | + pass + +# ------------------------------------ + +def test(): + # | + pass + +# ------------------------------------ + +def test_multiline_func_declaration( + # | + val, + val2 +): + wrapper() + +# ------------------------------------ + +def test_parameter(val): + # | + wrapper() + +# ------------------------------------ + +class Agent: + # | + pass + +# ------------------------------------ + + +class AgentMultiLine( + BaseClass1, + BaseClass2): + # | + def __init__(self, name): + self.name = name + +# ------------------------------------ + +class Agent: + def __init__(self, name): + # | + self.name = name + +# ------------------------------------ + +class Agent: + def __init__(self, name): + self.name = name + + def test(self): + # | + pass + +# ------------------------------------ + +def return_statement(): + return + # | + +# ------------------------------------ + +return_statement('value') +# | + +# ------------------------------------ + +user_name = 'Tom' + # | + +# ------------------------------------ + +user_name = 'Tom' + # | diff --git a/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.go b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.go new file mode 100644 index 0000000000..9ea0c85e08 --- /dev/null +++ b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.go @@ -0,0 +1,158 @@ +// +// | - query start position in the source file. +// █ – query start position in the annotated file. +// ^ – characters matching the last query result. +// +// ------------------------------------ + + package main + + type Creature struct { +//^ start range.identifier[1] +// ^^^^^^^^ symbol.identifier[1] +// █ + } +//^ end range.identifier[1] + +// Nodes types: +// symbol.identifier[1]: type_identifier +// range.identifier[1]: type_declaration + +// ------------------------------------ + + type Animal struct { + Name string +// ^^^^ symbol.identifier[1] +// ^^^^^^^^^^^ range.identifier[1] +// █ + Type string + } + +// Nodes types: +// symbol.identifier[1]: field_identifier +// range.identifier[1]: field_declaration + +// ------------------------------------ + + type Stringer interface { +//^ start range.identifier[1] +// ^^^^^^^^ symbol.identifier[1] +// █ + String() string + } +//^ end range.identifier[1] + +// Nodes types: +// symbol.identifier[1]: type_identifier +// range.identifier[1]: type_declaration + +// ------------------------------------ + + type Stringer interface { + String() string +// ^^^^^^ symbol.identifier[1] +// ^^^^^^^^^^^^^^^ range.identifier[1] +// █ + } + +// Nodes types: +// symbol.identifier[1]: field_identifier +// range.identifier[1]: method_spec + +// ------------------------------------ + + type key int +//^^^^^^^^^^^^ range.identifier[1] +// ^^^ symbol.identifier[1] +// █ + +// Nodes types: +// symbol.identifier[1]: type_identifier +// range.identifier[1]: type_declaration + +// ------------------------------------ + + var person = struct { +//^ start range.identifier[1] +// █ + }{} +// ^ end range.identifier[1] + +// Nodes types: +// range.identifier[1]: var_declaration + +// ------------------------------------ + + var person = struct { +//^ start range.identifier[1] +// ^^^^^^ symbol.identifier[1] +// █ + }{} +// ^ end range.identifier[1] + +// Nodes types: +// symbol.identifier[1]: identifier +// range.identifier[1]: var_declaration + +// ------------------------------------ + + shortDeclaration := 4 +//^^^^^^^^^^^^^^^^ symbol.identifier[1] +//^^^^^^^^^^^^^^^^^^^^^ range.identifier[1] +// █ + +// Nodes types: +// symbol.identifier[1]: identifier +// range.identifier[1]: short_var_declaration + +// ------------------------------------ + + const name = "Tom" +//^^^^^^^^^^^^^^^^^^ range.identifier[1] +// ^^^^ symbol.identifier[1] +// █ + +// Nodes types: +// symbol.identifier[1]: identifier +// range.identifier[1]: const_declaration + +// ------------------------------------ + + func nestedVar() { + y := 4 +// ^ symbol.identifier[1] +// ^^^^^^ range.identifier[1] +// █ + } + +// Nodes types: +// symbol.identifier[1]: identifier +// range.identifier[1]: short_var_declaration + +// ------------------------------------ + + func greet() { +//^ start range.function[1] +// ^^^^^ symbol.function[1] +// █ + } +//^ end range.function[1] + +// Nodes types: +// symbol.function[1]: identifier +// range.function[1]: function_declaration + +// ------------------------------------ + + func (u User) DisplayName() string { +//^ start range.function[1] +// ^^^^^^^^^^^ symbol.function[1] +// █ + return u.FirstName + " " + u.LastName + } +//^ end range.function[1] + +// Nodes types: +// symbol.function[1]: field_identifier +// range.function[1]: method_declaration + diff --git a/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.jsx b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.jsx new file mode 100644 index 0000000000..9cc2207541 --- /dev/null +++ b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.jsx @@ -0,0 +1,29 @@ +// +// | - query start position in the source file. +// █ – query start position in the annotated file. +// ^ – characters matching the last query result. +// +// ------------------------------------ + + function ComponentProp() { +//^ start range.function[1] + return +// █ + } +//^ end range.function[1] + +// Nodes types: +// range.function[1]: function_declaration + +// ------------------------------------ + + function ComponentTag() { +//^ start range.function[1] + return
Hello
+// █ + } +//^ end range.function[1] + +// Nodes types: +// range.function[1]: function_declaration + diff --git a/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.py b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.py new file mode 100644 index 0000000000..0183428a19 --- /dev/null +++ b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.py @@ -0,0 +1,173 @@ +# +# | - query start position in the source file. +# █ – query start position in the annotated file. +# ^ – characters matching the last query result. +# +# ------------------------------------ + + def wrapper(): + print('wrapper') + def test(): +# ^ start range.function[1] +# ^^^^ symbol.function[1] +# ^ insertion.point[1] +# █ + pass +# ^ end range.function[1] + +# Nodes types: +# symbol.function[1]: identifier +# range.function[1]: function_definition +# insertion.point[1]: : + +# ------------------------------------ + + def test(): +#^ start range.function[1] +# ^^^^ symbol.function[1] +# ^ insertion.point[1] +# █ + pass +# ^ end range.function[1] + +# Nodes types: +# symbol.function[1]: identifier +# range.function[1]: function_definition +# insertion.point[1]: : + +# ------------------------------------ + + def test_multiline_func_declaration( +#^ start range.function[1] +# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ symbol.function[1] +# █ + val, + val2 + ): +# ^ insertion.point[1] + wrapper() +# ^ end range.function[1] + +# Nodes types: +# symbol.function[1]: identifier +# range.function[1]: function_definition +# insertion.point[1]: : + +# ------------------------------------ + + def test_parameter(val): +#^ start range.function[1] +# ^ insertion.point[1] +# █ + wrapper() +# ^ end range.function[1] + +# Nodes types: +# range.function[1]: function_definition +# insertion.point[1]: : + +# ------------------------------------ + + class Agent: +#^ start range.class[1] +# ^^^^^ symbol.class[1] +# ^ insertion.point[1] +# █ + pass +# ^ end range.class[1] + +# Nodes types: +# symbol.class[1]: identifier +# range.class[1]: class_definition +# insertion.point[1]: : + +# ------------------------------------ + + + class AgentMultiLine( +#^ start range.class[1] + BaseClass1, + BaseClass2): +# ^ insertion.point[1] +# █ + def __init__(self, name): + self.name = name +# ^ end range.class[1] + +# Nodes types: +# range.class[1]: class_definition +# insertion.point[1]: : + +# ------------------------------------ + + class Agent: + def __init__(self, name): +# ^ start range.function[1] +# ^^^^^^^^ symbol.function[1] +# ^ insertion.point[1] +# █ + self.name = name +# ^ end range.function[1] + +# Nodes types: +# symbol.function[1]: identifier +# range.function[1]: function_definition +# insertion.point[1]: : + +# ------------------------------------ + + class Agent: + def __init__(self, name): + self.name = name + + def test(self): +# ^ start range.function[1] +# ^^^^ symbol.function[1] +# ^ insertion.point[1] +# █ + pass +# ^ end range.function[1] + +# Nodes types: +# symbol.function[1]: identifier +# range.function[1]: function_definition +# insertion.point[1]: : + +# ------------------------------------ + + def return_statement(): +#^ start range.function[1] +# ^ insertion.point[1] + return +# ^ end range.function[1] +# █ + +# Nodes types: +# range.function[1]: function_definition +# insertion.point[1]: : + +# ------------------------------------ + +return_statement('value') +# | + +# ------------------------------------ + + user_name = 'Tom' +#^^^^^^^^^ symbol.identifier[1] +#^^^^^^^^^^^^^^^^^ range.identifier[1] +# █ + +# Nodes types: +# symbol.identifier[1]: identifier +# range.identifier[1]: assignment + +# ------------------------------------ + + user_name = 'Tom' +#^^^^^^^^^^^^^^^^^ range.identifier[1] +# █ + +# Nodes types: +# range.identifier[1]: assignment + diff --git a/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.ts b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.ts index 45a878df3c..d8206629da 100644 --- a/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.ts +++ b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.ts @@ -8,227 +8,210 @@ function wrapper() { console.log('wrapper') function test() { -// ^^^^ documentableNode[1] +// ^ start range.function[1] +// ^^^^ symbol.function[1] // █ } +// ^ end range.function[1] } // Nodes types: -// documentableNode[1]: identifier +// symbol.function[1]: identifier +// range.function[1]: function_declaration // ------------------------------------ function testFunc() { -// ^^^^^^^^ documentableNode[1] +//^ start range.function[1] +// ^^^^^^^^ symbol.function[1] // █ wrapper } +//^ end range.function[1] // Nodes types: -// documentableNode[1]: identifier +// symbol.function[1]: identifier +// range.function[1]: function_declaration // ------------------------------------ -function testParameter(val) { - // | - wrapper -} + function testParameter(val) { +//^ start range.function[1] +// █ + wrapper + } +//^ end range.function[1] + +// Nodes types: +// range.function[1]: function_declaration // ------------------------------------ function arrowWrapper() { const arrow = (value: string) => { -// ^^^^^ documentableNode[1] +// ^ start range.identifier[1] +// ^^^^^ symbol.identifier[1] // █ } +// ^ end range.identifier[1] } // Nodes types: -// documentableNode[1]: identifier +// symbol.identifier[1]: identifier +// range.identifier[1]: lexical_declaration // ------------------------------------ const arrowFunc = (value: string) => { -// ^^^^^^^^^ documentableNode[1] +//^ start range.identifier[1] +// ^^^^^^^^^ symbol.identifier[1] // █ } +//^ end range.identifier[1] // Nodes types: -// documentableNode[1]: identifier +// symbol.identifier[1]: identifier +// range.identifier[1]: lexical_declaration // ------------------------------------ class Agent { -// ^^^^^ documentableNode[1] +//^ start range.identifier[1] +// ^^^^^ symbol.identifier[1] // █ } +//^ end range.identifier[1] // Nodes types: -// documentableNode[1]: type_identifier +// symbol.identifier[1]: type_identifier +// range.identifier[1]: class_declaration // ------------------------------------ class AgentConstructor { constructor() { -// ^^^^^^^^^^^ documentableNode[1] +// ^^^^^^^^^^^ symbol.function[1] +// ^ start range.function[1] // █ } +// ^ end range.function[1] } // Nodes types: -// documentableNode[1]: property_identifier +// symbol.function[1]: property_identifier +// range.function[1]: method_definition // ------------------------------------ function signature() -// ^^^^^^^^^ documentableNode[1] +//^^^^^^^^^^^^^^^^^^^^ range.function[1] +// ^^^^^^^^^ symbol.function[1] // █ // Nodes types: -// documentableNode[1]: identifier +// symbol.function[1]: identifier +// range.function[1]: function_signature // ------------------------------------ interface TestInterface { -// ^^^^^^^^^^^^^ documentableNode[1] +//^ start range.identifier[1] +// ^^^^^^^^^^^^^ symbol.identifier[1] // █ } +//^ end range.identifier[1] // Nodes types: -// documentableNode[1]: type_identifier +// symbol.identifier[1]: type_identifier +// range.identifier[1]: interface_declaration // ------------------------------------ interface TestInterfacePropertySignature { test: boolean -// ^^^^ documentableNode[1] +// ^^^^ symbol.identifier[1] +// ^^^^^^^^^^^^^ range.identifier[1] // █ } // Nodes types: -// documentableNode[1]: property_identifier +// symbol.identifier[1]: property_identifier +// range.identifier[1]: property_signature // ------------------------------------ interface TestInterfaceCallSignature { (): boolean; -// ^^^^^^^^^^^ documentableNode[1] +// ^^^^^^^^^^^ symbol.function[1], range.function[1] // █ } // Nodes types: -// documentableNode[1]: call_signature +// symbol.function[1]: call_signature +// range.function[1]: call_signature // ------------------------------------ type TestType = { -// ^^^^^^^^ documentableNode[1] +//^ start range.identifier[1] +// ^^^^^^^^ symbol.identifier[1] // █ } +//^ end range.identifier[1] // Nodes types: -// documentableNode[1]: type_identifier +// symbol.identifier[1]: type_identifier +// range.identifier[1]: type_alias_declaration // ------------------------------------ type TestTypePropertySignature = { test: number -// ^^^^ documentableNode[1] +// ^^^^ symbol.identifier[1] +// ^^^^^^^^^^^^ range.identifier[1] // █ } // Nodes types: -// documentableNode[1]: property_identifier +// symbol.identifier[1]: property_identifier +// range.identifier[1]: property_signature // ------------------------------------ type TestTypeCallSignature = { (): boolean; -// ^^^^^^^^^^^ documentableNode[1] +// ^^^^^^^^^^^ symbol.function[1], range.function[1] // █ } // Nodes types: -// documentableNode[1]: call_signature +// symbol.function[1]: call_signature +// range.function[1]: call_signature // ------------------------------------ enum TestEnum { One, Two, Three } -// ^^^^^^^^ documentableNode[1] +//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ range.identifier[1] +// ^^^^^^^^ symbol.identifier[1] // █ // Nodes types: -// documentableNode[1]: identifier +// symbol.identifier[1]: identifier +// range.identifier[1]: enum_declaration // ------------------------------------ const name = 'test' -// ^^^^ documentableNode[1] +//^^^^^^^^^^^^^^^^^^^ range.identifier[1] +// ^^^^ symbol.identifier[1] // █ // Nodes types: -// documentableNode[1]: identifier +// symbol.identifier[1]: identifier +// range.identifier[1]: lexical_declaration // ------------------------------------ let changingName = 'test' changingName = 'other' // | - -// ------------------------------------ - - export function testFunc() {} -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ documentableExport[1] -// █ - -// Nodes types: -// documentableExport[1]: export_statement - -// ------------------------------------ - - export function testFunc() {} -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ documentableExport[1] -// █ - -// Nodes types: -// documentableExport[1]: export_statement - -// ------------------------------------ - - const name = 'test' - export { name } -//^^^^^^^^^^^^^^^ documentableExport[1] -// █ - -// Nodes types: -// documentableExport[1]: export_statement - -// ------------------------------------ - - const name = 'test' - export { name } -// ^^^^ documentableNode[1] -// █ - -// Nodes types: -// documentableNode[1]: identifier - -// ------------------------------------ - - const name = 'test' - export default name -//^^^^^^^^^^^^^^^^^^^ documentableExport[1] -// █ - -// Nodes types: -// documentableExport[1]: export_statement - -// ------------------------------------ - - export default function testFunc() {} -//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ documentableExport[1] -// █ - -// Nodes types: -// documentableExport[1]: export_statement - diff --git a/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.tsx b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.tsx new file mode 100644 index 0000000000..9cc2207541 --- /dev/null +++ b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.snap.tsx @@ -0,0 +1,29 @@ +// +// | - query start position in the source file. +// █ – query start position in the annotated file. +// ^ – characters matching the last query result. +// +// ------------------------------------ + + function ComponentProp() { +//^ start range.function[1] + return +// █ + } +//^ end range.function[1] + +// Nodes types: +// range.function[1]: function_declaration + +// ------------------------------------ + + function ComponentTag() { +//^ start range.function[1] + return
Hello
+// █ + } +//^ end range.function[1] + +// Nodes types: +// range.function[1]: function_declaration + diff --git a/vscode/src/tree-sitter/query-tests/test-data/documentable-node.ts b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.ts index 24a64bad7e..ac81262abf 100644 --- a/vscode/src/tree-sitter/query-tests/test-data/documentable-node.ts +++ b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.ts @@ -107,36 +107,3 @@ const name = 'test' let changingName = 'test' changingName = 'other' // | - -// ------------------------------------ - -export function testFunc() {} -// | - -// ------------------------------------ - -export function testFunc() {} -// | - -// ------------------------------------ - -const name = 'test' -export { name } -// | - -// ------------------------------------ - -const name = 'test' -export { name } -// | - -// ------------------------------------ - -const name = 'test' -export default name -// | - -// ------------------------------------ - -export default function testFunc() {} -// | diff --git a/vscode/src/tree-sitter/query-tests/test-data/documentable-node.tsx b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.tsx new file mode 100644 index 0000000000..216c211c19 --- /dev/null +++ b/vscode/src/tree-sitter/query-tests/test-data/documentable-node.tsx @@ -0,0 +1,11 @@ +function ComponentProp() { + return + // | +} + +// ------------------------------------ + +function ComponentTag() { + return
Hello
+ // | +} From 3891e30df2b2717775700cb460d868310e5e8ecf Mon Sep 17 00:00:00 2001 From: Tom Ross Date: Fri, 15 Mar 2024 16:48:11 +0000 Subject: [PATCH 04/13] Edit: Only compute diffs for actual edits (#3424) --- vscode/CHANGELOG.md | 3 ++- vscode/src/non-stop/FixupController.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/vscode/CHANGELOG.md b/vscode/CHANGELOG.md index b2dbddb669..78a17cb836 100644 --- a/vscode/CHANGELOG.md +++ b/vscode/CHANGELOG.md @@ -13,7 +13,9 @@ This is a log of all notable changes to Cody for VS Code. [Unreleased] changes a - Edit: Added a ghost text hint ("Alt+K to Generate Code") that shows on empty files. [pull/3275](https://github.com/sourcegraph/cody/pull/3275) ### Fixed + - Document: Fixed an issue where the generated documentation would be incorrectly inserted for Python. Cody will now follow PEP 257 – Docstring Conventions. [pull/3275](https://github.com/sourcegraph/cody/pull/3275) +- Edit: Fixed incorrect decorations being shown for edits that only insert new code. [pull/3424](https://github.com/sourcegraph/cody/pull/3424) ### Changed @@ -24,7 +26,6 @@ This is a log of all notable changes to Cody for VS Code. [Unreleased] changes a - Autocomplete: Enabled dynamic multiline completions by default. [pull/3392](https://github.com/sourcegraph/cody/pull/3392) - Document: Upgraded to use a faster model. [pull/3275](https://github.com/sourcegraph/cody/pull/3275) - ## [1.8.3] ### Fixed diff --git a/vscode/src/non-stop/FixupController.ts b/vscode/src/non-stop/FixupController.ts index de9c990aa4..9dd87eddbb 100644 --- a/vscode/src/non-stop/FixupController.ts +++ b/vscode/src/non-stop/FixupController.ts @@ -984,7 +984,7 @@ export class FixupController if (this.needsDiffUpdate_.size === 0) { void this.scheduler.scheduleIdle(() => this.updateDiffs()) } - if (!this.needsDiffUpdate_.has(task)) { + if (task.mode === 'edit' && !this.needsDiffUpdate_.has(task)) { this.needsDiffUpdate_.add(task) } } From 449692f12dbf591e24d8aa62cc126a417478693e Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Fri, 15 Mar 2024 17:50:57 +0100 Subject: [PATCH 05/13] Add Claude 3 to model dropdown (#3423) --- lib/shared/src/models/dotcom.ts | 8 ++++++++ vscode/CHANGELOG.md | 1 + vscode/src/edit/prompt/index.ts | 1 + 3 files changed, 10 insertions(+) diff --git a/lib/shared/src/models/dotcom.ts b/lib/shared/src/models/dotcom.ts index 0ebd71bffb..cf07f84a0b 100644 --- a/lib/shared/src/models/dotcom.ts +++ b/lib/shared/src/models/dotcom.ts @@ -27,6 +27,14 @@ export const DEFAULT_DOT_COM_MODELS = [ codyProOnly: true, usage: [ModelUsage.Chat, ModelUsage.Edit], }, + { + title: 'Claude 3 Haiku', + model: 'anthropic/claude-3-haiku-20240307', + provider: 'Anthropic', + default: false, + codyProOnly: true, + usage: [ModelUsage.Chat, ModelUsage.Edit], + }, { title: 'Claude 3 Sonnet', model: 'anthropic/claude-3-sonnet-20240229', diff --git a/vscode/CHANGELOG.md b/vscode/CHANGELOG.md index 78a17cb836..ac5377c0cf 100644 --- a/vscode/CHANGELOG.md +++ b/vscode/CHANGELOG.md @@ -11,6 +11,7 @@ This is a log of all notable changes to Cody for VS Code. [Unreleased] changes a - Document: Added a ghost text hint ("Alt+D to Document") that shows when the users' cursor is on a documentable symbol. Currently supported in JavaScript, TypeScript, Go and Python. [pull/3275](https://github.com/sourcegraph/cody/pull/3275) - Document: Added a shortcut (`Alt+D`) to immediately execute the document command. [pull/3275](https://github.com/sourcegraph/cody/pull/3275) - Edit: Added a ghost text hint ("Alt+K to Generate Code") that shows on empty files. [pull/3275](https://github.com/sourcegraph/cody/pull/3275) +- Chat: Add Claude 3 Haiku for Pro users. [pull/3423](https://github.com/sourcegraph/cody/pull/3423) ### Fixed diff --git a/vscode/src/edit/prompt/index.ts b/vscode/src/edit/prompt/index.ts index 3cddbb0414..4af5aa6eff 100644 --- a/vscode/src/edit/prompt/index.ts +++ b/vscode/src/edit/prompt/index.ts @@ -25,6 +25,7 @@ const INTERACTION_MODELS: Record = { 'anthropic/claude-instant-1.2': claude, 'anthropic/claude-3-opus-20240229': claude, 'anthropic/claude-3-sonnet-20240229': claude, + 'anthropic/claude-3-haiku-20240307': claude, 'openai/gpt-3.5-turbo': openai, 'openai/gpt-4-1106-preview': openai, } as const From 3e40fb500c12eb7126ff1bbdbd7a63233f19c274 Mon Sep 17 00:00:00 2001 From: Philipp Spiess Date: Fri, 15 Mar 2024 18:00:52 +0100 Subject: [PATCH 06/13] Agent: Bundle WASM artifacts (#3386) --- agent/package.json | 16 +- .../recording.har.yaml | 907 +++++------------- agent/scripts/test-agent-binary.ts | 112 +++ agent/src/AgentWorkspaceConfiguration.ts | 3 - agent/src/TestClient.ts | 8 +- agent/src/esbuild.mjs | 11 + agent/src/index.test.ts | 57 +- lib/shared/src/configuration.ts | 1 - vscode/package.json | 70 +- vscode/src/configuration.test.ts | 2 - vscode/src/tree-sitter/parser.ts | 1 + 11 files changed, 437 insertions(+), 751 deletions(-) create mode 100644 agent/scripts/test-agent-binary.ts diff --git a/agent/package.json b/agent/package.json index 82f988814f..62a1f28d56 100644 --- a/agent/package.json +++ b/agent/package.json @@ -1,6 +1,6 @@ { "private": true, - "name": "@sourcegraph/cody-agent", + "name": "@sourcegraph/agent", "version": "0.0.1", "description": "Cody JSON-RPC agent for consistent cross-editor support", "license": "Apache-2.0", @@ -19,9 +19,21 @@ "agent": "pnpm run build && node dist/index.js", "agent:debug": "pnpm run build && node --inspect --enable-source-maps ./dist/index.js", "build-ts": "tsc --build", - "build-agent-binaries": "pnpm run build && cp dist/index.js dist/agent.js && pkg -t latest-linux-arm64,latest-linux-x64,latest-macos-arm64,latest-macos-x64,latest-win-x64 dist/agent.js --out-path ${AGENT_EXECUTABLE_TARGET_DIRECTORY:-dist}", + "build-agent-binaries": "pnpm run build && pkg --compress GZip --no-bytecode --public-packages \"*\" --public . --out-path ${AGENT_EXECUTABLE_TARGET_DIRECTORY:-dist}", + "test-agent-binary": "esbuild ./scripts/test-agent-binary.ts --bundle --platform=node --alias:vscode=./src/vscode-shim.ts --outdir=dist && node ./dist/test-agent-binary.js", "test": "vitest" }, + "pkg": { + "targets": [ + "latest-linux-arm64", + "latest-linux-x64", + "latest-macos-x64", + "latest-win-x64", + "latest-macos-arm64" + ], + "assets": "dist/*.{wasm,map}" + }, + "bin": "dist/index.js", "dependencies": { "@pollyjs/core": "^6.0.6", "@pollyjs/persister": "^6.0.6", diff --git a/agent/recordings/defaultClient_631904893/recording.har.yaml b/agent/recordings/defaultClient_631904893/recording.har.yaml index f23877244c..cf4cd4dc1a 100644 --- a/agent/recordings/defaultClient_631904893/recording.har.yaml +++ b/agent/recordings/defaultClient_631904893/recording.har.yaml @@ -9666,6 +9666,7 @@ log: + - speaker: assistant @@ -17801,11 +17802,11 @@ log: send: 0 ssl: -1 wait: 0 - - _id: b6b27fd2cc4315a38d0aa2768d7bdae6 + - _id: 29995f66f46573160240f85311dbfbc9 _order: 0 cache: {} request: - bodySize: 2923 + bodySize: 2646 cookies: [] headers: - name: content-type @@ -17832,19 +17833,6 @@ log: text: You are Cody, an AI coding assistant from Sourcegraph. - speaker: assistant text: I am Cody, an AI coding assistant from Sourcegraph. - - speaker: human - text: >+ - Codebase context from file src/TestClass.tsin repository - undefined: - - const foo = 42 - - - export class TestClass { - constructor(private shouldGreet: boolean) {} - - - speaker: assistant - text: Ok. - speaker: human text: >- - You are an AI programming assistant who is an expert in @@ -17867,16 +17855,13 @@ log: - Do not provide any additional commentary about the changes you made. Only respond with the generated code. - This is part of the file: src/TestClass.ts + This is part of the file: src/sum.ts The user has the following code in their selection: - public functionName() { - if (this.shouldGreet) { - console.log(/* CURSOR */ 'Hello World!') - } - } + export function sum(a: number, b: number): number { + /* CURSOR */ } @@ -17894,101 +17879,201 @@ log: model: anthropic/claude-instant-1.2 stopSequences: - - - " public functionName() {" + - "export function sum(a: number, b: number): number {" temperature: 0 topK: -1 topP: -1 queryString: [] url: https://sourcegraph.com/.api/completions/stream response: - bodySize: 1829 + bodySize: 5426 content: mimeType: text/event-stream - size: 1829 + size: 5426 text: >+ event: completion - data: {"completion":"\n","stopReason":""} + data: {"completion":"\n/**","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n *","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n *","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @param","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @param a","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @param a Th","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in th","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n *","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b Th","stopReason":""} + + + event: completion + + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second","stopReason":""} event: completion - data: {"completion":"\n /**","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number","stopReason":""} event: completion - data: {"completion":"\n /** \n","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in","stopReason":""} event: completion - data: {"completion":"\n /** \n *","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in th","stopReason":""} event: completion - data: {"completion":"\n /** \n * Condition","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in the addition","stopReason":""} event: completion - data: {"completion":"\n /** \n * Conditionally","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in the addition\n *","stopReason":""} event: completion - data: {"completion":"\n /** \n * Conditionally logs","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in the addition\n * @","stopReason":""} event: completion - data: {"completion":"\n /** \n * Conditionally logs a","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in the addition\n * @returns","stopReason":""} event: completion - data: {"completion":"\n /** \n * Conditionally logs a greeting","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in the addition\n * @returns Th","stopReason":""} event: completion - data: {"completion":"\n /** \n * Conditionally logs a greeting message","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in the addition\n * @returns The sum","stopReason":""} event: completion - data: {"completion":"\n /** \n * Conditionally logs a greeting message to","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in the addition\n * @returns The sum of","stopReason":""} event: completion - data: {"completion":"\n /** \n * Conditionally logs a greeting message to the","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in the addition\n * @returns The sum of a","stopReason":""} event: completion - data: {"completion":"\n /** \n * Conditionally logs a greeting message to the console","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in the addition\n * @returns The sum of a and","stopReason":""} event: completion - data: {"completion":"\n /** \n * Conditionally logs a greeting message to the console\n","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in the addition\n * @returns The sum of a and b","stopReason":""} event: completion - data: {"completion":"\n /** \n * Conditionally logs a greeting message to the console\n */","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in the addition\n * @returns The sum of a and b\n */","stopReason":""} event: completion - data: {"completion":"\n /** \n * Conditionally logs a greeting message to the console\n */\n","stopReason":""} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in the addition\n * @returns The sum of a and b\n */\n","stopReason":""} event: completion - data: {"completion":"\n /** \n * Conditionally logs a greeting message to the console\n */\n","stopReason":"stop_sequence"} + data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number in the addition\n * @param b The second number in the addition\n * @returns The sum of a and b\n */\n","stopReason":"stop_sequence"} event: done @@ -17998,15 +18083,13 @@ log: cookies: [] headers: - name: date - value: Fri, 15 Mar 2024 15:21:07 GMT + value: Fri, 15 Mar 2024 16:50:56 GMT - name: content-type value: text/event-stream - name: transfer-encoding value: chunked - name: connection value: keep-alive - - name: retry-after - value: "2" - name: access-control-allow-credentials value: "true" - name: access-control-allow-origin @@ -18024,12 +18107,12 @@ log: value: 1; mode=block - name: strict-transport-security value: max-age=31536000; includeSubDomains; preload - headersSize: 1404 + headersSize: 1299 httpVersion: HTTP/1.1 redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-03-15T15:21:06.368Z + startedDateTime: 2024-03-15T16:50:55.228Z time: 0 timings: blocked: -1 @@ -18039,11 +18122,11 @@ log: send: 0 ssl: -1 wait: 0 - - _id: 8961a8ede88d148c637b993e659e2660 + - _id: 582ec1d4d07385ec49cfb74bdda77e47 _order: 0 cache: {} request: - bodySize: 2930 + bodySize: 2912 cookies: [] headers: - name: content-type @@ -18071,11 +18154,18 @@ log: - speaker: assistant text: I am Cody, an AI coding assistant from Sourcegraph. - speaker: human - text: > - Codebase context from file src/TestLogger.tsin repository - undefined: + text: "Codebase context from file src/TestClass.tsin repository undefined: - const foo = 42 + t foo = 42 + + + export class TestClass { + + \ constructor(private shouldGreet: + boolean) {} + + + \ " - speaker: assistant text: Ok. - speaker: human @@ -18100,25 +18190,16 @@ log: - Do not provide any additional commentary about the changes you made. Only respond with the generated code. - This is part of the file: src/TestLogger.ts + This is part of the file: src/TestClass.ts The user has the following code in their selection: - export const TestLogger = { - startLogging: () => { - // Do some stuff - - function recordLog() { - console.log(/* CURSOR */ 'Recording the log') + public functionName() { + if (this.shouldGreet) { + console.log(/* CURSOR */ 'Hello World!') } - - recordLog() - }, - } - - - + } The user wants you to generate documentation for the selected code by following their instructions. @@ -18134,17 +18215,17 @@ log: model: anthropic/claude-instant-1.2 stopSequences: - - - export const TestLogger = { + - public functionName() { temperature: 0 topK: -1 topP: -1 queryString: [] url: https://sourcegraph.com/.api/completions/stream response: - bodySize: 3337 + bodySize: 1759 content: mimeType: text/event-stream - size: 3337 + size: 1759 text: >+ event: completion @@ -18158,122 +18239,77 @@ log: event: completion - data: {"completion":"\n/**\n * Starts","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Starts recording","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Starts recording th","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Starts recording the log","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Starts recording the log.","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Starts recording the log. Logs","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Starts recording the log. Logs th","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Starts recording the log. Logs the messag","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording","stopReason":""} + data: {"completion":"\n/**\n * Logs","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording th","stopReason":""} + data: {"completion":"\n/**\n * Logs a","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log","stopReason":""} + data: {"completion":"\n/**\n * Logs a greeting","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\"","stopReason":""} + data: {"completion":"\n/**\n * Logs a greeting message","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after","stopReason":""} + data: {"completion":"\n/**\n * Logs a greeting message if","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing","stopReason":""} + data: {"completion":"\n/**\n * Logs a greeting message if the","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing som","stopReason":""} + data: {"completion":"\n/**\n * Logs a greeting message if the should","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial","stopReason":""} + data: {"completion":"\n/**\n * Logs a greeting message if the shouldG","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial setup","stopReason":""} + data: {"completion":"\n/**\n * Logs a greeting message if the shouldGreet","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial setup work","stopReason":""} + data: {"completion":"\n/**\n * Logs a greeting message if the shouldGreet flag","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial setup work.","stopReason":""} + data: {"completion":"\n/**\n * Logs a greeting message if the shouldGreet flag is","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial setup work.\n*/","stopReason":""} + data: {"completion":"\n/**\n * Logs a greeting message if the shouldGreet flag is true","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial setup work.\n*/ ","stopReason":""} + data: {"completion":"\n/**\n * Logs a greeting message if the shouldGreet flag is true\n */","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial setup work.\n*/ \n","stopReason":""} + data: {"completion":"\n/**\n * Logs a greeting message if the shouldGreet flag is true\n */\n","stopReason":""} event: completion - data: {"completion":"\n/**\n * Starts recording the log. Logs the message \"Recording the log\" after doing some initial setup work.\n*/ \n","stopReason":"stop_sequence"} + data: {"completion":"\n/**\n * Logs a greeting message if the shouldGreet flag is true\n */\n","stopReason":"stop_sequence"} event: done @@ -18283,7 +18319,7 @@ log: cookies: [] headers: - name: date - value: Fri, 15 Mar 2024 15:21:09 GMT + value: Fri, 15 Mar 2024 16:50:58 GMT - name: content-type value: text/event-stream - name: transfer-encoding @@ -18312,7 +18348,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-03-15T15:21:07.866Z + startedDateTime: 2024-03-15T16:50:57.011Z time: 0 timings: blocked: -1 @@ -18322,11 +18358,11 @@ log: send: 0 ssl: -1 wait: 0 - - _id: d1bd7ceb4c707609889eb3d648d1da28 + - _id: da84ec33509faaa8f9e6c5ce26e7f2ef _order: 0 cache: {} request: - bodySize: 3155 + bodySize: 2881 cookies: [] headers: - name: content-type @@ -18354,16 +18390,18 @@ log: - speaker: assistant text: I am Cody, an AI coding assistant from Sourcegraph. - speaker: human - text: >+ - Codebase context from file src/example.test.tsin repository - undefined: + text: "Codebase context from file src/TestLogger.tsin repository undefined: - import { expect } from 'vitest' + o = 42 - import { it } from 'vitest' + export const TestLogger = { + + \ startLogging: () => { + + \ // Do some stuff - import { describe } from 'vitest' + \ " - speaker: assistant text: Ok. - speaker: human @@ -18388,28 +18426,14 @@ log: - Do not provide any additional commentary about the changes you made. Only respond with the generated code. - This is part of the file: src/example.test.ts + This is part of the file: src/TestLogger.ts The user has the following code in their selection: - describe('test block', () => { - it('does 1', () => { - expect(true).toBe(true) - }) - - it('does 2', () => { - expect(true).toBe(true) - }) - - it('does something else', () => { - // This line will error due to incorrect usage of `performance.now` - const startTime = performance.now(/* CURSOR */) - }) - }) - - - + function recordLog() { + console.log(/* CURSOR */ 'Recording the log') + } The user wants you to generate documentation for the selected code by following their instructions. @@ -18425,17 +18449,17 @@ log: model: anthropic/claude-instant-1.2 stopSequences: - - - describe('test block', () => { + - function recordLog() { temperature: 0 topK: -1 topP: -1 queryString: [] url: https://sourcegraph.com/.api/completions/stream response: - bodySize: 20644 + bodySize: 1122 content: mimeType: text/event-stream - size: 20644 + size: 1122 text: >+ event: completion @@ -18449,422 +18473,62 @@ log: event: completion - data: {"completion":"\n/**\n * Tests","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component ","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n *","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * ","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n *","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a","stopReason":""} + data: {"completion":"\n/**\n * Records","stopReason":""} event: completion - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set","stopReason":""} + data: {"completion":"\n/**\n * Records a","stopReason":""} event: completion - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of","stopReason":""} + data: {"completion":"\n/**\n * Records a log","stopReason":""} event: completion - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests","stopReason":""} + data: {"completion":"\n/**\n * Records a log message","stopReason":""} event: completion - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for","stopReason":""} + data: {"completion":"\n/**\n * Records a log message to","stopReason":""} event: completion - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an","stopReason":""} + data: {"completion":"\n/**\n * Records a log message to the","stopReason":""} event: completion - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example","stopReason":""} + data: {"completion":"\n/**\n * Records a log message to the console","stopReason":""} event: completion - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component","stopReason":""} + data: {"completion":"\n/**\n * Records a log message to the console\n */","stopReason":""} event: completion - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component,","stopReason":""} + data: {"completion":"\n/**\n * Records a log message to the console\n */\n","stopReason":""} event: completion - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, ","stopReason":""} - + data: {"completion":"\n/**\n * Records a log message to the console\n */\n","stopReason":"stop_sequence"} - event: completion - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n *","stopReason":""} + event: done - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n *","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * ","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n *","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * -","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\"","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" -","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check ","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n *","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * -","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\"","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" -","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n *","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * -","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\"","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" -","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attemp","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing ","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n *","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n * ","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n * a","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n * a require","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n * a required argument","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n * a required argument\n*/","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n * a required argument\n*/\n","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Tests for an example component \n * \n * This block describes a set of tests for an example component, \n * with three example test cases:\n * \n * - \"does 1\" - Tests a simple true check \n * - \"does 2\" - Another simple true check\n * - \"does something else\" - Attempts to get a performance timing but is missing \n * a required argument\n*/\n","stopReason":"stop_sequence"} - - - event: done - - data: {} + data: {} cookies: [] headers: - name: date - value: Fri, 15 Mar 2024 15:21:10 GMT + value: Fri, 15 Mar 2024 16:50:59 GMT - name: content-type value: text/event-stream - name: transfer-encoding @@ -18893,7 +18557,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-03-15T15:21:09.454Z + startedDateTime: 2024-03-15T16:50:58.493Z time: 0 timings: blocked: -1 @@ -18903,11 +18567,11 @@ log: send: 0 ssl: -1 wait: 0 - - _id: 90f6a2b3896be9c4af214f4aeb3a0b98 + - _id: 7347e410fb6a9c6e45e3c07eb55ec9ce _order: 0 cache: {} request: - bodySize: 2648 + bodySize: 3150 cookies: [] headers: - name: content-type @@ -18934,6 +18598,40 @@ log: text: You are Cody, an AI coding assistant from Sourcegraph. - speaker: assistant text: I am Cody, an AI coding assistant from Sourcegraph. + - speaker: human + text: "Codebase context from file src/example.test.tsin repository undefined: + + \ expect } from 'vitest' + + import { it } from 'vitest' + + import { describe } from 'vitest' + + + describe('test block', () => { + + \ it('does 1', () => { + + \ expect(true).toBe(true) + + \ }) + + + \ it('does 2', () => { + + \ expect(true).toBe(true) + + \ }) + + + \ it('does something else', () => { + + \ // This line will error due to + incorrect usage of `performance.now` + + \ " + - speaker: assistant + text: Ok. - speaker: human text: >- - You are an AI programming assistant who is an expert in @@ -18956,16 +18654,12 @@ log: - Do not provide any additional commentary about the changes you made. Only respond with the generated code. - This is part of the file: src/sum.ts + This is part of the file: src/example.test.ts The user has the following code in their selection: - export function sum(a: number, b: number): number { - /* CURSOR */ - } - - + const startTime = performance.now(/* CURSOR */) The user wants you to generate documentation for the selected code by following their instructions. @@ -18982,17 +18676,17 @@ log: model: anthropic/claude-instant-1.2 stopSequences: - - - "export function sum(a: number, b: number): number {" + - const startTime = performance.now(/* CURSOR */) temperature: 0 topK: -1 topP: -1 queryString: [] url: https://sourcegraph.com/.api/completions/stream response: - bodySize: 4184 + bodySize: 1239 content: mimeType: text/event-stream - size: 4184 + size: 1239 text: >+ event: completion @@ -19001,157 +18695,62 @@ log: event: completion - data: {"completion":"\n/**\n *","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n *","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @param","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @param a","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @param a Th","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number ","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n *","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b Th","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number","stopReason":""} - - - event: completion - - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n *","stopReason":""} + data: {"completion":"\n/** Me","stopReason":""} event: completion - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @","stopReason":""} + data: {"completion":"\n/** Measures","stopReason":""} event: completion - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns","stopReason":""} + data: {"completion":"\n/** Measures the","stopReason":""} event: completion - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns Th","stopReason":""} + data: {"completion":"\n/** Measures the time","stopReason":""} event: completion - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum","stopReason":""} + data: {"completion":"\n/** Measures the time when","stopReason":""} event: completion - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum of","stopReason":""} + data: {"completion":"\n/** Measures the time when this","stopReason":""} event: completion - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum of a","stopReason":""} + data: {"completion":"\n/** Measures the time when this test","stopReason":""} event: completion - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum of a and","stopReason":""} + data: {"completion":"\n/** Measures the time when this test begins","stopReason":""} event: completion - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum of a and b","stopReason":""} + data: {"completion":"\n/** Measures the time when this test begins running","stopReason":""} event: completion - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum of a and b\n */","stopReason":""} + data: {"completion":"\n/** Measures the time when this test begins running */","stopReason":""} event: completion - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum of a and b\n */\n","stopReason":""} + data: {"completion":"\n/** Measures the time when this test begins running */\n","stopReason":""} event: completion - data: {"completion":"\n/**\n * Adds two numbers\n * @param a The first number \n * @param b The second number\n * @returns The sum of a and b\n */\n","stopReason":"stop_sequence"} + data: {"completion":"\n/** Measures the time when this test begins running */\n","stopReason":"stop_sequence"} event: done @@ -19161,7 +18760,7 @@ log: cookies: [] headers: - name: date - value: Fri, 15 Mar 2024 15:25:46 GMT + value: Fri, 15 Mar 2024 16:51:01 GMT - name: content-type value: text/event-stream - name: transfer-encoding @@ -19190,7 +18789,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-03-15T15:25:41.308Z + startedDateTime: 2024-03-15T16:50:59.961Z time: 0 timings: blocked: -1 diff --git a/agent/scripts/test-agent-binary.ts b/agent/scripts/test-agent-binary.ts new file mode 100644 index 0000000000..10e7a8247c --- /dev/null +++ b/agent/scripts/test-agent-binary.ts @@ -0,0 +1,112 @@ +/** + * This file is intended as a playground if you need to interact with the agent + * single binary build. + */ + +import os from 'os' +import path from 'path' +import fs from 'fs/promises' +import * as vscode from 'vscode' +import { TestClient } from '../src/TestClient' + +async function main() { + if (!process.env.SRC_ACCESS_TOKEN) { + console.log('SRC_ACCESS_TOKEN is not defined') + process.exit(1) + } + const accessToken = process.env.SRC_ACCESS_TOKEN + const serverEndpoint = process.env.SRC_ENDPOINT ?? 'https://sourcegraph.com' + + const prototypePath = path.join(__dirname, '..', 'src', '__tests__', 'example-ts') + const workspaceRootUri = vscode.Uri.file(path.join(os.tmpdir(), 'cody-vscode-shim-test')) + const workspaceRootPath = workspaceRootUri.fsPath + const sumPath = path.join(workspaceRootPath, 'src', 'sum.ts') + const sumUri = vscode.Uri.file(sumPath) + + await fs.mkdir(workspaceRootPath, { recursive: true }) + await fs.cp(prototypePath, workspaceRootPath, { + recursive: true, + }) + + const osArch = getOSArch() + + const client = new TestClient( + { + name: 'defaultClient', + accessToken, + }, + './dist/agent-' + osArch + ) + + await client.initialize({ + serverEndpoint: serverEndpoint, + accessToken, + }) + + const valid = await client.request('extensionConfiguration/change', { + ...client.info.extensionConfiguration, + anonymousUserID: 'abcde1234', + accessToken, + serverEndpoint: serverEndpoint, + customHeaders: {}, + }) + + if (!valid?.authenticated) { + throw new Error('Failed to authenticate') + } + + await client.openFile(sumUri) + const doc = client.workspace.getDocument(sumUri) + if (!doc) { + throw new Error('Failed to open document') + } + + // Wait some time so that WASM can init + await new Promise(resolve => setTimeout(resolve, 3000)) + + const completions = await client.request('autocomplete/execute', { + uri: sumUri.toString(), + position: { line: 1, character: 3 }, + triggerKind: 'Invoke', + }) + console.log('Successfully ran an autocomplete!') + console.log(completions) + + client.exit() + process.exit(0) +} + +main().catch(console.error) + +// Supported agent builds: +// +// - agent-linux-arm64 +// - agent-linux-x64 +// - agent-macos-arm64 +// - agent-macos-x64 +// - agent-win-x64.exe +function getOSArch(): string { + const platform = os.platform() + const arch = os.arch() + + const nodePlatformToPlatform: { [key: string]: string } = { + darwin: 'macos', + linux: 'linux', + win32: 'win', + } + const nodeMachineToArch: { [key: string]: string } = { + arm64: 'arm64', + aarch64: 'arm64', + x86_64: 'x64', + x64: 'x64', + } + + const platformName = nodePlatformToPlatform[platform] + const archName = nodeMachineToArch[arch] + + if (!platformName || !archName) { + throw new Error(`Unsupported platform: ${platform} ${arch}`) + } + + return `${platformName}-${archName}` + (platform === 'win32' ? '.exe' : '') +} diff --git a/agent/src/AgentWorkspaceConfiguration.ts b/agent/src/AgentWorkspaceConfiguration.ts index 80076a0239..88fe326cbd 100644 --- a/agent/src/AgentWorkspaceConfiguration.ts +++ b/agent/src/AgentWorkspaceConfiguration.ts @@ -85,9 +85,6 @@ export class AgentWorkspaceConfiguration implements vscode.WorkspaceConfiguratio return extensionConfig?.verboseDebug ?? false case 'cody.experimental.tracing': return extensionConfig?.verboseDebug ?? false - case 'cody.autocomplete.experimental.syntacticPostProcessing': - // False because we don't embed WASM with the agent yet. - return false case 'cody.useContext': // Disable embeddings by default. return 'keyword' diff --git a/agent/src/TestClient.ts b/agent/src/TestClient.ts index b4416dec6e..d6e502ba57 100644 --- a/agent/src/TestClient.ts +++ b/agent/src/TestClient.ts @@ -77,7 +77,8 @@ export class TestClient extends MessageHandler { areFeatureFlagsEnabled?: boolean // do not evaluate feature flags by default logEventMode?: 'connected-instance-only' | 'all' | 'dotcom-only' onWindowRequest?: (params: ShowWindowMessageParams) => Promise - } + }, + private bin = 'node' ) { super() this.serverEndpoint = params.serverEndpoint ?? 'https://sourcegraph.com' @@ -637,7 +638,10 @@ ${patch}` const recordingDirectory = path.join(agentDir, 'recordings') const agentScript = path.join(agentDir, 'dist', 'index.js') - return spawn('node', ['--enable-source-maps', agentScript, 'jsonrpc'], { + const bin = this.bin + const args = bin === 'node' ? ['--enable-source-maps', agentScript, 'jsonrpc'] : ['jsonrpc'] + + return spawn(bin, args, { stdio: 'pipe', cwd: agentDir, env: { diff --git a/agent/src/esbuild.mjs b/agent/src/esbuild.mjs index 7672a9a6e0..1e6e5f3a16 100644 --- a/agent/src/esbuild.mjs +++ b/agent/src/esbuild.mjs @@ -1,4 +1,5 @@ import path from 'path' +import fs from 'fs/promises' import process from 'process' import { build } from 'esbuild' @@ -23,4 +24,14 @@ import { build } from 'esbuild' }, } const res = await build(esbuildOptions) + + // Copy all .wasm files to the dist/ directory + const distDir = path.join(process.cwd(), '..', 'vscode', 'dist') + const files = await fs.readdir(distDir) + const wasmFiles = files.filter(file => file.endsWith('.wasm')) + for (const file of wasmFiles) { + const src = path.join(distDir, file) + const dest = path.join(process.cwd(), 'dist', file) + await fs.copyFile(src, dest) + } })() diff --git a/agent/src/index.test.ts b/agent/src/index.test.ts index 79abe989c5..2f95b6c04c 100644 --- a/agent/src/index.test.ts +++ b/agent/src/index.test.ts @@ -106,7 +106,9 @@ describe('Agent', () => { expect(valid?.isLoggedIn).toBeTruthy() // Confirm .cody/ignore is active at start up - const codyIgnore = await client.request('check/isCodyIgnoredFile', { urls: [ignoredPath] }) + const codyIgnore = await client.request('check/isCodyIgnoredFile', { + urls: [ignoredPath], + }) expect(codyIgnore).toBeTruthy() }, 10_000) @@ -160,7 +162,6 @@ describe('Agent', () => { // source agent/scripts/export-cody-http-recording-tokens.sh // // If you don't have access to this private file then you need to ask - // for sombody on the Sourcegraph team to help you update the HTTP requests. expect(valid?.username).toStrictEqual('sourcegraphbot9k-fnwmu') }, 10_000) @@ -483,7 +484,9 @@ describe('Agent', () => { const codyIgnoreConfigFile = client.workspace.getDocument(codyIgnoreConfig) expect(codyIgnoreConfigFile?.content).toBeDefined() - const result = await client.request('check/isCodyIgnoredFile', { urls: [ignoredPath] }) + const result = await client.request('check/isCodyIgnoredFile', { + urls: [ignoredPath], + }) expect(result).toBeTruthy() }, 10_000) @@ -519,7 +522,9 @@ describe('Agent', () => { expect(contextFiles.find(f => f.uri.toString() === ignoredUri.toString())).toBeUndefined() // Ignored file should not be included in context files const contextFilesUrls = contextFiles.map(f => f.uri?.path) - const result = await client.request('check/isCodyIgnoredFile', { urls: contextFilesUrls }) + const result = await client.request('check/isCodyIgnoredFile', { + urls: contextFilesUrls, + }) expect(result).toBeFalsy() // Files that are not ignored should be used as context files expect(contextFiles.length).toBeGreaterThan(0) @@ -542,7 +547,9 @@ describe('Agent', () => { // Since no enhanced context is requested, no context files should be included expect(contextFiles.length).toBe(0) // Ignored file should not be included in context files - const result = await client.request('check/isCodyIgnoredFile', { urls: contextUrls }) + const result = await client.request('check/isCodyIgnoredFile', { + urls: contextUrls, + }) expect(result).toBeFalsy() }, 30_000) @@ -569,14 +576,18 @@ describe('Agent', () => { it('ignore rule is not case sensitive', async () => { const alsoIgnoredPath = path.join(workspaceRootPath, 'src/is_ignored.ts') - const result = await client.request('check/isCodyIgnoredFile', { urls: [alsoIgnoredPath] }) + const result = await client.request('check/isCodyIgnoredFile', { + urls: [alsoIgnoredPath], + }) expect(result).toBeTruthy() }) afterAll(async () => { // Makes sure cody ignore is still active after tests // as it should stay active for each workspace session. - const result = await client.request('check/isCodyIgnoredFile', { urls: [ignoredPath] }) + const result = await client.request('check/isCodyIgnoredFile', { + urls: [ignoredPath], + }) expect(result).toBeTruthy() // Check the network requests to ensure no requests include context from ignored files @@ -940,8 +951,8 @@ describe('Agent', () => { expect(obtained).toMatchInlineSnapshot(` "/** * Adds two numbers - * @param a The first number - * @param b The second number + * @param a The first number in the addition + * @param b The second number in the addition * @returns The sum of a and b */ export function sum(a: number, b: number): number { @@ -963,9 +974,9 @@ describe('Agent', () => { constructor(private shouldGreet: boolean) {} /** - * Conditionally logs a greeting message to the console - */ - public functionName() { + * Logs a greeting message if the shouldGreet flag is true + */ + public functionName() { if (this.shouldGreet) { console.log(/* CURSOR */ 'Hello World!') } @@ -982,14 +993,14 @@ describe('Agent', () => { obtained => expect(obtained).toMatchInlineSnapshot(` "const foo = 42 - /** - * Starts recording the log. Logs the message "Recording the log" after doing some initial setup work. - */ export const TestLogger = { startLogging: () => { // Do some stuff - function recordLog() { + /** + * Records a log message to the console + */ + function recordLog() { console.log(/* CURSOR */ 'Recording the log') } @@ -1010,17 +1021,6 @@ describe('Agent', () => { import { it } from 'vitest' import { describe } from 'vitest' - /** - * Tests for an example component - * - * This block describes a set of tests for an example component, - * with three example test cases: - * - * - "does 1" - Tests a simple true check - * - "does 2" - Another simple true check - * - "does something else" - Attempts to get a performance timing but is missing - * a required argument - */ describe('test block', () => { it('does 1', () => { expect(true).toBe(true) @@ -1032,7 +1032,8 @@ describe('Agent', () => { it('does something else', () => { // This line will error due to incorrect usage of \`performance.now\` - const startTime = performance.now(/* CURSOR */) + /** Measures the time when this test begins running */ + const startTime = performance.now(/* CURSOR */) }) }) " diff --git a/lib/shared/src/configuration.ts b/lib/shared/src/configuration.ts index c2a13643f6..779e07c9d3 100644 --- a/lib/shared/src/configuration.ts +++ b/lib/shared/src/configuration.ts @@ -61,7 +61,6 @@ export interface Configuration { /** * Experimental autocomplete */ - autocompleteExperimentalSyntacticPostProcessing?: boolean autocompleteExperimentalHotStreak?: boolean autocompleteExperimentalGraphContext: 'bfg' | 'bfg-mixed' | null autocompleteExperimentalOllamaOptions: OllamaOptions diff --git a/vscode/package.json b/vscode/package.json index ff3aab252d..bc3ca0ce2f 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -38,12 +38,7 @@ "test:unit:tree-sitter-queries": "vitest ./src/tree-sitter/query-tests/*.test.ts", "github-changelog": "ts-node-transpile-only ./scripts/github-changelog.ts" }, - "categories": [ - "Programming Languages", - "Machine Learning", - "Snippets", - "Education" - ], + "categories": ["Programming Languages", "Machine Learning", "Snippets", "Education"], "keywords": [ "ai", "openai", @@ -94,11 +89,7 @@ }, "main": "./dist/extension.node.js", "browser": "./dist/extension.web.js", - "activationEvents": [ - "onLanguage", - "onStartupFinished", - "onWebviewPanel:cody.chatPanel" - ], + "activationEvents": ["onLanguage", "onStartupFinished", "onWebviewPanel:cody.chatPanel"], "contributes": { "walkthroughs": [ { @@ -825,20 +816,12 @@ "order": 2, "type": "string", "markdownDescription": "A Git repository URL to use instead of allowing Cody to infer the Git repository from the workspace.", - "examples": [ - "https://github.com/sourcegraph/cody", - "ssh://git@github.com/sourcegraph/cody" - ] + "examples": ["https://github.com/sourcegraph/cody", "ssh://git@github.com/sourcegraph/cody"] }, "cody.useContext": { "order": 99, "type": "string", - "enum": [ - "embeddings", - "keyword", - "blended", - "none" - ], + "enum": ["embeddings", "keyword", "blended", "none"], "default": "blended", "markdownDescription": "Controls which context providers Cody uses for chat, commands and inline edits. Use 'blended' for best results. For debugging other context sources, 'embeddings' will use an embeddings-based index if available. 'keyword' will use a search-based index. 'none' will not use embeddings or search-based indexes." }, @@ -902,9 +885,7 @@ "order": 6, "type": "string", "markdownDescription": "A custom instruction to be included at the start of all chat messages. (E.g., \"Answer all my questions in Spanish.\")", - "examples": [ - "Answer all my questions in Spanish." - ] + "examples": ["Answer all my questions in Spanish."] }, "cody.codeActions.enabled": { "order": 11, @@ -969,27 +950,15 @@ "cody.telemetry.level": { "order": 99, "type": "string", - "enum": [ - "all", - "off" - ], - "enumDescriptions": [ - "Sends usage data and errors.", - "Disables all extension telemetry." - ], + "enum": ["all", "off"], + "enumDescriptions": ["Sends usage data and errors.", "Disables all extension telemetry."], "markdownDescription": "Controls the telemetry about Cody usage and errors. See [Cody usage and privacy notice](https://about.sourcegraph.com/terms/cody-notice).", "default": "all" }, "cody.autocomplete.advanced.provider": { "type": "string", "default": null, - "enum": [ - null, - "anthropic", - "fireworks", - "unstable-openai", - "experimental-ollama" - ], + "enum": [null, "anthropic", "fireworks", "unstable-openai", "experimental-ollama"], "markdownDescription": "The provider used for code autocomplete. Most providers other than `anthropic` require the `cody.autocomplete.advanced.serverEndpoint` and `cody.autocomplete.advanced.accessToken` settings to also be set. Check the Cody output channel for error messages if autocomplete is not working as expected." }, "cody.autocomplete.advanced.serverEndpoint": { @@ -1003,12 +972,7 @@ "cody.autocomplete.advanced.model": { "type": "string", "default": null, - "enum": [ - null, - "starcoder-16b", - "starcoder-7b", - "llama-code-13b" - ], + "enum": [null, "starcoder-16b", "starcoder-7b", "llama-code-13b"], "markdownDescription": "Overwrite the model used for code autocompletion inference. This is only supported with the `fireworks` provider" }, "cody.autocomplete.completeSuggestWidgetSelection": { @@ -1028,10 +992,7 @@ }, "cody.experimental.foldingRanges": { "type": "string", - "enum": [ - "lsp", - "indentation-based" - ], + "enum": ["lsp", "indentation-based"], "enumDescriptions": [ "Use folding ranges that are enabled by default in VS Code, and are usually powered by LSP", "Use custom implementation of folding ranges that is indentation based. This is the implementation that is used by other Cody clients like the JetBrains plugin" @@ -1039,11 +1000,6 @@ "markdownDescription": "Determines the algorithm Cody uses to detect folding ranges. Cody uses folding ranges for several features like the 'Document code' command", "default": "all" }, - "cody.autocomplete.experimental.syntacticPostProcessing": { - "type": "boolean", - "default": true, - "markdownDescription": "Rank autocomplete results with tree-sitter." - }, "cody.autocomplete.experimental.hotStreak": { "type": "boolean", "default": false, @@ -1057,11 +1013,7 @@ "cody.autocomplete.experimental.graphContext": { "type": "string", "default": null, - "enum": [ - null, - "bfg", - "bfg-mixed" - ], + "enum": [null, "bfg", "bfg-mixed"], "markdownDescription": "Use the code graph to retrieve context for autocomplete requests." }, "cody.autocomplete.experimental.ollamaOptions": { diff --git a/vscode/src/configuration.test.ts b/vscode/src/configuration.test.ts index da3a276b0f..2357984edd 100644 --- a/vscode/src/configuration.test.ts +++ b/vscode/src/configuration.test.ts @@ -81,8 +81,6 @@ describe('getConfiguration', () => { return true case 'cody.autocomplete.disableInsideComments': return false - case 'cody.autocomplete.experimental.syntacticPostProcessing': - return true case 'cody.autocomplete.experimental.hotStreak': return false case 'cody.autocomplete.experimental.ollamaOptions': diff --git a/vscode/src/tree-sitter/parser.ts b/vscode/src/tree-sitter/parser.ts index afe8cfe707..3b6ad5dfe1 100644 --- a/vscode/src/tree-sitter/parser.ts +++ b/vscode/src/tree-sitter/parser.ts @@ -55,6 +55,7 @@ export async function createParser(settings: ParserSettings): Promise Date: Sat, 16 Mar 2024 09:36:16 -0700 Subject: [PATCH 07/13] show "File too large" @-mention item warning on 2nd line in menu (#3429) --- .../plugins/atMentions/OptionsList.module.css | 20 ++++++++-------- .../plugins/atMentions/OptionsList.tsx | 24 ++++++++++--------- 2 files changed, 23 insertions(+), 21 deletions(-) diff --git a/vscode/webviews/promptEditor/plugins/atMentions/OptionsList.module.css b/vscode/webviews/promptEditor/plugins/atMentions/OptionsList.module.css index 4130b53c4a..3099906d99 100644 --- a/vscode/webviews/promptEditor/plugins/atMentions/OptionsList.module.css +++ b/vscode/webviews/promptEditor/plugins/atMentions/OptionsList.module.css @@ -23,7 +23,7 @@ } .item { - height: calc(var(--item-height) - 2*var(--item-padding-y)); + min-height: calc(var(--item-height) - 2*var(--item-padding-y)); padding: var(--item-padding-y) var(--item-padding-x); } @@ -80,16 +80,18 @@ body[data-vscode-theme-kind='vscode-high-contrast'] .option-item.selected { /* Option item content */ .option-item { display: flex; - align-items: flex-end; - gap: 0.35rem; + flex-direction: column; + gap: calc(0.75*var(--item-padding-y)); } -.option-item-title, .option-item-description { +.option-item-title, .option-item-description, .option-item-warning { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; } -.option-item-title--with-warning { - opacity: 0.7; +.option-item-row { + display: flex; + align-items: flex-end; + gap: 0.35rem; } .option-item-description { font-size: var(--description-font-size); @@ -97,9 +99,7 @@ body[data-vscode-theme-kind='vscode-high-contrast'] .option-item.selected { flex: 1; } .option-item-warning { - font-weight: bold; - font-size: 90%; - white-space: nowrap; - padding-left: 0.25rem; + font-size: var(--description-font-size); + opacity: 0.7; } diff --git a/vscode/webviews/promptEditor/plugins/atMentions/OptionsList.tsx b/vscode/webviews/promptEditor/plugins/atMentions/OptionsList.tsx index f14a8a18b0..a4984c895d 100644 --- a/vscode/webviews/promptEditor/plugins/atMentions/OptionsList.tsx +++ b/vscode/webviews/promptEditor/plugins/atMentions/OptionsList.tsx @@ -100,18 +100,20 @@ const Item: FunctionComponent<{ onMouseEnter={onMouseEnter} onClick={onClick} > - {item.type === 'symbol' && icon && ( - - )} - + {item.type === 'symbol' && icon && ( + )} - > - {title} - - {description && {description}} + + {title} + + {description && {description}} + {warning && {warning}} ) From 8864db30bd60a5e3f4071c3658fee2ac9531f5e8 Mon Sep 17 00:00:00 2001 From: Quinn Slack Date: Sat, 16 Mar 2024 13:35:49 -0700 Subject: [PATCH 08/13] explicitly enable biome in VS Code workspace settings (#3434) --- .vscode/settings.json | 1 + 1 file changed, 1 insertion(+) diff --git a/.vscode/settings.json b/.vscode/settings.json index 3fcb6acdee..34cbc603f2 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,6 +18,7 @@ "typescript.tsc.autoDetect": "off", "typescript.tsdk": "node_modules/typescript/lib", "task.allowAutomaticTasks": "on", + "biome.enabled": true, "editor.defaultFormatter": "biomejs.biome", "editor.codeActionsOnSave": { "source.organizeImports": "never", From 7414cf2771d5b3e310ade3d362780167eb632f5a Mon Sep 17 00:00:00 2001 From: Quinn Slack Date: Sat, 16 Mar 2024 21:53:20 -0700 Subject: [PATCH 09/13] use interface extends for consistency (#3438) --- lib/shared/src/codebase-context/messages.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/shared/src/codebase-context/messages.ts b/lib/shared/src/codebase-context/messages.ts index 2a31417e85..49bb4371cc 100644 --- a/lib/shared/src/codebase-context/messages.ts +++ b/lib/shared/src/codebase-context/messages.ts @@ -89,7 +89,7 @@ export interface ContextItemFile extends ContextItemCommon { /** * A symbol (which is a range within a file) that is included as context in a chat message. */ -export type ContextItemSymbol = ContextItemCommon & { +export interface ContextItemSymbol extends ContextItemCommon { type: 'symbol' /** The name of the symbol, used for presentation only (not semantically meaningful). */ From 7cde697c41a205e185cb38eebde02c141efe353d Mon Sep 17 00:00:00 2001 From: Quinn Slack Date: Sat, 16 Mar 2024 23:17:57 -0700 Subject: [PATCH 10/13] remove needless command:_cody.vscode.open wrapping for https? URLs (#3437) --- .../src/chat/transcript/display-text.ts | 21 ++++++++++++++++++- lib/shared/src/index.ts | 2 +- vscode/test/e2e/chat-atFile.test.ts | 10 +++++---- vscode/test/e2e/chat-edits.test.ts | 5 +++-- vscode/test/e2e/command-core.test.ts | 3 ++- vscode/test/e2e/command-custom.test.ts | 12 ++++++----- .../webviews/Components/FileLink.module.css | 1 - vscode/webviews/Components/FileLink.tsx | 16 ++++---------- vscode/webviews/chat/CodeBlocks.tsx | 10 ++++++--- vscode/webviews/chat/TranscriptItem.tsx | 1 + .../chat/actions/TranscriptAction.module.css | 3 +-- .../nodes/ContextItemMentionNode.ts | 11 ++++++++-- 12 files changed, 61 insertions(+), 34 deletions(-) diff --git a/lib/shared/src/chat/transcript/display-text.ts b/lib/shared/src/chat/transcript/display-text.ts index 2424b9a7b4..b76759d1f9 100644 --- a/lib/shared/src/chat/transcript/display-text.ts +++ b/lib/shared/src/chat/transcript/display-text.ts @@ -1,5 +1,6 @@ import type * as vscode from 'vscode' import type { URI } from 'vscode-uri' +import type { ContextItem } from '../../codebase-context/messages' import type { RangeData } from '../../common/range' /** @@ -15,7 +16,7 @@ export const CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID = '_cody.vscode.open' * Return a `command:` URI for use within VS Code webviews that invokes `vscode.open` (proxied via * {@link CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID}). */ -export function commandURIForVSCodeOpen(resource: URI, range?: RangeData): string { +function commandURIForVSCodeOpen(resource: URI, range?: RangeData): string { return `command:${CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID}?${encodeURIComponent( JSON.stringify([ resource, @@ -29,3 +30,21 @@ export function commandURIForVSCodeOpen(resource: URI, range?: RangeData): strin ]) )}` } + +/** + * Return the URI that opens the given context item in the webview. For most context items, this + * just calls {@link commandURIForVSCodeOpen}. However, if {@link resource} is a web page (`http` or + * `https` protocol), then the URL itself is used with `target="_blank"`. + */ +export function webviewOpenURIForContextItem(item: Pick): { + href: string + target: '_blank' | undefined +} { + if (item.uri.scheme === 'http' || item.uri.scheme === 'https') { + return { + href: item.uri.toString(), + target: '_blank', + } + } + return { href: commandURIForVSCodeOpen(item.uri, item.range), target: undefined } +} diff --git a/lib/shared/src/index.ts b/lib/shared/src/index.ts index 88c5b0d256..8d5444f751 100644 --- a/lib/shared/src/index.ts +++ b/lib/shared/src/index.ts @@ -22,7 +22,7 @@ export type { } from './chat/transcript/messages' export { CODY_PASSTHROUGH_VSCODE_OPEN_COMMAND_ID, - commandURIForVSCodeOpen, + webviewOpenURIForContextItem, } from './chat/transcript/display-text' export { Typewriter } from './chat/typewriter' export { reformatBotMessageForChat } from './chat/viewHelpers' diff --git a/vscode/test/e2e/chat-atFile.test.ts b/vscode/test/e2e/chat-atFile.test.ts index 60efd6d179..e3ecec35bd 100644 --- a/vscode/test/e2e/chat-atFile.test.ts +++ b/vscode/test/e2e/chat-atFile.test.ts @@ -303,8 +303,9 @@ test('@-mention file range', async ({ page, sidebar }) => { // @-file range with the correct line range shows up in the chat view and it opens on click await chatPanelFrame.getByText('✨ Context: 3 lines from 1 file').hover() await chatPanelFrame.getByText('✨ Context: 3 lines from 1 file').click() - await chatPanelFrame.getByRole('button', { name: '@buzz.ts:2-4' }).hover() - await chatPanelFrame.getByRole('button', { name: '@buzz.ts:2-4' }).click() + const chatContext = chatPanelFrame.locator('details').last() + await chatContext.getByRole('link', { name: '@buzz.ts:2-4' }).hover() + await chatContext.getByRole('link', { name: '@buzz.ts:2-4' }).click() const previewTab = page.getByRole('tab', { name: /buzz.ts, preview, Editor Group/ }) await previewTab.hover() await expect(previewTab).toBeVisible() @@ -355,8 +356,9 @@ test.extend({ // @-file with the correct line range shows up in the chat view and it opens on click await chatPanelFrame.getByText('✨ Context: 15 lines from 1 file').hover() await chatPanelFrame.getByText('✨ Context: 15 lines from 1 file').click() - await chatPanelFrame.getByRole('button', { name: '@buzz.ts:1-15' }).hover() - await chatPanelFrame.getByRole('button', { name: '@buzz.ts:1-15' }).click() + const chatContext = chatPanelFrame.locator('details').last() + await chatContext.getByRole('link', { name: '@buzz.ts:1-15' }).hover() + await chatContext.getByRole('link', { name: '@buzz.ts:1-15' }).click() const previewTab = page.getByRole('tab', { name: /buzz.ts, preview, Editor Group/ }) await previewTab.hover() await expect(previewTab).toBeVisible() diff --git a/vscode/test/e2e/chat-edits.test.ts b/vscode/test/e2e/chat-edits.test.ts index cb7f8b9d96..59a7ed42bb 100644 --- a/vscode/test/e2e/chat-edits.test.ts +++ b/vscode/test/e2e/chat-edits.test.ts @@ -129,9 +129,10 @@ test.extend({ // both main.java and var.go should be used await expect(chatFrame.getByText(/Context: 2 files/)).toBeVisible() await chatFrame.getByText(/Context: 2 files/).click() - await expect(chatFrame.getByRole('button', { name: 'Main.java' })).toBeVisible() + const chatContext = chatFrame.locator('details').last() + await expect(chatContext.getByRole('link', { name: 'Main.java' })).toBeVisible() await expect( - chatFrame.getByRole('button', { name: withPlatformSlashes('lib/batches/env/var.go') }) + chatContext.getByRole('link', { name: withPlatformSlashes('lib/batches/env/var.go') }) ).toBeVisible() // Meta+/ also creates a new chat session diff --git a/vscode/test/e2e/command-core.test.ts b/vscode/test/e2e/command-core.test.ts index bbae3585a5..bd1da934d3 100644 --- a/vscode/test/e2e/command-core.test.ts +++ b/vscode/test/e2e/command-core.test.ts @@ -53,7 +53,8 @@ test.extend({ await expect(chatPanel.getByText('hello from the assistant')).toBeVisible() // Click on the file link in chat - await chatPanel.getByRole('button', { name: '@index.html' }).click() + const chatContext = chatPanel.locator('details').last() + await chatContext.getByRole('link', { name: '@index.html' }).click() // Check if the file is opened await expect(page.getByRole('list').getByText('index.html')).toBeVisible() diff --git a/vscode/test/e2e/command-custom.test.ts b/vscode/test/e2e/command-custom.test.ts index 35e03a99c6..ac013d85b6 100644 --- a/vscode/test/e2e/command-custom.test.ts +++ b/vscode/test/e2e/command-custom.test.ts @@ -210,8 +210,9 @@ test.extend({ chatPanel.locator('span').filter({ hasText: withPlatformSlashes('@lib/batches/env/var.go:1') }) ).toBeVisible() // Click on the file link should open the 'var.go file in the editor - await chatPanel - .getByRole('button', { name: withPlatformSlashes('@lib/batches/env/var.go:1') }) + const chatContext = chatPanel.locator('details').last() + await chatContext + .getByRole('link', { name: withPlatformSlashes('@lib/batches/env/var.go:1') }) .click() await expect(page.getByRole('tab', { name: 'var.go' })).toBeVisible() @@ -226,9 +227,9 @@ test.extend({ // The files from the open tabs should be added as context await expect(chatPanel.getByText('✨ Context: 12 lines from 2 files')).toBeVisible() await chatPanel.getByText('✨ Context: 12 lines from 2 files').click() - await expect(chatPanel.getByRole('button', { name: '@index.html:1-11' })).toBeVisible() + await expect(chatContext.getByRole('link', { name: '@index.html:1-11' })).toBeVisible() await expect( - chatPanel.getByRole('button', { name: withPlatformSlashes('@lib/batches/env/var.go:1') }) + chatContext.getByRole('link', { name: withPlatformSlashes('@lib/batches/env/var.go:1') }) ).toBeVisible() }) @@ -325,7 +326,8 @@ testGitWorkspace('use terminal output as context', async ({ page, sidebar }) => const panel = getChatPanel(page) await expect(panel.getByText('✨ Context: 1 line from 2 files')).toBeVisible() await panel.getByText('✨ Context: 1 line from 2 files').click() + const chatContext = panel.locator('details').last() await expect( - panel.getByRole('button', { name: withPlatformSlashes('@/terminal-output') }) + chatContext.getByRole('link', { name: withPlatformSlashes('@/terminal-output') }) ).toBeVisible() }) diff --git a/vscode/webviews/Components/FileLink.module.css b/vscode/webviews/Components/FileLink.module.css index 9847e1b7ce..b287775aff 100644 --- a/vscode/webviews/Components/FileLink.module.css +++ b/vscode/webviews/Components/FileLink.module.css @@ -5,7 +5,6 @@ cursor: pointer; font-size: inherit; text-decoration: underline; - display: contents; /* so our parent can tell us to truncate with ellipsis */ padding: 0; margin: 0; text-align: left; diff --git a/vscode/webviews/Components/FileLink.tsx b/vscode/webviews/Components/FileLink.tsx index 6911d9ecd7..77adc5d059 100644 --- a/vscode/webviews/Components/FileLink.tsx +++ b/vscode/webviews/Components/FileLink.tsx @@ -1,10 +1,8 @@ import type React from 'react' -import { displayLineRange, displayPath } from '@sourcegraph/cody-shared' +import { displayLineRange, displayPath, webviewOpenURIForContextItem } from '@sourcegraph/cody-shared' import type { FileLinkProps } from '../chat/components/EnhancedContext' -import { getVSCodeAPI } from '../utils/VSCodeApi' - import styles from './FileLink.module.css' export const FileLink: React.FunctionComponent = ({ @@ -37,16 +35,10 @@ export const FileLink: React.FunctionComponent = ({ const pathToDisplay = `@${displayPath(uri)}` const pathWithRange = range ? `${pathToDisplay}:${displayLineRange(range)}` : pathToDisplay const tooltip = source ? `${pathWithRange} included via ${source}` : pathWithRange + const { href, target } = webviewOpenURIForContextItem({ uri, range }) return ( - + ) } diff --git a/vscode/webviews/chat/CodeBlocks.tsx b/vscode/webviews/chat/CodeBlocks.tsx index a201cc1e09..41b5517ac6 100644 --- a/vscode/webviews/chat/CodeBlocks.tsx +++ b/vscode/webviews/chat/CodeBlocks.tsx @@ -21,6 +21,7 @@ export interface CodeBlockActionsProps { interface CodeBlocksProps { displayMarkdown: string + wrapLinksWithCodyCommand: boolean copyButtonClassName?: string insertButtonClassName?: string @@ -240,6 +241,7 @@ class GuardrailsStatusController { export const CodeBlocks: React.FunctionComponent = React.memo( function CodeBlocksContent({ displayMarkdown, + wrapLinksWithCodyCommand, copyButtonClassName, copyButtonOnSubmit, insertButtonClassName, @@ -317,12 +319,14 @@ export const CodeBlocks: React.FunctionComponent = React.memo( ref={rootRef} // biome-ignore lint/security/noDangerouslySetInnerHtml: the result is run through dompurify dangerouslySetInnerHTML={{ - // wrapLinksWithCodyCommand opens all links using the _cody.vscode.open command - __html: renderCodyMarkdown(displayMarkdown, { wrapLinksWithCodyCommand: true }), + // wrapLinksWithCodyCommand opens all links in assistant responses using the + // _cody.vscode.open command (but not human messages because those already + // have the right URIs and are trusted). + __html: renderCodyMarkdown(displayMarkdown, { wrapLinksWithCodyCommand }), }} /> ), - [displayMarkdown] + [displayMarkdown, wrapLinksWithCodyCommand] ) } ) diff --git a/vscode/webviews/chat/TranscriptItem.tsx b/vscode/webviews/chat/TranscriptItem.tsx index a667a63c6e..91eb5f0e93 100644 --- a/vscode/webviews/chat/TranscriptItem.tsx +++ b/vscode/webviews/chat/TranscriptItem.tsx @@ -145,6 +145,7 @@ export const TranscriptItem: React.FunctionComponent< {displayMarkdown ? ( Date: Sat, 16 Mar 2024 23:51:34 -0700 Subject: [PATCH 11/13] make cody ignore e2e test less flaky on Windows (#3441) --- vscode/test/e2e/cody-ignore.test.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/vscode/test/e2e/cody-ignore.test.ts b/vscode/test/e2e/cody-ignore.test.ts index b0abccc63d..aaaa58f211 100644 --- a/vscode/test/e2e/cody-ignore.test.ts +++ b/vscode/test/e2e/cody-ignore.test.ts @@ -65,6 +65,7 @@ test.extend({ await expect(chatPanel.getByRole('heading', { name: 'No files found' })).toBeVisible() await chatInput.clear() await chatInput.fill('@ignore') + await page.waitForTimeout(1000) // seems to make it less flaky on Windows await expect( chatPanel.getByRole('option', { name: withPlatformSlashes('ignore .cody') }) ).toBeVisible() From 5a94b6ea6a74738891d95e452a490897b4f90e21 Mon Sep 17 00:00:00 2001 From: Tim Lucas Date: Mon, 18 Mar 2024 09:51:04 +1100 Subject: [PATCH 12/13] Update the logged out status bar item with more obvious CTA (#3230) --- .../recording.har.yaml | 105 ++++++++++++++++++ .../recording.har.yaml | 105 ++++++++++++++++++ .../inline-completion-item-provider.ts | 2 + vscode/src/main.ts | 24 ---- .../src/notifications/setup-notification.ts | 31 +++++- vscode/src/services/StatusBar.ts | 37 +++++- vscode/test/e2e/auth.test.ts | 11 +- 7 files changed, 277 insertions(+), 38 deletions(-) diff --git a/agent/recordings/enterpriseClient_3965582033/recording.har.yaml b/agent/recordings/enterpriseClient_3965582033/recording.har.yaml index 8240da3874..3b8b0fffb0 100644 --- a/agent/recordings/enterpriseClient_3965582033/recording.har.yaml +++ b/agent/recordings/enterpriseClient_3965582033/recording.har.yaml @@ -3466,6 +3466,111 @@ log: send: 0 ssl: -1 wait: 0 + - _id: 7dff941dfa6c21b42b65737c883afa5f + _order: 0 + cache: {} + request: + bodySize: 352 + cookies: [] + headers: + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: enterpriseClient / v1 + - _fromType: array + name: x-sourcegraph-actor-anonymous-uid + value: enterpriseClientabcde1234 + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "352" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: demo.sourcegraph.com + headersSize: 318 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + query: | + + mutation RecordTelemetryEvents($events: [TelemetryEventInput!]!) { + telemetry { + recordEvents(events: $events) { + alwaysNil + } + } + } + variables: + events: + - action: shown + feature: cody.signInNotification + parameters: + privateMetadata: {} + version: 0 + source: + client: VSCode.Cody + clientVersion: 1.8.3 + queryString: + - name: RecordTelemetryEvents + value: null + url: https://demo.sourcegraph.com/.api/graphql?RecordTelemetryEvents + response: + bodySize: 38 + content: + mimeType: text/plain; charset=utf-8 + size: 38 + text: | + Private mode requires authentication. + cookies: [] + headers: + - name: date + value: Fri, 15 Mar 2024 11:57:08 GMT + - name: content-type + value: text/plain; charset=utf-8 + - name: content-length + value: "38" + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1217 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 401 + statusText: Unauthorized + startedDateTime: 2024-03-15T11:57:08.460Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 - _id: b38540ce2256c839f6ea9b4ee26f34fd _order: 0 cache: {} diff --git a/agent/recordings/enterpriseMainBranchClient_759014996/recording.har.yaml b/agent/recordings/enterpriseMainBranchClient_759014996/recording.har.yaml index 656b43cf05..a412b08307 100644 --- a/agent/recordings/enterpriseMainBranchClient_759014996/recording.har.yaml +++ b/agent/recordings/enterpriseMainBranchClient_759014996/recording.har.yaml @@ -778,6 +778,111 @@ log: send: 0 ssl: -1 wait: 0 + - _id: e68efafb65f7c8292e78490a07aa0bb0 + _order: 0 + cache: {} + request: + bodySize: 352 + cookies: [] + headers: + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: enterpriseMainBranchClient / v1 + - _fromType: array + name: x-sourcegraph-actor-anonymous-uid + value: enterpriseMainBranchClientabcde1234 + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "352" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: sourcegraph.sourcegraph.com + headersSize: 352 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + query: | + + mutation RecordTelemetryEvents($events: [TelemetryEventInput!]!) { + telemetry { + recordEvents(events: $events) { + alwaysNil + } + } + } + variables: + events: + - action: shown + feature: cody.signInNotification + parameters: + privateMetadata: {} + version: 0 + source: + client: VSCode.Cody + clientVersion: 1.8.3 + queryString: + - name: RecordTelemetryEvents + value: null + url: https://sourcegraph.sourcegraph.com/.api/graphql?RecordTelemetryEvents + response: + bodySize: 38 + content: + mimeType: text/plain; charset=utf-8 + size: 38 + text: | + Private mode requires authentication. + cookies: [] + headers: + - name: date + value: Fri, 15 Mar 2024 11:57:09 GMT + - name: content-type + value: text/plain; charset=utf-8 + - name: content-length + value: "38" + - name: connection + value: keep-alive + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1218 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 401 + statusText: Unauthorized + startedDateTime: 2024-03-15T11:57:09.518Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 - _id: 3b1b5f59d45319c7ea64d97ad93384aa _order: 0 cache: {} diff --git a/vscode/src/completions/inline-completion-item-provider.ts b/vscode/src/completions/inline-completion-item-provider.ts index 7e7aac51a8..bd229858fd 100644 --- a/vscode/src/completions/inline-completion-item-provider.ts +++ b/vscode/src/completions/inline-completion-item-provider.ts @@ -626,6 +626,7 @@ export class InlineCompletionItemProvider title: errorTitle, description: `${error.userMessage} ${error.retryMessage ?? ''}`.trim(), errorType: error.name, + removeAfterSelected: true, onSelect: () => { if (canUpgrade) { telemetryService.log('CodyVSCodeExtension:upsellUsageLimitCTA:clicked', { @@ -677,6 +678,7 @@ export class InlineCompletionItemProvider title: errorTitle, description: 'Contact your Sourcegraph site admin to enable autocomplete', errorType: 'AutoCompleteDisabledByAdmin', + removeAfterSelected: false, onShow: () => { if (shown) { return diff --git a/vscode/src/main.ts b/vscode/src/main.ts index cce6770ccc..ce7e42f224 100644 --- a/vscode/src/main.ts +++ b/vscode/src/main.ts @@ -528,30 +528,6 @@ const register = async ( vscode.commands.registerCommand('cody.debug.enable.all', () => enableDebugMode()) ) - /** - * Signed out status bar indicator - */ - let removeAuthStatusBarError: undefined | (() => void) - function updateAuthStatusBarIndicator(): void { - if (removeAuthStatusBarError) { - removeAuthStatusBarError() - removeAuthStatusBarError = undefined - } - if (!authProvider.getAuthStatus().isLoggedIn) { - removeAuthStatusBarError = statusBar.addError({ - title: 'Sign In to Use Cody', - errorType: 'auth', - description: 'You need to sign in to use Cody.', - onSelect: () => { - // Bring up the sidebar view - void vscode.commands.executeCommand('cody.focus') - }, - }) - } - } - authProvider.addChangeListener(() => updateAuthStatusBarIndicator()) - updateAuthStatusBarIndicator() - let setupAutocompleteQueue = Promise.resolve() // Create a promise chain to avoid parallel execution let autocompleteDisposables: vscode.Disposable[] = [] diff --git a/vscode/src/notifications/setup-notification.ts b/vscode/src/notifications/setup-notification.ts index 3bc66883a8..a6566bd2e9 100644 --- a/vscode/src/notifications/setup-notification.ts +++ b/vscode/src/notifications/setup-notification.ts @@ -5,6 +5,8 @@ import type { ConfigurationWithAccessToken } from '@sourcegraph/cody-shared' import { localStorage } from '../services/LocalStorageProvider' import { showActionNotification } from '.' +import { telemetryService } from '../services/telemetry' +import { telemetryRecorder } from '../services/telemetry-v2' export const showSetupNotification = async (config: ConfigurationWithAccessToken): Promise => { if (config.serverEndpoint && config.accessToken) { @@ -25,16 +27,37 @@ export const showSetupNotification = async (config: ConfigurationWithAccessToken return } + telemetryService.log('CodyVSCodeExtension:signInNotification:shown', undefined, { hasV2Event: true }) + telemetryRecorder.recordEvent('cody.signInNotification', 'shown') + return showActionNotification({ - message: 'Continue setting up Cody', + message: 'Sign in to Cody to get started', actions: [ { - label: 'Setup', - onClick: () => vscode.commands.executeCommand('cody.focus'), + label: 'Sign In', + onClick: async () => { + vscode.commands.executeCommand('cody.focus') + telemetryService.log( + 'CodyVSCodeExtension:signInNotification:signIn:clicked', + undefined, + { hasV2Event: true } + ) + telemetryRecorder.recordEvent('cody.signInNotification.signInButton', 'clicked') + }, }, { label: 'Do not show again', - onClick: () => localStorage.set('notification.setupDismissed', 'true'), + onClick: async () => { + localStorage.set('notification.setupDismissed', 'true') + telemetryService.log( + 'CodyVSCodeExtension:signInNotification:doNotShow:clicked', + undefined, + { + hasV2Event: true, + } + ) + telemetryRecorder.recordEvent('cody.signInNotification.doNotShow', 'clicked') + }, }, ], }) diff --git a/vscode/src/services/StatusBar.ts b/vscode/src/services/StatusBar.ts index 8792a748a0..1b3ada0e8c 100644 --- a/vscode/src/services/StatusBar.ts +++ b/vscode/src/services/StatusBar.ts @@ -6,12 +6,15 @@ import { getConfiguration } from '../configuration' import { getGhostHintEnablement } from '../commands/GhostHintDecorator' import { FeedbackOptionItems, PremiumSupportItems } from './FeedbackOptions' +import { telemetryService } from './telemetry' +import { telemetryRecorder } from './telemetry-v2' import { enableDebugMode } from './utils/export-logs' interface StatusBarError { title: string description: string errorType: StatusBarErrorName + removeAfterSelected: boolean onShow?: () => void onSelect?: () => void } @@ -53,6 +56,21 @@ export function createStatusBar(): CodyStatusBar { let authStatus: AuthStatus | undefined const command = vscode.commands.registerCommand(statusBarItem.command, async () => { + telemetryService.log( + 'CodyVSCodeExtension:statusBarIcon:clicked', + { loggedIn: Boolean(authStatus?.isLoggedIn) }, + { hasV2Event: true } + ) + telemetryRecorder.recordEvent('cody.statusbarIcon', 'clicked', { + privateMetadata: { loggedIn: Boolean(authStatus?.isLoggedIn) }, + }) + + if (!authStatus?.isLoggedIn) { + // Bring up the sidebar view + void vscode.commands.executeCommand('cody.focus') + return + } + const workspaceConfig = vscode.workspace.getConfiguration() const config = getConfiguration(workspaceConfig) @@ -111,9 +129,11 @@ export function createStatusBar(): CodyStatusBar { detail: QUICK_PICK_ITEM_EMPTY_INDENT_PREFIX + error.error.description, onSelect(): Promise { error.error.onSelect?.() - const index = errors.indexOf(error) - errors.splice(index) - rerender() + if (error.error.removeAfterSelected) { + const index = errors.indexOf(error) + errors.splice(index) + rerender() + } return Promise.resolve() }, })), @@ -239,6 +259,16 @@ export function createStatusBar(): CodyStatusBar { statusBarItem.tooltip = DEFAULT_TOOLTIP } + // Only show this if authStatus is present, otherwise you get a flash of + // yellow status bar icon when extension first loads but login hasn't + // initialized yet + if (authStatus && !authStatus.isLoggedIn) { + statusBarItem.text = 'Sign In' + statusBarItem.tooltip = 'Sign in to get started with Cody' + statusBarItem.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground') + return + } + if (errors.length > 0) { statusBarItem.backgroundColor = new vscode.ThemeColor('statusBarItem.warningBackground') statusBarItem.tooltip = errors[0].error.title @@ -322,6 +352,7 @@ export function createStatusBar(): CodyStatusBar { }, syncAuthStatus(newStatus: AuthStatus) { authStatus = newStatus + rerender() }, dispose() { statusBarItem.dispose() diff --git a/vscode/test/e2e/auth.test.ts b/vscode/test/e2e/auth.test.ts index 604affb0a1..b7ac601824 100644 --- a/vscode/test/e2e/auth.test.ts +++ b/vscode/test/e2e/auth.test.ts @@ -22,6 +22,7 @@ test.extend({ 'CodyVSCodeExtension:logout:clicked', 'CodyVSCodeExtension:Auth:failed', 'CodyVSCodeExtension:Auth:disconnected', + 'CodyVSCodeExtension:statusBarIcon:clicked', ], })('requires a valid auth token and allows logouts', async ({ page, sidebar }) => { await expect(page.getByText('Authentication failed.')).not.toBeVisible() @@ -49,13 +50,9 @@ test.extend({ sidebarFrame.getByRole('button', { name: 'Sign In to Your Enterprise Instance' }) ).toBeVisible() - // Click on Cody at the bottom menu to open the Cody Settings Menu and click on Sign In. - await page.getByRole('button', { name: 'cody-logo-heavy, Sign In to Use Cody' }).click() - await page - .getByLabel('alert Sign In to Use Cody, You need to sign in to use Cody., notice') - .locator('a') - .first() - .click() + // Click on Cody at the bottom menu to open sign in + await page.getByRole('button', { name: 'Sign In, Sign in to get started with Cody' }).click() + // Makes sure the sign in page is loaded in the sidebar view with Cody: Chat as the heading // instead of the chat panel. await expect(page.getByRole('heading', { name: 'Cody: Chat' })).toBeVisible() From dee656236b33caa09546acf6b12fbc896c9c9c17 Mon Sep 17 00:00:00 2001 From: Valery Bugakov Date: Sun, 17 Mar 2024 18:42:42 -0700 Subject: [PATCH 13/13] Autocomplete: wrap some `parser.parse()` calls in OpenTelemetry spans (#3419) --- .../AutocompleteMatcher.ts | 6 ++-- .../src/cli/evaluate-autocomplete/Queries.ts | 9 ++--- .../cli/evaluate-autocomplete/testParse.ts | 4 +-- .../triggerAutocomplete.ts | 5 +-- .../get-current-doc-context.test.ts | 4 +-- .../text-processing/parse-completion.ts | 5 +-- vscode/src/tree-sitter/parse-tree-cache.ts | 6 ++-- vscode/src/tree-sitter/parser.ts | 34 ++++++++++++++----- vscode/src/tree-sitter/query-sdk.ts | 4 +-- .../annotate-and-match-snapshot.ts | 5 +-- vscode/src/tree-sitter/test-helpers.ts | 6 ++-- 11 files changed, 55 insertions(+), 33 deletions(-) diff --git a/agent/src/cli/evaluate-autocomplete/AutocompleteMatcher.ts b/agent/src/cli/evaluate-autocomplete/AutocompleteMatcher.ts index 65919cf33e..ee72ff0764 100644 --- a/agent/src/cli/evaluate-autocomplete/AutocompleteMatcher.ts +++ b/agent/src/cli/evaluate-autocomplete/AutocompleteMatcher.ts @@ -1,8 +1,8 @@ import * as vscode from 'vscode' -import type { Tree, default as Parser } from 'web-tree-sitter' +import type { Tree } from 'web-tree-sitter' import { SupportedLanguage, isSupportedLanguage } from '../../../../vscode/src/tree-sitter/grammars' -import { createParser } from '../../../../vscode/src/tree-sitter/parser' +import { type WrappedParser, createParser } from '../../../../vscode/src/tree-sitter/parser' import { EvaluationDocument, type EvaluationDocumentParams } from './EvaluationDocument' import type { Queries } from './Queries' @@ -20,7 +20,7 @@ interface AutocompleteMatch { requestPosition: vscode.Position } export class AutocompleteMatcher { - public parser: Parser | undefined + public parser: WrappedParser | undefined public originalTree: Tree | undefined public originalTreeIsFreeOfErrrors: boolean | undefined constructor( diff --git a/agent/src/cli/evaluate-autocomplete/Queries.ts b/agent/src/cli/evaluate-autocomplete/Queries.ts index 0b82804c52..c81c70c104 100644 --- a/agent/src/cli/evaluate-autocomplete/Queries.ts +++ b/agent/src/cli/evaluate-autocomplete/Queries.ts @@ -1,9 +1,10 @@ import * as path from 'path' import * as fspromises from 'fs/promises' -import type { Query, default as Parser } from 'web-tree-sitter' +import type { Query } from 'web-tree-sitter' import { SupportedLanguage } from '../../../../vscode/src/tree-sitter/grammars' +import type { WrappedParser } from '../../../../vscode/src/tree-sitter/parser' type QueryName = 'context' @@ -19,7 +20,7 @@ export class Queries { private cache: CompiledQuery[] = [] constructor(private queriesDirectory: string) {} public async loadQuery( - parser: Parser, + parser: WrappedParser, language: SupportedLanguage, name: QueryName ): Promise { @@ -38,7 +39,7 @@ export class Queries { } private async compileQuery( - parser: Parser, + parser: WrappedParser, language: SupportedLanguage, name: QueryName ): Promise { @@ -93,7 +94,7 @@ interface CompiledQuery extends UncompiledQuery { compiledQuery: Query } -function compileQuery(query: UncompiledQuery, parser: Parser): CompiledQuery { +function compileQuery(query: UncompiledQuery, parser: WrappedParser): CompiledQuery { return { ...query, compiledQuery: parser.getLanguage().query(query.queryString), diff --git a/agent/src/cli/evaluate-autocomplete/testParse.ts b/agent/src/cli/evaluate-autocomplete/testParse.ts index 867e487ef6..31416ea488 100644 --- a/agent/src/cli/evaluate-autocomplete/testParse.ts +++ b/agent/src/cli/evaluate-autocomplete/testParse.ts @@ -1,7 +1,7 @@ -import type Parser from 'web-tree-sitter' +import type { WrappedParser } from '../../../../vscode/src/tree-sitter/parser' /** Returns true if the new text parses successfully. */ -export function testParses(newText: string, parser: Parser): boolean | undefined { +export function testParses(newText: string, parser: WrappedParser): boolean | undefined { // Originally, this function passed the `previousTree` argument to benefit // from performance improvements but it didn't work correctly, // parseTest.test.ts was failing until we removed `previousTree`. diff --git a/agent/src/cli/evaluate-autocomplete/triggerAutocomplete.ts b/agent/src/cli/evaluate-autocomplete/triggerAutocomplete.ts index c89826b6d8..bcf601566e 100644 --- a/agent/src/cli/evaluate-autocomplete/triggerAutocomplete.ts +++ b/agent/src/cli/evaluate-autocomplete/triggerAutocomplete.ts @@ -1,12 +1,13 @@ import { calcPatch } from 'fast-myers-diff' import * as vscode from 'vscode' -import type { Tree, default as Parser } from 'web-tree-sitter' +import type { Tree } from 'web-tree-sitter' import { ProtocolTextDocumentWithUri } from '../../../../vscode/src/jsonrpc/TextDocumentWithUri' import { AgentTextDocument } from '../../AgentTextDocument' import type { MessageHandler } from '../../jsonrpc-alias' import type { AutocompleteResult } from '../../protocol-alias' +import type { WrappedParser } from '../../../../vscode/src/tree-sitter/parser' import type { AutocompleteMatchKind } from './AutocompleteMatcher' import type { EvaluationDocument } from './EvaluationDocument' import type { TestParameters } from './TestParameters' @@ -15,7 +16,7 @@ import { testParses } from './testParse' import { testTypecheck } from './testTypecheck' export interface AutocompleteParameters { - parser?: Parser + parser?: WrappedParser originalTree?: Tree originalTreeIsErrorFree?: boolean client: MessageHandler diff --git a/vscode/src/completions/get-current-doc-context.test.ts b/vscode/src/completions/get-current-doc-context.test.ts index 1306fac80c..014d7d32fb 100644 --- a/vscode/src/completions/get-current-doc-context.test.ts +++ b/vscode/src/completions/get-current-doc-context.test.ts @@ -5,7 +5,7 @@ import type * as Parser from 'web-tree-sitter' import { range } from '../testutils/textDocument' import { asPoint } from '../tree-sitter/parse-tree-cache' -import { resetParsersCache } from '../tree-sitter/parser' +import { type WrappedParser, resetParsersCache } from '../tree-sitter/parser' import { getContextRange } from './doc-context-getters' import { @@ -194,7 +194,7 @@ describe('getCurrentDocContext', () => { }) describe('multiline triggers', () => { - let parser: Parser + let parser: WrappedParser interface PrepareTestParams { code: string diff --git a/vscode/src/completions/text-processing/parse-completion.ts b/vscode/src/completions/text-processing/parse-completion.ts index 2573e46c12..f35a620490 100644 --- a/vscode/src/completions/text-processing/parse-completion.ts +++ b/vscode/src/completions/text-processing/parse-completion.ts @@ -6,6 +6,7 @@ import { asPoint, getCachedParseTreeForDocument } from '../../tree-sitter/parse- import type { DocumentContext } from '../get-current-doc-context' import type { InlineCompletionItem } from '../types' +import type { WrappedParser } from '../../tree-sitter/parser' import { type InlineCompletionItemWithAnalytics, getMatchingSuffixLength, @@ -89,7 +90,7 @@ interface PasteCompletionParams { document: TextDocument docContext: DocumentContext tree: Tree - parser: Parser + parser: WrappedParser } interface PasteCompletionResult { @@ -129,7 +130,7 @@ function pasteCompletion(params: PasteCompletionParams): PasteCompletionResult { // TODO(tree-sitter): consider parsing only the changed part of the document to improve performance. // parser.parse(textWithCompletion, tree, { includedRanges: [...]}) - const treeWithCompletion = parser.parse(textWithCompletion, treeCopy) + const treeWithCompletion = parser.observableParse(textWithCompletion, treeCopy) addAutocompleteDebugEvent('paste-completion', { text: textWithCompletion, }) diff --git a/vscode/src/tree-sitter/parse-tree-cache.ts b/vscode/src/tree-sitter/parse-tree-cache.ts index 980edd8bf4..73fb58b49e 100644 --- a/vscode/src/tree-sitter/parse-tree-cache.ts +++ b/vscode/src/tree-sitter/parse-tree-cache.ts @@ -4,7 +4,7 @@ import type { TextDocument } from 'vscode' import type { Tree, default as Parser } from 'web-tree-sitter' import { type SupportedLanguage, isSupportedLanguage } from './grammars' -import { createParser, getParser } from './parser' +import { type WrappedParser, createParser, getParser } from './parser' const parseTreesPerFile = new LRUCache({ max: 10, @@ -12,7 +12,7 @@ const parseTreesPerFile = new LRUCache({ interface ParseTreeCache { tree: Tree - parser: Parser + parser: WrappedParser cacheKey: string } @@ -49,7 +49,7 @@ async function parseDocument(document: TextDocument): Promise { updateParseTreeCache(document, parser) } -export function updateParseTreeCache(document: TextDocument, parser: Parser): void { +export function updateParseTreeCache(document: TextDocument, parser: WrappedParser): void { const tree = parser.parse(document.getText()) parseTreesPerFile.set(document.uri.toString(), tree) } diff --git a/vscode/src/tree-sitter/parser.ts b/vscode/src/tree-sitter/parser.ts index 3b6ad5dfe1..91dc886b63 100644 --- a/vscode/src/tree-sitter/parser.ts +++ b/vscode/src/tree-sitter/parser.ts @@ -3,6 +3,7 @@ import path from 'path' import * as vscode from 'vscode' import type Parser from 'web-tree-sitter' +import { wrapInActiveSpan } from '@sourcegraph/cody-shared' import type { Tree } from 'web-tree-sitter' import { DOCUMENT_LANGUAGE_TO_GRAMMAR, type SupportedLanguage, isSupportedLanguage } from './grammars' import { initQueries } from './query-sdk' @@ -14,7 +15,7 @@ const ParserImpl = require('web-tree-sitter') as typeof Parser * and load language grammar only once, first time we need parser for a specific * language, next time we read it from this cache. */ -const PARSERS_LOCAL_CACHE: Partial> = {} +const PARSERS_LOCAL_CACHE: Partial> = {} interface ParserSettings { language: SupportedLanguage @@ -26,7 +27,7 @@ interface ParserSettings { grammarDirectory?: string } -export function getParser(language: SupportedLanguage): Parser | undefined { +export function getParser(language: SupportedLanguage): WrappedParser | undefined { return PARSERS_LOCAL_CACHE[language] } @@ -45,7 +46,14 @@ async function isRegularFile(uri: vscode.Uri): Promise { } } -export async function createParser(settings: ParserSettings): Promise { +export type WrappedParser = Pick & { + /** + * Wraps `parser.parse()` call into an OpenTelemetry span. + */ + observableParse: Parser['parse'] +} + +export async function createParser(settings: ParserSettings): Promise { const { language, grammarDirectory = __dirname } = settings const cachedParser = PARSERS_LOCAL_CACHE[language] @@ -66,14 +74,24 @@ export async function createParser(settings: ParserSettings): Promise parser.getLanguage(), + parse: (...args) => parser.parse(...args), + observableParse: (...args) => wrapInActiveSpan('parser.parse', () => parser.parse(...args)), + } + + PARSERS_LOCAL_CACHE[language] = wrappedParser initQueries(languageGrammar, language, parser) - return parser + return wrappedParser } export function parseString(languageId: string, source: string): Tree | null { diff --git a/vscode/src/tree-sitter/query-sdk.ts b/vscode/src/tree-sitter/query-sdk.ts index 96da5ab654..28a9caf466 100644 --- a/vscode/src/tree-sitter/query-sdk.ts +++ b/vscode/src/tree-sitter/query-sdk.ts @@ -12,7 +12,7 @@ import type { import { type SupportedLanguage, isSupportedLanguage } from './grammars' import { getCachedParseTreeForDocument } from './parse-tree-cache' -import { getParser } from './parser' +import { type WrappedParser, getParser } from './parser' import { type CompletionIntent, type QueryName, intentPriority, languages } from './queries' interface ParsedQuery { @@ -59,7 +59,7 @@ export function initQueries(language: Language, languageId: SupportedLanguage, p } export interface DocumentQuerySDK { - parser: Parser + parser: WrappedParser queries: ResolvedQueries & QueryWrappers language: SupportedLanguage } diff --git a/vscode/src/tree-sitter/query-tests/annotate-and-match-snapshot.ts b/vscode/src/tree-sitter/query-tests/annotate-and-match-snapshot.ts index 80f07276ad..8fc4207ffa 100644 --- a/vscode/src/tree-sitter/query-tests/annotate-and-match-snapshot.ts +++ b/vscode/src/tree-sitter/query-tests/annotate-and-match-snapshot.ts @@ -8,6 +8,7 @@ import type { Point, SyntaxNode, default as Parser } from 'web-tree-sitter' import type { SupportedLanguage } from '../grammars' import { getLanguageConfig } from '../language' +import type { WrappedParser } from '../parser' interface CommentSymbolInfo { delimiter: string @@ -104,7 +105,7 @@ export type Captures = ( interface AnnotateSnippetParams { code: string language: SupportedLanguage - parser: Parser + parser: WrappedParser captures: Captures isOnly: boolean } @@ -235,7 +236,7 @@ function commentOutLines(text: string, commentSymbol: string): string { interface AnnotateAndMatchParams { sourcesPath: string - parser: Parser + parser: WrappedParser language: SupportedLanguage captures: Captures } diff --git a/vscode/src/tree-sitter/test-helpers.ts b/vscode/src/tree-sitter/test-helpers.ts index 108053ce55..792272e784 100644 --- a/vscode/src/tree-sitter/test-helpers.ts +++ b/vscode/src/tree-sitter/test-helpers.ts @@ -1,9 +1,9 @@ import path from 'path' -import type { QueryCapture, QueryMatch, default as Parser } from 'web-tree-sitter' +import type { QueryCapture, QueryMatch } from 'web-tree-sitter' import { SupportedLanguage } from './grammars' -import { createParser } from './parser' +import { type WrappedParser, createParser } from './parser' import { type DocumentQuerySDK, getDocumentQuerySDK } from './query-sdk' const CUSTOM_WASM_LANGUAGE_DIR = path.join(__dirname, '../../resources/wasm') @@ -13,7 +13,7 @@ const CUSTOM_WASM_LANGUAGE_DIR = path.join(__dirname, '../../resources/wasm') */ export function initTreeSitterParser( language = SupportedLanguage.typescript -): Promise { +): Promise { return createParser({ language, grammarDirectory: CUSTOM_WASM_LANGUAGE_DIR,