Skip to content

Commit

Permalink
fix get fim provider, i broke it :)
Browse files Browse the repository at this point in the history
  • Loading branch information
rjmacarthy committed Dec 17, 2024
1 parent 4f446ef commit 2b88958
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/extension/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as vscode from "vscode"
import {
ACTIVE_CHAT_PROVIDER_STORAGE_KEY,
ACTIVE_EMBEDDINGS_PROVIDER_STORAGE_KEY,
ACTIVE_FIM_PROVIDER_STORAGE_KEY,
EVENT_NAME,
EXTENSION_CONTEXT_NAME
} from "../common/constants"
Expand All @@ -29,6 +30,13 @@ export class Base {
})
}

public getFimProvider = () => {
const provider = this.context?.globalState.get<TwinnyProvider>(
ACTIVE_FIM_PROVIDER_STORAGE_KEY
)
return provider
}

public getProvider = () => {
const provider = this.context?.globalState.get<TwinnyProvider>(
ACTIVE_CHAT_PROVIDER_STORAGE_KEY
Expand Down
8 changes: 4 additions & 4 deletions src/extension/providers/completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import { createStreamRequestBodyFim } from "../provider-options"
import { TemplateProvider } from "../template-provider"
import {
getCurrentLineText,
getFimDataFromProvider as getProviderFimData,
getFimDataFromProvider as getFimProviderFimData,
getIsMiddleOfString,
getIsMultilineCompletion,
getPrefixSuffix,
Expand Down Expand Up @@ -135,7 +135,7 @@ export class CompletionProvider
context: InlineCompletionContext
): Promise<InlineCompletionItem[] | InlineCompletionList | null | undefined> {
const editor = window.activeTextEditor
this._provider = this.getProvider()
this._provider = this.getFimProvider()
const isLastCompletionAccepted =
this._acceptedLastCompletion && !this.config.enableSubsequentCompletions

Expand Down Expand Up @@ -200,7 +200,7 @@ export class CompletionProvider
return new Promise<ResolvedInlineCompletion>((resolve, reject) => {
this._debouncer = setTimeout(() => {
this._lock.acquire("twinny.completion", async () => {
const provider = this.getProvider()
const provider = this.getFimProvider()
if (!provider) return
const request = this.buildFimRequest(prompt, provider)

Expand Down Expand Up @@ -256,7 +256,7 @@ export class CompletionProvider
)

try {
const providerFimData = getProviderFimData(this._provider.provider, data)
const providerFimData = getFimProviderFimData(this._provider.provider, data)
if (providerFimData === undefined) return ""

this._completion = this._completion + providerFimData
Expand Down

0 comments on commit 2b88958

Please sign in to comment.