Files
cs249r_book/book/vscode-ext/src/utils/workspace.ts
Vijay Janapa Reddi 9e257f960f Add VSCode extension for book build and debug tooling
Sidebar extension with tree views for build, debug, precommit, and
publish workflows. Integrates with the book CLI for chapter-level
builds, cross-reference checks, and MIT Press release packaging.
2026-01-31 19:46:54 -05:00

18 lines
545 B
TypeScript

import * as vscode from 'vscode';
import { QmdFileContext, VolumeId } from '../types';
export function getRepoRoot(): string | undefined {
const folders = vscode.workspace.workspaceFolders;
if (!folders || folders.length === 0) { return undefined; }
return folders[0].uri.fsPath;
}
export function parseQmdFile(uri: vscode.Uri): QmdFileContext | undefined {
const match = uri.fsPath.match(/contents\/(vol[12])\/([^/]+)\//);
if (!match) { return undefined; }
return {
volume: match[1] as VolumeId,
chapter: match[2],
};
}