npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@domorium/codemirror

v2.1.0

Published

CodeMirror 6 integration for GEDCOM language features

Readme

@domorium/codemirror

npm License: MIT

CodeMirror 6 integration for GEDCOM completion, diagnostics, hover, folding, semantic highlighting, document links, definitions, references, rename, and record preview. The language behavior comes from @domorium/language-service.

Part of Domorium — GEDCOM editor tooling for the browser, Obsidian, VS Code, and JetBrains IDEs.

Install

Install the package and the CodeMirror peer dependencies used by your host:

npm install @domorium/codemirror \
  @codemirror/autocomplete \
  @codemirror/commands \
  @codemirror/language \
  @codemirror/lint \
  @codemirror/state \
  @codemirror/view \
  @lezer/highlight

Usage

import { EditorState } from "@codemirror/state";
import { EditorView } from "@codemirror/view";
import {
  applyWorkspaceEdit,
  createGedcomExtensions,
  createStandaloneEditorExtensions,
  EditorLanguageService,
} from "@domorium/codemirror";

const language = new EditorLanguageService();
let view: EditorView;

const state = EditorState.create({
  doc: "0 HEAD\n0 TRLR\n",
  extensions: [
    ...createStandaloneEditorExtensions(),
    ...createGedcomExtensions({
      language,
      settings: {
        diagnostics: true,
        indentationHints: true,
      },
      actions: {
        applyWorkspaceEdit: (edit) =>
          applyWorkspaceEdit(view, edit, language.getVersion()),
        openDocumentLink: (link) => {
          console.log(link);
        },
      },
    }),
  ],
});

view = new EditorView({ state, parent: document.body });

createGedcomExtensions contains GEDCOM-specific features and accepts host callbacks for workspace edits and document links. It does not install general editor keymaps, gutters, history, or layout behavior.

recordPreviewHover installs the gesture that previews the record a cross-reference names, and marks the pointer under the reader's attention. The host supplies show and hide, because what a preview is drawn on — a tooltip, a popover — is the host's to decide; getRecordPreviewRuns turns the record into runs carrying the host's own highlight classes.

Which record a pointer names, and how much of it fits, is answered by getRecordPreview in @domorium/language-service, so a host that speaks LSP gets the same preview. What belongs to this package is the gesture, the mark on the pointer, and the colouring; findRecordPreview converts that answer to the offsets CodeMirror works in.

trigger decides what opens one and defaults to the platform modifier; clearRecordPreview(view) closes one from anywhere, and hide is called for it.

delay is how long the pointer must rest before a preview opens, and it is zero by default — right for a modifier gesture, where holding the modifier is already the intent. A host that triggers on a bare hover should pass HOVER_TIME_MS, the wait this package gives its own tag tooltip. Closing never waits: leaving a pointer clears the preview at once.

createStandaloneEditorExtensions is an optional preset for a complete standalone editor; its lint gutter follows the diagnostics option. Embedded hosts such as IDEs and note-taking applications usually provide their own editor shell and should use only the extensions they need, composing their own theme and highlight style on top of the preset rather than restating it.

The package does not depend on a browser worker, the Language Server Protocol, or any particular editor host. CodeMirror packages are peer dependencies so the host and GEDCOM integration share one CodeMirror runtime.