pause fix, cancelled status
This commit is contained in:
parent
abac7274cf
commit
f7f64ff341
7 changed files with 23 additions and 15 deletions
|
|
@ -154,10 +154,10 @@ export class Core {
|
|||
// Index on initialization
|
||||
void this.ide.getWorkspaceDirs().then(async (dirs) => {
|
||||
// Respect pauseCodebaseIndexOnStart user settings
|
||||
this.indexingPauseToken.paused = true;
|
||||
if (ideSettings.pauseCodebaseIndexOnStart) {
|
||||
this.indexingPauseToken.paused = true;
|
||||
void this.messenger.request("indexProgress", {
|
||||
progress: 1,
|
||||
progress: 0,
|
||||
desc: "Initial Indexing Skipped",
|
||||
status: "paused",
|
||||
});
|
||||
|
|
@ -803,6 +803,8 @@ export class Core {
|
|||
this.indexingCancellationController.signal,
|
||||
)) {
|
||||
let updateToSend = { ...update };
|
||||
// TODO reconsider this status overwrite?
|
||||
// original goal was to not concern users with edge noncritical errors
|
||||
if (update.status === "failed") {
|
||||
updateToSend.status = "done";
|
||||
updateToSend.desc = "Indexing complete";
|
||||
|
|
|
|||
11
core/index.d.ts
vendored
11
core/index.d.ts
vendored
|
|
@ -42,11 +42,18 @@ export interface IndexingProgressUpdate {
|
|||
progress: number;
|
||||
desc: string;
|
||||
shouldClearIndexes?: boolean;
|
||||
status: "loading" | "indexing" | "done" | "failed" | "paused" | "disabled";
|
||||
status:
|
||||
| "loading"
|
||||
| "indexing"
|
||||
| "done"
|
||||
| "failed"
|
||||
| "paused"
|
||||
| "disabled"
|
||||
| "cancelled";
|
||||
debugInfo?: string;
|
||||
}
|
||||
|
||||
// This is more or less a V2 of IndexingProgressUpdate
|
||||
// This is more or less a V2 of IndexingProgressUpdate for docs etc.
|
||||
export interface IndexingStatus {
|
||||
id: string;
|
||||
type: "docs";
|
||||
|
|
|
|||
|
|
@ -145,9 +145,7 @@ export class CodebaseIndexer {
|
|||
}
|
||||
}
|
||||
|
||||
async *refreshFiles(
|
||||
files: string[],
|
||||
): AsyncGenerator<IndexingProgressUpdate> {
|
||||
async *refreshFiles(files: string[]): AsyncGenerator<IndexingProgressUpdate> {
|
||||
let progress = 0;
|
||||
if (files.length === 0) {
|
||||
yield {
|
||||
|
|
@ -192,9 +190,9 @@ export class CodebaseIndexer {
|
|||
|
||||
if (dirs.length === 0) {
|
||||
yield {
|
||||
progress,
|
||||
progress: 1,
|
||||
desc: "Nothing to index",
|
||||
status: "disabled",
|
||||
status: "done",
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
|
@ -238,9 +236,9 @@ export class CodebaseIndexer {
|
|||
directoryFiles.push(p);
|
||||
if (abortSignal.aborted) {
|
||||
yield {
|
||||
progress: 1,
|
||||
progress: 0,
|
||||
desc: "Indexing cancelled",
|
||||
status: "disabled",
|
||||
status: "cancelled",
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
|
@ -263,9 +261,9 @@ export class CodebaseIndexer {
|
|||
// Handle pausing in this loop because it's the only one really taking time
|
||||
if (abortSignal.aborted) {
|
||||
yield {
|
||||
progress: 1,
|
||||
progress: 0,
|
||||
desc: "Indexing cancelled",
|
||||
status: "disabled",
|
||||
status: "cancelled",
|
||||
};
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ const STATUS_TO_ICON: Record<IndexingProgressUpdate["status"], any> = {
|
|||
paused: PauseCircleIcon,
|
||||
done: CheckCircleIcon,
|
||||
failed: null, // Since we show an erorr message below
|
||||
cancelled: null,
|
||||
};
|
||||
|
||||
function IndexingProgressIndicator({ update }: IndexingProgressIndicatorProps) {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ const STATUS_TO_SUBTITLE_TEXT: Record<
|
|||
paused: "Click to resume",
|
||||
failed: "Click to retry",
|
||||
disabled: "Click to open config.json and enable indexing (requires reload)",
|
||||
cancelled: "Click to restart",
|
||||
};
|
||||
|
||||
function IndexingProgressSubtext({
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ const STATUS_TO_TEXT: Record<IndexingProgressUpdate["status"], string> = {
|
|||
paused: "Indexing paused",
|
||||
failed: "Indexing failed",
|
||||
disabled: "Indexing disabled",
|
||||
cancelled: "Indexing cancelled",
|
||||
};
|
||||
|
||||
function IndexingProgressTitleText({ update }: IndexingProgressTitleTextProps) {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { JSONContent } from "@tiptap/react";
|
||||
import { IndexingProgressUpdate } from "core";
|
||||
import { OnboardingStatus } from "../components/OnboardingCard";
|
||||
|
||||
type LocalStorageTypes = {
|
||||
|
|
@ -12,7 +11,6 @@ type LocalStorageTypes = {
|
|||
lastSessionId: string | undefined;
|
||||
[key: `inputHistory_${string}`]: JSONContent[];
|
||||
extensionVersion: string;
|
||||
indexingState: IndexingProgressUpdate;
|
||||
showTutorialCard: boolean;
|
||||
shownProfilesIntroduction: boolean;
|
||||
disableIndexing: boolean;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue