Editor integration: lsp

lsp serves the Language Server Protocol 3.17 over TCP while the database is open. An editor or an agent connects to the port. There is no server program. Select io as well.

SettingPurposeDefaultRange
portTCP port. Without it, the first free port from 1980 up. With 0, the system selects a free port.19800–65,535
hostIP address to bind.127.0.0.1IP address
port-fileFile that receives the bound port.nonepath

The socket has no authentication. A peer that connects can evaluate code and write the database with the access of the process that opened it. When the database opens, it writes a warning to standard error. Bind to a loopback address if the network is not trusted.

Dependencies

  • Requires io

Configuration

Select this plugin explicitly when opening the database:

json119 B
{
  "plugins": {
    "stdlib": true,
    "io": true,
    "database": true,
    "lsp": {
      "port": 1980
    }
  }
}

Usage

Connect the editor to the port. Without port, the plugin uses 1980, or the next free port when a different process uses 1980. A configured port that is in use refuses the open. The startup warning, stardust/status and port-file give the bound port. The plugin sends each database operation as an ordinary request, with the same workers, sessions and request capacity as the host. When every request slot is busy, an editor request waits in the plugin and runs when a slot becomes free. Waiting database operations start in the order that they were queued. Each ready operation of a multi-step command joins the end of that queue. A request can wait for as long as every slot stays busy, for example while live queries hold all the slots. $/cancelRequest or the end of the connection removes a waiting request. stardust/status reports the port and the open connections.