FreePascal Toolkit
is a VSCode extension for developing FreePascal applications.
中文文档
Requirements
Install Lazarus or FreePascal on your system.
The extendsion will auto search the path of fpc. If it's not be found, please set the system PATH environment variable, or set fpctoolkit.env.PP
in vscode's user setting.
Install GDB Debugger - Beyond to debug your freepascal program .
Features
Pascal Language Server
from pascal-language-server
An LSP server
implementation for Pascal variants that are supported by Free
Pascal, including Object Pascal. It uses
CodeTools from
Lazarus as backend.
Freepascal Task Settings
You can add freepascal compile tasks by editing task.json
in your .vscode folder.
The task's type is fpc
. It contains the following configuration items.
Task settings
Field |
type |
Description |
file |
string |
main program file. .lpr or .dpr |
type |
string |
always be fpc |
cwd |
string |
current path. Use wrokspace root if null. |
cleanExt |
string |
file extensions for clean file in unitOutputDir. use * for clear all file. default:(.o,.ppu) |
buildOption |
object |
build options |
inherited |
string |
inherit from other task |
buildEvent
Field |
type |
Description |
before_build |
string[] |
Run commands before build |
after_build_success |
string[] |
Run commands after build success. |
after_build_failure |
string [] |
Run commands after build failure. |
buildOptions
Field |
type |
Description |
targetOS |
string |
Target OS (-T). eg. linux win64 |
targetCPU |
string |
Target cpu family (-P). eg. x86_64 i386 |
customOptions |
string [] |
Any compile options for fpc. |
libPath |
string[] |
Searchpath for libraries.(-Fl) |
outputFile |
string |
Target file name.(-o) |
unitOutputDir |
string |
Unit output directory.(-FU) |
optimizationLevel |
number |
Optimization levels (-O) |
searchPath |
string[] |
Searchpath for units and other system dependent things.(-Fu) |
syntaxMode |
string |
Syntax Mode (-M) |
forceRebuild |
boolean |
Re-compile all used units, even if the unit sources didn’t change since the last compilation.(-B) |
msgIgnore |
number[] |
Is a list of messages numbers which should not be shown.(-vmxxx) |
example:
{
"version": "2.0.0",
"tasks": [
{
"label": "debug",
"file": "main.lpr",
"type": "fpc",
"buildOption": {
"unitOutputDir": "./out",
"customOptions": [
"-dDEBUG",
"-gw2"
]
}
}
]
}
Thanks
HighLight
Syntaxes from https://github.com/maresmar/ST-Pascal
Clone and modified from https://github.com/git-bee/jcf-cli
Pascal-language-server
Clone and modified from
https://github.com/genericptr/pascal-language-server
https://github.com/arjanadriaanse/pascal-language-server
Release Notes
view changelog