Skip to content

Commit

Permalink
rm completions cache
Browse files Browse the repository at this point in the history
  • Loading branch information
sqs committed Aug 2, 2023
1 parent cc4388b commit 33fc664
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 435 deletions.
1 change: 0 additions & 1 deletion lib/shared/src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ export interface Configuration {
| 'unstable-azure-openai'
autocompleteAdvancedServerEndpoint: string | null
autocompleteAdvancedAccessToken: string | null
autocompleteAdvancedCache: boolean
autocompleteAdvancedEmbeddings: boolean
autocompleteExperimentalCompleteSuggestWidgetSelection?: boolean
pluginsEnabled?: boolean
Expand Down
5 changes: 0 additions & 5 deletions vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -885,11 +885,6 @@
"type": "string",
"markdownDescription": "Overwrite the access token used for code autocomplete. This is only supported with a provider other than `anthropic`."
},
"cody.autocomplete.advanced.cache": {
"type": "boolean",
"default": true,
"markdownDescription": "Enables caching of code autocomplete."
},
"cody.autocomplete.advanced.embeddings": {
"order": 99,
"type": "boolean",
Expand Down
97 changes: 0 additions & 97 deletions vscode/src/completions/cache.test.ts

This file was deleted.

104 changes: 0 additions & 104 deletions vscode/src/completions/cache.ts

This file was deleted.

25 changes: 1 addition & 24 deletions vscode/src/completions/request-manager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { beforeEach, describe, expect, it, vi } from 'vitest'

import { vsCodeMocks } from '../testutils/mocks'

import { CompletionsCache } from './cache'
import { Provider } from './providers/provider'
import { RequestManager } from './request-manager'
import { Completion } from './types'
Expand Down Expand Up @@ -51,8 +50,7 @@ function createProvider(prefix: string) {
describe('RequestManager', () => {
let createRequest: (prefix: string, provider: Provider) => Promise<Completion[]>
beforeEach(() => {
const cache = new CompletionsCache()
const requestManager = new RequestManager(cache)
const requestManager = new RequestManager()

createRequest = (prefix: string, provider: Provider) =>
requestManager.request(DOCUMENT_URI, LOG_ID, prefix, [provider], [], new AbortController().signal)
Expand Down Expand Up @@ -98,25 +96,4 @@ describe('RequestManager', () => {
expect((await promise1)[0].content).toBe('log();')
expect(provider1.didFinishNetworkRequest).toBe(true)
})

it('serves request from cache when a prior request resolves', async () => {
const prefix1 = 'console.'
const provider1 = createProvider(prefix1)
const promise1 = createRequest(prefix1, provider1)

const prefix2 = 'console.log('
const provider2 = createProvider(prefix2)
const promise2 = createRequest(prefix2, provider2)

provider1.resolveRequest(["log('hello')"])

expect((await promise1)[0].content).toBe("log('hello')")
expect((await promise2)[0].content).toBe("'hello')")

expect(provider1.didFinishNetworkRequest).toBe(true)
expect(provider2.didFinishNetworkRequest).toBe(false)

// Ensure that the completed network request does not cause issues
provider2.resolveRequest(["'world')"])
})
})
Loading

0 comments on commit 33fc664

Please sign in to comment.