12 releases

0.1.0 May 23, 2024
0.0.13 Oct 13, 2024
0.0.9 Aug 15, 2024
0.0.3 Jun 22, 2024
0.0.1 May 23, 2024

#128 in Text editors

Download history 236/week @ 2024-06-22 5/week @ 2024-06-29 4/week @ 2024-07-27 217/week @ 2024-08-03 324/week @ 2024-08-10 34/week @ 2024-08-17 1/week @ 2024-08-31 42/week @ 2024-09-14 11/week @ 2024-09-21 51/week @ 2024-09-28 124/week @ 2024-10-05

228 downloads per month
Used in testing-ls-adapter

MIT license

76KB
1K SLoC

Rust 1K SLoC // 0.0% comments Go 199 SLoC // 0.1% comments PHP 38 SLoC TypeScript 35 SLoC // 0.1% comments JavaScript 14 SLoC

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.

Instllation

cargo install testing-language-server
cargo install testing-ls-adapter

Features

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_arg": ["--test-kind=cargo-test"],
              "include": ["**/*.rs"],
              "exclude": ["**/target/**"]
            }
          ],
          "jest": [
            {
              "path": "<adapter path>/testing-ls-adapter",
              "extra_arg": ["--test-kind=jest"],
              "include": ["/**/*.js"],
              "exclude": ["/node_modules/**/*"]
            }
          ]
        }
      }
    }
  }
}

See more example

Adapter

  • cargo test
  • cargo nextest
  • jest
  • deno test
  • go test
  • phpunit
  • vitest

Writing custom adapter

⚠ The specification of adapter CLI is not stabilized yet.

See SPEC.md and spec.rs.

Dependencies

~22–32MB
~602K SLoC