Metadata-Version: 2.1
Name: lspleanklib
Version: 0.3.1
Summary: LSP proxy and library to link LSP-enabled editors to Lake LSP servers
Author-email: Castedo Ellerman <castedo@castedo.com>
License: MIT License
        
        Copyright (c) 2026 E. Castedo Ellerman
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be
        included in all copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
        FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
        DEALINGS IN THE SOFTWARE.
        
Keywords: lean,lsp,language-server-protocol,jsonrpc
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: POSIX
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Provides-Extra: crossplatform
Requires-Dist: platformdirs; extra == "crossplatform"

Lspleanklib
===========

This repository is online at both:

* [gitlab.com](https://gitlab.com/castedo/lspleanklib) for active development
* [github.com](https://github.com/castedo/lspleanklib) as a mirror


Lspleanklib is a low-level library that implements functionality used by
[Webleank](https://gitlab.com/castedo/webleank/), including:

* LSP (Language Server Protocol)
* JSON-RPC
* Multiplexing multiple `lake serve` workspace sessions into a single unified editor LSP session
* Connecting to `lake serve` via local UNIX domain sockets
* Running `lake serve` outside the editor process
* Proper reading of stdin with Python asyncio

There are no required dependencies on Linux and macOS. However, Windows requires the Python
package `platformdirs` to be installed. The pip install package specification
`lspleanklib[crossplatform]` will add `platformdirs` as a requirement.

This package also includes two CLI utilities for advanced usage:
* `lspleank`: an LSP server used by Webleank to run inside an editor process
* `lakelspout`: a stdio LSP proxy that adapts Lake LSP to Leank LSP

For more information, visit [Webleank](https://gitlab.com/castedo/webleank) and
[lean.castedo.com](https://lean.castedo.com).


Leank LSP Reference
-------------------

[Leank LSP Reference](docs/leank-lsp.md)


CLI Reference
-------------

The `lspleank` and `lakelspout` programs provide low-level functionality.
For reference information on the high-level program `webleank`,
see [the Webleank README](https://gitlab.com/castedo/webleank).


### Lspleank

Lspleank is an LSP server. It runs as a subprocess, communicating with an editor via
stdio.

```
$ lspleank -h
usage: lspleank  [-h] [--version] {connect,lake,stdio} [-- external_command ...]

Stdio LSP server multiplexing one or more Lake LSP servers.

positional arguments:
  {connect,lake,stdio}
    connect             connect to an lspleank socket service after starting it with the external command
    lake                internally use lakelspout to run Leank LSP servers
    stdio               use the external command to run stdio Leank LSP servers

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
```

#### Subcommand `connect`

Runs as a Leank client (and LSP server), connecting to a Leank server via an *lspleank
socket*. The command following `--` is used to start a Leank server if needed.

#### Subcommand `lake`

Runs as an LSP client to `lake serve` (and as an LSP server to the editor).
The command following `--` may be used as an alternative to `lake serve`.
The command
```
lspleank lake
```
is functionally equivalent to
```
lspleank stdio -- lakelspout stdio
```

#### Subcommand `stdio`

Runs as a Leank client (and LSP server) and executes the command following `--`
as a stdio Leank server.


### Lakelspout

Lakelspout is a Leank service/server.
Editors use Leank clients such as `lspleank` or `webleank` to connect to `lakelspout`
processes.

```
$ lakelspout -h
usage: lakelspout  [-h] [--version] {stdio} [-- lake_serve_command ...]

Adapt a Lake LSP server as a Leank service/server.

positional arguments:
  {stdio}
    stdio               run as a stdio Leank LSP server

options:
  -h, --help            show this help message and exit
  --version             show program's version number and exit
```

#### Subcommand `stdio`

Runs as a Leank LSP server.
By default, `lake serve` will be adapted.
The optional command following `--` can be used as an alternative to `lake serve`.
