Inhaltsverzeichnis

WvdS VSCode Projects

The Projects extension manages Pascal projects in VS Code. It provides project templates, configuration dialogs, and solution management.

Function and Purpose

The Projects extension enables:

Commands

Command Description
WvdS Projects: New Project (Quick) Creates a project with default settings
WvdS Projects: New Project from Template… Shows the template selection dialog
WvdS Projects: Open Project Opens an existing project
WvdS Projects: Project Settings… Opens the project settings dialog

Project Templates

The extension includes predefined templates for various project types:

Desktop Console

Simple console application for command-line tools and services.

Generated Files:

MyProject/
  MyProject.lpr     -- Main program

Example Code:

program MyProject;
 
{$mode objfpc}{$H+}
 
uses
  SysUtils;
 
begin
  WriteLn('Hello, World!');
end.

Use Cases:

Desktop GUI

Native desktop application with LCL (Lazarus Component Library).

Generated Files:

MyProject/
  MyProject.lpr     -- Main program
  MainForm.pas      -- Main form unit
  MainForm.lfm      -- Form design

Prerequisites:

Use Cases:

Desktop Library

Shared library (DLL/SO) for plugin systems or external integration.

Generated Files:

MyProject/
  MyProject.lpr     -- Library project

Example Code:

library MyProject;
 
{$mode objfpc}{$H+}
 
uses
  SysUtils;
 
procedure HelloWorld; cdecl;
begin
  WriteLn('Hello from library!');
end;
 
exports
  HelloWorld;
 
begin
end.

Use Cases:

TUI App

Terminal User Interface - text-based user interface.

Generated Files:

MyProject/
  MyProject.lpr     -- Main program
  TuiMain.pas       -- TUI main unit

Use Cases:

Web PWA

Progressive Web App with pas2js - runs in the browser.

Generated Files:

MyProject/
  MyProject.lpr     -- Main program (becomes JS)
  index.html.tmpl   -- HTML template
  manifest.json.tmpl-- PWA manifest
  sw.js             -- Service Worker

Prerequisites:

Use Cases:

VSCode Extension

VS Code extension in Pascal, transpiled with pas2js.

Generated Files:

MyExtension/
  extension_main.pas   -- Entry point
  package.json.tmpl    -- Extension manifest

Prerequisites:

Use Cases:

Installer (Inno Setup)

Windows installer for desktop applications.

Generated Files:

MyInstaller/
  MyInstaller.iss    -- Inno Setup script

Prerequisites:

Use Cases:

Project Settings

The WvdS Projects: Project Settings… dialog provides a graphical interface for:

General Settings

Compiler Options

Dependencies

Multi-Project Workspaces

VS Code workspaces can contain multiple projects:

MyWorkspace.code-workspace
  MyApp/          -- Desktop application
  MyLib/          -- Shared library
  MyTests/        -- Unit tests

Creating a Workspace

  1. FileAdd Folder to Workspace…
  2. Add all project folders
  3. FileSave Workspace As…

Selecting a Project

With multiple projects:

  1. Open a file from the desired project
  2. Or: Select the project in the Project Explorer

Context Menu

Right-click on .lpi/.lpr files in the Explorer shows:

Troubleshooting

Template Dialog Does Not Open

Cause: Extension not activated or error.

Solution:

  1. Check if the extension is installed
  2. Check the Developer Console for errors
  3. Restart VS Code

Project Not Recognized

Cause: No .lpr, .dpr, or .pas file in the folder.

Solution:

  1. Ensure a main file exists
  2. Open the folder with FileOpen Folder…

Project Settings Not Saved

Cause: No write permissions or faulty configuration.

Solution:

  1. Check write permissions in the project folder
  2. Check settings.json for syntax errors

Technical Details

Property Value
Extension ID wvds.wvds-vscode-projects
Activation workspaceContains:/*.lpr, onLanguage:pascal
Dependencies wvds-vscode-core
Min. VS Code 1.85.0

See Also