Logtalk for VSCodeA VSCode extension which provides language support for Logtalk. Forked from the original plugin by Arthur Wang. Requires Logtalk 3.81.0 or later and a supported Prolog backend. 🙏 Sponsored by Permion and GitHub Sponsors. Installation | Features | Configuration | Known Issues | Development | Acknowledgements | Licence InstallationThis extension can be installed directly from VSCode, from its Marketplace, or by downloading its This extension must be configured before it can be used. Notably, the following settings are required:
For details, see Configuration. This extension includes a walkthrough that can be accessed from the VSCode "Welcome" page after installing the extension. The walkthrough can also be accessed from the command palette using the command "Welcome: Open Walkthrough...". FeaturesSyntax highlighting
Indentation, snippets and auto-completion
Note: Relations between entities use choice snippets: The snippets for built-ins all are triggered by natural prefix, i.e. Refer to the table below for other snippets:
Linter
CommandsMost commands, notably those that run the developer tools, require the code to be loaded, typically by opening the project loader file and selecting the "Load File" menu or context menu item. Project commandsProject (or workspace) commands can be triggered from command palette via entering 'Logtalk' to pop up the list of all commands of this extension. Alternatively, these commands can be triggered from the explorer/context menu via right click (Ctrl+click on Windows and Linux, Cmd+click on macOS) in a Logtalk source file in the Explorer.
The "Load Project" command looks for a The output of the When running the workspace commands from the command palette (instead of using the explorer context menu on a folder or file), the commands resort to the first workspace folder. Directory and source file commandsThese commands can be triggered from the editor/context menu via right click in the editor area. These commands can also be triggered from command palette assuming there's an active editor window.
The "Load Directory" command looks for a The "Run Tests" command adds failed tests to the "PROBLEMS" pane. Logtalk (integrated terminal) process commandsThese commands don't depend on the directory of a file selected by right clicking in a workspace file or in an active editor window but only on the Logtalk process running in the integrated terminal. They can be triggered from the editor/context menu via right click in the editor area or from the command palette.
Code NavigationCode navigation features require the code to be loaded, typically by using the "Load Project" command or by opening the project loader file and using the "Load File" command from the editor/context menu. Additionally, code must be compiled with the Go to DeclarationClick in a predicate name and select the "Go to Declaration" menu or context menu item to go to the predicate scope directive. Go to DefinitionClick in a predicate name in a goal or Go to Type DefinitionEntities (objects, protocols, and categories) are interpreted as types. Click in an entity name and select the "Go to Type Definition" menu or context menu item to go to the entity opening directive. Go to ReferencesClick in a predicate name in a scope directive, goal, or Click in an entity name in an entity opening directive to find references to it in other entity opening directives (i.e. entities in an implementing, importing, complementing, extending, instantiating, or specializing relation with the with the selected entity), Go to ImplementationsClick in the middle of a predicate name in a scope directive and select the "Go to Implementations" or "Find All Implementations" menu or context menu items. Note that you can go to a predicate scope directive by clicking the predicate name in a goal and selecting the "Go to Declaration" menu or context menu item. Click in a protocol name in its entity opening directive to find implementations of the protocol. Note that you can go to an entity opening directive by clicking in an entity name and selecting the "Go to Type Definition" menu or context menu item. Go to Symbol in Editor...Symbols include object, protocol, and category identifiers in entity opening directives plus predicate (and non-terminal) indicators in predicate scope directives. Note that VSCode doesn't support customization of symbol kind names and icons, thus forcing adapting the pre-defined names and icons. This feature doesn't require the code to be loaded. Assumes that a single predicate (or non-terminal) is declared per scope directive. Go to Symbol in Workspace...Symbols include object, protocol, and category identifiers in entity opening directives plus predicate (and non-terminal) indicators in predicate scope directives. Note that VSCode doesn't support customization of symbol kind names and icons, thus forcing adapting the pre-defined names and icons. This feature doesn't require the code to be loaded. Assumes that a single predicate (or non-terminal) is declared per scope directive. Show Call HierarchyClick in the middle of a predicate name in a goal or in a clause head and select the "Show Call Hierarchy" context menu item to browse callers and callees of the selected predicate. Note that callers and callees that can only be resolved at runtime (e.g. in a message to self goal or when dynamic predicates are used) may not be returned. Show Type HierarchyClick in the middle of an entity name and select the "Show Type Hierarchy" context menu item to browse ancestors and descendants of the selected entity. Here, ancestor is interpreted as any entity from which the selected entity inherits and descendant is interpreted as any entity that inherits from the selected entity. Debugging supportWhen debugging in the integrated terminal using the Spy points, log points, and conditional breakpoints can be added and removed using the "Run" menu breakpoint items. Function breakpoints are interpreted as predicate (or non-terminal) spy points by entering a predicate indicator (or a non-terminal indicator) or as context spy points by entering a Although VSCode support it, a breakpoint cannot be a combination of log point, conditional breakpoint, and hit count breakpoint. If you edit a breakpoint, you must keep its singular type. Changes to spy points via user-typed queries in the integrated terminal are not reflected in the VSCode display of current breakpoints. A particular case is when, at a leashed port, you enter the Hover contentsHover contents is provided for built-in directives, built-in predicates, and built-in methods. ConfigurationThe user can configure settings via VSCode menu On Windows, use forward slashes in settings that require paths. Also on Windows, PowerShell 7.3.x or later is required for settings that call scripts. Use the On a POSIX system (e.g. macOS, Linux, or BSD), use the For settings that specify scripts, see their man pages for their available options. Logtalk home and user paths
No defaults (VSCode doesn't support using environment variables to define settings). Must be set to the Logtalk executable
Logtalk executable or integration script plus its arguments. On POSIX systems (e.g. macOS, Linux, or BSD), the
On Windows systems, use the absolute path to the Prolog backend executable and then set the arguments to load Logtalk (look into the properties of the Logtalk integration shortcuts that are available from the Start Menu after installing Logtalk). For example (assuming the default Logtalk installation) and using SWI-Prolog as the backend:
Logtalk project testers
Automation script for running tests and its arguments. The arguments must included at least the
On Windows systems, these settings must be set differently. For example (assuming the default Logtalk installation) and using SWI-Prolog as the backend:
Logtalk project doclets
Automation script for running doclets and its arguments. The arguments must included at least the
On Windows systems, these settings must be set differently. For example (assuming the default Logtalk installation) and using SWI-Prolog as the backend:
Logtalk project documentation
Documentation script and its arguments for converting the XML files generated by the Logtalk
On Windows systems, these settings must be set differently. For example (assuming the default Logtalk installation):
Logtalk project diagrams
Script and its arguments for converting the On Windows systems, these settings must be set differently. For example (assuming the default Logtalk installation):
Diagrams script for converting the Timeout for waiting to run conversion scripts
The number of milliseconds to wait before running the scripts that convert Code metrics and test results code lens
Enables displaying inline test results (including code coverage when collected) using code lens in both the test object and the tested entity source files opened in the editor. It also enables displaying inline entity cyclomatic complexity after computing code metrics. The tests and metrics data is persistent and can be updated by re-running tests and re-computing metrics (e.g. by simply clicking in the inline data). This setting can be toggled using the "Toggle Code Lens" command. Known IssuesCode issues detected when running the "Make - Check" or "Make - Circular" commands are displayed in the integrated terminal but not added to the "PROBLEMS" pane. On Windows systems, the file paths on the "PROBLEMS" pane may not be relative to the workspace directory depending on the Prolog backend. This is a consequence of some backends "normalizing" file paths in a way that seem to break VSCode computing of the relative paths. E.g. paths are relative when using GNU Prolog but absolute when using SWI-Prolog or SICStus Prolog. On Windows systems, some Prolog backends such as ECLiPSe and XSB are not usable due to file path representation issues. Also, using GNU Prolog requires the following setting:
If you're migrating from the old "VSC-Logtalk" extension, you may see duplicated context menu items even after uninstalling it. If that happens, delete any extension leftovers in the VSCode notable usability issuesVSCode provides a "Toggle Activate Breakpoints" button in the "Run and Debug" pane but doesn't generate an event that can be handled by extensions. VSCode doesn't support disabling menu items that are not supported by language extensions (e.g. the "Run" menu "New Breakpoint" > "Triggered Breakpoint..." item). When the "Run and Debug" pane is closed, selecting the "Run" menu "New Breakpoint > Function Breakpoint..." item doesn't open the pane to show the new breakpoint text insertion box. VSCode triggers the "Go to Definition" computations if the cursor happens to be over some text when typing the command (macOS) or control (Windows, Linux) keys to type any keyboard command without waiting for or requiring cursor movement. DevelopmentDeveloped and tested with Logtalk 3.81.0 and VSCode 1.90 on macOS 14.4 and Windows 10 with Node 22. After running See the CHANGELOG.md file for the most recent changes. Contributions and bug reports are most welcome. AcknowledgementsDue to Arthur's current unavailability and since-deprecated modules, this extension has been adopted by new maintainers. Arthur Wang (Original Author)"The original author of this extension thanks Professor Paulo Moura who is the author of Logtalk for his patient help and support. Syntax highlighting, some snippets, and some commands are integrated from his distro of Logtalk." LicenseThis extension is published under the MIT license. |