warn of large highlighted ranges, cmd+k->m

This commit is contained in:
Nate Sesti 2023-07-14 03:24:46 -07:00
parent 5c6d2f1be8
commit 39cd2ef27d
10 changed files with 141 additions and 94 deletions

View file

@ -59,7 +59,7 @@ class DemoPolicy(Policy):
return (
MessageStep(name="Welcome to Continue", message=dedent("""\
- Highlight code and ask a question or give instructions
- Use `cmd+k` (Mac) / `ctrl+k` (Windows) to open Continue
- Use `cmd+m` (Mac) / `ctrl+m` (Windows) to open Continue
- Use `/help` to ask questions about how to use Continue""")) >>
WelcomeStep() >>
# SetupContinueWorkspaceStep() >>

View file

@ -19,7 +19,7 @@ help = dedent("""\
Continue passes all of the sections of code you highlight, the code above and below the to-be edited highlighted code section, and all previous steps above input box as context to the LLM.
You can use cmd+k (Mac) / ctrl+k (Windows) to open Continue. You can use cmd+shift+e / ctrl+shift+e to open file Explorer. You can add your own OpenAI API key to VS Code Settings with `cmd+,`
You can use cmd+m (Mac) / ctrl+m (Windows) to open Continue. You can use cmd+shift+e / ctrl+shift+e to open file Explorer. You can add your own OpenAI API key to VS Code Settings with `cmd+,`
If Continue is stuck loading, try using `cmd+shift+p` to open the command palette, search "Reload Window", and then select it. This will reload VS Code and Continue and often fixes issues.

View file

@ -1,12 +1,12 @@
{
"name": "continue",
"version": "0.0.163",
"version": "0.0.164",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "continue",
"version": "0.0.163",
"version": "0.0.164",
"license": "Apache-2.0",
"dependencies": {
"@electron/rebuild": "^3.2.10",

View file

@ -14,7 +14,7 @@
"displayName": "Continue",
"pricing": "Free",
"description": "The open-source coding autopilot",
"version": "0.0.163",
"version": "0.0.164",
"publisher": "Continue",
"engines": {
"vscode": "^1.67.0"
@ -111,8 +111,8 @@
"keybindings": [
{
"command": "continue.focusContinueInput",
"mac": "cmd+k",
"key": "ctrl+k"
"mac": "cmd+m",
"key": "ctrl+m"
},
{
"command": "continue.suggestionDown",

View file

@ -228,6 +228,11 @@ const ComboBox = React.forwardRef((props: ComboBoxProps, ref) => {
)} */}
{highlightedCodeSections.map((section, idx) => (
<PillButton
warning={
section.range.contents.length > 4000 && section.editing
? "Editing such a large range may be slow"
: undefined
}
editing={section.editing}
pinned={section.pinned}
index={idx}

View file

@ -109,6 +109,7 @@ const Onboarding = () => {
paddingBottom: "50px",
textAlign: "center",
cursor: "pointer",
whiteSpace: "nowrap",
}}
>
<StyledSpan

View file

@ -1,12 +1,11 @@
import { useContext, useState } from "react";
import styled from "styled-components";
import { StyledTooltip, defaultBorderRadius, secondaryDark } from ".";
import {
StyledTooltip,
defaultBorderRadius,
lightGray,
secondaryDark,
} from ".";
import { Trash, PaintBrush, MapPin } from "@styled-icons/heroicons-outline";
Trash,
PaintBrush,
ExclamationTriangle,
} from "@styled-icons/heroicons-outline";
import { GUIClientContext } from "../App";
const Button = styled.button`
@ -31,7 +30,6 @@ const GridDiv = styled.div`
grid-template-columns: 1fr 1fr;
align-items: center;
border-radius: ${defaultBorderRadius};
overflow: hidden;
background-color: ${secondaryDark};
`;
@ -48,6 +46,21 @@ const ButtonDiv = styled.div<{ backgroundColor: string }>`
}
`;
const CircleDiv = styled.div`
position: absolute;
top: -10px;
right: -10px;
width: 20px;
height: 20px;
border-radius: 50%;
background-color: red;
color: white;
display: flex;
align-items: center;
justify-content: center;
padding: 2px;
`;
interface PillButtonProps {
onHover?: (arg0: boolean) => void;
onDelete?: () => void;
@ -55,6 +68,7 @@ interface PillButtonProps {
index: number;
editing: boolean;
pinned: boolean;
warning?: string;
}
const PillButton = (props: PillButtonProps) => {
@ -63,75 +77,96 @@ const PillButton = (props: PillButtonProps) => {
return (
<>
<Button
style={{
position: "relative",
borderColor: props.editing
? "#8800aa"
: props.pinned
? "#ffff0099"
: "transparent",
borderWidth: "1px",
borderStyle: "solid",
}}
onMouseEnter={() => {
setIsHovered(true);
if (props.onHover) {
props.onHover(true);
}
}}
onMouseLeave={() => {
setIsHovered(false);
if (props.onHover) {
props.onHover(false);
}
}}
>
{isHovered && (
<GridDiv>
<ButtonDiv
data-tooltip-id={`edit-${props.index}`}
backgroundColor={"#8800aa55"}
onClick={() => {
client?.setEditingAtIndices([props.index]);
}}
>
<PaintBrush style={{ margin: "auto" }} width="1.6em"></PaintBrush>
</ButtonDiv>
<div style={{ position: "relative" }}>
<Button
style={{
position: "relative",
borderColor: props.warning
? "red"
: props.editing
? "#8800aa"
: props.pinned
? "#ffff0099"
: "transparent",
borderWidth: "1px",
borderStyle: "solid",
}}
onMouseEnter={() => {
setIsHovered(true);
if (props.onHover) {
props.onHover(true);
}
}}
onMouseLeave={() => {
setIsHovered(false);
if (props.onHover) {
props.onHover(false);
}
}}
>
{isHovered && (
<GridDiv>
<ButtonDiv
data-tooltip-id={`edit-${props.index}`}
backgroundColor={"#8800aa55"}
onClick={() => {
client?.setEditingAtIndices([props.index]);
}}
>
<PaintBrush
style={{ margin: "auto" }}
width="1.6em"
></PaintBrush>
</ButtonDiv>
{/* <ButtonDiv
{/* <ButtonDiv
data-tooltip-id={`pin-${props.index}`}
backgroundColor={"#ffff0055"}
onClick={() => {
client?.setPinnedAtIndices([props.index]);
}}
>
>
<MapPin style={{ margin: "auto" }} width="1.6em"></MapPin>
</ButtonDiv> */}
<StyledTooltip id={`pin-${props.index}`}>
Edit this range
<StyledTooltip id={`pin-${props.index}`}>
Edit this range
</StyledTooltip>
<ButtonDiv
data-tooltip-id={`delete-${props.index}`}
backgroundColor={"#cc000055"}
onClick={() => {
if (props.onDelete) {
props.onDelete();
}
}}
>
<Trash style={{ margin: "auto" }} width="1.6em"></Trash>
</ButtonDiv>
</GridDiv>
)}
{props.title}
</Button>
<StyledTooltip id={`edit-${props.index}`}>
{props.editing
? "Editing this range (with rest of file as context)"
: "Edit this range"}
</StyledTooltip>
<StyledTooltip id={`delete-${props.index}`}>Delete</StyledTooltip>
{props.warning && (
<>
<CircleDiv data-tooltip-id={`circle-div-${props.title}`}>
<ExclamationTriangle
style={{ margin: "auto" }}
width="1.0em"
strokeWidth={2}
/>
</CircleDiv>
<StyledTooltip id={`circle-div-${props.title}`}>
{props.warning}
</StyledTooltip>
<ButtonDiv
data-tooltip-id={`delete-${props.index}`}
backgroundColor={"#cc000055"}
onClick={() => {
if (props.onDelete) {
props.onDelete();
}
}}
>
<Trash style={{ margin: "auto" }} width="1.6em"></Trash>
</ButtonDiv>
</GridDiv>
</>
)}
{props.title}
</Button>
<StyledTooltip id={`edit-${props.index}`}>
{props.editing
? "Editing this range (with rest of file as context)"
: "Edit this range"}
</StyledTooltip>
<StyledTooltip id={`delete-${props.index}`}>Delete</StyledTooltip>
</div>
</>
);
};

View file

@ -95,11 +95,8 @@ function GUI(props: GUIProps) {
name: "Welcome to Continue",
hide: false,
description: `- Highlight code and ask a question or give instructions
- Use \`cmd+k\` (Mac) / \`ctrl+k\` (Windows) to open Continue
- Use \`cmd+shift+e\` / \`ctrl+shift+e\` to open file Explorer
- Add your own OpenAI API key to VS Code Settings with \`cmd+,\`
- Use slash commands when you want fine-grained control
- Past steps are included as part of the context by default`,
- Use \`cmd+m\` (Mac) / \`ctrl+m\` (Windows) to open Continue
- Use \`/help\` to ask questions about how to use Continue`,
system_message: null,
chat_context: [],
manage_own_chat_context: false,
@ -269,15 +266,17 @@ function GUI(props: GUIProps) {
return (
<>
<Onboarding />
<TextDialog showDialog={showFeedbackDialog}
onEnter={(text) => {
client?.sendMainInput(`/feedback ${text}`);
setShowFeedbackDialog(false);
}}
onClose={() => {
setShowFeedbackDialog(false);
}}
message={feedbackDialogMessage} />
<TextDialog
showDialog={showFeedbackDialog}
onEnter={(text) => {
client?.sendMainInput(`/feedback ${text}`);
setShowFeedbackDialog(false);
}}
onClose={() => {
setShowFeedbackDialog(false);
}}
message={feedbackDialogMessage}
/>
<TopGUIDiv
ref={topGuiDivRef}

View file

@ -19,6 +19,8 @@ import { debugPanelWebview } from "./debugPanel";
import { sendTelemetryEvent, TelemetryEvent } from "./telemetry";
import { ideProtocolClient } from "./activation/activate";
let focusedOnContinueInput = false;
// Copy everything over from extension.ts
const commandsMap: { [command: string]: (...args: any) => any } = {
"continue.suggestionDown": suggestionDownCommand,
@ -30,10 +32,15 @@ const commandsMap: { [command: string]: (...args: any) => any } = {
"continue.acceptAllSuggestions": acceptAllSuggestionsCommand,
"continue.rejectAllSuggestions": rejectAllSuggestionsCommand,
"continue.focusContinueInput": async () => {
vscode.commands.executeCommand("continue.continueGUIView.focus");
debugPanelWebview?.postMessage({
type: "focusContinueInput",
});
if (focusedOnContinueInput) {
vscode.commands.executeCommand("workbench.action.focusActiveEditorGroup");
} else {
vscode.commands.executeCommand("continue.continueGUIView.focus");
debugPanelWebview?.postMessage({
type: "focusContinueInput",
});
}
focusedOnContinueInput = !focusedOnContinueInput;
},
"continue.quickTextEntry": async () => {
const text = await vscode.window.showInputBox({
@ -53,4 +60,4 @@ export function registerAllCommands(context: vscode.ExtensionContext) {
vscode.commands.registerCommand(command, callback)
);
}
}
}

View file

@ -60,12 +60,12 @@ class DiffViewerCodeLensProvider implements vscode.CodeLensProvider {
}
codeLenses.push(
new vscode.CodeLens(range, {
title: "Accept ✅ (⌘⇧↩)",
title: "Accept All ✅ (⌘⇧↩)",
command: "continue.acceptDiff",
arguments: [document.uri.fsPath],
}),
new vscode.CodeLens(range, {
title: "Reject ❌ (⌘⇧⌫)",
title: "Reject All ❌ (⌘⇧⌫)",
command: "continue.rejectDiff",
arguments: [document.uri.fsPath],
})