Swiftpack.co - JCWasmx86/Swift-MesonLSP as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by JCWasmx86.
JCWasmx86/Swift-MesonLSP v2.4.3
An unofficial, unendorsed language server for meson written in Swift.
⭐️ 13
🕓 5 days ago
macOS linux iOS
.package(url: "https://github.com/JCWasmx86/Swift-MesonLSP.git", from: "v2.4.3")


Copr build status AUR Version codecov

A reimplementation of my Meson language server in Swift.

Current feature set

  • Hovering (Documentation often copied verbatim/minimally modified from mesonbuild, CC BY-SA 4.0, same for the entire Sources/MesonDocs directory due to ShareAlike)
  • Symbol resolving
  • Jump-To-Definition
  • Jump-To-Subdir
  • A basic set of diagnostics
  • Formatting
  • Document symbols
  • Autocompletion (Somewhat working)
  • Inlay hints
  • Highlighting
  • Automatic subproject/wrap downloads
  • Code actions
  • Renaming

Auto Completion Diagnostics Hover Hover Inlay Hints Special integration for pkg-config


  • set_variable/get_variable with non-constant variable name will fail in more complex cases. See here for working patterns
  • subdir with non-constant subdir name will fail in more complex cases. See here for working patterns
  • Type deduction is not 100% correct yet
  • Type definitions may have minor errors regarding:
    • Is this argument optional?
    • What is the type of the argument?

Why a reimplementation?

The first version, written in Vala, had some code maintenance problems because basically everything was done in one file. I had the choice between untangling that mess or rewriting it as cleanly as possible. I have chosen the latter because I wanted to learn Swift.


Install the language server

Easy way

Compile from source

git clone https://github.com/JCWasmx86/Swift-MesonLSP
cd Swift-MesonLSP
swift build -c release --static-swift-stdlib
sudo cp .build/release/Swift-MesonLSP /usr/local/bin

Or you can use podman (Maybe even docker, but only podman is tested):

DOCKER_BUILDKIT=1 podman build --file docker/Dockerfile --output out --no-cache .
# If you want to use Ubuntu 22.04 as docker image
DOCKER_BUILDKIT=1 podman build --file docker/Dockerfile.ubuntu --output out --no-cache .
# If you want to use Ubuntu 18.04 as docker image
DOCKER_BUILDKIT=1 podman build --file docker/Dockerfile.ubuntu1804 --output out --no-cache .
# If you want to use Ubuntu 20.04 as docker image
DOCKER_BUILDKIT=1 podman build --file docker/Dockerfile.ubuntu2004 --output out --no-cache .

This will place a file "Fedora37.zip" (Or Ubuntu22.04.zip) in the directory out. It contains two statically linked binaries. Copy Swift-MesonLSP to /usr/local/bin.

A debug build is provided, too. Just rename it from Swift-MesonLSP.debug to Swift-MesonLSP and copy it to the right destination.

Connect with your editor


Install this fork of vscode-meson: https://github.com/JCWasmx86/vscode-meson

GNOME Builder 45 and GNOME Builder Nightly

You have to do nothing. The editor already has the support code for Swift-MesonLSP. All you have to do is installing the language server.


Add this JSON to ~/.config/kate/lspclient/settings.json:

  "servers": {
    "meson": {
      "command": [
      "rootIndicationFileNames": [
      "url": "https://github.com/JCWasmx86/Swift-MesonLSP",
      "highlightingModeRegex": "^Meson$"

After that, a dialog should be shown asking you to confirm that the language server may be started.


Add this JSON to :CocConfig:

    "languageserver": {
        "meson": {
            "command": "Swift-MesonLSP",
            "args": ["--lsp"],
            "rootPatterns": ["meson.build"],
            "filetypes": ["meson"]

Want to contribute?

Take an item from the TODO list in PROGRESS.md and work on it. Feel free to join the matrix channel #mesonlsp:matrix.org


  • ConsoleKit - APIs for creating interactive CLI tools. (Used the loghandler from there to have nice logs)
  • Perfect-INIParser - A lightweight INI file parser in Server Side Swift
  • sourcekit-lsp - Language Server Protocol implementation for Swift and C-based languages. (I used the JSONRPC definitions from them)
  • SWCompression - A Swift framework for working with compression, archives and containers.
  • swift-argument-parser - Straightforward, type-safe argument parsing for Swift
  • swift-crypto - Open-source implementation of a substantial portion of the API of Apple CryptoKit suitable for use on Linux platforms.
  • Swifter - Tiny http server engine written in Swift programming language.
  • swift-log - A Logging API for Swift
  • swift-backtrace - Backtraces for Swift on Linux and Windows
  • SwiftTreeSitter - Swift API for the tree-sitter incremental parsing system
  • tree-sitter-meson - A tree-sitter grammar for meson.build files. Forked and enhanced by me.

Projects I tested the language server with


Stars: 13
Last commit: 6 hours ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Release 2.4.3
6 days ago

Attempts to fix build on Arch Linux and Fedora 39

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics