Skip to main content

SSH-config Language Server (sshls)

A Language Server for OpenSSH configuration files, with a CLI formatter.

✨ Features

  • Formatting of SSH config files via the sshls format command
  • Language server started with sshls server, following the Language Server Protocol (LSP)
  • Formatting, real-time error reporting and keyword completion through the language server

📦 Installation

You can install the tool easily with pipx or uv:

uv tool install ssh-config-ls

🧑‍💻 Editor integration

While the formatter can be used from the terminal, the main feature of sshls is its server. Since it is compliant with the LSP, it can be more or less easily used with your favorite editor.

Neovim 0.11+

If sshls is available on your path, you can use the vim.lua framework to configure the server, in <rtp>/lsp/sshls.lua:

return {
    cmd = { "sshls", "server" },
    filetypes = { "sshconfig" },
    settings = {}, -- Put your options there
}

Just do not forget to enable the config:

vim.lsp.enable("sshls")

🔧 Configuration

The language server accepts the following options from the client (e.g. Neovim):

{
    formatter = {
        indent = "    ",  -- Indentation for directives inside Host and Match blocks
        separator = " ",  -- Separator between a keyword and its arguments
        sort_directives = true, -- Sort directives within blocks
    }
}

🚧 Roadmap

This is the Python prototype of the language server. The following features are currently planned to reach a mature state and a stable API, but additional features may be added as development progresses:

  • Implement a lexer
    • Keep comments for easier formatting
  • Implement a parser
    • Parse directives blocks (the global one and Host and Match ones)
  • Implement a formatter
    • Remove blocks without directives
    • Indent Host and Match blocks
    • Sort directives within a block
    • Sort consecutive Host blocks
  • Provide a CLI
    • Add the format subcommand to format a file
    • format: add a --check option to give a status code
    • format: add a --diff option to show the difference between the current file and the formatted replacement
    • Add the server subcommand to start the language server over STDIO
  • Language server
    • textDocument/formatting
    • textDocument/completion
    • textDocument/diagnostic - Report syntax errors
    • textDocument/diagnostic - Report warnings
    • textDocument/hover
  • Test coverage

Once all features have been implemented and the program has reached a mature stage, I will release version 1.0 and start working on the Rust rewrite. Of course, I will continue to fix bugs, but new features will not necessarily be added to the Python implementation in the meantime (and since learning Rust is the main reason I started this project, it will take time).

For the Rust implementation, it is planned to use the tower-lsp crate instead of the pygls Python module.

More badges

Python badge Packager: uv Linter/Formatter: ruff Type checker: ty

References

Metadata

Release files for ssh-config-ls 0.10.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ssh-config-ls 0.10.2
File Size Uploaded Provenance Actions
ssh_config_ls-0.10.2.tar.gz 13.1 kB Without provenance Details for ssh_config_ls-0.10.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ssh-config-ls 0.10.2
File Interpreter ABI Platform Actions
ssh_config_ls-0.10.2-py3-none-any.whl Python 3 none any Details for ssh_config_ls-0.10.2-py3-none-any.whl

Total release size: 29.1 kB

Release files / ssh_config_ls-0.10.2.tar.gz

Download URL ssh_config_ls-0.10.2.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
96efff8c53c1dfaaca1bc5f8cab71636065828fee186bff33092e1ad34f4ecdd
BLAKE2b-256 checksum
How to use checksums
699bae194ddf1278522e7f6b814ba36752fa38e61e56fb72b1fe11a60da55c1b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.23.7","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / ssh_config_ls-0.10.2-py3-none-any.whl

Download URL ssh_config_ls-0.10.2-py3-none-any.whl
Size 16.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
590046874f78a5cd3e1ee8d26983e2c78cee8a7ff880bf10662c500cd056b693
BLAKE2b-256 checksum
How to use checksums
396d8988609335aa0139df45fcb1be82170b4a2fb8b8abb5f792c2d6448a751f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.23.7","id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for ssh-config-ls 0.10.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page