A VS Code extension which provides language support for Logtalk.
Features | Configurations | Bug Reporting
This extension can be installed via extensions viewlet of VS Code or 'Extensions: install extension' command from the command palette. The author notices that it is developed and tested in Logtalk 3.12.0 and VS Code 1.17 on Debian 9.0 (stretch). It's not yet tested under other environments.
Note: Relations between entities use choice snippets. 'orel' triggers object relation choices and 'crel' for category. There is only one relation between protocols 'extends', so 'ext' will trigger the snippet.
The snippets for built-ins all are triggered by natural prefix, i.e. ':- public' triggers ':- public()' directive. You needn't to type all charaters to show up the suggestion list.
Refter to the table below for other snippets:
Prefix | Description |
---|---|
:- obj | Object |
:- cat | Category |
:- pro | Protocol |
orel | relations between objects(choice) |
crel | relations between categories(choice) |
ext | relations between categories |
category | Category with protocol |
category | Category |
class | Class with all |
class | Class with category |
class | Class with metaclass |
class | Class with protocol |
class | Class |
category | Complementing category |
category | Extended category |
protocol | Extended protocol |
instance | Instance with all |
instance | Instance with category |
instance | Instance with protocol |
instance | Instance |
private | (with no arguments) |
private | Private predicate |
protected | (with no arguments) |
protected | Protected predicate |
protocol | Protocol |
object | Prototype with all |
object | Prototype with category |
object | Prototype with parent |
object | Prototype with protocol |
object | Prototype |
public | (with no arguments) |
public | Public predicate |
The grammar errors (if any) will display in OUTPUT channel when active source file is saved.
Command 'Goto next/previous error': see section Commands below.
Project specified commands can be triggered from command palette via entering 'logtalk' to pop up the list of all commands of VSC-Logtalk.
Command | Description | Key binding |
---|---|---|
Open Logtalk | Opens Logtalk in an integrated terminal | alt-x o |
Run Testers | Runs the logtalk_tester script on the project root directory | |
Run Doclets | Runs the logtalk_doclet script on the project root directory |
These commands can be triggered from editor/context and explorer/context menus via right click editor area or Logtalk files in explorer area respectively. In explorer context, the file name at which right click occurs will be passed in the command as argument. File specified commands can also be triggered from command palette so that active file name in the editor will be passed in the command.
Command | Description | Key binding |
---|---|---|
Load Document | Loads the active source file into the Logtalk process | F9 |
Run Tests | Runs the tester file under the active source file directory | |
Run Doclet | Run the doclet file under the active source file directory | |
Goto Next/Previous Error | Locate cursor to the nearest line with error/warning from current cursor location and the corresponding error/warning message displays in output channel | F7/shift-F7 |
Scan Dead Code | Scans active file for dead code | |
Generate Documentation | Generates documentation for the files under the active source file directory | |
Generate Diagrams | Generates diagrams for the files under the active source file directory |
The user can configure settings via VS Code menu File/Preferences/Settings. Entering 'logtalk' in the input box will show up Logtalk settings. The settings in this extension with their default values are:
This setting points to the Logtalk executable, which can be created by running the logtalk_backend_select
script. In alternative, use the absolute path to the integration script you want to use, e.g. swilgt
or swilgt.sh
.
Arguments of Logtalk executable run in terminal.
Automation script for running tests.
Arguments for the automation script for running tests.
Automation script for running doclets.
Arguments for the automation script for running doclets.
Script for converting the XML files generated by the Logtalk lgtdoc
tool.
Arguments for the script that converts the XML files generated by the Logtalk lgtdoc
tool.
Graphviz executable for converting the .dot
files generated by the Logtalk diagrams
tool.
Arguments for the Graphviz executable that converts the .dot
files generated by the Logtalk diagrams
tool.
File name extension for the diagram files generated by the Graphviz executable.
Feel free to report bugs or suggestions via issues
Pull requests are welcome.
The 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.