diff options
author | Nate Sesti <sestinj@gmail.com> | 2023-06-21 14:02:56 -0700 |
---|---|---|
committer | Nate Sesti <sestinj@gmail.com> | 2023-06-21 14:02:56 -0700 |
commit | 94341653cae5b9af6e33f480847dfb562aa7578c (patch) | |
tree | 01e7541746d5d75d607e029db54bfda6ff54d16a /extension/src/continueIdeClient.ts | |
parent | a06fc2a82de1ca55ea6f748baa297cf6fbb57222 (diff) | |
download | sncontinue-94341653cae5b9af6e33f480847dfb562aa7578c.tar.gz sncontinue-94341653cae5b9af6e33f480847dfb562aa7578c.tar.bz2 sncontinue-94341653cae5b9af6e33f480847dfb562aa7578c.zip |
first slightly working version of suggestions
Diffstat (limited to 'extension/src/continueIdeClient.ts')
-rw-r--r-- | extension/src/continueIdeClient.ts | 25 |
1 files changed, 9 insertions, 16 deletions
diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts index fbad5f5d..fbd00c6e 100644 --- a/extension/src/continueIdeClient.ts +++ b/extension/src/continueIdeClient.ts @@ -1,5 +1,8 @@ // import { ShowSuggestionRequest } from "../schema/ShowSuggestionRequest"; -import { showSuggestion, SuggestionRanges } from "./suggestions"; +import { + showSuggestion as showSuggestionInEditor, + SuggestionRanges, +} from "./suggestions"; import { openEditorAndRevealRange, getRightViewColumn } from "./util/vscode"; import { FileEdit } from "../schema/FileEdit"; import { RangeInFile } from "../schema/RangeInFile"; @@ -115,7 +118,10 @@ class IdeProtocolClient { break; case "setFileOpen": this.openFile(data.filepath); - // TODO: Close file + // TODO: Close file if False + break; + case "showSuggestion": + this.showSuggestion(data.edit); break; case "openGUI": case "connected": @@ -157,25 +163,12 @@ class IdeProtocolClient { isWholeLine: true, }); editor.setDecorations(decorationType, [range]); - - // Listen for changes to cursor position and then remove the decoration (but keep for at least 2 seconds) - const allowRemoveHighlight = () => { - const cursorDisposable = vscode.window.onDidChangeTextEditorSelection( - (event) => { - if (event.textEditor.document.uri.fsPath === rangeInFile.filepath) { - cursorDisposable.dispose(); - editor.setDecorations(decorationType, []); - } - } - ); - }; - setTimeout(allowRemoveHighlight, 2000); } } showSuggestion(edit: FileEdit) { // showSuggestion already exists - showSuggestion( + showSuggestionInEditor( edit.filepath, new vscode.Range( edit.range.start.line, |