mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-04-29 17:20:21 -05:00
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.
18 lines
545 B
TypeScript
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],
|
|
};
|
|
}
|