Did you know ... Search Documentation:
Packs (add-ons) for SWI-Prolog

Package "prolog_lsp"

Title:Implementation of Language Server Protocol for Prolog
Rating:Not rated. Create the first rating!
Latest version:0.0.10
SHA1 sum:c880a92057394f03b8a429e46872da4efd46d90c
Author:Phil Hargett <phil@haphazardhouse.net>
Maintainer:Phil Hargett <phil@haphazardhouse.net>
Packager:Phil Hargett <phil@haphazardhouse.net>
Home page:https://github.com/hargettp/prolog_lsp
Download URL:https://github.com/hargettp/prolog_lsp/releases/*.zip
Requires:log4p
Provides:prolog_lsp

Reviews

No reviews. Create the first review!.

Details by download location

VersionSHA1#DownloadsURL
0.0.1fbd96604abab185f7cc1f363c76ef9acffb2c86b1https://github.com/hargettp/prolog_lsp.git
0.0.2ba8332ab694455eea14bce6d533ec6ddeb2e01751https://github.com/hargettp/prolog_lsp.git
c0484a9ef9d03de9ef65d1769bd424ba68333d031https://github.com/hargettp/prolog_lsp.git
0.0.6090f941458e68f0f8592a7275591e7a80c6204031https://github.com/hargettp/prolog_lsp.git
10010ce616fba7b47faad3507d22d89b054bde741https://github.com/hargettp/prolog_lsp.git
5e5415804faee674758530695f34fb878f8c6b8514https://github.com/hargettp/prolog_lsp.git
89ffbfe3e368686715cd86e137e43dfdd0d14a412https://github.com/hargettp/prolog_lsp.git
92c981a8c5f2375c6065b397bc216bdba101d3886https://github.com/hargettp/prolog_lsp.git
937e58e65b83457b6d324862a26eada60205a3e52https://github.com/hargettp/prolog_lsp.git
df5eb8aae1dcc4573c474b4db5d0e57e5ccc95c76https://github.com/hargettp/prolog_lsp.git
0.0.10c880a92057394f03b8a429e46872da4efd46d90c184https://github.com/hargettp/prolog_lsp.git

Prolog Language Server

An implementation of the Language Server Protocol written in Prolog to support a language server for Prolog applications.

This is written for SWI-Prolog, and employs predicates specific to that implementation.

Getting Started

There are 2 implementations within this package:

  • stdio - it reads request from stdin and writes responses out to stdout, with logging and diagnostics on stderr. Eventually, this would be the backend for IDE or editors plugins (e.g., in VS Code).
  • tcp - it creates a server on the specified port and listens for new connections, handling requests and responses on each connection in separate threads. To load using the SWI-Prolog manager and download the latest tagged version, in a SWI-Prolog console type:

    pack_install(prolog_lsp)

    To load from a locally cloned copy of this repository:

    pack_install('.')

Run stdio server

Once installed, running the following lines will start a stdio language server in the same process as the SWI-Prolog console. Note that this call will not return until the server exits, a signal is fired, or Ctrl-C is hit.

use_module(library(prolog_lsp)).
run_stdio_language_server.

Run tcp server

Similar to the stdio server, these lines will run the TCP server locally on the specified port. Note that this call will return once the server starts in a separate threads, so it becomes possible to interact with the server in the same process. The port in this example is 3101, but the choice is arbitrary and can be available port number.

use_module(library(prolog_lsp)).
start_tcp_language_server(3101)

Developing

For development, the easiest path may be to clone the git repository, then run either the explicit local package installation above, or use the test.pl to both load the package and run its unit tests.

[test]

Status

This project is very immature and not at all recommended for daily production use. Happy to discuss contributions!

Contents of pack "prolog_lsp"

Pack contains 52 files holding a total of 86.3K bytes.