From 07f1a9a4dbbca57c14957eb21ef356adbf803bff Mon Sep 17 00:00:00 2001 From: Nate Sesti <33237525+sestinj@users.noreply.github.com> Date: Fri, 1 Sep 2023 14:03:53 -0700 Subject: Windows meilisearch (#441) * feat: :sparkles: first attempt at windows download meilisearch * Fixed starting meilisearch on windows * Meilisearch to server/meilisearch * feat: :sparkles: select custom model to use with edit step * feat: :art: recursive getDirectoryContents --- extension/src/continueIdeClient.ts | 89 +++++++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 34 deletions(-) (limited to 'extension/src/continueIdeClient.ts') diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts index 94997d76..353584e9 100644 --- a/extension/src/continueIdeClient.ts +++ b/extension/src/continueIdeClient.ts @@ -272,40 +272,10 @@ class IdeProtocolClient { break; case "listDirectoryContents": messenger.send("listDirectoryContents", { - contents: ( - await vscode.workspace.fs.readDirectory( - uriFromFilePath(data.directory) - ) - ) - .map(([name, type]) => name) - .filter((name) => { - const DEFAULT_IGNORE_DIRS = [ - ".git", - ".vscode", - ".idea", - ".vs", - ".venv", - "env", - ".env", - "node_modules", - "dist", - "build", - "target", - "out", - "bin", - ".pytest_cache", - ".vscode-test", - ".continue", - "__pycache__", - ]; - if ( - !DEFAULT_IGNORE_DIRS.some((dir) => - name.split(path.sep).includes(dir) - ) - ) { - return name; - } - }), + contents: await this.getDirectoryContents( + data.directory, + data.recursive || false + ), }); break; case "editFile": @@ -562,6 +532,57 @@ class IdeProtocolClient { }); } + async getDirectoryContents( + directory: string, + recursive: boolean + ): Promise { + let nameAndType = ( + await vscode.workspace.fs.readDirectory(uriFromFilePath(directory)) + ).filter(([name, type]) => { + const DEFAULT_IGNORE_DIRS = [ + ".git", + ".vscode", + ".idea", + ".vs", + ".venv", + "env", + ".env", + "node_modules", + "dist", + "build", + "target", + "out", + "bin", + ".pytest_cache", + ".vscode-test", + ".continue", + "__pycache__", + ]; + if ( + !DEFAULT_IGNORE_DIRS.some((dir) => name.split(path.sep).includes(dir)) + ) { + return name; + } + }); + + let absolutePaths = nameAndType + .filter(([name, type]) => type === vscode.FileType.File) + .map(([name, type]) => path.join(directory, name)); + if (recursive) { + for (const [name, type] of nameAndType) { + if (type === vscode.FileType.Directory) { + const subdirectory = path.join(directory, name); + const subdirectoryContents = await this.getDirectoryContents( + subdirectory, + recursive + ); + absolutePaths = absolutePaths.concat(subdirectoryContents); + } + } + } + return absolutePaths; + } + async readFile(filepath: string): Promise { let contents: string | undefined; if (typeof contents === "undefined") { -- cgit v1.2.3-70-g09d2