Language server for real-time testing diagnostics
Find a file
2024-08-05 22:26:35 +09:00
.github/workflows add GHA workflow for CI 2024-06-30 22:30:17 +09:00
.vim chore: update coc-settings 2024-08-04 18:29:57 +09:00
crates/adapter chore(adapter): update version 2024-08-05 22:26:35 +09:00
demo chore: update demo 2024-08-04 22:14:05 +09:00
src fix: prevent accessing to a non-existent field 2024-08-05 21:50:59 +09:00
.gitignore mvp 2024-05-07 00:08:27 +09:00
Cargo.lock chore(adapter): update version 2024-08-05 22:26:35 +09:00
Cargo.toml chore: update version 2024-08-05 21:53:36 +09:00
justfile mvp 2024-05-07 00:08:27 +09:00
LICENSE add license 2024-06-30 22:39:44 +09:00
README.md update README 2024-06-22 19:32:59 +09:00

testing-language-server

General purpose LSP server that integrate with testing. The language server is characterized by portability and extensibility.

Motivation

This LSP server is heavily influenced by the following tools

These tools are very useful and powerful. However, they depend on the execution environment, such as VSCode and NeoVim, and the portability aspect was inconvenient for me. So, I designed this testing-language-server and its dedicated adapters for each test tool to be the middle layer to the parts that depend on each editor.

This design makes it easy to view diagnostics from tests in any editor. Environment-dependent features like neotest and VSCode's built-in testing tools can also be achieved with minimal code using testing-language-server.

Features

  • Realtime testing diagnostics
  • More efficient checking of diagnostics
  • Adapter installation command
  • VSCode extension
  • Coc.nvim extension
  • NeoVim builtin LSP plugin

Configuration

language server config:

"languageserver": {
  "testing": {
    "command": "<server path>/testing-language-server",
    "trace.server": "verbose",
    "filetypes": [
      "rust",
      "javascript"
    ],
    "initializationOptions": {
      "initializationOptions": {
        "adapterCommand": {
          "cargo test": [
            {
              "path": "<adapter path>/testing-ls-adapter",
              "extra_args": ["--test-kind=cargo-test"],
              "include_pattern": ["**/*.rs"],
              "exclude_pattern": ["**/target/**"]
            }
          ],
          "jest": [
            {
              "path": "<adapter path>/testing-ls-adapter",
              "extra_args": ["--test-kind=jest"],
              "include_patterns": ["/**/*.js"],
              "exclude_patterns": ["/node_modules/**/*"]
            }
          ]
        }
      }
    }
  }
}

Adapter

  • cargo test
  • jest
  • others

Writing custom adapter

⚠ The specification of adapter CLI is not stabilized yet.

See spec.rs.

clap crate makes it easy to address specification, but in principle you can create an adapter in any way you like, regardless of the language you implement.