VS Code extension for {log}.
Highlights
- Language support: syntax highlighting & snippets for
.pl/.slog. - Verification: generate and (optionally) check verification conditions (VCs), surface errors as diagnostics.
- Simulation: run default or custom simulation operations, with optional ground solutions.
- Configuration: toolbar indicators, a side-panel settings view, and bidirectional config file sync.
Quick Navigation
(Click to collapse)
- {log} for VS Code
Prerequisites
- VS Code (v1.102 or latter) installed.
- Java SE (v21 or latter) installed and available on your
PATH. - SWI-Prolog (v10.0.1 or latter) installed and available on your
PATH.
Installation
From the Visual Studio Code Marketplace
- Open Visual Studio Code.
- Navigate to the Extensions view (
Ctrl+Shift+Xon Windows/Linux,Cmd+Shift+Xon macOS). - Search for Setlog and click Install.
From a VSIX file
- Download the latest released
.vsixfile from the repo.- On the right side panel select Releases → link below Other to download the latest available .vsix file.
- Install it:
- GUI: Extensions → Install from VSIX… → choose the file → Install.
- CLI:
code --install-extension path/to/vscode-setlog-X.Y.Z.vsix
After installation
The extension activates automatically every time you open any .pl or .slog file.
After opening a file, you should see (1) the new extension toolbar buttons in the editor title bar and (2) the new side panel with the icon {L} that shows the current settings of the extension.
Toolbar buttons (editor title bar)
When editing a .pl / .slog file, the following buttons appear in the top-right corner of the editor:
| Icon | Name | Meaning |
|---|---|---|
| VCG | Verify Conditions | Generate (and optionally check) VCs. Available only for .pl and .slogfiles. |
| SIM | Simulate | Run a simulation operation. Available only for *-sim.pl files. |
| CON | Consult | Load and check the type declarations of the specification contained in a .pl or .slog file |
| >- | {log} Terminal | Open an interactive {log} terminal |
| {L} | {log} setup | Setup {log} system. If (green) then it uses the bundle version. Otherwise (purple) uses a custom version. Click icon to change setup. |
| ✅ | Config file | Config file active and paired. Click icon to read and edit it |
Side panel ({log} Tools)
Click the {log} Tools icon in the Activity Bar (left sidebar) to open the configuration panel. All settings are clickable and update immediately.
| Setting | Description | Default |
|---|---|---|
| Execution Mode | rsetlog (recommended), term, or termR |
rsetlog |
| Help | Show additional usage insights | Off |
| Max VC Execution Time | Timeout for VC checking (ms, 0 = no limit) | 60000 |
| Max Total Execution Time | Global execution timeout (ms, 0 = no limit) | 60000 |
| History | Save command history | On |
| Type Check | Include type checking during consult | On |
| Auto Consult | Automatically consult on file save | On |
| Mode | Output verbosity: quiet, verbose, or debug |
quiet |
| JSON | Output results as JSON | Off |
| Output File | Redirect output to a .txt file |
None |
| Max Depth | Maximum number of levels of nesting in a compound term that are displayed before the remaining sub-terms are replaced with an ellipsis (...) (0 = unlimited) | 10 |
| {log} | Shows default version of {log} used by the extension | v.499-1g |
| Path | Copy the file path of the setlog.pl version you are currently using to your clipboard | - |
| Config | Indicates the setlogj.conf file to use for custom configuration. More information below in section Configuration |
None |
| Groundsol | Force concrete ground solutions in simulations | On |
Getting started
- Open a workspace/folder containing your {log} files.
- Open a
.pl(or.slog) file. The extension activates automatically. - Use the toolbar buttons or the Command Palette (
Ctrl+Shift+P):- {log}: Consult File — load and check your specification
- {log}: Verify Conditions — generate and optionally check VCs
- {log}: Check VCs — check an existing
*-vc.plfile - {log}: Simulate — run a simulation with default or custom operation
- Results appear in dedicated Output Channels:
- Setlog Consult Results
- Setlog VCG Results
- Setlog check VCS Results
- Setlog Simulation Results
- Errors appear in the Problems panel. Clicking a diagnostic jumps to the source line.
Workflows
Below a summary of the most representative use cases you may face with. Consult the User Guide for more details.
Consulting a file
To check the syntax and types of your specification:
- Click the CON button in the editor toolbar, or
- Simply save the file (auto-consult is enabled by default).
A successful consult shows the clauses stored and __R = success. in the output channel.
Generating and checking VCs
- Open your specification file (e.g.
bb.pl). - Click the VCG button in the toolbar.
- Choose "Yes, check VCs" to immediately verify, or "No" to only generate the
*-vc.plfile. - Results (e.g.
birthdayBookInit_sat_birthdayBookInv ... OK) appear in the VCG output channel. - You can later re-check VCs by opening the
*-vc.plfile and clicking the Check VCs button that appears.
Running a simulation
- Create a simulation file (e.g.
bb-sim.pl)::- notype_check. :- consult('bb.pl'). simulate_adding_someone(K, B, K_, B_, FoundDate, NewName, NewDate, Msg1, Msg2, Msg3) :- birthdayBookInit(K, B) & addBirthday(K, B, messi, 2406, K1, B1, Msg1) & addBirthday(K1, B1, pele, 2310, K2, B2, Msg2) & findBirthday(K2, B2, messi, FoundDate, K2, B2) & addBirthday(K2, B2, NewName, NewDate, K_, B_, Msg3). - Open the file and click the SIM button, or click Run Simulation above the predicate (CodeLens).
- Choose Use Default Operation or Provide Custom Operation.
- Results appear in the Simulation output channel.
Tip: Enable Groundsol in the side panel to get concrete values instead of constraints.
Using the interactive terminal
Click the >- icon in the toolbar to open a dedicated {log} terminal. This is useful for:
- Typing goals directly at the
{log}=>prompt - Using
groundsolinteractively before running simulations - Exploring your specification step by step
Configuration
The {L} side panel shows the current configuration on which the extension operates.
Clicking on each setting of the configuration allows to change its value.
Configuration file
To allow to share a configuration along with the {log} specification and related simulation files, the extension provides a feature to export the configuration settings into a file.
This file must be named setlogj.conf and contain a value for each configuration setting.
Once a setlogj.conf is set, the extension makes a bidirectional sync between the indicated setlogj.conf file and the {log} settings. This allows to change the configuration either by editing the file content or using the {L} side panel.
The extension provides features to support the life cycle of a setlogj.conf files. Clicking on the Config setting it allows to:
- Set: links an existing
setlog.conffile with the {log} settings - Create: creates a new
setlog.confwith default values - Edit: changes the content of the
setlog.confbeing used - Reset: sets the content of the
setlog.conffile to its default value - Default: removes binding with
setlog.confand sets {log} settings to their default values.
Config file keys
| Config key | Type |
|---|---|
tout |
natural number (ms) |
vcgTimeout |
natural number (ms) |
mode |
quiet / verbose / debug |
typeCheck |
true / false |
noHistory |
true / false |
help |
true / false |
json |
true / false |
outputFile |
file path or empty |
maxDepth |
natural number |
groundsol |
true / false |
executionMode |
rsetlog / term / termR |
autoConsult |
true / false |
Example
# setlogj configuration file
tout 60000
vcgTimeout 60000
mode quiet
typeCheck true
noHistory false
help false
json false
outputFile
maxDepth 10
groundsol true
executionMode rsetlog
autoConsult true
Important: Configuration for the {log} version is handled separately and is not included in
setlog.conf. See the following section for more information
Configuring the {log} version
As {log} is a standalone product and may evolve at a different pace than this VS Code extension, users can change the specific version of {log} being used.
The {L} side panel allows you to see which version of {log} is currently active.
To switch to a different version, simply click on the current version and browse to the setlog.pl file for the version you wish to use. You may also enter the file path directly.
To return to the built-in version that comes with the extension (the default), select the Clear Path option.
The {L} icon in the toolbar allows you to perform these same operations. When a custom version of {log} is set, the icon turns purple. While using the built-in version, it remains green.
Troubleshooting
- "Please open a Setlog file first": The extension does not detect a
.plor.slogfile. Click on your code editor area so VS Code focuses on the file. - "Java not found": Ensure
java -versionworks in your terminal and Java is on yourPATH. - SWI-Prolog path errors: Use {log}: Set SWI-Prolog Path from the Command Palette to configure the path to your
swiplbinary. - Output missing: Check the Setlog … Results output channels and the Problems panel.
- Language server didn't start: Look in Help → Toggle Developer Tools → Console and the extension host log.
- Headless/CI tests: Use
xvfb-run -aon Linux. - Extension not activating: Ensure the file extension is
.plor.slog. The extension activates ononLanguage:setlog.
Uninstall & cleanup
The process for disabling or uninstalling the {log} VS Code extension is the same as for any other extension.
Temporary files are stored within VS Code's global storage specific for this extension.
Upon deactivation or uninstallation, the extension executes java -jar server/setlogj.jar deltmp to remove the temporary folders.
If Java is missing or the command is blocked, VS Code will still clear the extension's storage directory upon uninstallation.
Contributing
We love contributions! Whether you're fixing a bug, improving documentation, or suggesting a new feature, your help makes this project better for everyone. To maintain a high quality of code and a friendly environment, please check out our Contributing Guidelines before you get started.
Notice
It is licensed under Apache License, Version 2.0.
Setlog-vscode was created by Mykyta Yampolskyi, and Alfredo Capozucca.
It is currently maintained by Alexandre Tinouert.
See CONTRIBUTING.md to know how you can contribute to the project.