diff --git a/src/vs/workbench/contrib/void/browser/react/src/markdown/BlockCode.tsx b/src/vs/workbench/contrib/void/browser/react/src/markdown/BlockCode.tsx index f77bc2b4..66c8e1e5 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/markdown/BlockCode.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/markdown/BlockCode.tsx @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { ReactNode } from "react" -import { VoidCodeEditor } from '../util/inputs.js'; +import { VoidCodeEditor, VoidCodeEditorProps } from '../util/inputs.js'; const extensionMap: { [key: string]: string } = { @@ -63,10 +63,9 @@ export function getLanguageFromFileName(fileName: string): string { return extensionMap[ext] || 'plaintext'; } -export const BlockCode = ({ text, buttonsOnHover, language }: { text: string, buttonsOnHover?: ReactNode, language?: string }) => { +export const BlockCode = ({ buttonsOnHover, ...codeEditorProps }: { buttonsOnHover?: React.ReactNode } & VoidCodeEditorProps) => { - - const isSingleLine = !text.includes('\n') + const isSingleLine = !codeEditorProps.initValue.includes('\n') return (<>
@@ -76,10 +75,7 @@ export const BlockCode = ({ text, buttonsOnHover, language }: { text: string, bu
)} - + ) diff --git a/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx b/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx index e89cb665..3b214b92 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/markdown/ChatMarkdownRender.tsx @@ -76,7 +76,7 @@ const RenderToken = ({ token, nested = false }: { token: Token | string, nested? if (t.type === "code") { return } /> 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 329724d6..894850f4 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 @@ -362,7 +362,7 @@ export const SelectedFiles = ( {/* selection text */} {isThisSelectionOpened &&
- +
} diff --git a/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx b/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx index d1a5dab6..bc7c538c 100644 --- a/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx +++ b/src/vs/workbench/contrib/void/browser/react/src/util/inputs.tsx @@ -294,9 +294,12 @@ const normalizeIndentation = (code: string): string => { } -export const VoidCodeEditor = ({ initValue, language }: { initValue: string, language: string | undefined }) => { +export type VoidCodeEditorProps = { initValue: string, language?: string, maxHeight?: number, hideScrollbars?: boolean } +export const VoidCodeEditor = ({ initValue, language, maxHeight, hideScrollbars }: VoidCodeEditorProps) => { - const MAX_HEIGHT = Infinity; + // apply default settings + const MAX_HEIGHT = maxHeight ?? Infinity; + const HIDE_SCROLLBARS = hideScrollbars ?? false; const divRef = useRef(null) @@ -320,10 +323,15 @@ export const VoidCodeEditor = ({ initValue, language }: { initValue: string, lan scrollbar: { alwaysConsumeMouseWheel: false, - // vertical: 'hidden', - // horizontal: 'hidden', - verticalScrollbarSize: 8, - horizontalScrollbarSize: 8, + ...HIDE_SCROLLBARS ? { + vertical: 'hidden', + horizontal: 'hidden', + verticalScrollbarSize: 0, + horizontalScrollbarSize: 0, + } : { + verticalScrollbarSize: 8, + horizontalScrollbarSize: 8, + }, }, scrollBeyondLastLine: false,