Repository navigation
Releases
orthra 0.3.0
- reads every language with its own lexer, each language's rules data in its
lex.toml, in place of
tree-sitter and its grammars: on the projects measured, a check per 2 000 lines costs 1.5 to 7 ms
cold where it cost up to 82, a keystroke's p95 at most 0.6 ms where it was up to 7, its slowest a
few ms where it was up to 248, and the binary is 25 MB where it was 104. Each language moved once
its findings on real files were the old engine's or fewer, or more where they were real typos:
Objective-C methods' names, Groovy past what its grammar could not parse, zsh scripts' comments; - reads an open document again only around a keystroke: the lexer's scan resumes before the edit and
meets the old one past it, in PHP too, around its page, and Markdown's parse, the words and their
verdicts are kept the same way; - reads a language's rules on its first document, 0.2 to 1.6 ms, where every language's took 7 to 16
at once and a tree-sitter grammar's query up to 87; - checks Twig and Blade templates and LaTeX: their text and comments, and not their code, math or
keys; - reads a page's
<script>and<style>, and a Vue or Svelte component's, by their own languages,
and the page around PHP as HTML; - reads a PHP heredoc named for a language by that language's rules,
<<<HTML,<<<'SQL',
<<<JSON,<<<'YAML',<<<'LUA', what interpolates in it left out: Laravel's Redis scripts are
code, and no longer 20 findings; - reads cspell's comments as its own directives:
cspell:ignoreandcspell:wordslist a file's
words, andcspell:disable,cspell:disable-lineandcspell:disable-next-lineignore lines; - offers the project's own words as corrections, what it declares and what its words files list:
Kubeflowmshgets theKubeflowmesha file declares, first among corrections as near; a known
typo the project declares is never offered; - offers every enabled pack's corrections: with both spellings of English on,
favouritgets
favourite, not onlyfavorite; - keeps the words a project taught cspell or VS Code's Code Spell Checker:
wordsandignoreWords
incspell.json, the word lists it turns on, andcSpell.wordsin.vscode/settings.json; - checks Polish:
languages = ["en-US", "pl-PL"]installs sjp.pl's dictionary on first use and
compiles it to a 2.7 MB index; - tells a word written the other way from the rest of its file, with both Englishes on
(inconsistent-spelling):colouronce in a file that writescolornine times getscolor. A
file written both ways about as often says nothing, and neither does a word a words file lists; - looks a word up in the technical vocabulary and the rare-word lists five and three times as fast,
from sets compiled when orthra is: a cold check costs 3 to 6 % less; - reads a string of one word in code as a value, held to known typos as names are:
"endsession",
"dirsep",className="banner". On the zero corpus 190 of 1 120 findings were such strings, and
the typo sample lost no typo. A piece of a string beside an escape or a substitution is text, as
Helloof"Hello\nworld"andWelcome,of`Welcome, ${name}`always should have been; - leaves out code a project carries and did not write, in
vendor,third_partyandthird-party,
as it leaves outnode_modules: phrost's vendored PHP stubs were 67 of its 472 findings; - offers a word run together as its two words:
noonegetsno one,everytimeevery time,
Polishnapewnona pewnoand Ukrainianбудьласкабудь ласка, after the single words as
near; - offers first the misspellings a dictionary expects, from its
REPtable, as Hunspell does:
bendziegetsbędzie,fonegetsphoneandalotgetsa lot, which were never offered or
came after words written more often; - installs a dictionary written in another encoding than UTF-8, in the one its
SETnames, which
failed at its first letter past ASCII. - ends quietly when its reader goes away, as
headdoes inorthra check . | head, with the status
141 a shell gives a program SIGPIPE ended: it panicked and said so on stderr.
orthra 0.2.1
- reports less that is not a typo, and catches what it caught: on the zero corpus, unknown words
fell from 234 to 108 in ripgrep, from 139 to 103 in composer and from 421 to 311 in helix, and the
typo sample's recall did not fall; - accepts a word a words file or an
orthra: ignoredirective lists in every part orthra cuts it
into, and before a possessive:TruStagein.orthra/words.txtno longer has its first part
reported as a typo oftrue, inTruStageor inTruStage's. On such a part, Add to words and
Ignore in this file list the whole word, not the part, which would accept a typo everywhere; - matches a listed word whichever apostrophe it was written with, in the list or in the text:
O'ReillyacceptsO’Reilly, andкв'язокacceptsкв’язокandквʼязок; - reads a words file an editor saved with a byte-order mark, which lost its first word, and adds a
word to it once, whatever comment follows the same word already there; - takes a Cargo target's name and an npm command's as words the project declares: a binary
foundrydis no finding in the project that builds it; - takes after a backslash only the letters its escape takes:
\Generatorin a Python raw string is
Generator, no longer a typo ofgeneratorwith its first letter cut off. Go's comments and raw
strings read the escapes they write out,\ufffd, as escapes; - reads reStructuredText's double-backtick literals as code, in a docstring or a comment, as it
reads code between single backticks: CMake's module docs went from 1 126 findings to 894; - reads a variable's name,
$name,${name},$ENV{NAME}, a setting written out,
RESTRICT=binchecks, and a glob whose class opens it,[Mm]akefile, as what they are, not words; - leaves a Rust
cfgpredicate's strings alone,#[cfg(target_os = "emscripten")]: they name
targets and features; - reads Go's
//go:build,//go:generateand the toolchain's other directives as directives, and
the comments before a declaration as its doc, whose code blocks gofmt indents by a tab. Go's
standard library went from 2 823 findings to 2 505; - leaves a file a tool wrote alone, whatever its name: one that says so at its top (
DO NOT EDIT,
@generated,<auto-generated>), whose declarations stay the project's; one with a line longer
than 10 000 characters, as a minified bundle has; and one larger than 2 MB, as a parser's
generated tables are. A 2 MB bundle took 3.4 s to check, and a keystroke in it half a second; - reads
tests/data/as test data, asfixtures/andtestdata/are; - reads two of the commonest words joined as one where code joins words, in a string, a value or a
name:statuscode,sectionmissing. Prose and comments keep the space, soeverytimeis still
reported, and so isfeedbacks; - accepts
libas a prefix,libmagic; a software word with'd,'edor'ingafter it,
mmap'd,chmod'd,malloc'ed; the names of languages, editor themes and tools software writes,
Starlark, Verilog, Catppuccin, Dracula, Solarized, gdbserver; anddialogs,lossy,natively,
browseable,exportfsandunparseable. A vocabulary word no longer takesswhere English
writeses:autofocussis reported; - stops reporting on a document whose change it could not apply, a column inside a character, until
the editor sends it whole: what it had published would have been at the wrong places, and a fix
applied there would have edited somewhere else; - keeps its memory bounded on a huge workspace: on the cargo registry, 36 000 files, the server's
peak went from 5 GB to 313 MB and its first diagnostic from 89 s to 37 s; - compiles Objective-C's, Scala's and C#'s queries in about half the time, and Julia's in less, so
the first file of those languages opens sooner.
orthra 0.2.0
- checks 45 more languages, each in its comments, its strings and the names a file declares:
JavaScript and JSX, Scala, Groovy, Swift, Objective-C, C, C++, C#, F#, Dart, Zig, Kotlin, Java,
Ruby, Lua, Elixir, Erlang, Haskell, OCaml, Elm, R, Julia, PowerShell, shell scripts, SQL, HTML,
Vue and Svelte components, CSS, SCSS, LESS, XML, reStructuredText, Protocol Buffers, GraphQL, Nix,
HCL and Terraform, INI, Java properties, Makefiles, CMake and Dockerfiles; a property name in a
stylesheet is held to known typos (widht); - leaves a template's code out of an HTML page (
{{ }},{% %},{# #},<% %>): Django's admin
templates went from 268 findings to none; - rewrites the selection, not only the sentence at the cursor, and rephrases it, with a model you
run through a local OpenAI-compatible endpoint, now described in the README; the prompts can be
your own, and an API key is sent to a server that asks for one; - settings: the built-in model is
context.rankand a model you run iscontext.rewrite, each
on its own. 0.1.0'scontext.enabledandcontext.httpare no longer read; - offers to change every same finding in a file at once, and to ignore one line with an
orthra: ignore-next-linecomment above it; - applies every exact fix in a file at once, a known typo's only correction or a word in one script,
from the menu or when the editor saves:source.fixAll.orthra; - reads a doc comment's markup as markup, whatever the language:
<pre>,<code>,{@code},
{@link}, odoc's{!refs}, Scaladoc's{{{ }}}, doctests (>>>,iex>,scala>), Haddock's
>lines, and a code block indented in Markdown's way, in a docstring or heredoc too; - reads a handle or a name as a name:
TODO(nweiz), code review'sCR rgrinberg:, and what follows
(c),©,Copyrightanywhere in a line,Created byandWritten by:; - leaves a name qualified by its module unchecked,
os.path.join,Vec::new: it refers to code; - English's dictionaries are compiled to FSTs when orthra is built: 12.8 MB less memory, a faster
start, and corrections ranked by how common a word is, soletergetslaterandletterbefore
leerandlefter; the right correction comes first a point more often on real typos; how common
each word is is compiled too, so the first correction asked for comes as fast as the next; - gives back on macOS what its parsers free, with mimalloc as the process's allocator there: 6 to 9
MB after checking a large project; - English is either spelling until a setting names one: en-US and en-GB are built in, and
languages = ["en-US"]makes a project American only; - test data is not checked:
fixtures/,*-fixtures/,__fixtures__/andtestdata/in every
language; - a translation into a language no enabled pack speaks has its text left unchecked:
locales/de.json,config/locales/devise.de.yml,_locales/zh_CN/messages.json, Android's
res/values-de/,de.lproj/,Strings.de.resxandmessages_de.properties; - more of software English is a word: 86 000 uncommon words from SCOWL size 80, 5 000 names of
commands from tldr-pages,un-,re-,sub-and six more prefixes on a known word, and plurals
of the technical vocabulary (datagrams). On the projects beside orthra, 13 827 findings became 1
923, and the typo sample's recall moved by 0.2 points.
orthra 0.1.0
The first release.
The language server, orthra serve, for Zed and any LSP client:
- checks the prose of plain text, Markdown and commit messages, and the comments, doc comments,
strings and declared names of Rust, TypeScript and TSX, Python, Go, PHP, TOML, YAML and JSON; - reports a name where it is declared, never where somebody else's API is used, and accepts what the
project declares: its name, its dependencies, its authors, the parts of its identifiers; - skips what is never a word: URLs, paths, emails, hashes, UUIDs, versions, CLI flags, language
tags, inline code, link targets and front matter; - re-checks only what a keystroke changed: 0.1 to 1.1 ms at the 95th percentile on real projects;
- offers fixes, adds a word to the project's words or the user's, or ignores it in one file.
What it finds:
unknown-word: a word no dictionary of its script accepts;known-typo: one of 96 000 known misspellings (crate-ci/typos), with its exact fix;mixed-script: a word with a letter from another script (сountwith a Cyrillicс), fixed to
one script;wrong-layout:руддщ цщкдвtyped with the Ukrainian layout still on, fixed tohello world.
Languages: en-US and en-GB built in, with 27 000 names and terms of software from cspell-dicts.
uk-UA is installed on first use from dict_uk and compiled to a 3.9 MB index of its 3.6 million word
forms. Words are routed to a language by their script, word by word.
The optional model, off by default: ELECTRA-small, 15 MB, run in the process, reorders a word's
corrections by its sentence when the code actions are asked for. The server downloads it from a
pinned revision when the settings turn it on, and unloads it after ten minutes unasked. With a local
endpoint (Ollama, llama.cpp), an action rewrites the sentence at the cursor.
The command line: orthra check (with --ratchet for CI), orthra explain,
orthra pack install, orthra model install.
Measured against codebook-lsp 0.3.42 on the same files: 16 to 23 times fewer findings on well-kept
projects, and the right correction first for 71.4 % of real typos from GitHub against 59–63 %; 72.2
% with the model.