From 4284461b060f452a0f4a357055ffdecaf0ccc80f Mon Sep 17 00:00:00 2001 From: Mathew Pareles Date: Sat, 15 Mar 2025 02:47:02 -0700 Subject: [PATCH] fix height issue --- .../contrib/void/browser/editCodeService.ts | 1 - .../react/src/sidebar-tsx/SidebarChat.tsx | 130 ++++++++++-------- 2 files changed, 73 insertions(+), 58 deletions(-) diff --git a/src/vs/workbench/contrib/void/browser/editCodeService.ts b/src/vs/workbench/contrib/void/browser/editCodeService.ts index 78acce8e..3785310e 100644 --- a/src/vs/workbench/contrib/void/browser/editCodeService.ts +++ b/src/vs/workbench/contrib/void/browser/editCodeService.ts @@ -384,7 +384,6 @@ class EditCodeService extends Disposable implements IEditCodeService { // Update or remove the entry for this URI if (diffsInUri.length > 0) { this._sortedDiffsOfFspath[uri.fsPath] = diffsInUri.sort((a, b) => a.startLine - b.startLine); - console.log('_sortedDiffsOfFspath', this._sortedDiffsOfFspath) } else { delete this._sortedDiffsOfFspath[uri.fsPath]; } diff --git a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx index 2d011a36..4d5e3ac6 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/sidebar-tsx/SidebarChat.tsx @@ -1611,6 +1611,11 @@ const ChatBubble = ({ chatMessage, isLoading, messageIdx, isLast }: ChatBubblePr } +const VoidCommandBarNavButtonsShell = () => { + +} + + const VoidCommandBar = () => { const accessor = useAccessor() const editCodeService = accessor.get('IEditCodeService') @@ -1618,6 +1623,8 @@ const VoidCommandBar = () => { const commandService = accessor.get('ICommandService') const [_, rerender] = useState(0) + // Add a state variable to track focus + const [isFocused, setIsFocused] = useState(false) console.log('rerender count: ', _) // state for what the user is currently focused on (both URI and diff) @@ -1694,76 +1701,83 @@ const VoidCommandBar = () => { }, [getCurrentUri, editCodeService._sortedUrisWithDiffs]) + const gotoNextDiff = ({ step }: { step: 1 | -1 }) => { - return
+ // get the next diff + const res = getNextDiff({ step: 1 }) + if (!res) return; - + // scroll to the next diff + const { nextDiff, nextDiffIdx } = res; + const editor = editorService.getActiveCodeEditor() + if (!editor) return; - + }) + } + + return
setIsFocused(true)} + onBlurCapture={() => setIsFocused(false)} + > - // get the next uri - const res = getNextUri({ step: 1 }) - if (!res) return; + - const { nextUri, nextUriIdx } = res; + - // open the uri and scroll to diff - const sortedDiffs = editCodeService._sortedDiffsOfFspath[nextUri.fsPath] - if (!sortedDiffs) return; + - const diffIdx = diffIdxOfFspath[nextUri.fsPath] || 0 - const diff = sortedDiffs[diffIdx] - - const range = { startLineNumber: diff.startLine, endLineNumber: diff.startLine, startColumn: 1, endColumn: 1 }; - - commandService.executeCommand('vscode.open', nextUri).then(() => { - - // select the text - setTimeout(() => { - - const editor = editorService.getActiveCodeEditor() - if (!editor) return; - - editor.revealRange(range, ScrollType.Immediate) - - }, 50) - - }) - }} - > - next diff area -
numUris: {Object.keys(editCodeService._sortedDiffsOfFspath).length}
@@ -1908,7 +1922,7 @@ export const SidebarChat = () => {
const messagesHTML = { onAbort() } }, [onSubmit, onAbort, isStreaming]) - const inputForm =
0 ? 'absolute bottom-0' : ''}`}> + const inputForm =
0 ? 'absolute bottom-0' : ''}`}> { fnsRef={textAreaFnsRef} multiline={true} /> - +
return