Skip to content

chunk 2/13: parser LANGUAGES descriptor (single source of truth)#2

Merged
cogeor merged 7 commits into
mainfrom
land/02-parser-languages
Jun 4, 2026
Merged

chunk 2/13: parser LANGUAGES descriptor (single source of truth)#2
cogeor merged 7 commits into
mainfrom
land/02-parser-languages

Conversation

@cogeor

@cogeor cogeor commented Jun 4, 2026

Copy link
Copy Markdown
Owner

Chunk 2/13. Introduces src/parser/languages.ts as the single source of truth and drives ParserRegistry, config.ts ext/highlight maps, install hints, and webview ignore lists from it; adds registry.getSupport() 3-state affordance and the check:langs parity gate.

🤖 Generated with Claude Code

cogeor and others added 7 commits June 4, 2026 02:55
LANGUAGES declares id/displayName/extensions/grammarPackage/callGraph/
highlightId/load per language in one place, replacing the ~7 hand-synced sites
that drift today. callGraph is designed once here (ts semantic, python
heuristic, cpp/rust/r none) and consumed later by getSupport and
python-callgraph. highlightOverrides preserves the per-extension
.js/.jsx->javascript vs .ts/.tsx->typescript split. Pure additive — no consumer
imports it yet; the registry/config/scan migrations follow.

Implements: 1-package-hardening/PH-D-01

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Fixes the toggle-noop: a source file whose grammar is not installed rendered a
live "watch" dot (static isSupportedFile) that silently did nothing on click
(runtime registry returns null). getSupport reconciles static vs runtime and
reads installHint/callGraph from the LANGUAGES descriptor. worktree bakes
parsable/needsGrammar/installHint/callGraph into ITreeNode + browser FileNode;
the renderer adds a muted needs-grammar marker (not a toggle) with an
"Install <pkg>" hint, leaving the existing toggle path byte-identical. callGraph
now rides per-file into the vis payload for python-callgraph's badge.

Implements: 1-package-hardening/PH-04

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the bespoke TypeScript block and four copy-paste tryRegisterOptional
blocks with one data-driven loop over LANGUAGES: no-grammar entries register
eagerly via descriptor.load(); grammar-backed entries go through the
missing/active try/catch (MODULE_NOT_FOUND -> missing). Adding a language no
longer edits registry.ts. Active/missing summary output and duplicate guards
preserved.

Implements: 1-package-hardening/PH-D-02

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… drop .dart

ALL_SUPPORTED_EXTENSIONS = LANGUAGES.flatMap(extensions); getLanguageFromPath
looks up the descriptor (highlightOverrides[ext] ?? highlightId, default 'code',
case-insensitive). Deletes the four eager adapter imports (config-load no longer
pulls the adapter tree) and the .dart->'dart' ghost (no Dart adapter). The
.js/.jsx->javascript vs .ts/.tsx->typescript split is preserved via the
typescript descriptor's highlightOverrides.

Implements: 1-package-hardening/PH-D-03

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Build the ext->grammar-package hint map from LANGUAGES.filter(grammarPackage)
instead of a fourth hand-maintained map. cpp extension coverage audited (all of
.c/.h/.cpp/.hpp/.cc/.cxx/.hxx present). C/C++ family display collapsing
(CPP_FAMILY_EXTS, formatUnsupportedSourceHints) left hand-owned. The .r hint
collapses to the single descriptor package @davisvaughan/tree-sitter-r.

Implements: 1-package-hardening/PH-D-04

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…_FOLDERS

The explorer kept a divergent ALWAYS_IGNORED set that omitted venvs/target/dist/
build/.arch, so the tree rendered large vendored trees the scanner skips
(clickable dead files + walk cost). worktree.ts now consumes IGNORED_FOLDERS as
the single source; .DS_Store (a file name, matched per-entry) and .llmem (the
centralized root, one folder name ignores the whole tree) are folded into the
shared set. Drops the now-stale worktree.ts row from the .artifacts allowlist
(the literal moved to config.ts, already allowlisted).

Implements: 1-package-hardening/PH-07

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
scripts/check-langs.ts asserts package.json optional grammar peerDeps ==
LANGUAGES grammar packages (bidirectional) and that the README languages table
mentions each language + grammar package; wired into CI. README gains a
descriptor-mirrored Languages table + node-gyp/optional-grammar toolchain note.
ADDING_LANGUAGES.md / LANGUAGE_ROADMAP.md rewritten to the single-descriptor
flow (one LANGUAGES entry + adapter + peerDep), dropping the stale
getLanguageFromPath/registry/config edit steps. Docs honestly mark Python
import-only (heuristic call graph not wired until the python-callgraph plan).

Implements: 1-package-hardening/PH-D-05

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@cogeor cogeor merged commit bfde9de into main Jun 4, 2026
6 checks passed
@cogeor cogeor deleted the land/02-parser-languages branch June 4, 2026 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant