summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--continuedev/src/continuedev/plugins/context_providers/file.py9
-rw-r--r--extension/react-app/src/pages/gui.tsx3
-rw-r--r--extension/scripts/install_from_source.py37
-rw-r--r--extension/src/continueIdeClient.ts9
-rw-r--r--schema/json/FullState.json50
5 files changed, 80 insertions, 28 deletions
diff --git a/continuedev/src/continuedev/plugins/context_providers/file.py b/continuedev/src/continuedev/plugins/context_providers/file.py
index 3e1b12c8..67a79610 100644
--- a/continuedev/src/continuedev/plugins/context_providers/file.py
+++ b/continuedev/src/continuedev/plugins/context_providers/file.py
@@ -10,7 +10,8 @@ def get_file_contents(filepath: str) -> str:
try:
with open(filepath, "r") as f:
return f.read()
- except UnicodeDecodeError:
+ except Exception as e:
+ print("Error reading file contents", e)
return ""
@@ -53,6 +54,12 @@ class FileContextProvider(ContextProvider):
for file_name in file_names:
filepaths.append(os.path.join(root, file_name))
+ if len(filepaths) > 1000:
+ break
+
+ if len(filepaths) > 1000:
+ break
+
return [ContextItem(
content=get_file_contents(file)[:min(
2000, len(get_file_contents(file)))],
diff --git a/extension/react-app/src/pages/gui.tsx b/extension/react-app/src/pages/gui.tsx
index 9bb558c7..72b2e139 100644
--- a/extension/react-app/src/pages/gui.tsx
+++ b/extension/react-app/src/pages/gui.tsx
@@ -313,6 +313,9 @@ function GUI(props: GUIProps) {
<>
<Loader />
<p style={{ textAlign: "center" }}>Loading Continue server...</p>
+ {/* <p style={{ textAlign: "center" }}>
+ Make sure you have a folder opened in VS Code
+ </p> */}
</>
)}
{history?.timeline.map((node: HistoryNode, index: number) => {
diff --git a/extension/scripts/install_from_source.py b/extension/scripts/install_from_source.py
index bbb86797..d004259b 100644
--- a/extension/scripts/install_from_source.py
+++ b/extension/scripts/install_from_source.py
@@ -6,7 +6,28 @@ def run(cmd: str):
return subprocess.run(cmd, shell=True, capture_output=False)
+def get_latest_version() -> str:
+ latest = None
+ latest_major = 0
+ latest_minor = 0
+ latest_patch = 0
+ for file in os.listdir("../build"):
+ if file.endswith(".vsix"):
+ version = file.split("-")[1].split(".vsix")[0]
+ major, minor, patch = list(
+ map(lambda x: int(x), version.split(".")))
+ if latest is None or (major >= latest_major and minor >= latest_minor and patch > latest_patch):
+ latest = file
+ latest_major = major
+ latest_minor = minor
+ latest_patch = patch
+
+
def main():
+ # Clear out old stuff
+ run(f"rm -rf ../build/{get_latest_version()}")
+ run("rm ../server/continuedev-0.1.2-py3-none-any.whl")
+
# Check for Python and Node - we won't install them, but will warn
resp1 = run("python --version")
resp2 = run("python3 --version")
@@ -39,21 +60,7 @@ def main():
print("This was the error: ", resp.stderr)
return
- latest = None
- latest_major = 0
- latest_minor = 0
- latest_patch = 0
- for file in os.listdir("../build"):
- if file.endswith(".vsix"):
- version = file.split("-")[1].split(".vsix")[0]
- major, minor, patch = list(
- map(lambda x: int(x), version.split(".")))
- if latest is None or (major >= latest_major and minor >= latest_minor and patch > latest_patch):
- latest = file
- latest_major = major
- latest_minor = minor
- latest_patch = patch
-
+ latest = get_latest_version()
resp = run(f"cd ..; code --install-extension ./build/{latest}")
print("Continue VS Code extension installed successfully. Please restart VS Code to use it.")
diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts
index d92a829d..4e6f0494 100644
--- a/extension/src/continueIdeClient.ts
+++ b/extension/src/continueIdeClient.ts
@@ -19,6 +19,7 @@ import path = require("path");
import { registerAllCodeLensProviders } from "./lang-server/codeLens";
import { registerAllCommands } from "./commands";
import registerQuickFixProvider from "./lang-server/codeActions";
+const os = require("os");
const continueVirtualDocumentScheme = "continue";
@@ -70,7 +71,11 @@ class IdeProtocolClient {
reconnect();
});
messenger.onMessage((messageType, data, messenger) => {
- this.handleMessage(messageType, data, messenger);
+ this.handleMessage(messageType, data, messenger).catch((err) => {
+ vscode.window.showErrorMessage(
+ "Error handling message from Continue server: " + err.message
+ );
+ });
});
}
@@ -267,7 +272,7 @@ class IdeProtocolClient {
getWorkspaceDirectory() {
if (!vscode.workspace.workspaceFolders) {
// Return the home directory
- return process.env.HOME || process.env.USERPROFILE || "/";
+ return os.homedir();
}
return vscode.workspace.workspaceFolders[0].uri.fsPath;
}
diff --git a/schema/json/FullState.json b/schema/json/FullState.json
index aea199fe..7b6dfd6b 100644
--- a/schema/json/FullState.json
+++ b/schema/json/FullState.json
@@ -15,7 +15,10 @@
"type": "string"
}
},
- "required": ["name", "arguments"]
+ "required": [
+ "name",
+ "arguments"
+ ]
},
"ChatMessage": {
"title": "ChatMessage",
@@ -23,7 +26,12 @@
"properties": {
"role": {
"title": "Role",
- "enum": ["assistant", "user", "system", "function"],
+ "enum": [
+ "assistant",
+ "user",
+ "system",
+ "function"
+ ],
"type": "string"
},
"content": {
@@ -42,7 +50,10 @@
"$ref": "#/definitions/FunctionCall"
}
},
- "required": ["role", "summary"]
+ "required": [
+ "role",
+ "summary"
+ ]
},
"Step": {
"title": "Step",
@@ -119,7 +130,10 @@
}
}
},
- "required": ["step", "depth"]
+ "required": [
+ "step",
+ "depth"
+ ]
},
"History": {
"title": "History",
@@ -138,7 +152,10 @@
"type": "integer"
}
},
- "required": ["timeline", "current_index"]
+ "required": [
+ "timeline",
+ "current_index"
+ ]
},
"SlashCommandDescription": {
"title": "SlashCommandDescription",
@@ -153,7 +170,10 @@
"type": "string"
}
},
- "required": ["name", "description"]
+ "required": [
+ "name",
+ "description"
+ ]
},
"ContextItemId": {
"title": "ContextItemId",
@@ -169,7 +189,10 @@
"type": "string"
}
},
- "required": ["provider_title", "item_id"]
+ "required": [
+ "provider_title",
+ "item_id"
+ ]
},
"ContextItemDescription": {
"title": "ContextItemDescription",
@@ -188,7 +211,11 @@
"$ref": "#/definitions/ContextItemId"
}
},
- "required": ["name", "description", "id"]
+ "required": [
+ "name",
+ "description",
+ "id"
+ ]
},
"ContextItem": {
"title": "ContextItem",
@@ -213,7 +240,10 @@
"type": "boolean"
}
},
- "required": ["description", "content"]
+ "required": [
+ "description",
+ "content"
+ ]
},
"src__continuedev__core__main__FullState": {
"title": "FullState",
@@ -268,4 +298,4 @@
]
}
}
-}
+} \ No newline at end of file