💄 show file currently being indexed

This commit is contained in:
Nate Sesti 2024-01-10 22:40:24 -08:00
parent 37c775ccf4
commit e69b225910
5 changed files with 30 additions and 13 deletions

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.9.9",
"version": "0.9.11",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.9.9",
"version": "0.9.11",
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",

View file

@ -170,7 +170,7 @@ const Layout = () => {
};
}, [location, navigate]);
const { progress: indexingProgress } = useLoadEmbeddings();
const { progress: indexingProgress, currentlyIndexing } = useLoadEmbeddings();
return (
<LayoutTopDiv>
@ -240,6 +240,7 @@ const Layout = () => {
{indexingProgress < 1 && (
<IndexingProgressBar
currentlyIndexing={currentlyIndexing}
completed={indexingProgress * 100}
total={100}
/>

View file

@ -1,4 +1,4 @@
import React from "react";
import ReactDOM from "react-dom";
import styled from "styled-components";
import { StyledTooltip, lightGray, vscForeground } from "..";
@ -40,11 +40,18 @@ const P = styled.p`
interface ProgressBarProps {
completed: number;
total: number;
currentlyIndexing?: string;
}
const IndexingProgressBar = ({ completed, total }: ProgressBarProps) => {
const IndexingProgressBar = ({
completed,
total,
currentlyIndexing,
}: ProgressBarProps) => {
const fillPercentage = Math.min(100, Math.max(0, (completed / total) * 100));
const tooltipPortalDiv = document.getElementById("tooltip-portal-div");
return (
<>
<GridDiv data-tooltip-id="usage_progress_bar">
@ -53,11 +60,13 @@ const IndexingProgressBar = ({ completed, total }: ProgressBarProps) => {
</ProgressBarWrapper>
<P>Indexing ({Math.trunc((completed / total) * 100)}%)</P>
</GridDiv>
<StyledTooltip id="usage_progress_bar" place="bottom">
{
"Continue is indexing your codebase locally. You can find the index in ~/.continue/embeddings."
}
</StyledTooltip>
{tooltipPortalDiv &&
ReactDOM.createPortal(
<StyledTooltip id="usage_progress_bar" place="top">
Indexing {currentlyIndexing}
</StyledTooltip>,
tooltipPortalDiv
)}
</>
);
};

View file

@ -1,14 +1,19 @@
import { ExtensionIde } from "core/ide";
import { Chunk } from "core/index/chunk";
import { chunkDocument } from "core/index/chunk/chunk";
import { getBasename } from "core/util";
import { useEffect, useState } from "react";
import { useSelector } from "react-redux";
import { RootStore } from "../redux/store";
const MAX_CHUNK_SIZE = 256;
const MAX_CHUNK_SIZE = 512;
function useLoadEmbeddings() {
const [progress, setProgress] = useState(1);
const [currentlyIndexing, setCurrentlyIndexing] = useState<string | null>(
null
);
const embeddingsProvider = useSelector(
(store: RootStore) => store.state.config.embeddingsProvider
);
@ -29,6 +34,8 @@ function useLoadEmbeddings() {
let done = 1;
for (let [tag, filepath, hash] of filesToEmbed) {
setCurrentlyIndexing(getBasename(filepath));
try {
const contents = await ide.readFile(filepath);
const chunkGenerator = await chunkDocument(
@ -78,7 +85,7 @@ function useLoadEmbeddings() {
loadEmbeddings();
}, [embeddingsProvider, disableIndexing]);
return { progress };
return { progress, currentlyIndexing };
}
export default useLoadEmbeddings;

View file

@ -347,7 +347,7 @@ impl Tree {
const GLOBAL_IGNORE_PATTERNS: &[&str] = &[
"**/.DS_Store",
"**/package-lock.json",
"**/yarn.lock",
"*.lock",
"*.log",
"*.ttf",
"*.png",