Skip to main content

SSH-config Language Server (sshls)

Python badge PyPI MIT License

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

prek

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.

References

Release files for ssh-config-ls 0.10.1

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.1
File Size Uploaded
ssh_config_ls-0.10.1.tar.gz 12.1 kB Details

Built distribution (wheel)

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

Total release size: 28.0 kB

Release files / ssh_config_ls-0.10.1.tar.gz

Download URL ssh_config_ls-0.10.1.tar.gz
Size 12.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e95b140e0ccf1615062cc4b4bdc8ceb985523a5be86b318b5a68475df7c59560
BLAKE2b-256 checksum
How to use checksums
18b19800d8e5166692602abe0fe3c04254f53cdc0ce5558e06c264d1e122a1df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Alpine Linux","version":"3.23.5","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.1-py3-none-any.whl

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

Release history Release notifications | RSS feed

This release

0.10.1 This release

2 release files

0.10.0

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.2

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.7

2 release files

0.7.6

2 release files

0.7.5

2 release files

0.7.4

2 release files

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