-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add insert at cursor functionality with tooltip #4936
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for continuedev canceled.
|
Thanks for taking this on @aadarshkt ! Some thoughts on the layout here:
With that in mind, I think the following UI would work well:
If we go this route, we should probably re-order the the other action buttons (can't recall where they are in the GUI folder) to also follow this same order (see screenshot below) ![]() Lmk your thoughts 👍 |
@Patrick-Erichsen, Thanks for the review, Yeah seems right to me as well, users will remember more what was first and last in the icon list, thus it is better to keep frequently used icons there. I will make a change at both places. |
const uiConfig = useAppSelector(selectUIConfig); | ||
const isBottomToolbarPosition = | ||
uiConfig?.codeBlockToolbarPosition == "bottom"; | ||
|
||
const toolTipPlacement = isBottomToolbarPosition ? "top" : "bottom"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is all of this logic necessary given that the toolbar position is either top or bottom?
https://github.com/aadarshkt/continue/blob/fix-insert-at-cursor/core/index.d.ts#L1099
How about something like the following instead?
<HeaderButtonWithToolTip
text="Insert at cursor"
style={{ backgroundColor: vscEditorBackground }}
onClick={() =>
ideMessenger.post("insertAtCursor", {
text: codeBlockContent,
})
}
tooltipPlacement={uiConfig?.codeBlockToolbarPosition ?? "top"}
>
Description
Fixes : #4890
Added insert at cursor with help of existing codebase.
Checklist
Screenshots
Testing instructions
[ For new or modified features, provide step-by-step testing instructions to validate the intended behavior of the change, including any relevant tests to run. ]