Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hitesh/vscode 1.34.3 release #5576

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ This is a log of all notable changes to Cody for VS Code. [Unreleased] changes a

### Changed

## 1.34.3

### Fixed
- Autocomplete Logging: Fix the diff for recent edits by replacing psDedent with ps to preserve the indentation. [pull/5574](https://github.com/sourcegraph/cody/pull/5574)


## 1.34.2

Expand Down
2 changes: 1 addition & 1 deletion vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "cody-ai",
"private": true,
"displayName": "Cody: AI Coding Assistant with Autocomplete & Chat",
"version": "1.34.2",
"version": "1.34.3",
"publisher": "sourcegraph",
"license": "Apache-2.0",
"icon": "resources/cody.png",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { PromptString, contextFiltersProvider } from '@sourcegraph/cody-shared'
import { ps, psDedent } from '@sourcegraph/cody-shared'
import type { AutocompleteContextSnippet } from '@sourcegraph/cody-shared'
import * as vscode from 'vscode'
import { getLanguageConfig } from '../../../../tree-sitter/language'
import type { ContextRetriever, ContextRetrieverOptions } from '../../../types'
import { RetrieverIdentifier, type ShouldUseContextParams, shouldBeUsedAsContext } from '../../utils'

Expand Down Expand Up @@ -47,11 +45,7 @@ export class RecentEditsRetriever implements vscode.Disposable, ContextRetriever

const autocompleteContextSnippets = []
for (const diff of diffs) {
const content = this.getCommentedPromptForCompletions(
diff.languageId,
diff.uri,
diff.diff
).toString()
const content = diff.diff.toString()
const autocompleteSnippet = {
uri: diff.uri,
identifier: RetrieverIdentifier.RecentEditsRetriever,
Expand Down Expand Up @@ -89,18 +83,6 @@ export class RecentEditsRetriever implements vscode.Disposable, ContextRetriever
return diffs
}

public getCommentedPromptForCompletions(
languageId: string,
filename: vscode.Uri,
diff: PromptString
): PromptString {
const filePath = PromptString.fromDisplayPath(filename)
const languageConfig = getLanguageConfig(languageId)
const commentStart = languageConfig ? languageConfig.commentStart : ps`// `
const prompt = psDedent`${commentStart} Here is git diff of the recent change made to the file ${filePath} which is used to provide context for the completion:\n${diff}`
return prompt
}

public filterCandidateDiffs(
allDiffs: DiffAcrossDocuments[],
document: vscode.TextDocument
Expand Down
Loading