From 4c84e6945a7c2018622eceb54e7fb54de193b03a Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Wed, 26 Jul 2023 09:20:56 -0700 Subject: fix: :bug: fix dialog links --- extension/src/debugPanel.ts | 1 + extension/src/diffs.ts | 56 ++++++++++++++++++++------------------------- 2 files changed, 26 insertions(+), 31 deletions(-) (limited to 'extension/src') diff --git a/extension/src/debugPanel.ts b/extension/src/debugPanel.ts index 6dcb588a..ece362f5 100644 --- a/extension/src/debugPanel.ts +++ b/extension/src/debugPanel.ts @@ -95,6 +95,7 @@ export function setupDebugPanel( panel.webview.options = { enableScripts: true, localResourceRoots: [vscode.Uri.joinPath(extensionUri, "react-app/dist")], + enableCommandUris: true, }; const nonce = getNonce(); diff --git a/extension/src/diffs.ts b/extension/src/diffs.ts index 1130a06a..efaf7626 100644 --- a/extension/src/diffs.ts +++ b/extension/src/diffs.ts @@ -273,40 +273,34 @@ class DiffManager { export const diffManager = new DiffManager(); function recordAcceptReject(accepted: boolean, diffInfo: DiffInfo) { - const collectOn = vscode.workspace - .getConfiguration("continue") - .get("dataSwitch"); + const devDataDir = devDataPath(); + const suggestionsPath = path.join(devDataDir, "suggestions.json"); - if (collectOn) { - const devDataDir = devDataPath(); - const suggestionsPath = path.join(devDataDir, "suggestions.json"); + // Initialize suggestions list + let suggestions = []; - // Initialize suggestions list - let suggestions = []; - - // Check if suggestions.json exists - if (fs.existsSync(suggestionsPath)) { - const rawData = fs.readFileSync(suggestionsPath, "utf-8"); - suggestions = JSON.parse(rawData); - } - - // Add the new suggestion to the list - suggestions.push({ - accepted, - timestamp: Date.now(), - suggestion: diffInfo.originalFilepath, - }); - - // Send the suggestion to the server - // ideProtocolClient.sendAcceptRejectSuggestion(accepted); - - // Write the updated suggestions back to the file - fs.writeFileSync( - suggestionsPath, - JSON.stringify(suggestions, null, 4), - "utf-8" - ); + // Check if suggestions.json exists + if (fs.existsSync(suggestionsPath)) { + const rawData = fs.readFileSync(suggestionsPath, "utf-8"); + suggestions = JSON.parse(rawData); } + + // Add the new suggestion to the list + suggestions.push({ + accepted, + timestamp: Date.now(), + suggestion: diffInfo.originalFilepath, + }); + + // Send the suggestion to the server + // ideProtocolClient.sendAcceptRejectSuggestion(accepted); + + // Write the updated suggestions back to the file + fs.writeFileSync( + suggestionsPath, + JSON.stringify(suggestions, null, 4), + "utf-8" + ); } export async function acceptDiffCommand(newFilepath?: string) { -- cgit v1.2.3-70-g09d2