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.4.0

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 18805 files of published Ada, counting files that parse with no error node:

| Corpus | Files | Clean | | --- | ---: | ---: | | GNATprove and the SPARK 2014 testsuite | 13055 | 98.41% | | Ada Language Server | 1763 | 94.61% | | AWS, the Ada Web Server | 1229 | 99.59% | | GtkAda | 774 | 100.00% | | Ada Util | 546 | 100.00% | | GNATColl | 493 | 100.00% | | Alire | 479 | 98.12% | | VSS | 466 | 99.36% | | All of it | 18805 | 98.30% |

Rosetta Code is the other measurement and the softer one: 1447 files, 95.02%. A snippet there is a fragment somebody pasted to demonstrate a task, so it never reaches for a contract, a private child or a subunit, and half of what still fails under it is not Ada at all. Wiki markup left in the source, GNAT project files, shell transcripts, and pages elided with a literal ....

The two disagreed by 27 points before 0.2.0, and that is why the harder one is quoted first.

Three things a tokenizer has to settle

Almost all of Ada can be written down as a grammar directly. Three 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.

A quoted operator is sometimes a name. "+" (A, B) calls the addition function and "/"'Result names its answer in a contract, but Put ("+") prints a plus sign. Two questions the grammar cannot ask settle it: whether the quoted text is one of the operators a subprogram may be named after, and whether a ' or a ( follows the closing quote. Both have to hold.

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

npm run corpus -- 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 under the GNU Free Documentation License 1.2 and cannot be redistributed under this one.