SPIDER for VSCode, other editors, and the command line
SPIDER helps you find problems in SICStus Prolog code while you edit.
In Visual Studio Code and other supported editors, you can also jump to
predicate definitions, find references, complete predicate names, view
documentation, and rename predicates and variables.
For VSCode, install the extension below.
For Emacs and other editors, use the
standalone language server: a background program that connects SPIDER's
analysis to your editor through the Language Server Protocol (LSP).
The same download can check files from the command line,
without an editor. Available editing features depend on your editor's LSP support.
These tools analyze source code. For an integrated SICStus top level,
debugger, profiling, and coverage tools, see SPIDER for Eclipse.
Downloads and requirements
Both downloads run on Windows, macOS, and Linux with Java 21 or
newer. Check your installation with java -version.
Java and SICStus Prolog are not included.
- Download
SICStus Prolog for VSCode 0.0.1 (VSIX).
Choose this download if you use desktop VSCode 1.91 or newer.
It includes the language server; you do not need the standalone ZIP as well.
- Download
SPIDER language server 0.0.79 (ZIP).
Choose this download for Emacs, other editors with LSP support, or
command-line checking. Extract the ZIP into a folder of your choice and
keep all its JAR files together. The included README has additional editor
setup examples. No separate installation step is needed.
A SICStus Prolog installation is recommended: configure its
library directory, which contains devsys_info.
Without it, analysis still runs, but references to library predicates may
be reported as undefined and documentation for those predicates may be missing.
The server does not run your Prolog program.
Examples below use /opt/spider-cli-0.0.79
and /usr/local/sicstus/library. Substitute your installation
paths; quote paths containing spaces. On Windows you can use paths such as
C:/spider-cli-0.0.79/spider-cli.jar.
If you do not have a SICStus installation, omit --library and
the directory immediately following it from the commands below.
Optional: verify your download
You can check that your downloaded file is complete and matches the file
we published. This is optional and does not install anything.
- Open the list of SHA-256 checksums
and find the line for the file you downloaded.
- In a terminal, change to the folder containing your download and run the
command for your system. These examples check the VSCode extension;
if you downloaded the standalone server, replace the filename with
spider-cli-0.0.79.zip.
Linux:
sha256sum sicstus-prolog-0.0.1.vsix
macOS:
shasum -a 256 sicstus-prolog-0.0.1.vsix
Windows PowerShell:
Get-FileHash .\sicstus-prolog-0.0.1.vsix -Algorithm SHA256
- Compare the hash printed by the command with the hash next to your
filename in the checksum list. They should match (uppercase and lowercase
letters are equivalent). If they differ, download the file again before
installing or using it.
Visual Studio Code
- Download the VSIX above. In the Extensions view, open the “…”
menu, choose Install from VSIX..., and select the file.
Alternatively, with VSCode's
code command on your PATH:
code --install-extension sicstus-prolog-0.0.1.vsix
See also VSCode's installation instructions.
- Open your project folder and a Prolog file. If the language indicator says
Perl, change it to SICStus Prolog.
- If you have SICStus installed, open VSCode Settings and set
sicstus.libraryDirectory to its library directory.
For example, use Preferences: Open User Settings (JSON)
from the Command Palette and add these settings to your existing configuration:
{
"sicstus.libraryDirectory": "/usr/local/sicstus/library",
"files.associations": { "*.pl": "prolog" }
}
Replace the library path with your own. The files.associations
setting makes VSCode open .pl files as Prolog rather than Perl.
If VSCode cannot find Java 21 or newer, also set sicstus.java
to the full path of a suitable Java executable.
With Remote SSH, WSL, or development containers, install the extension and
Java in that environment and use the library path available there.
Use the Problems panel for diagnostics, hover for documentation,
Go to Definition and Find All References for navigation, and F2 to rename.
The command SICStus Prolog: Change Signature... can also add,
remove, and reorder predicate arguments. That dialog is specific to VSCode.
The extension's Details page contains its full README, including settings
for file search paths, diagnostic severities, and .spider_data.
To update, download the new VSIX and install it in the same way; reload
VSCode when prompted. Uninstall from the Extensions view, or run
code --uninstall-extension sics.sicstus-prolog.
Emacs and other editors
Download and extract the standalone ZIP above. Your editor needs LSP
support, either built in or provided by an extension. For Emacs, follow the
Eglot example below. For another editor, configure its
LSP support to start SPIDER with this command:
java -jar /opt/spider-cli-0.0.79/spider-cli.jar --library /usr/local/sicstus/library --stdio
Configure the client for Prolog files (LSP language ID prolog)
and open your project's folder as its workspace. The editor starts the server
and communicates with it over standard input and output. If you run this
command directly in a terminal, it will wait for messages from an LSP client.
Emacs with Eglot
Eglot is included in Emacs 29 and later. Add this to your Emacs configuration,
adjusting the paths:
(with-eval-after-load 'eglot
(add-to-list 'eglot-server-programs
'(prolog-mode . ("java" "-jar"
"/opt/spider-cli-0.0.79/spider-cli.jar"
"--library" "/usr/local/sicstus/library" "--stdio"))))
(add-to-list 'auto-mode-alist '("\\.pl\\'" . prolog-mode))
Open a Prolog buffer in your project and run M-x eglot.
Use M-x xref-find-definitions for definitions and
M-x eglot-rename to rename. To start automatically, add
(add-hook 'prolog-mode-hook #'eglot-ensure).
See the Eglot server setup manual.
Optional project settings
If your project uses symbolic file search paths, or you want to adjust
which problems are reported, supply settings under sicstus.
For example:
{
"sicstus": {
"fileSearchPath": { "mylib": "/path/to/mylib" },
"diagnosticSeverities": { "undefined-predicate": "error" }
}
}
These configure symbolic paths such as mylib(file) and the
severity of diagnostics. The exact place to enter these settings depends on
your editor, which must support LSP's workspace/configuration
requests. The README in the extracted ZIP has configuration examples for
Eglot, lsp-mode, Neovim 0.11+, Helix, and Sublime Text's LSP package.
These settings apply to editor use; the command-line checker does not read them.
Projects configured for Eclipse can reuse their existing
.spider_data files with the language server.
Command-line checking
Download and extract the standalone ZIP above. In a terminal, change to
your Prolog project's folder and run the following command, replacing
main.pl and utils.pl with the files you want to check:
java -jar /opt/spider-cli-0.0.79/spider-cli.jar --library /usr/local/sicstus/library main.pl utils.pl
Diagnostics are written to standard error as
file:line:column: severity: message. Nothing is printed if no
problems are found. Loaded files are analyzed too; diagnostics are reported
for named files and loaded files inside a configured workspace.
To check a whole project and fail a script or CI job on warnings or errors:
java -jar /opt/spider-cli-0.0.79/spider-cli.jar --library /usr/local/sicstus/library --workspace /path/to/project -Werror
--workspace dir: without file arguments, check Prolog files in that workspace.
-Werror: exit with status 1 if warnings or errors are reported.
Without it, reported diagnostics do not by themselves cause a nonzero exit status.
Invalid command lines also exit with status 1.
-Wno-warn: report errors only.
-Winfo: also report informational findings.
--help and --version: show options and version.
Extra Java options go before -jar, for example
java -Xmx4g -jar ... for a larger heap.
AI agents and automation
To let an AI coding agent check its changes, give it the path to the
extracted server and the command from Command-line checking.
Ask it to run the checker after editing Prolog files and read the reported
warnings and errors. Include -Werror so its command fails when
problems are reported. Name individual files for a focused check, or use
--workspace to check the project.
If your agent supports language servers, configure it with the same
command as an editor's LSP client. It can then use
SPIDER for navigation, problem checking, and supported refactorings.
Consult the agent's documentation for where to enter this command.
Agents that only support MCP servers should use the command-line checker
through their shell tool; SPIDER does not provide an MCP connection.
Troubleshooting
- Check
java -version: Java 21 or later is required.
- Keep
spider-cli.jar and every dependency JAR from the ZIP together.
Try java -jar /path/to/spider-cli.jar --version.
- If library predicates are undefined, check the configured library path
and that it contains
devsys_info.
- In VSCode, select SICStus Prolog in View → Output.
For more detail set
sicstus.trace.server to verbose.
- In other clients, inspect their LSP log and confirm that the file is in
Prolog mode. Try the command-line checker on the same file.
|