🐛 continue server client fixes
This commit is contained in:
parent
ae05da6449
commit
a672f805de
4 changed files with 16 additions and 11 deletions
|
|
@ -13,12 +13,12 @@ export class ConfigHandler {
|
|||
|
||||
constructor(
|
||||
private readonly ide: IDE,
|
||||
private ideSettingsPromise: Promise<IdeSettings>,
|
||||
private ideSettings: IdeSettings,
|
||||
private readonly writeLog: (text: string) => Promise<void>,
|
||||
private readonly onConfigUpdate: () => void,
|
||||
) {
|
||||
this.ide = ide;
|
||||
this.ideSettingsPromise = ideSettingsPromise;
|
||||
this.ideSettings = ideSettings;
|
||||
this.writeLog = writeLog;
|
||||
this.onConfigUpdate = onConfigUpdate;
|
||||
try {
|
||||
|
|
@ -29,7 +29,7 @@ export class ConfigHandler {
|
|||
}
|
||||
|
||||
updateIdeSettings(ideSettings: IdeSettings) {
|
||||
this.ideSettingsPromise = Promise.resolve(ideSettings);
|
||||
this.ideSettings = ideSettings
|
||||
this.reloadConfig();
|
||||
}
|
||||
|
||||
|
|
@ -62,14 +62,14 @@ export class ConfigHandler {
|
|||
|
||||
const ideInfo = await this.ide.getIdeInfo();
|
||||
const uniqueId = await this.ide.getUniqueId();
|
||||
const ideSettings = await this.ideSettingsPromise;
|
||||
|
||||
let remoteConfigServerUrl = undefined;
|
||||
try {
|
||||
remoteConfigServerUrl =
|
||||
typeof ideSettings.remoteConfigServerUrl !== "string" ||
|
||||
ideSettings.remoteConfigServerUrl === ""
|
||||
typeof this.ideSettings.remoteConfigServerUrl !== "string" ||
|
||||
this.ideSettings.remoteConfigServerUrl === ""
|
||||
? undefined
|
||||
: new URL(ideSettings.remoteConfigServerUrl);
|
||||
: new URL(this.ideSettings.remoteConfigServerUrl);
|
||||
} catch (e) {}
|
||||
|
||||
this.savedConfig = await loadFullConfigNode(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,9 @@
|
|||
import { BranchAndDir, Chunk, ContextItem, ContextProviderExtras } from "../../index.js";
|
||||
import {
|
||||
BranchAndDir,
|
||||
Chunk,
|
||||
ContextItem,
|
||||
ContextProviderExtras,
|
||||
} from "../../index.js";
|
||||
import { LanceDbIndex } from "../../indexing/LanceDbIndex.js";
|
||||
|
||||
import { deduplicateArray, getBasename } from "../../util/index.js";
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ export class LanceDbIndex implements CodebaseIndex {
|
|||
constructor(
|
||||
private readonly embeddingsProvider: EmbeddingsProvider,
|
||||
private readonly readFile: (filepath: string) => Promise<string>,
|
||||
private readonly continueServerClient: IContinueServerClient,
|
||||
private readonly continueServerClient?: IContinueServerClient,
|
||||
) {}
|
||||
|
||||
private tableNameForTag(tag: IndexTag) {
|
||||
|
|
@ -176,7 +176,7 @@ export class LanceDbIndex implements CodebaseIndex {
|
|||
};
|
||||
|
||||
// Check remote cache
|
||||
if (this.continueServerClient.connected) {
|
||||
if (this.continueServerClient?.connected) {
|
||||
try {
|
||||
const keys = results.compute.map(({ cacheKey }) => cacheKey);
|
||||
const resp = await this.continueServerClient.getFromIndexCache(
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ export class VsCodeExtension {
|
|||
);
|
||||
this.configHandler = new ConfigHandler(
|
||||
this.ide,
|
||||
ideSettings,
|
||||
async (log: string) => {
|
||||
outputChannel.appendLine(
|
||||
"==========================================================================",
|
||||
|
|
@ -88,7 +89,6 @@ export class VsCodeExtension {
|
|||
(() => this.webviewProtocol?.request("configUpdate", undefined)).bind(
|
||||
this,
|
||||
),
|
||||
continueServerClient,
|
||||
);
|
||||
|
||||
this.configHandler.reloadConfig();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue