✨ Show VS Code Tutorial

This commit is contained in:
Nate Sesti 2023-10-18 00:02:28 -07:00
parent 461e3474e8
commit 63135fbcee
3 changed files with 20 additions and 9 deletions

View file

@ -7,6 +7,10 @@ It will walk you through the basic features:
1. Ask a question
2. Edit code
3. Debug
You can either
- follow the instructions on your own, or
- follow along by clicking the gray CodeLens buttons above the lines, in order, starting with "Begin Section"
"""
# region —————————————————————————— Part 1: Ask a question about code [⌘ M] ——————————————————————————

View file

@ -6,22 +6,16 @@ import {
getExtensionVersion,
startContinuePythonServer,
} from "./environmentSetup";
import fetch from "node-fetch";
import { registerAllCodeLensProviders } from "../lang-server/codeLens";
import { registerAllCommands } from "../commands";
import registerQuickFixProvider from "../lang-server/codeActions";
const PACKAGE_JSON_RAW_GITHUB_URL =
"https://raw.githubusercontent.com/continuedev/continue/HEAD/extension/package.json";
import { getExtensionUri } from "../util/vscode";
import path from "path";
export let extensionContext: vscode.ExtensionContext | undefined = undefined;
export let ideProtocolClient: IdeProtocolClient;
function getExtensionVersionInt(versionString: string): number {
return parseInt(versionString.replace(/\./g, ""));
}
function addPythonPathForConfig() {
// Add to python.analysis.extraPaths global setting so config.py gets LSP
@ -63,6 +57,18 @@ function addPythonPathForConfig() {
}
}
async function openTutorial(context: vscode.ExtensionContext) {
if (context.globalState.get<boolean>("continue.tutorialShown") !== true) {
const doc = await vscode.workspace.openTextDocument(
vscode.Uri.file(
path.join(getExtensionUri().fsPath, "continue_tutorial.py")
)
);
await vscode.window.showTextDocument(doc);
context.globalState.update("continue.tutorialShown", true);
}
}
export async function activateExtension(context: vscode.ExtensionContext) {
extensionContext = context;
console.log("Using Continue version: ", getExtensionVersion());
@ -80,6 +86,7 @@ export async function activateExtension(context: vscode.ExtensionContext) {
registerAllCommands(context);
registerQuickFixProvider();
addPythonPathForConfig();
await openTutorial(context);
// Start the server
const sessionIdPromise = (async () => {

View file

@ -261,7 +261,7 @@ class TutorialCodeLensProvider implements vscode.CodeLensProvider {
new vscode.CodeLens(range, {
title: "Highlight the function",
command: "continue.selectRange",
arguments: [lineOf21 + 1, lineOf21 + 8],
arguments: [lineOf21 + 1, lineOf21 + 12],
})
);
}