diff options
| author | Nate Sesti <sestinj@gmail.com> | 2023-07-02 20:15:36 -0700 |
|---|---|---|
| committer | Nate Sesti <sestinj@gmail.com> | 2023-07-02 20:15:36 -0700 |
| commit | 38d0c1ad7955b43c1765ac8faea723028a90201e (patch) | |
| tree | c2682170eb8f8a81fd494fce7bb8a435dcfa9829 /extension/src/suggestions.ts | |
| parent | 894a197892fc4e3a6a5af7d47b7702ea895e20b7 (diff) | |
| parent | c41314b095648e6b3bcecc84a20354574db8379d (diff) | |
| download | sncontinue-38d0c1ad7955b43c1765ac8faea723028a90201e.tar.gz sncontinue-38d0c1ad7955b43c1765ac8faea723028a90201e.tar.bz2 sncontinue-38d0c1ad7955b43c1765ac8faea723028a90201e.zip | |
Merge branch 'main' into explicit-context
Diffstat (limited to 'extension/src/suggestions.ts')
| -rw-r--r-- | extension/src/suggestions.ts | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/extension/src/suggestions.ts b/extension/src/suggestions.ts index baa49711..6e5a444f 100644 --- a/extension/src/suggestions.ts +++ b/extension/src/suggestions.ts @@ -5,7 +5,7 @@ import { translate, readFileAtRange } from "./util/vscode"; import * as fs from "fs"; import * as path from "path"; import { registerAllCodeLensProviders } from "./lang-server/codeLens"; -import { extensionContext } from "./activation/activate"; +import { extensionContext, ideProtocolClient } from "./activation/activate"; export interface SuggestionRanges { oldRange: vscode.Range; @@ -241,19 +241,14 @@ function selectSuggestion( suggestions = JSON.parse(rawData); } - if (accept === "new" || (accept === "selected" && suggestion.newSelected)) { - suggestions.push({ - accepted: true, - timestamp: Date.now(), - suggestion: suggestion.newContent, - }); - } else { - suggestions.push({ - accepted: false, - timestamp: Date.now(), - suggestion: suggestion.newContent, - }); - } + const accepted = + accept === "new" || (accept === "selected" && suggestion.newSelected); + suggestions.push({ + accepted, + timestamp: Date.now(), + suggestion: suggestion.newContent, + }); + ideProtocolClient.sendAcceptRejectSuggestion(accepted); // Write the updated suggestions back to the file fs.writeFileSync( |
