Metadata-Version: 2.4
Name: oxyaml
Version: 1.0.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Rust
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Text Editors :: Integrated Development Environments (IDE)
License-File: LICENSE-MIT
License-File: LICENSE-APACHE
Summary: Fast YAML language server and checker in Rust. Drop-in replacement for yaml-language-server: same settings, no Node.js.
Keywords: yaml,lsp,language-server,json-schema,kubernetes,linter,pre-commit
Home-Page: https://github.com/marwanvx/oxyaml
License-Expression: MIT OR Apache-2.0
Requires-Python: >=3.8
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Issues, https://github.com/marwanvx/oxyaml/issues
Project-URL: Repository, https://github.com/marwanvx/oxyaml

# oxyaml

[![CI](https://github.com/marwanvx/oxyaml/actions/workflows/ci.yml/badge.svg)](https://github.com/marwanvx/oxyaml/actions/workflows/ci.yml)
[![License: MIT OR Apache-2.0](https://img.shields.io/badge/license-MIT%20OR%20Apache--2.0-blue)](#license)

**A YAML language server in Rust, up to 400× faster than yaml-language-server on large files, with the same settings and no Node.js.**

oxyaml is a YAML language server and command-line checker written in Rust. It brings schema
validation, completion, hover, and formatting to your editor, and checks the same files in CI.
Switch from [yaml-language-server](https://github.com/redhat-developer/yaml-language-server) using
the same editor settings and schemas. The binary runs without Node.js.

## Benchmarks

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="docs/assets/benchmark-dark.svg">
  <img alt="Edit to diagnostics: oxyaml 2.6 ms, yaml-language-server 1,040 ms. Open to diagnostics: oxyaml 103 ms, yaml-language-server 1,064 ms. Peak memory: oxyaml 91.4 MB, yaml-language-server 1,345 MB." src="docs/assets/benchmark-light.svg">
</picture>

| | oxyaml | yaml-language-server | |
|---|---:|---:|---:|
| **Big file** (50,000 lines): edit → diagnostics | **2.6 ms** | 1,040 ms | 400× faster |
| open → diagnostics | **103 ms** | 1,064 ms | 10× faster |
| completion | **1 ms** | 81.1 ms | 81× faster |
| peak memory | **91.4 MB** | 1,345 MB | 15× less |
| **Small file** (500 lines): edit → diagnostics | **0.3 ms** | 214 ms | 712× faster |
| startup | **2.6 ms** | 230 ms | 89× faster |
| peak memory | **16.6 MB** | 123 MB | 7.4× less |

Measured on a GitHub Actions `ubuntu-latest` runner (the [bench-gate workflow](.github/workflows/bench-gate.yml)):
same files and the same Kubernetes schema for both servers, median of 5 sessions. yaml-language-server
waits 200 ms before validating, which is part of what an editor sees. How to reproduce: [docs/benchmarks.md](docs/benchmarks.md).

## Install

Release binaries target Linux, macOS, and Windows on x86-64 and ARM64. For installers and archives,
see [GitHub Releases](https://github.com/marwanvx/oxyaml/releases).

| Method | Command or location |
|---|---|
| Shell (Linux or macOS) | `curl -fsSL https://github.com/marwanvx/oxyaml/releases/latest/download/oxyaml-installer.sh \| sh` |
| PowerShell (Windows) | `irm https://github.com/marwanvx/oxyaml/releases/latest/download/oxyaml-installer.ps1 \| iex` |
| Homebrew | `brew install marwanvx/tap/oxyaml` once the tap is published |
| npm | `npm install -g oxyaml` once the package is published |
| PyPI | `pip install oxyaml` or `uvx oxyaml check` once the package is published |
| WinGet | `winget install --id marwanvx.oxyaml --exact` once the package is listed |
| VS Code | Look for `marwanvx.oxyaml` in the [Marketplace](https://marketplace.visualstudio.com/items?itemName=marwanvx.oxyaml) or [Open VSX](https://open-vsx.org/extension/marwanvx/oxyaml) once listed. You can also [build a VSIX](editors/vscode/README.md#development-and-packaging) and use **Install from VSIX** in Extensions. |
| Zed | Search Extensions for `oxyaml` once listed, or [install the development extension](editors/zed/README.md#local-development). |
| From source | `cargo install --locked --git https://github.com/marwanvx/oxyaml oxyaml` with the Rust toolchain in [`rust-toolchain.toml`](rust-toolchain.toml) |

## Migrating from yaml-language-server / redhat.vscode-yaml

Change your editor's server command to `oxyaml --stdio`. Keep your `yaml.*` settings,
including `yaml.schemas` glob associations, and leave existing modelines such as
`# yaml-language-server: $schema=./schema.json` in your YAML files. See
[behaviour differences](docs/DIFFERENCES.md).

### Editors

| Editor | What to change |
|---|---|
| [VS Code](editors/vscode/README.md) | Install oxyaml and disable Red Hat YAML for the workspace when prompted. Switch `editor.defaultFormatter` to `marwanvx.oxyaml` if it points to Red Hat YAML. |
| [Zed](editors/zed/README.md) | Set YAML's `language_servers` to `["oxyaml", "!yaml-language-server"]` and move `lsp.yaml-language-server.settings` to `lsp.oxyaml.settings`. |
| [Neovim](docs/editors/neovim.md) | Set `yamlls`'s `cmd` to `{ "oxyaml", "--stdio" }`. |
| [Helix](docs/editors/helix.md) | Set `command = "oxyaml"` and `args = ["--stdio"]` under `[language-server.yaml-language-server]`. |
| [Sublime Text](docs/editors/sublime.md) | Set `command` to `["oxyaml", "--stdio"]` in LSP-yaml or configure a standalone LSP client. |
| [Emacs](docs/editors/emacs.md) | Set the command to `("oxyaml" "--stdio")` in `eglot-server-programs` or `lsp-yaml-server-command`. |
| [Claude Code](editors/claude-code/README.md) | Put `oxyaml` on your PATH and load the `oxyaml-lsp` plugin for YAML. |

## Editor features

| Feature | What you get |
|---|---|
| Diagnostics | YAML 1.1 and 1.2 syntax, custom tags, style rules, and anchor hints |
| JSON Schema validation | Local and remote schemas, SchemaStore, Kubernetes, and custom resource definitions (CRDs) |
| Completion and hover | Schema-based keys, values, snippets, and documentation, plus anchor previews |
| Formatting | Whole-document formatting and indentation as you type |
| Code actions and lenses | Quick fixes and a link to the active schema |
| Outline and navigation | Document symbols, folding, expand selection, clickable links, and go to anchor definition |
| Rename | Rename an anchor and its aliases together |

## Check YAML in CI and before committing

Run `oxyaml check .` to validate YAML in the current directory. The checker looks for
`.oxyaml.toml` in the current directory and its parents. Use `--config <FILE>` to choose another
settings file and `--format json` or `--format sarif` for machine-readable output. Validation
errors exit with status 1.

Both integrations below use the `v1.0.0` tag. Add the hook to `.pre-commit-config.yaml` and run
`pre-commit install`. The hook requires Rust to build oxyaml.

```yaml
repos:
  - repo: https://github.com/marwanvx/oxyaml
    rev: v1.0.0
    hooks:
      - id: oxyaml-check
```

For GitHub Actions, check out your repository before running the action.

```yaml
name: Check YAML
on: [push, pull_request]
permissions:
  contents: read
jobs:
  yaml:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: marwanvx/oxyaml@v1.0.0
        with:
          paths: .github/workflows
          format: text
```

On a release tag the action downloads the prebuilt binary (checksum-verified, cached); other refs build
from source. It defaults to checking `.` and writing a SARIF report. See the
[action inputs](action.yml) for configuration and uploading the report to code scanning.

## Contributing

See the [contribution guide](CONTRIBUTING.md), [security policy](SECURITY.md),
[code of conduct](CODE_OF_CONDUCT.md), and [changelog](CHANGELOG.md).

## License

[MIT](LICENSE-MIT) or [Apache-2.0](LICENSE-APACHE).

