- Objective: To provide a reactive notebook environment specifically designed for TypeScript, enabling users to create and manage notebooks programmatically, with a strong emphasis on type safety and developer experience.
- "North Star" - Deep Project Integration: Mazha's primary differentiator is its deep, native integration with a user's existing TypeScript project environment. This is paramount.
tsconfig.json
Adherence: Mazha's backend (for execution and module resolution) and frontend (for client-side LSP) will strictly respect the project'stsconfig.json
, includingpaths
,baseUrl
,compilerOptions
,jsxImportSource
, etc., ensuring consistent behavior with the rest of the user's project.
- Seamless Local Imports: Users can
import
modules, functions, types, and React components directly from their local project files (e.g.,./src/utils
,../components/MyWidget
) into Mazha cells, with full t
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Objective: To collaboratively build an extensive and deep understanding of a topic, project, problem, or any subject you wish to explore, starting with minimal initial information. | |
Your Role (LLM): Act as an Expert Inquisitor and Context Synthesizer. Your primary function is not to provide answers initially, but to ask insightful, targeted questions to systematically elicit all necessary information from me (the user). You are building a comprehensive knowledge base about the subject, piece by piece, driven by your questions. | |
Process: |
Let me try a completely different approach then. Let's bypass Conform and use Neovim's built-in functions to run a formatter directly on the TypeScript code:
vim.api.nvim_create_user_command('FormatTSMarkdown', function()
-- Save cursor position
local cursor_pos = vim.api.nvim_win_get_cursor(0)
local bufnr = vim.api.nvim_get_current_buf()
-- Find TypeScript code blocks
local lines = vim.api.nvim_buf_get_lines(bufnr, 0, -1, false)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Function to collect all diagnostic errors and copy them to clipboard | |
local function copy_errors_to_clipboard() | |
-- Get the current buffer number | |
local current_buf = vim.api.nvim_get_current_buf() | |
-- Get all diagnostics for the current buffer | |
local diagnostics = vim.diagnostic.get(current_buf) | |
-- Format each diagnostic into readable lines | |
local lines = {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bun | |
import { access, mkdir, readdir, stat } from "node:fs/promises"; | |
import { basename, dirname, extname, join, relative } from "node:path"; | |
// ======================================== | |
// Global Configuration | |
// Edit these values instead of passing command line args | |
// ======================================== | |
const DEFAULT_CONFIG: SiteConfig = { | |
contentDir: './content', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let activeEffect: (() => void) | null = null; | |
export function signal<T>(initialValue: T) { | |
let value = initialValue; | |
const subscribers = new Set<() => void>(); | |
return { | |
get(): T { | |
if (activeEffect) { | |
subscribers.add(activeEffect); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type buildTuple< | |
n extends number, | |
acc extends any[] = [], | |
> = acc["length"] extends n ? acc : buildTuple<n, [...acc, 0]>; | |
type add<a extends number, b extends number> = [ | |
...buildTuple<a>, | |
...buildTuple<b>, | |
]["length"] & | |
number; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type buildTuple<L extends number, T extends any[] = []> = T["length"] extends L | |
? T | |
: buildTuple<L, [...T, unknown]>; | |
type addTuple<A extends unknown[], B extends unknown[]> = [ | |
...A, | |
...B, | |
]["length"] & | |
number; | |
type subTuple<A extends unknown[], B extends unknown[]> = A extends [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ts from "typescript"; | |
import { | |
Parser, | |
alphabet, | |
char, | |
digit, | |
many0, | |
many1, | |
optional, | |
or, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export type Fn = (...x: never[]) => unknown | |
export declare const _: unique symbol | |
export type _ = typeof _ | |
export declare abstract class Kind<F extends Fn = Fn> { | |
abstract readonly [_]: unknown | |
f: F | |
} |
NewerOlder