From e976d60974a7837967d03807605cbf2e7b4f3f9a Mon Sep 17 00:00:00 2001 From: Nate Sesti <33237525+sestinj@users.noreply.github.com> Date: Sat, 23 Sep 2023 13:06:00 -0700 Subject: UI Redesign and fixing many details (#496) * feat: :lipstick: start of major design upgrade * feat: :lipstick: model selection page * feat: :lipstick: use shortcut to add highlighted code as ctx * feat: :lipstick: better display of errors * feat: :lipstick: ui for learning keyboard shortcuts, more details * refactor: :construction: testing slash commands ui * Truncate continue.log * refactor: :construction: refactoring client_session, ui, more * feat: :bug: layout fixes * refactor: :lipstick: ui to enter OpenAI Key * refactor: :truck: rename MaybeProxyOpenAI -> OpenAIFreeTrial * starting help center * removing old shortcut docs * fix: :bug: fix model setting logic to avoid overwrites * feat: :lipstick: tutorial and model descriptions * refactor: :truck: rename unused -> saved * refactor: :truck: rename model roles * feat: :lipstick: edit indicator * refactor: :lipstick: move +, folder icons * feat: :lipstick: tab to clear all context * fix: :bug: context providers ui fixes * fix: :bug: fix lag when stopping step * fix: :bug: don't override system message for models * fix: :bug: fix continue button cursor * feat: :lipstick: title bar * fix: :bug: updates to code highlighting logic and more * fix: :bug: fix renaming of summarize model role * feat: :lipstick: help page and better session title * feat: :lipstick: more help page / ui improvements * feat: :lipstick: set session title * fix: :bug: small fixes for changing sessions * fix: :bug: perfecting the highlighting code and ctx interactions * style: :lipstick: sticky headers for scroll, ollama warming * fix: :bug: fix toggle bug --------- Co-authored-by: Ty Dunn --- extension/src/continueIdeClient.ts | 78 +++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 35 deletions(-) (limited to 'extension/src/continueIdeClient.ts') diff --git a/extension/src/continueIdeClient.ts b/extension/src/continueIdeClient.ts index 5c04e351..e2c86bdf 100644 --- a/extension/src/continueIdeClient.ts +++ b/extension/src/continueIdeClient.ts @@ -176,37 +176,37 @@ class IdeProtocolClient { }); // Setup listeners for any selection changes in open editors - vscode.window.onDidChangeTextEditorSelection((event) => { - if (!this.editorIsCode(event.textEditor)) { - return; - } - if (this._highlightDebounce) { - clearTimeout(this._highlightDebounce); - } - this._highlightDebounce = setTimeout(() => { - const highlightedCode = event.textEditor.selections - .filter((s) => !s.isEmpty) - .map((selection) => { - const range = new vscode.Range(selection.start, selection.end); - const contents = event.textEditor.document.getText(range); - return { - filepath: event.textEditor.document.uri.fsPath, - contents, - range: { - start: { - line: selection.start.line, - character: selection.start.character, - }, - end: { - line: selection.end.line, - character: selection.end.character, - }, - }, - }; - }); - this.sendHighlightedCode(highlightedCode); - }, 100); - }); + // vscode.window.onDidChangeTextEditorSelection((event) => { + // if (!this.editorIsCode(event.textEditor)) { + // return; + // } + // if (this._highlightDebounce) { + // clearTimeout(this._highlightDebounce); + // } + // this._highlightDebounce = setTimeout(() => { + // const highlightedCode = event.textEditor.selections + // .filter((s) => !s.isEmpty) + // .map((selection) => { + // const range = new vscode.Range(selection.start, selection.end); + // const contents = event.textEditor.document.getText(range); + // return { + // filepath: event.textEditor.document.uri.fsPath, + // contents, + // range: { + // start: { + // line: selection.start.line, + // character: selection.start.character, + // }, + // end: { + // line: selection.end.line, + // character: selection.end.character, + // }, + // }, + // }; + // }); + // this.sendHighlightedCode(highlightedCode); + // }, 100); + // }); // Register a content provider for the readonly virtual documents const documentContentProvider = new (class @@ -659,6 +659,11 @@ class IdeProtocolClient { ); const terminalContents = await vscode.env.clipboard.readText(); await vscode.env.clipboard.writeText(tempCopyBuffer); + + if (tempCopyBuffer === terminalContents) { + // This means there is no terminal open to select text from + return ""; + } return terminalContents; } @@ -729,16 +734,19 @@ class IdeProtocolClient { this.messenger?.send("commandOutput", { output }); } - sendHighlightedCode(highlightedCode: (RangeInFile & { contents: string })[]) { - this.messenger?.send("highlightedCodePush", { highlightedCode }); + sendHighlightedCode( + highlightedCode: (RangeInFile & { contents: string })[], + edit?: boolean + ) { + this.messenger?.send("highlightedCodePush", { highlightedCode, edit }); } sendAcceptRejectSuggestion(accepted: boolean) { this.messenger?.send("acceptRejectSuggestion", { accepted }); } - sendAcceptRejectDiff(accepted: boolean) { - this.messenger?.send("acceptRejectDiff", { accepted }); + sendAcceptRejectDiff(accepted: boolean, stepIndex: number) { + this.messenger?.send("acceptRejectDiff", { accepted, stepIndex }); } sendMainUserInput(input: string) { -- cgit v1.2.3-70-g09d2