summaryrefslogtreecommitdiff
path: root/extension/src
diff options
context:
space:
mode:
authorNate Sesti <33237525+sestinj@users.noreply.github.com>2023-08-22 13:12:40 -0700
committerGitHub <noreply@github.com>2023-08-22 13:12:40 -0700
commitb6435e1e479edb1e4f049098dc8522e944317f2a (patch)
tree29935c22e503ed1a64ac6db1d899dff75915c6ed /extension/src
parent7ed6b61a5b629b5e16fbd5c90ff0ad78300a77c2 (diff)
downloadsncontinue-b6435e1e479edb1e4f049098dc8522e944317f2a.tar.gz
sncontinue-b6435e1e479edb1e4f049098dc8522e944317f2a.tar.bz2
sncontinue-b6435e1e479edb1e4f049098dc8522e944317f2a.zip
feat: :children_crossing: keep file context up to data by listening for filesystem events (#396)
Diffstat (limited to 'extension/src')
-rw-r--r--extension/src/continueIdeClient.ts29
1 files changed, 29 insertions, 0 deletions
diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts
index 666b8ba0..430bb9dd 100644
--- a/extension/src/continueIdeClient.ts
+++ b/extension/src/continueIdeClient.ts
@@ -115,6 +115,35 @@ class IdeProtocolClient {
// }
// });
+ // Listen for new file creation
+ vscode.workspace.onDidCreateFiles((event) => {
+ const filepaths = event.files.map((file) => file.fsPath);
+ this.messenger?.send("filesCreated", { filepaths });
+ });
+
+ // Listen for file deletion
+ vscode.workspace.onDidDeleteFiles((event) => {
+ const filepaths = event.files.map((file) => file.fsPath);
+ this.messenger?.send("filesDeleted", { filepaths });
+ });
+
+ // Listen for file renaming
+ vscode.workspace.onDidRenameFiles((event) => {
+ const oldFilepaths = event.files.map((file) => file.oldUri.fsPath);
+ const newFilepaths = event.files.map((file) => file.newUri.fsPath);
+ this.messenger?.send("filesRenamed", {
+ old_filepaths: oldFilepaths,
+ new_filepaths: newFilepaths,
+ });
+ });
+
+ // Listen for file saving
+ vscode.workspace.onDidSaveTextDocument((event) => {
+ const filepath = event.uri.fsPath;
+ const contents = event.getText();
+ this.messenger?.send("fileSaved", { filepath, contents });
+ });
+
// Setup listeners for any selection changes in open editors
vscode.window.onDidChangeTextEditorSelection((event) => {
if (!this.editorIsCode(event.textEditor)) {