handle delete in vscode and filechanges in kotlin p1
This commit is contained in:
parent
f425cadcda
commit
963fe50f2d
4 changed files with 16 additions and 10 deletions
|
|
@ -77,7 +77,7 @@ export class Core {
|
|||
constructor(
|
||||
private readonly messenger: IMessenger<ToCoreProtocol, FromCoreProtocol>,
|
||||
private readonly ide: IDE,
|
||||
private readonly onWrite: (text: string) => Promise<void> = async () => {},
|
||||
private readonly onWrite: (text: string) => Promise<void> = async () => { },
|
||||
) {
|
||||
this.indexingState = { status: "loading", desc: "loading", progress: 0 };
|
||||
|
||||
|
|
@ -165,7 +165,7 @@ export class Core {
|
|||
this.configHandler,
|
||||
ide,
|
||||
getLlm,
|
||||
(e) => {},
|
||||
(e) => { },
|
||||
(..._) => Promise.resolve([]),
|
||||
);
|
||||
|
||||
|
|
@ -483,7 +483,7 @@ export class Core {
|
|||
on("tts/kill", async () => {
|
||||
void TTS.kill();
|
||||
});
|
||||
|
||||
|
||||
on("chatDescriber/describe", async (msg) => {
|
||||
const currentModel = await this.getSelectedModel();
|
||||
return await ChatDescriber.describe(currentModel, {}, msg.data);
|
||||
|
|
@ -674,7 +674,7 @@ export class Core {
|
|||
await codebaseIndexer.clearIndexes();
|
||||
}
|
||||
|
||||
const dirs = data?.dir ? [data.dir] : await this.ide.getWorkspaceDirs();
|
||||
const dirs = data?.dirs ?? await this.ide.getWorkspaceDirs();
|
||||
await this.refreshCodebaseIndex(dirs);
|
||||
});
|
||||
on("index/setPaused", (msg) => {
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ export type ToCoreFromIdeOrWebviewProtocol = {
|
|||
"tts/kill": [undefined, void];
|
||||
"index/setPaused": [boolean, void];
|
||||
"index/forceReIndex": [
|
||||
undefined | { dir?: string; shouldClearIndexes?: boolean },
|
||||
undefined | { dirs?: string[]; shouldClearIndexes?: boolean },
|
||||
void,
|
||||
];
|
||||
"index/indexingProgressBarInitialized": [undefined, void];
|
||||
|
|
|
|||
|
|
@ -272,11 +272,18 @@ export class VsCodeExtension {
|
|||
this.core.invoke("index/forceReIndex", undefined);
|
||||
} else {
|
||||
// Reindex the file
|
||||
const indexer = await this.core.codebaseIndexerPromise;
|
||||
indexer.refreshFile(filepath);
|
||||
this.core.invoke("index/forceReIndex", {
|
||||
dirs: [filepath]
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
vscode.workspace.onDidDeleteFiles(async (event) => {
|
||||
this.core.invoke("index/forceReIndex", {
|
||||
dirs: event.files.map((file) => file.fsPath)
|
||||
})
|
||||
})
|
||||
|
||||
// When GitHub sign-in status changes, reload config
|
||||
vscode.authentication.onDidChangeSessions(async (e) => {
|
||||
if (e.provider.id === "github") {
|
||||
|
|
@ -309,7 +316,7 @@ export class VsCodeExtension {
|
|||
currentBranch !== this.PREVIOUS_BRANCH_FOR_WORKSPACE_DIR[dir]
|
||||
) {
|
||||
// Trigger refresh of index only in this directory
|
||||
this.core.invoke("index/forceReIndex", { dir });
|
||||
this.core.invoke("index/forceReIndex", { dirs: [dir] });
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -322,8 +329,7 @@ export class VsCodeExtension {
|
|||
|
||||
// Register a content provider for the readonly virtual documents
|
||||
const documentContentProvider = new (class
|
||||
implements vscode.TextDocumentContentProvider
|
||||
{
|
||||
implements vscode.TextDocumentContentProvider {
|
||||
// emitter and its event
|
||||
onDidChangeEmitter = new vscode.EventEmitter<vscode.Uri>();
|
||||
onDidChange = this.onDidChangeEmitter.event;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue