mirror of
https://github.com/voideditor/void
synced 2026-05-23 09:28:23 +00:00
refactor blockcode
This commit is contained in:
parent
af244938b8
commit
f13c30ae0d
3 changed files with 12 additions and 8 deletions
|
|
@ -74,7 +74,6 @@ export const BlockCode = ({ buttonsOnHover, ...codeEditorProps }: { buttonsOnHov
|
|||
<div className={`flex space-x-2 ${isSingleLine ? '' : 'p-2'}`}>{buttonsOnHover}</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<VoidCodeEditor {...codeEditorProps} />
|
||||
</div>
|
||||
</>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import { IDisposable } from '../../../../../../../base/common/lifecycle.js';
|
|||
import { ErrorDisplay } from './ErrorDisplay.js';
|
||||
import { OnError, ServiceSendLLMMessageParams } from '../../../../../../../platform/void/common/llmMessageTypes.js';
|
||||
import { HistoryInputBox, InputBox } from '../../../../../../../base/browser/ui/inputbox/inputBox.js';
|
||||
import { VoidInputBox } from '../util/inputs.js';
|
||||
import { VoidCodeEditorProps, VoidInputBox } from '../util/inputs.js';
|
||||
import { ModelDropdown } from '../void-settings-tsx/ModelDropdown.js';
|
||||
import { chat_systemMessage, chat_prompt } from '../../../prompt/prompts.js';
|
||||
import { ISidebarStateService } from '../../../sidebarStateService.js';
|
||||
|
|
@ -362,7 +362,12 @@ export const SelectedFiles = (
|
|||
{/* selection text */}
|
||||
{isThisSelectionOpened &&
|
||||
<div className='w-full px-1 rounded-sm border-vscode-editor-border'>
|
||||
<BlockCode initValue={selection.selectionStr!} language={getLanguageFromFileName(selection.fileURI.path)} />
|
||||
<BlockCode
|
||||
initValue={selection.selectionStr!}
|
||||
language={getLanguageFromFileName(selection.fileURI.path)}
|
||||
maxHeight={100}
|
||||
showScrollbars={false}
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -294,12 +294,12 @@ const normalizeIndentation = (code: string): string => {
|
|||
|
||||
}
|
||||
|
||||
export type VoidCodeEditorProps = { initValue: string, language?: string, maxHeight?: number, hideScrollbars?: boolean }
|
||||
export const VoidCodeEditor = ({ initValue, language, maxHeight, hideScrollbars }: VoidCodeEditorProps) => {
|
||||
export type VoidCodeEditorProps = { initValue: string, language?: string, maxHeight?: number, showScrollbars?: boolean }
|
||||
export const VoidCodeEditor = ({ initValue, language, maxHeight, showScrollbars }: VoidCodeEditorProps) => {
|
||||
|
||||
// apply default settings
|
||||
// default settings
|
||||
const MAX_HEIGHT = maxHeight ?? Infinity;
|
||||
const HIDE_SCROLLBARS = hideScrollbars ?? false;
|
||||
const SHOW_SCROLLBARS = showScrollbars ?? false;
|
||||
|
||||
const divRef = useRef<HTMLDivElement | null>(null)
|
||||
|
||||
|
|
@ -323,7 +323,7 @@ export const VoidCodeEditor = ({ initValue, language, maxHeight, hideScrollbars
|
|||
|
||||
scrollbar: {
|
||||
alwaysConsumeMouseWheel: false,
|
||||
...HIDE_SCROLLBARS ? {
|
||||
...!SHOW_SCROLLBARS ? {
|
||||
vertical: 'hidden',
|
||||
horizontal: 'hidden',
|
||||
verticalScrollbarSize: 0,
|
||||
|
|
|
|||
Loading…
Reference in a new issue