✨ Button to force re-indexing
This commit is contained in:
parent
90cc17989e
commit
5fd87a9d80
4 changed files with 33 additions and 10 deletions
|
|
@ -73,6 +73,7 @@ export type WebviewProtocol = Protocol &
|
|||
|
||||
errorPopup: [{ message: string }, void];
|
||||
"index/setPaused": [boolean, void];
|
||||
"index/forceReIndex": [undefined, void];
|
||||
openUrl: [string, void];
|
||||
applyToCurrentFile: [{ text: string }, void];
|
||||
showTutorial: [undefined, void];
|
||||
|
|
|
|||
|
|
@ -107,6 +107,11 @@ export class VsCodeExtension {
|
|||
context.globalState.update("continue.indexingPaused", msg.data);
|
||||
indexingPauseToken.paused = msg.data;
|
||||
});
|
||||
this.webviewProtocol.on("index/forceReIndex", (msg) => {
|
||||
this.ide
|
||||
.getWorkspaceDirs()
|
||||
.then((dirs) => this.refreshCodebaseIndex(dirs));
|
||||
});
|
||||
|
||||
this.diffManager.webviewProtocol = this.webviewProtocol;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ import {
|
|||
} from "../redux/slices/uiStateSlice";
|
||||
import { RootState } from "../redux/store";
|
||||
import { getFontSize, isMetaEquivalentKeyPressed } from "../util";
|
||||
import { postToIde } from "../util/ide";
|
||||
import { isJetBrains, postToIde } from "../util/ide";
|
||||
import HeaderButtonWithText from "./HeaderButtonWithText";
|
||||
import TextDialog from "./dialogs";
|
||||
import IndexingProgressBar from "./loaders/IndexingProgressBar";
|
||||
|
|
@ -245,7 +245,7 @@ const Layout = () => {
|
|||
/>
|
||||
)}
|
||||
|
||||
{indexingProgress < 1 && (
|
||||
{isJetBrains() || (
|
||||
<IndexingProgressBar
|
||||
currentlyIndexing={indexingTask}
|
||||
completed={indexingProgress * 100}
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ import { StyledTooltip, lightGray, vscForeground } from "..";
|
|||
import { postToIde } from "../../util/ide";
|
||||
|
||||
const DIAMETER = 6;
|
||||
const CircleDiv = styled.div`
|
||||
background-color: #bb0;
|
||||
box-shadow: 0px 0px 2px 1px #bb0;
|
||||
const CircleDiv = styled.div<{ color: string }>`
|
||||
background-color: ${(props) => props.color};
|
||||
box-shadow: 0px 0px 2px 1px ${(props) => props.color};
|
||||
width: ${DIAMETER}px;
|
||||
height: ${DIAMETER}px;
|
||||
border-radius: ${DIAMETER / 2}px;
|
||||
|
|
@ -72,10 +72,27 @@ const IndexingProgressBar = ({
|
|||
|
||||
return (
|
||||
<div
|
||||
onClick={() => setExpanded((prev) => !prev)}
|
||||
onClick={() => {
|
||||
if (completed < total) {
|
||||
setExpanded((prev) => !prev);
|
||||
} else {
|
||||
postToIde("index/forceReIndex", undefined);
|
||||
}
|
||||
}}
|
||||
className="cursor-pointer"
|
||||
>
|
||||
{expanded ? (
|
||||
{completed >= total ? (
|
||||
<>
|
||||
<CircleDiv data-tooltip-id="progress_dot" color="#090"></CircleDiv>
|
||||
{tooltipPortalDiv &&
|
||||
ReactDOM.createPortal(
|
||||
<StyledTooltip id="progress_dot" place="top">
|
||||
Index up-to-date. Click to force re-indexing
|
||||
</StyledTooltip>,
|
||||
tooltipPortalDiv,
|
||||
)}
|
||||
</>
|
||||
) : expanded ? (
|
||||
<>
|
||||
<GridDiv
|
||||
data-tooltip-id="usage_progress_bar"
|
||||
|
|
@ -96,19 +113,19 @@ const IndexingProgressBar = ({
|
|||
<StyledTooltip id="usage_progress_bar" place="top">
|
||||
{currentlyIndexing}
|
||||
</StyledTooltip>,
|
||||
tooltipPortalDiv
|
||||
tooltipPortalDiv,
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<CircleDiv data-tooltip-id="progress_dot"></CircleDiv>
|
||||
<CircleDiv data-tooltip-id="progress_dot" color="#bb0"></CircleDiv>
|
||||
{tooltipPortalDiv &&
|
||||
ReactDOM.createPortal(
|
||||
<StyledTooltip id="progress_dot" place="top">
|
||||
Click to unpause indexing (
|
||||
{Math.trunc((completed / total) * 100)}%)
|
||||
</StyledTooltip>,
|
||||
tooltipPortalDiv
|
||||
tooltipPortalDiv,
|
||||
)}
|
||||
</>
|
||||
)}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue