wraith/node_modules/@codemirror/language/README.md
Vantz Stockwell 2848d79915 feat: Phase 1 complete — Tauri v2 foundation
Rust backend: SQLite (WAL mode, 8 tables), vault encryption
(Argon2id + AES-256-GCM), settings/connections/credentials
services, 19 Tauri command wrappers. 46/46 tests passing.

Vue 3 frontend: unlock/create vault flow, Pinia app store,
Tailwind CSS v4 dark theme with Wraith branding.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 15:09:41 -04:00

67 lines
2.1 KiB
Markdown

# @codemirror/language [![NPM version](https://img.shields.io/npm/v/@codemirror/language.svg)](https://www.npmjs.org/package/@codemirror/language)
[ [**WEBSITE**](https://codemirror.net/) | [**DOCS**](https://codemirror.net/docs/ref/#language) | [**ISSUES**](https://github.com/codemirror/dev/issues) | [**FORUM**](https://discuss.codemirror.net/c/next/) | [**CHANGELOG**](https://github.com/codemirror/language/blob/main/CHANGELOG.md) ]
This package implements the language support infrastructure for the
[CodeMirror](https://codemirror.net/) code editor.
The [project page](https://codemirror.net/) has more information, a
number of [examples](https://codemirror.net/examples/) and the
[documentation](https://codemirror.net/docs/).
This code is released under an
[MIT license](https://github.com/codemirror/language/tree/main/LICENSE).
We aim to be an inclusive, welcoming community. To make that explicit,
we have a [code of
conduct](http://contributor-covenant.org/version/1/1/0/) that applies
to communication around the project.
## Usage
Setting up a language from a [Lezer](https://lezer.codemirror.net)
parser looks like this:
```javascript
import {parser} from "@lezer/json"
import {LRLanguage, continuedIndent, indentNodeProp,
foldNodeProp, foldInside} from "@codemirror/language"
export const jsonLanguage = LRLanguage.define({
name: "json",
parser: parser.configure({
props: [
indentNodeProp.add({
Object: continuedIndent({except: /^\s*\}/}),
Array: continuedIndent({except: /^\s*\]/})
}),
foldNodeProp.add({
"Object Array": foldInside
})
]
}),
languageData: {
closeBrackets: {brackets: ["[", "{", '"']},
indentOnInput: /^\s*[\}\]]$/
}
})
```
Often, you'll also use this package just to access some specific
language-related features, such as accessing the editor's syntax
tree...
```javascript
import {syntaxTree} from "@codemirror/language"
const tree = syntaxTree(view)
```
... or computing the appriate indentation at a given point.
```javascript
import {getIndentation} from "@codemirror/language"
console.log(getIndentation(view.state, view.state.selection.main.head))
```