backtrace-ls 0.0.5

See failed assertions as diagnostic messages next to your test code.
Documentation
# Backtrace-LS

LSP server that **shows failed assertion messages** as diagnostics in your code.

Additional features:

- Backtraces are parsed to mark any stack frame locations inline.
- You can use code actions to navigate between failure, stack frames and context.

Works out of the box in Helix (or any editor with an LSP client):

![(screenshot of code action in helix)](./helix-action.png)

## Installation

```sh
cargo install backtrace-ls
```

## Editor Setup

Try out without installing by opening the demo project with Helix:

```bash
cd demo/rust
hx -v src/lib.rs
```

You should see the failing assertions inline next to test code.

Helix (`~/.config/helix/languages.toml`):

```toml
[language-server.backtrace-ls]
command = "backtrace-ls"

[[language]]
name = "rust"
language-servers = ["backtrace-ls", "rust-analyzer"]
```

Neovim:

```lua
vim.lsp.start({ name = "backtrace-ls", cmd = { "backtrace-ls" }, root_dir = vim.fn.getcwd() })
```

## Configuration

The language server auto-detects the test runner from your project files (e.g., `Cargo.toml`, `package.json`, `go.mod`).

Create `.backtrace-ls.toml` in your project root to customize behavior:

```toml
# Explicitly specify the test runner (optional)
# If not set, auto-detected from project files
runner = "cargo-test"

# Pass extra arguments to the test command
extra_args = ["--workspace", "--lib"]

# Show diagnostics for the entire function instead of just the assertion line
show_surrounding_function = false
```

CLI options:

```bash
# Explicitly specify runner (overrides auto-detection)
backtrace-ls --runner cargo-test

# Set workspace root for detection
backtrace-ls --path /path/to/project

# Run in text mode with file watching
backtrace-ls --text --verbose
```

Supported runners:

- **Rust**: `cargo-test`, `cargo-nextest`
- **JavaScript/TypeScript**: `jest`, `vitest`, `node-test`, `deno`
- **Go**: `go-test`
- **PHP**: `phpunit`
- **C++**: `gtest`, `catch2`

**Note**: If multiple project types are detected, use `--runner` or the `runner` config option to specify which one to use.

## Contributing

You can debug more easily by running in `--text` and `--verbose` mode:

```bash
cargo run -- --path demo/rust --text -v
```

## License

MIT