diff options
| author | Nate Sesti <sestinj@gmail.com> | 2023-08-27 02:17:49 -0700 | 
|---|---|---|
| committer | Nate Sesti <sestinj@gmail.com> | 2023-08-27 02:17:49 -0700 | 
| commit | 6140d05e7d415d3334032c300ed593bdd181f7f5 (patch) | |
| tree | bf3ad937e0300419457a01e80652d693c1bac409 /extension/src | |
| parent | 34b14dc9f7725bb81ac82f0aad59a3d7d4c1d82e (diff) | |
| download | sncontinue-6140d05e7d415d3334032c300ed593bdd181f7f5.tar.gz sncontinue-6140d05e7d415d3334032c300ed593bdd181f7f5.tar.bz2 sncontinue-6140d05e7d415d3334032c300ed593bdd181f7f5.zip  | |
fix: :bug: write to local diff files
Diffstat (limited to 'extension/src')
| -rw-r--r-- | extension/src/diffs.ts | 16 | 
1 files changed, 8 insertions, 8 deletions
diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts index f8b311f7..e56878c8 100644 --- a/extension/src/diffs.ts +++ b/extension/src/diffs.ts @@ -21,11 +21,8 @@ async function readFile(path: string): Promise<string> {      .then((bytes) => new TextDecoder().decode(bytes));  } -async function writeFile(path: string, contents: string) { -  await vscode.workspace.fs.writeFile( -    uriFromFilePath(path), -    new TextEncoder().encode(contents) -  ); +async function writeFile(uri: vscode.Uri, contents: string) { +  await vscode.workspace.fs.writeFile(uri, new TextEncoder().encode(contents));  }  // THIS IS LOCAL @@ -154,7 +151,7 @@ class DiffManager {      // Create or update existing diff      const newFilepath = this.getNewFilepath(originalFilepath); -    await writeFile(newFilepath, newContent); +    await writeFile(vscode.Uri.file(newFilepath), newContent);      // Open the diff editor if this is a new diff      if (!this.diffs.has(newFilepath)) { @@ -254,7 +251,7 @@ class DiffManager {        ?.save()        .then(async () => {          await writeFile( -          diffInfo.originalFilepath, +          uriFromFilePath(diffInfo.originalFilepath),            await readFile(diffInfo.newFilepath)          );          this.cleanUpDiff(diffInfo); @@ -321,7 +318,10 @@ async function recordAcceptReject(accepted: boolean, diffInfo: DiffInfo) {    // ideProtocolClient.sendAcceptRejectSuggestion(accepted);    // Write the updated suggestions back to the file -  await writeFile(suggestionsPath, JSON.stringify(suggestions, null, 4)); +  await writeFile( +    vscode.Uri.file(suggestionsPath), +    JSON.stringify(suggestions, null, 4) +  );  }  export async function acceptDiffCommand(newFilepath?: string) {  | 
