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 fda65ec5..c9b49391 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 @@ -288,102 +288,97 @@ export const SelectedFiles = ( const isThisSelectionOpened = !!(selection.selectionStr && selectionIsOpened[i]) const isThisSelectionAFile = selection.selectionStr === null - return ( -
+ {/* selection summary */} +
{ + // open the file if it is a file + if (isThisSelectionAFile) { + commandService.executeCommand('vscode.open', selection.fileURI, { + preview: true, + // preserveFocus: false, + }); + } else { + // open the selection if it is a text-selection + setSelectionIsOpened(s => { + const newS = [...s] + newS[i] = !newS[i] + return newS + }); + } + }} > - {/* selection summary */} -
{ - // open the file if it is a file - if (isThisSelectionAFile) { - commandService.executeCommand('vscode.open', selection.fileURI, { - preview: true, - // preserveFocus: false, - }); - } else { - // open the selection if it is a text-selection - setSelectionIsOpened(s => { - const newS = [...s] - newS[i] = !newS[i] - return newS - }); - } - }} - > - - {/* file name */} - {getBasename(selection.fileURI.fsPath)} - {/* selection range */} - {!isThisSelectionAFile ? ` (${selection.range.startLineNumber}-${selection.range.endLineNumber})` : ''} - + + {/* file name */} + {getBasename(selection.fileURI.fsPath)} + {/* selection range */} + {!isThisSelectionAFile ? ` (${selection.range.startLineNumber}-${selection.range.endLineNumber})` : ''} + - {/* X button */} - {type === 'staging' && - { - e.stopPropagation(); // don't open/close selection - if (type !== 'staging') return; - setStaging([...selections.slice(0, i), ...selections.slice(i + 1)]) - setSelectionIsOpened(o => [...o.slice(0, i), ...o.slice(i + 1)]) - }} - > - - } - - - {/* clear all selections button */} - {type !== 'staging' || selections.length === 0 || i !== selections.length - 1 ? null :
setIsClearHovered(true)} - onMouseLeave={() => setIsClearHovered(false)} - > - { setStaging([]) }} - /> -
} - - -
- {/* selection text */} - {isThisSelectionOpened && -
{ - e.stopPropagation(); // don't focus input box + e.stopPropagation(); // don't open/close selection + if (type !== 'staging') return; + setStaging([...selections.slice(0, i), ...selections.slice(i + 1)]) + setSelectionIsOpened(o => [...o.slice(0, i), ...o.slice(i + 1)]) }} > - -
- } + + } + +
- ) + {/* selection text */} + {isThisSelectionOpened && +
{ + e.stopPropagation(); // don't focus input box + }} + > + +
} +
+ + if (type !== 'staging' || selections.length === 0 || i !== selections.length - 1) + return {content} + + else return
+ {content} +
setIsClearHovered(true)} + onMouseLeave={() => setIsClearHovered(false)} + > + { setStaging([]) }} + /> +
+
})}