fix scroll

This commit is contained in:
Andrew Pareles 2024-12-04 18:54:05 -08:00
parent 86c9a17f8d
commit 389efb4701
6 changed files with 63 additions and 28 deletions

View file

@ -90,15 +90,8 @@ Here are the full options: `vscode-{win32-ia32 | win32-x64 | darwin-x64 | darwin
## Roadmap
Here are the most important topics on our Roadmap. More ⭐'s = more important. Please refer to our [Issues](https://github.com/voideditor/void/issues) page for the latest issues.
Please refer to our [Issues](https://github.com/voideditor/void/issues) page for the latest issues.
## ⭐⭐⭐ Make History work well.
When the user submits a response or presses the apply/accept/reject button, we should add these events to the history, allowing the user to undo/redo them. Right now there is unexpected behavior if the user tries to undo or redo their changes.
## ⭐⭐⭐ Build Cursor-style quick edits (Ctrl+K).
When the user presses Ctrl+K, an input box should appear inline with the code that they were selecting. This is somewhat difficult to do because an extension alone cannot do this, and it requires creating a new component in the IDE. We think you can modify vscode's built-in "codelens" or "zone widget" components, but we are open to alternatives.
## ⭐⭐⭐ Creative.
@ -106,10 +99,6 @@ Examples: creating better code search, or supporting AI agents that can edit acr
Eventually, we want to build a convenient API for creating AI tools. The API will provide methods for creating the UI (showing an autocomplete suggestion, or creating a new diff), detecting event changes (like `onKeystroke` or `onFileOpen`), and modifying the user's file-system (storing indexes associated with each file), making it much easier to make your own AI plugin. We plan on building these features further along in timeline, but we wanted to list them for completeness.
## ⭐ One-stars.
⭐ Let the user Accept / Reject all Diffs in an entire file via the sidebar.
# Guidelines
We're always glad to talk about new ideas, help you get set up, and make sure your changes align with our vision for the project. Feel free to shoot us a message in the #general channel of the [Discord](https://discord.gg/RSNjgaugJs) for any reason. Please check in especially if you want to make a lot of changes or build a large new feature.

View file

@ -1,7 +1,6 @@
import React, { useState } from 'react';
import { AlertCircle, ChevronDown, ChevronUp, X } from 'lucide-react';
import { getCmdKey } from '../../../getCmdKey.js';
// const opaqueMessage = `\
// Unfortunately, Void can't see the full error. However, you should be able to find more details by pressing ${getCmdKey()}+Shift+P, typing "Toggle Developer Tools", and looking at the console.\n

View file

@ -0,0 +1,36 @@
// import { useEffect, useRef } from 'react'
// import { HistoryInputBox } from '../../../../../../../base/browser/ui/inputbox/inputBox.js'
// import { useService } from '../util/services.js'
// import { defaultInputBoxStyles } from '../../../../../../../platform/theme/browser/defaultStyles.js'
// export const InputBox = ({ onChangeText, placeholder, className }: { onChangeText: (value: string) => void, placeholder: string, className: string }) => {
// const domNodeRef = useRef<HTMLDivElement | null>(null)
// const contextViewProvider = useService('contextViewService')
// useEffect(() => {
// const htmlNode = domNodeRef.current
// if (!htmlNode) return
// console.log('creating inputbox')
// const widget = new HistoryInputBox(htmlNode, contextViewProvider, {
// inputBoxStyles: defaultInputBoxStyles,
// placeholder,
// history: [],
// })
// widget.onDidChange((newStr) => { onChangeText(newStr) })
// return () => {
// console.log('disposing inputbox')
// widget.dispose()
// }
// }, [onChangeText, contextViewProvider, placeholder])
// return <div ref={domNodeRef}className={className}/>
// }

View file

@ -19,7 +19,7 @@ const Sidebar = () => {
const { isHistoryOpen, currentTab: tab } = sidebarState
return <div className='@@void-scope'>
<div className={`flex flex-col h-screen w-full`}>
<div className={`flex flex-col h-screen w-full px-2 py-2 overflow-y-auto`}>
{/* <span onClick={() => {
const tabs = ['chat', 'settings', 'threadSelector']
@ -27,7 +27,7 @@ const Sidebar = () => {
sidebarStateService.setState({ currentTab: tabs[(index + 1) % tabs.length] as any })
}}>clickme {tab}</span> */}
<div className={`mb-2 h-[30vh] ${isHistoryOpen ? '' : 'hidden'}`}>
<div className={`mb-2 h-[30vh] overflow-y-auto ${isHistoryOpen ? '' : 'hidden'}`}>
<SidebarThreadSelector />
</div>

View file

@ -16,10 +16,12 @@ import { IModelService } from '../../../../../../../editor/common/services/model
import { URI } from '../../../../../../../base/common/uri.js';
import { EndOfLinePreference } from '../../../../../../../editor/common/model.js';
import { IDisposable } from '../../../../../../../base/common/lifecycle.js';
import { ErrorDisplay } from '../util/ErrorDisplay.js';
import { ErrorDisplay } from './ErrorDisplay.js';
import { LLMMessageServiceParams } from '../../../../../../../platform/void/common/llmMessageTypes.js';
import { getCmdKey } from '../../../getCmdKey.js'
// import { } from '@vscode/webview-ui-toolkit/react';
import { VSCodeDropdown } from '@vscode/webview-ui-toolkit/react';
import { InputBox } from './InputBox.js';
// read files from VSCode
const VSReadFile = async (modelService: IModelService, uri: URI): Promise<string | null> => {
@ -292,25 +294,39 @@ export const SidebarChat = () => {
<SelectedFiles type='staging' selections={selections} setStaging={threadsStateService.setStaging.bind(threadsStateService)} />
</div>}
{/* error message */}
{latestError === null ? null :
<ErrorDisplay
error={latestError}
onDismiss={() => { setLatestError(null) }}
/>}
<form
ref={formRef}
className="flex flex-row items-center rounded-md p-2"
className={`flex flex-row items-center rounded-md p-2`}
onKeyDown={(e) => { if (e.key === 'Enter' && !e.shiftKey) onSubmit(e) }}
onSubmit={(e) => {
console.log('submit!')
onSubmit(e)
}}>
{/* input */}
{/* <InputBox
placeholder={`${getCmdKey()}+L to select`}
onChangeText={(newStr) => { setInstructions(newStr) }}
className='w-full p-2 leading-tight resize-none max-h-[50vh] overflow-auto bg-transparent border-none !outline-none'
/> */}
<textarea
ref={chatInputRef}
onChange={(e) => { setInstructions(e.target.value) }}
className="w-full p-2 leading-tight resize-none max-h-[50vh] overflow-hidden bg-transparent border-none !outline-none"
placeholder="Ctrl+L to select"
className={`w-full p-2 leading-tight resize-none max-h-[50vh] overflow-auto bg-transparent border-none !outline-none`}
placeholder={`${getCmdKey()}+L to select`}
rows={1}
onInput={e => { e.currentTarget.style.height = 'auto'; e.currentTarget.style.height = e.currentTarget.scrollHeight + 'px' }} // Adjust height dynamically
/>
{isLoading ?
// stop button
<button
@ -341,13 +357,6 @@ export const SidebarChat = () => {
</div>
</div>
</div>
{/* error message */}
{latestError === null ? null :
<ErrorDisplay
error={latestError}
onDismiss={() => { setLatestError(null) }}
/>}
</div>
</>
}

View file

@ -33,7 +33,7 @@ import { IViewsService } from '../../../services/views/common/viewsService.js';
import { IThreadHistoryService } from './registerThreads.js';
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
import { IThemeService } from '../../../../platform/theme/common/themeService.js';
import { IContextMenuService } from '../../../../platform/contextview/browser/contextView.js';
import { IContextMenuService, IContextViewService } from '../../../../platform/contextview/browser/contextView.js';
import { IKeybindingService } from '../../../../platform/keybinding/common/keybinding.js';
import { IOpenerService } from '../../../../platform/opener/common/opener.js';
import { ITelemetryService } from '../../../../platform/telemetry/common/telemetry.js';
@ -69,6 +69,7 @@ export type ReactServicesType = {
modelService: IModelService;
inlineDiffService: IInlineDiffsService;
sendLLMMessageService: ISendLLMMessageService;
contextViewService: IContextViewService;
}
// ---------- Define viewpane ----------
@ -114,6 +115,7 @@ class VoidSidebarViewPane extends ViewPane {
modelService: accessor.get(IModelService),
inlineDiffService: accessor.get(IInlineDiffsService),
sendLLMMessageService: accessor.get(ISendLLMMessageService),
contextViewService: accessor.get(IContextViewService),
}
mountFn(root, services);
});