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.6
SHA1 sum:89ffbfe3e368686715cd86e137e43dfdd0d14a41
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.65e5415804faee674758530695f34fb878f8c6b8514https://github.com/hargettp/prolog_lsp.git
89ffbfe3e368686715cd86e137e43dfdd0d14a412https://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 49 files holding a total of 72.8K bytes.