Skip to content

Visual Studio Code, rebuilt in Rust

Rust
1.2 KB
Raw Blame
// Reads the ledger's files: port/ledger.md (open work), port/ledger/done.md (closed work)
// and port/ledger/units/<file>.md (the Units table, one file per area). Each file holds one table.
import { readdirSync, readFileSync } from 'node:fs';
import { join } from 'node:path';

export const unitFiles: Record<string, string> = {
	'extension host seam': 'seam',
	'MainThread* shape (Rust side)': 'mainthread',
	'src/vs/base': 'base',
	'src/vs/platform': 'platform',
	'src/vs/editor': 'editor',
	'src/vs/editor/contrib': 'editor-contrib',
	'workbench part': 'workbench-parts',
	'workbench service': 'workbench-services',
	'workbench contribution': 'workbench-contrib',
	'built-in extension': 'extensions',
	'cross-cutting check': 'checks',
	'port feature': 'checks',
};

export function readLedger(root = join(import.meta.dir, '../..')) {
	const unitsDir = join(root, 'port/ledger/units');
	return {
		openWork: tableRows(join(root, 'port/ledger.md')),
		doneWork: tableRows(join(root, 'port/ledger/done.md')),
		units: readdirSync(unitsDir).sort().flatMap(file => tableRows(join(unitsDir, file))),
	};
}

function tableRows(path: string) {
	return readFileSync(path, 'utf8').split('\n').filter(line => line.startsWith('| ') && !line.startsWith('|---')).slice(1);
}