summaryrefslogtreecommitdiff
path: root/extension
diff options
context:
space:
mode:
Diffstat (limited to 'extension')
-rw-r--r--extension/package.json80
-rw-r--r--extension/react-app/src/components/CodeBlock.tsx1
-rw-r--r--extension/react-app/src/components/StepContainer.tsx23
-rw-r--r--extension/react-app/src/tabs/chat/MessageDiv.tsx4
-rw-r--r--extension/react-app/src/tabs/gui.tsx20
-rw-r--r--extension/src/continueIdeClient.ts31
-rw-r--r--extension/src/decorations.ts19
7 files changed, 83 insertions, 95 deletions
diff --git a/extension/package.json b/extension/package.json
index 1d2fd995..8ee8cb4c 100644
--- a/extension/package.json
+++ b/extension/package.json
@@ -55,93 +55,13 @@
},
"commands": [
{
- "command": "continue.writeDocstring",
- "category": "Continue",
- "title": "Write a docstring for the current function"
- },
- {
"command": "continue.openContinueGUI",
"category": "Continue",
"title": "Open Continue GUI"
- },
- {
- "command": "continue.askQuestionFromInput",
- "Category": "Continue",
- "title": "Ask a question from input box"
- },
- {
- "command": "continue.openCapturedTerminal",
- "Category": "Continue",
- "title": "Open Captured Terminal"
- },
- {
- "command": "continue.askQuestion",
- "Category": "Continue",
- "title": "Ask a question from webview"
- },
- {
- "command": "continue.createTerminal",
- "category": "Continue",
- "title": "Create Terminal"
- },
- {
- "command": "continue.debugTest",
- "category": "Continue",
- "title": "Debug Test"
- },
- {
- "command": "continue.suggestionDown",
- "category": "Continue",
- "title": "Suggestion Down"
- },
- {
- "command": "continue.suggestionUp",
- "category": "Continue",
- "title": "Suggestion Up"
- },
- {
- "command": "continue.acceptSuggestion",
- "category": "Continue",
- "title": "Accept Suggestion"
- },
- {
- "command": "continue.rejectSuggestion",
- "category": "Continue",
- "title": "Reject Suggestion"
- },
- {
- "command": "continue.writeUnitTest",
- "title": "Write Unit Test",
- "category": "Continue"
- },
- {
- "command": "continue.findSuspiciousCode",
- "title": "Find Suspicious Code",
- "category": "Continue"
- },
- {
- "command": "continue.focusContinueInput",
- "title": "Focus Continue Input",
- "category": "Continue"
}
],
"keybindings": [
{
- "command": "continue.suggestionDown",
- "mac": "shift+ctrl+down",
- "key": "shift+ctrl+down"
- },
- {
- "command": "continue.suggestionUp",
- "mac": "shift+ctrl+up",
- "key": "shift+ctrl+up"
- },
- {
- "command": "continue.acceptSuggestion",
- "mac": "shift+ctrl+enter",
- "key": "shift+ctrl+enter"
- },
- {
"command": "continue.focusContinueInput",
"mac": "cmd+k",
"key": "ctrl+k"
diff --git a/extension/react-app/src/components/CodeBlock.tsx b/extension/react-app/src/components/CodeBlock.tsx
index e0336554..eedae3fb 100644
--- a/extension/react-app/src/components/CodeBlock.tsx
+++ b/extension/react-app/src/components/CodeBlock.tsx
@@ -11,6 +11,7 @@ const StyledPre = styled.pre`
border: 1px solid gray;
border-radius: ${defaultBorderRadius};
background-color: ${vscBackground};
+ padding: 8px;
`;
const StyledCode = styled.code`
diff --git a/extension/react-app/src/components/StepContainer.tsx b/extension/react-app/src/components/StepContainer.tsx
index 8ea54325..fb0143b5 100644
--- a/extension/react-app/src/components/StepContainer.tsx
+++ b/extension/react-app/src/components/StepContainer.tsx
@@ -84,6 +84,15 @@ const OnHoverDiv = styled.div`
animation: ${appear} 0.3s ease-in-out;
`;
+const MarkdownPre = styled.pre`
+ background-color: ${secondaryDark};
+ padding: 10px;
+ border-radius: ${defaultBorderRadius};
+ border: 0.5px solid white;
+`;
+
+const MarkdownCode = styled.code``;
+
function StepContainer(props: StepContainerProps) {
const [open, setOpen] = useState(
typeof props.open === "undefined" ? true : props.open
@@ -182,7 +191,19 @@ function StepContainer(props: StepContainerProps) {
{props.historyNode.observation.error as string}
</pre>
) : (
- <ReactMarkdown key={1} className="overflow-scroll">
+ <ReactMarkdown
+ key={1}
+ className="overflow-scroll"
+ components={{
+ pre: ({ node, ...props }) => {
+ return (
+ <CodeBlock
+ children={props.children[0] as string}
+ ></CodeBlock>
+ );
+ },
+ }}
+ >
{props.historyNode.step.description as any}
</ReactMarkdown>
)}
diff --git a/extension/react-app/src/tabs/chat/MessageDiv.tsx b/extension/react-app/src/tabs/chat/MessageDiv.tsx
index 1d7bb5f5..3543dd93 100644
--- a/extension/react-app/src/tabs/chat/MessageDiv.tsx
+++ b/extension/react-app/src/tabs/chat/MessageDiv.tsx
@@ -58,7 +58,9 @@ function MessageDiv(props: ChatMessage) {
}, [richContent, isStreaming]);
useEffect(() => {
- setRichContent([<ReactMarkdown key={1}>{props.content}</ReactMarkdown>]);
+ setRichContent([
+ <ReactMarkdown key={1} children={props.content}></ReactMarkdown>,
+ ]);
}, [props.content]);
return (
diff --git a/extension/react-app/src/tabs/gui.tsx b/extension/react-app/src/tabs/gui.tsx
index 5c75579b..9f7e651f 100644
--- a/extension/react-app/src/tabs/gui.tsx
+++ b/extension/react-app/src/tabs/gui.tsx
@@ -41,7 +41,7 @@ function GUI(props: GUIProps) {
// name: "Waiting for user input",
// cmd: "python3 /Users/natesesti/Desktop/continue/extension/examples/python/main.py",
// description:
- // "Run `python3 /Users/natesesti/Desktop/continue/extension/examples/python/main.py`",
+ // "Run `python3 /Users/natesesti/Desktop/continue/extension/examples/python/main.py` and ```\nprint(sum(first, second))\n```\n- Testing\n- Testing 2\n- Testing 3",
// },
// observation: {
// title: "ERROR FOUND",
@@ -92,7 +92,7 @@ function GUI(props: GUIProps) {
// prompt:
// "I ran into this problem with my Python code:\n\n Traceback (most recent call last):\n File \"/Users/natesesti/Desktop/continue/extension/examples/python/main.py\", line 7, in <module>\n print(sum(first, second))\n ^^^^^^^^^^^^^^^^^^\n File \"/Users/natesesti/Desktop/continue/extension/examples/python/sum.py\", line 2, in sum\n return a + b\n ~~^~~\nTypeError: unsupported operand type(s) for +: 'int' and 'str'\n\n Below are the files that might need to be fixed:\n\n {code}\n\n This is what the code should be in order to avoid the problem:\n",
// description:
- // "Editing files: /Users/natesesti/Desktop/continue/extension/examples/python/main.py",
+ // "Run `python3 /Users/natesesti/Desktop/continue/extension/examples/python/main.py` and\n```python\nprint(sum(first, second))\n```\n- Testing\n- Testing 2\n- Testing 3",
// },
// output: [
// null,
@@ -154,22 +154,30 @@ function GUI(props: GUIProps) {
// output: [null, null],
// },
// ],
- // current_index: 0,
+ // current_index: 3,
// } as any);
const topGuiDivRef = useRef<HTMLDivElement>(null);
const client = useContinueGUIProtocol();
+ const [scrollTimeout, setScrollTimeout] = useState<NodeJS.Timeout | null>(
+ null
+ );
const scrollToBottom = useCallback(() => {
+ if (scrollTimeout) {
+ clearTimeout(scrollTimeout);
+ }
+ // Debounced smooth scroll to bottom of screen
if (topGuiDivRef.current) {
- setTimeout(() => {
+ const timeout = setTimeout(() => {
window.scrollTo({
top: window.outerHeight,
behavior: "smooth",
});
- }, 100);
+ }, 200);
+ setScrollTimeout(timeout);
}
- }, [topGuiDivRef.current]);
+ }, [topGuiDivRef.current, scrollTimeout]);
useEffect(() => {
console.log("CLIENT ON STATE UPDATE: ", client, client?.onStateUpdate);
diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts
index bbaf5f08..c395ae0e 100644
--- a/extension/src/continueIdeClient.ts
+++ b/extension/src/continueIdeClient.ts
@@ -13,6 +13,7 @@ import { FileEditWithFullContents } from "../schema/FileEditWithFullContents";
import fs = require("fs");
import { WebsocketMessenger } from "./util/messenger";
import { CapturedTerminal } from "./terminal/terminalEmulator";
+import { decorationManager } from "./decorations";
class IdeProtocolClient {
private messenger: WebsocketMessenger | null = null;
@@ -281,8 +282,36 @@ class IdeProtocolClient {
edit.range.start.line,
edit.range.start.character,
edit.range.end.line,
- edit.range.end.character + 1
+ edit.range.end.character
);
+ const decorationKey =
+ edit.replacement === ""
+ ? {
+ editorUri: editor.document.uri.fsPath,
+ options: {
+ range: new vscode.Range(
+ new vscode.Position(range.start.line, 0),
+ new vscode.Position(range.end.line + 1, 0)
+ ),
+ // after: {
+ // contentText: "Removed",
+ // },
+ },
+ decorationType: vscode.window.createTextEditorDecorationType({
+ backgroundColor: "rgba(255, 0, 0, 0.2)",
+ }),
+ }
+ : {
+ editorUri: editor.document.uri.fsPath,
+ options: {
+ range,
+ },
+ decorationType: vscode.window.createTextEditorDecorationType({
+ backgroundColor: "rgba(66, 105, 55, 1.0)",
+ isWholeLine: true,
+ }),
+ };
+ decorationManager.addDecoration(decorationKey);
editor.edit((editBuilder) => {
this._makingEdit += 2; // editBuilder.replace takes 2 edits: delete and insert
editBuilder.replace(range, edit.replacement);
diff --git a/extension/src/decorations.ts b/extension/src/decorations.ts
index 456f0c10..d2c94135 100644
--- a/extension/src/decorations.ts
+++ b/extension/src/decorations.ts
@@ -94,15 +94,22 @@ class DecorationManager {
decorationTypes = new Map();
decorationTypes.set(key.decorationType, [key.options]);
this.editorToDecorations.set(key.editorUri, decorationTypes);
- }
-
- const decorations = decorationTypes.get(key.decorationType);
- if (!decorations) {
- decorationTypes.set(key.decorationType, [key.options]);
} else {
- decorations.push(key.options);
+ const decorations = decorationTypes.get(key.decorationType);
+ if (!decorations) {
+ decorationTypes.set(key.decorationType, [key.options]);
+ } else {
+ decorations.push(key.options);
+ }
}
+
this.rerenderDecorations(key.editorUri, key.decorationType);
+
+ vscode.window.onDidChangeTextEditorSelection((event) => {
+ if (event.textEditor.document.fileName === key.editorUri) {
+ this.deleteAllDecorations(key.editorUri);
+ }
+ });
}
deleteDecoration(key: DecorationKey) {