🧑💻 button to re-open tutorial
This commit is contained in:
parent
bb582f86b0
commit
1f0ecdf498
3 changed files with 50 additions and 19 deletions
|
|
@ -17,24 +17,27 @@ export let extensionContext: vscode.ExtensionContext | undefined = undefined;
|
|||
export let ideProtocolClient: IdeProtocolClient;
|
||||
export let windowId: string = v4();
|
||||
|
||||
async function openTutorial(context: vscode.ExtensionContext) {
|
||||
if (context.globalState.get<boolean>("continue.tutorialShown") !== true) {
|
||||
const tutorialPath = path.join(
|
||||
getExtensionUri().fsPath,
|
||||
"continue_tutorial.py"
|
||||
);
|
||||
// Ensure keyboard shortcuts match OS
|
||||
const os = process.platform;
|
||||
export async function showTutorial() {
|
||||
const tutorialPath = path.join(
|
||||
getExtensionUri().fsPath,
|
||||
"continue_tutorial.py"
|
||||
);
|
||||
// Ensure keyboard shortcuts match OS
|
||||
if (process.platform !== "darwin") {
|
||||
let tutorialContent = fs.readFileSync(tutorialPath, "utf8");
|
||||
if (os !== "darwin") {
|
||||
tutorialContent = tutorialContent.replace("⌘", "^");
|
||||
fs.writeFileSync(tutorialPath, tutorialContent);
|
||||
}
|
||||
tutorialContent = tutorialContent.replace("⌘", "^");
|
||||
fs.writeFileSync(tutorialPath, tutorialContent);
|
||||
}
|
||||
|
||||
const doc = await vscode.workspace.openTextDocument(
|
||||
vscode.Uri.file(tutorialPath)
|
||||
);
|
||||
await vscode.window.showTextDocument(doc);
|
||||
const doc = await vscode.workspace.openTextDocument(
|
||||
vscode.Uri.file(tutorialPath)
|
||||
);
|
||||
await vscode.window.showTextDocument(doc);
|
||||
}
|
||||
|
||||
async function openTutorialFirstTime(context: vscode.ExtensionContext) {
|
||||
if (context.globalState.get<boolean>("continue.tutorialShown") !== true) {
|
||||
await showTutorial();
|
||||
context.globalState.update("continue.tutorialShown", true);
|
||||
}
|
||||
}
|
||||
|
|
@ -79,7 +82,7 @@ export async function activateExtension(context: vscode.ExtensionContext) {
|
|||
registerAllCodeLensProviders(context);
|
||||
registerAllCommands(context);
|
||||
registerQuickFixProvider();
|
||||
await openTutorial(context);
|
||||
await openTutorialFirstTime(context);
|
||||
setupInlineTips(context);
|
||||
showRefactorMigrationMessage();
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,11 @@ import * as path from "path";
|
|||
import * as io from "socket.io-client";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import * as vscode from "vscode";
|
||||
import { ideProtocolClient, windowId } from "./activation/activate";
|
||||
import {
|
||||
ideProtocolClient,
|
||||
showTutorial,
|
||||
windowId,
|
||||
} from "./activation/activate";
|
||||
import { getContinueServerUrl } from "./bridge";
|
||||
import { streamEdit } from "./diff/verticalPerLine/manager";
|
||||
import historyManager from "./history";
|
||||
|
|
@ -712,6 +716,10 @@ export function getSidebarContent(
|
|||
);
|
||||
break;
|
||||
}
|
||||
case "showTutorial": {
|
||||
showTutorial();
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (e: any) {
|
||||
let message = `Continue error: ${e.message}`;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,8 @@
|
|||
import { ArrowLeftIcon } from "@heroicons/react/24/outline";
|
||||
import { postToIde } from "core/ide/messaging";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import styled from "styled-components";
|
||||
import { lightGray, vscBackground, vscForeground } from "../components";
|
||||
import { Button, lightGray, vscBackground, vscForeground } from "../components";
|
||||
import KeyboardShortcutsDialog from "../components/dialogs/KeyboardShortcuts";
|
||||
|
||||
const IconDiv = styled.div<{ backgroundColor?: string }>`
|
||||
|
|
@ -18,6 +19,18 @@ const IconDiv = styled.div<{ backgroundColor?: string }>`
|
|||
}
|
||||
`;
|
||||
|
||||
const TutorialButton = styled(Button)`
|
||||
padding: 2px 4px;
|
||||
margin-left: auto;
|
||||
margin-right: 12px;
|
||||
background-color: transparent;
|
||||
color: ${vscForeground};
|
||||
border: 1px solid ${lightGray};
|
||||
&:hover {
|
||||
background-color: ${lightGray};
|
||||
}
|
||||
`;
|
||||
|
||||
function HelpPage() {
|
||||
const navigate = useNavigate();
|
||||
|
||||
|
|
@ -37,6 +50,13 @@ function HelpPage() {
|
|||
className="inline-block ml-4 cursor-pointer"
|
||||
/>
|
||||
<h3 className="text-lg font-bold m-2 inline-block">Help Center</h3>
|
||||
<TutorialButton
|
||||
onClick={() => {
|
||||
postToIde("showTutorial", {});
|
||||
}}
|
||||
>
|
||||
Open tutorial
|
||||
</TutorialButton>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-cols-2 grid-rows-2">
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue