* Fix an issue where CMD+K does not clear the terminal when the terminal has focus (#1671) On MacOS, ⌘+K is bound, by default, to Terminal:Clear. Without this change ⌘+K does not clear the terminal but instead iniates a chord sequence and waits for the next stroke of the chord. Co-authored-by: Rob Leidle <rleidle@tesla.com> * Change treeSitter to cache the Language objects it loads from wasm (#1672) Without this change, for a repository with 600 typescript files, the indexer would fail to finish correctly and there would be many of the following errors in the webview console log: 'Unable to load language for file ${path} RuntimeError: table index is out of bounds' The following bash will create a repo that reproduces the problem: current_path="." for ((i=1; i<=20; i++)); do new_folder="folder-$i" mkdir -p "$current_path/$new_folder" current_path="$current_path/$new_folder" for ((a=1; a<=30; a++)); do head -c 10000 /dev/urandom | base64 > "$current_path/file-$a.ts" done done Co-authored-by: Rob Leidle <rleidle@tesla.com> * acknowledge sourcemap flag in esbuild.js * don't run jetbrains-release.yaml on vscode releases * further testing for walkDir * chore: add telemetry to commands (#1673) * test: Add basic unit test to baseLLM (#1668) * update version * test: Add basic unit test to baseLLM --------- Co-authored-by: Nate Sesti <sestinj@gmail.com> Co-authored-by: inimaz <imaz@ai-verse.com> * feat: add Quick Actions CodeLens feature (#1674) * docs: add docs and schema for "OS" provider (#1536) * ignore .env * ✨ use and cache imports for autocomplete (#1456) * ✨ use and cache imports for autocomplete * fix tsc * add voyage rerank-1 * import Handlebars * feat: open pane on install (#1564) * feat: open pane on activation * comment out testing code * chore: add telemetry for pageviews (#1576) * feat: update onboarding w/ embeddings model (#1570) * chore(gui): remove unused pages * feat: add embeddings step * feat: update styles * feat: copy button updates * fix: correct pull command for embed model * fix: remove commented code * fix: remove commented code * feat: simplify copy btn props * chore: rename onboarding selection event * feat: add provider config * fix: undo msg name * remove dead code * fix: invalid mode check * fix: remove testing logic * fix: fullscreen gui retains context when hidden, fixed fullscreen focusing (#1582) * small UI tweaks * media query * feat: add best experience onboarding * small fixes * feat: add free trial card to onboarding (#1600) * feat: add free trial card to onboarding * add import * chore: add telemetry for full screen toggle (#1618) * rerank-lite-1 * remove doccs * basic tests for VS Code extension * improved testing of VS Code extension * manually implement stop tokens for hf inference api * chore: onboarding metrics (#1626) * fix: pageview tracking * feat: add onboarding telemetry * create single `onboardingStatus` type * improved var naming * remove console logs * fix windows performance issue * rename vscodeExtension.ts * migration of onboarding variables * "stash" instead of "delete" in indexing progress * fix preview.yaml * also fix main.yaml * Update troubleshooting.md (#1637) * feat: add quick actions * Update index.d.ts * quick actions mvp * update docs * subscribe to vscode change settings * Update commands.ts * cleanup * Update quick-actions.md * Update VerticalPerLineCodeLensProvider.ts * resolve feedback --------- Co-authored-by: Nate Sesti <sestinj@gmail.com> Co-authored-by: Nate Sesti <33237525+sestinj@users.noreply.github.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com> * chore: add `isCommandEvent` to command telemetry (#1675) * chore: add `isCommandEvent` to command telemetry * Update commands.ts * Nate/better retrieval (#1677) * deduplicatearray tests * break out separate retrieval pipelines * IConfigHandler * tests for codebase indexer * better .continueignore for continue * indexing fixes * ignore .gitignore and .continueignore when indexing * retrieval pipeline improvements * fix formatting err in out .continueignore * add necessary filter to lance_db_cache * update package.json version --------- Co-authored-by: Rob Leidle <rleidle@gmail.com> Co-authored-by: Rob Leidle <rleidle@tesla.com> Co-authored-by: Patrick Erichsen <patrick.a.erichsen@gmail.com> Co-authored-by: inimaz <49730431+inimaz@users.noreply.github.com> Co-authored-by: inimaz <imaz@ai-verse.com> Co-authored-by: Jonah Wagner <jonahwagner231@gmail.com>
167 lines
5.2 KiB
TypeScript
167 lines
5.2 KiB
TypeScript
import type { FileEdit } from "core";
|
|
import { IConfigHandler } from "core/config/IConfigHandler";
|
|
import * as vscode from "vscode";
|
|
import { getTheme } from "./util/getTheme";
|
|
import { getExtensionVersion } from "./util/util";
|
|
import { getExtensionUri, getNonce, getUniqueId } from "./util/vscode";
|
|
import { VsCodeWebviewProtocol } from "./webviewProtocol";
|
|
|
|
export class ContinueGUIWebviewViewProvider
|
|
implements vscode.WebviewViewProvider
|
|
{
|
|
public static readonly viewType = "continue.continueGUIView";
|
|
public webviewProtocol: VsCodeWebviewProtocol;
|
|
|
|
resolveWebviewView(
|
|
webviewView: vscode.WebviewView,
|
|
_context: vscode.WebviewViewResolveContext,
|
|
_token: vscode.CancellationToken,
|
|
): void | Thenable<void> {
|
|
this._webview = webviewView.webview;
|
|
webviewView.webview.html = this.getSidebarContent(
|
|
this.extensionContext,
|
|
webviewView,
|
|
);
|
|
}
|
|
|
|
private _webview?: vscode.Webview;
|
|
|
|
get webview() {
|
|
return this._webview;
|
|
}
|
|
|
|
public resetWebviewProtocolWebview(): void {
|
|
if (this._webview) {
|
|
this.webviewProtocol.webview = this._webview;
|
|
} else {
|
|
console.warn("no webview found during reset");
|
|
}
|
|
}
|
|
|
|
sendMainUserInput(input: string) {
|
|
this.webview?.postMessage({
|
|
type: "userInput",
|
|
input,
|
|
});
|
|
}
|
|
|
|
constructor(
|
|
private readonly configHandlerPromise: Promise<IConfigHandler>,
|
|
private readonly windowId: string,
|
|
private readonly extensionContext: vscode.ExtensionContext,
|
|
) {
|
|
this.webviewProtocol = new VsCodeWebviewProtocol(
|
|
(async () => {
|
|
const configHandler = await this.configHandlerPromise;
|
|
return configHandler.reloadConfig();
|
|
}).bind(this),
|
|
);
|
|
}
|
|
|
|
getSidebarContent(
|
|
context: vscode.ExtensionContext | undefined,
|
|
panel: vscode.WebviewPanel | vscode.WebviewView,
|
|
page: string | undefined = undefined,
|
|
edits: FileEdit[] | undefined = undefined,
|
|
isFullScreen = false,
|
|
): string {
|
|
const extensionUri = getExtensionUri();
|
|
let scriptUri: string;
|
|
let styleMainUri: string;
|
|
const vscMediaUrl: string = panel.webview
|
|
.asWebviewUri(vscode.Uri.joinPath(extensionUri, "gui"))
|
|
.toString();
|
|
|
|
const inDevelopmentMode =
|
|
context?.extensionMode === vscode.ExtensionMode.Development;
|
|
if (!inDevelopmentMode) {
|
|
scriptUri = panel.webview
|
|
.asWebviewUri(vscode.Uri.joinPath(extensionUri, "gui/assets/index.js"))
|
|
.toString();
|
|
styleMainUri = panel.webview
|
|
.asWebviewUri(vscode.Uri.joinPath(extensionUri, "gui/assets/index.css"))
|
|
.toString();
|
|
} else {
|
|
scriptUri = "http://localhost:5173/src/main.tsx";
|
|
styleMainUri = "http://localhost:5173/src/index.css";
|
|
}
|
|
|
|
panel.webview.options = {
|
|
enableScripts: true,
|
|
localResourceRoots: [
|
|
vscode.Uri.joinPath(extensionUri, "gui"),
|
|
vscode.Uri.joinPath(extensionUri, "assets"),
|
|
],
|
|
enableCommandUris: true,
|
|
portMapping: [
|
|
{
|
|
webviewPort: 65433,
|
|
extensionHostPort: 65433,
|
|
},
|
|
],
|
|
};
|
|
|
|
const nonce = getNonce();
|
|
|
|
const currentTheme = getTheme();
|
|
vscode.workspace.onDidChangeConfiguration((e) => {
|
|
if (e.affectsConfiguration("workbench.colorTheme")) {
|
|
// Send new theme to GUI to update embedded Monaco themes
|
|
this.webviewProtocol?.request("setTheme", { theme: getTheme() });
|
|
}
|
|
});
|
|
|
|
this.webviewProtocol.webview = panel.webview;
|
|
|
|
return `<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<script>const vscode = acquireVsCodeApi();</script>
|
|
<link href="${styleMainUri}" rel="stylesheet">
|
|
|
|
<title>Continue</title>
|
|
</head>
|
|
<body>
|
|
<div id="root"></div>
|
|
|
|
${
|
|
inDevelopmentMode
|
|
? `<script type="module">
|
|
import RefreshRuntime from "http://localhost:5173/@react-refresh"
|
|
RefreshRuntime.injectIntoGlobalHook(window)
|
|
window.$RefreshReg$ = () => {}
|
|
window.$RefreshSig$ = () => (type) => type
|
|
window.__vite_plugin_react_preamble_installed__ = true
|
|
</script>`
|
|
: ""
|
|
}
|
|
|
|
<script type="module" nonce="${nonce}" src="${scriptUri}"></script>
|
|
|
|
<script>localStorage.setItem("ide", '"vscode"')</script>
|
|
<script>localStorage.setItem("extensionVersion", '"${getExtensionVersion()}"')</script>
|
|
<script>window.windowId = "${this.windowId}"</script>
|
|
<script>window.vscMachineId = "${getUniqueId()}"</script>
|
|
<script>window.vscMediaUrl = "${vscMediaUrl}"</script>
|
|
<script>window.ide = "vscode"</script>
|
|
<script>window.fullColorTheme = ${JSON.stringify(currentTheme)}</script>
|
|
<script>window.colorThemeName = "dark-plus"</script>
|
|
<script>window.workspacePaths = ${JSON.stringify(
|
|
vscode.workspace.workspaceFolders?.map(
|
|
(folder) => folder.uri.fsPath,
|
|
) || [],
|
|
)}</script>
|
|
<script>window.isFullScreen = ${isFullScreen}</script>
|
|
|
|
${
|
|
edits
|
|
? `<script>window.edits = ${JSON.stringify(edits)}</script>`
|
|
: ""
|
|
}
|
|
${page ? `<script>window.location.pathname = "${page}"</script>` : ""}
|
|
</body>
|
|
</html>`;
|
|
}
|
|
}
|