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

@codincod/codemirror-lang-ada

v0.1.1

Published

Ada language support for the CodeMirror code editor

Readme

@codincod/codemirror-lang-ada NPM version

[ CHANGELOG ]

This package implements Ada language support for the CodeMirror code editor, using a Lezer grammar written for this package.

CodeMirror has never shipped Ada, in either version. Editors that offer it usually reach for a Pascal or VHDL mode, which colours some of the keywords and gets the rest wrong: Integer'First comes out as an unterminated string, 'a' and 'Length are the same thing, and there is no tree underneath either way.

Written in part for CodinCod, a competitive coding platform, where it colours the editor people solve puzzles in.

This code is released under an MIT license.

Usage

import {EditorView, basicSetup} from "codemirror"
import {ada} from "@codincod/codemirror-lang-ada"

const view = new EditorView({
  parent: document.body,
  doc: `with Ada.Text_IO; use Ada.Text_IO;

procedure Main is
begin
   Put_Line ("Hello World!");
end Main;
`,
  extensions: [basicSetup, ada()]
})

Coverage

Ada 2012, with the Ada 2022 additions that have already reached real code: square-bracket array aggregates, iterated component associations, the @ target name, iterator filters and parallel-free loop syntax. Tasking, protected objects, generics, representation clauses, aspect specifications, extension aggregates and expression functions are all in.

Measured against 1447 Ada files from Rosetta Code, 94.61% parse with no error node. Most of the rest is not Ada: wiki markup left in the sources, GNAT project files, distributed-systems configuration files, and fragments with ... written where the author elided a page.

Two things a tokenizer has to settle

Almost all of Ada can be written down as a grammar directly. Two things cannot.

Case does not matter. IF, If and if are one word, and so are Put_Line and PUT_LINE. Reserved words are recognised by a function that lower-cases the word before looking it up, so a file written in the shouting style of 1983 highlights the same as one written last week.

An apostrophe is two different things. 'a' is a character and Integer'First is an attribute. Ada settles it by what stands in front: after a name or a closing parenthesis the apostrophe is an attribute tick, and elsewhere it opens a literal. That rule alone gets when 'a' => wrong, because when is a word too, so the parser is asked as well: where an attribute could not stand, the apostrophe is a literal whatever preceded it.

One thing about the grammar is worth saying out loud. Ada writes a call, an index and an aggregate the same way, with a parenthesised list, and cannot tell them apart without knowing what the name means. Neither does this, so there is one Arguments node for all three and no guessing.

What it gives an editor

Syntax highlighting, folding for subprograms, packages, tasks, blocks, loops and records, indentation that knows end, else, when and exception come back out, and completion for the reserved words, the predefined types, the attributes and the packages of the standard library.

adaLanguage is exported for use with LanguageSupport, and parser for use on its own.

Testing it on your own code

node test/corpus.ts path/to/your/ada

It prints the files that failed, the first line of each that did, and the proportion that came out clean. The corpus itself is not included; Rosetta Code is CC BY-SA and cannot be redistributed under this licence.