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 98926fd4..b00954f9 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 @@ -531,7 +531,7 @@ export const SidebarChat = () => { className='flex flex-row justify-between items-end gap-1' > {/* submit options */} -
+
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 7d82965a..5995ea78 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 @@ -246,7 +246,44 @@ export const VoidSelectBox = ({ onChangeSelection, onCreateInstance, selectB />; }; +// makes it so that code in the sidebar isnt too tabbed out +const normalizeIndentation = (code: string): string => { + const lines = code.split('\n') + let minLeadingSpaces = Infinity + + // find the minimum number of leading spaces + for (const line of lines) { + if (line.trim() === '') continue; + let leadingSpaces = 0; + for (let i = 0; i < line.length; i++) { + const char = line[i]; + if (char === '\t' || char === ' ') { + leadingSpaces += 1; + } else { break; } + } + minLeadingSpaces = Math.min(minLeadingSpaces, leadingSpaces) + } + + // remove the leading spaces + return lines.map(line => { + if (line.trim() === '') return line; + + let spacesToRemove = minLeadingSpaces; + let i = 0; + while (spacesToRemove > 0 && i < line.length) { + const char = line[i]; + if (char === '\t' || char === ' ') { + spacesToRemove -= 1; + i++; + } else { break; } + } + + return line.slice(i); + + }).join('\n') + +} export const VoidCodeEditor = ({ initValue, language }: { initValue: string, language: string | undefined }) => { const divRef = useRef(null) @@ -255,6 +292,8 @@ export const VoidCodeEditor = ({ initValue, language }: { initValue: string, lan const instantiationService = accessor.get('IInstantiationService') const modelService = accessor.get('IModelService') + initValue = normalizeIndentation(initValue) + return
@@ -267,7 +306,18 @@ export const VoidCodeEditor = ({ initValue, language }: { initValue: string, lan scrollbar: { vertical: 'hidden', horizontal: 'auto', - } + }, + lineNumbers: 'off', + folding: false, + lineDecorationsWidth: 0, + scrollBeyondLastLine: false, + minimap: { enabled: false }, + overviewRulerLanes: 0, + hideCursorInOverviewRuler: true, + overviewRulerBorder: false, + renderLineHighlight: 'none', + glyphMargin: false, + readOnly: true, }, { isSimpleWidget: true, diff --git a/textureAtlas.png b/textureAtlas.png new file mode 100644 index 00000000..9810b957 Binary files /dev/null and b/textureAtlas.png differ