====== Installation und Konfiguration ====== Anleitung zur Einrichtung der WvdS FPC Tools in Visual Studio Code. ===== Extension installieren ===== ==== Variante 1: Extension Pack (empfohlen) ==== - VSCode öffnen - Extensions Sidebar (''Ctrl+Shift+X'') - Suche: ''WvdS FPC Tools'' - **Install** klicken — installiert alle drei Extensions automatisch ==== Variante 2: Einzelne Extensions ==== Falls nur bestimmte Extensions benötigt werden: | Extension | Package-ID | ^ Solution Manager | ''wvds.wvds-fpc-solution-manager'' | ^ PAS2JS Studio | ''wvds.wvds-fpc-pas2js-studio'' | ^ ISS Designer | ''wvds.wvds-fpc-iss-designer'' | PAS2JS Studio und ISS Designer setzen Solution Manager voraus. ==== Variante 3: VSIX-Datei ==== code --install-extension wvds-fpc-solution-manager-0.1.0.vsix code --install-extension wvds-fpc-pas2js-studio-0.1.0.vsix code --install-extension wvds-fpc-iss-designer-0.1.0.vsix ===== Toolchain einrichten ===== ==== Free Pascal Compiler (FPC) ==== **Download:** [[https://www.freepascal.org/download.html]] oder via [[https://github.com/LongDirtyAnimAlf/fpcupdeluxe|fpcupdeluxe]] **Empfohlene Installation:** | Variante | Pfad | ^ Lazarus-Bundle | ''C:\Lazarus'' (enthält FPC + Lazarus + pas2js) | ^ fpcupdeluxe | Benutzerdefiniert | **Konfiguration in VSCode:** * ''fpc-solution-manager.fpcPath'' — Pfad zum FPC Compiler * ''fpc-solution-manager.lazbuildPath'' — Pfad zu lazbuild * ''fpc-solution-manager.lazarusPath'' — Lazarus-Installationsverzeichnis Oder: **Setup Toolchain** Wizard über die Command Palette (''Ctrl+Shift+P'' → ''Setup Toolchain''). Die Extension erkennt automatisch FPC-Installationen in Standardpfaden. ==== pas2js ==== pas2js ist im Lazarus-Bundle enthalten (ab 3.0). Separater Download: [[https://wiki.freepascal.org/pas2js]] **Konfiguration:** * ''fpc-pas2js.pas2jsPath'' — Pfad zu ''pas2js.exe'' * ''fpc-pas2js.pas2jsRtlPath'' — Pfad zu pas2js RTL Packages ==== InnoSetup ==== **Download:** [[https://jrsoftware.org/isinfo.php]] **Konfiguration:** * ''fpc-iss.innoSetupPath'' — Pfad zu ''iscc.exe'' (z.B. ''C:\Program Files (x86)\Inno Setup 6\iscc.exe'') ==== Pascal Language Server (pasls) ==== Optional aber empfohlen für Code Completion, Go to Definition und Navigation. **Quellcode:** [[https://github.com/castle-engine/pascal-language-server]] **Mindestanforderungen:** FPC >= 3.2.0 + Lazarus (für lazbuild) === Variante A: Selbst kompilieren (empfohlen) === # 1. Repository klonen cd D:\Workspace\3rd git clone https://github.com/castle-engine/pascal-language-server.git cd pascal-language-server git submodule update --init --recursive # 2. Mit lazbuild kompilieren cd server C:\Lazarus\lazbuild.exe pasls.lpi # 3. Binary installieren copy pasls.exe C:\Lazarus\pasls.exe === Variante B: Castle Game Engine === pasls wird mit [[https://castle-engine.io|Castle Game Engine]] ausgeliefert (''bin/pasls.exe''). Nachteil: ~500 MB Download für ein 5-MB-Binary. === Konfiguration === * ''fpc-solution-manager.pasls.enabled'' — ''true'' (Standard) * ''fpc-solution-manager.paslsPath'' — Pfad zu ''pasls.exe'' (Auto-Detection sucht in ''C:\Lazarus'', Lazarus-Verzeichnis, FPC-bin-Verzeichnis und PATH) * ''fpc-solution-manager.fpcSourcePath'' — Pfad zu FPC-Quellen (z.B. ''C:\Lazarus\fpc\3.3.1\source'') — wird als ''FPCDIR'' an pasls übergeben === Unterstützte LSP-Features === | Feature | Tastenkürzel | Status | ^ Code Completion | ''Ctrl+Space'' | Verfügbar | ^ Signature Help | automatisch bei ''('' | Verfügbar | ^ Go to Definition | ''F12'' | Verfügbar | ^ Go to Declaration | ''Ctrl+Click'' | Verfügbar | ^ Go to Implementation | ''Ctrl+Shift+F12'' | Verfügbar (via Definition-Fallback) | ^ Document Symbols (Outline) | ''Ctrl+Shift+O'' | Verfügbar (Methoden/Prozeduren) | ^ Workspace Symbols | ''Ctrl+T'' | Verfügbar | ^ Hover mit Typ-Info + PasDoc | Mauszeiger | Verfügbar (pasls-nativ + Fallback) | ^ Find All References | ''Shift+F12'' | Verfügbar | ^ Document Highlight | automatisch | Verfügbar | ^ Rename Symbol | ''F2'' | Geplant (erfordert pasls-Update) | ^ Diagnostics (Fehler/Warnungen) | — | Geplant (erfordert pasls-Update) | === Debugging/Logging === pasls kann über eine ''castle-pasls.ini'' Datei konfiguriert werden (Log-Pfad, Verbosity). Platziere die Datei neben ''pasls.exe''. Bei FPC 3.3.1 (trunk) können Code-Anpassungen im pasls-Repository nötig sein. Die aktuelle Version kompiliert aber problemlos. ===== Erstes Projekt ===== ==== Bestehendes Lazarus-Projekt öffnen ==== - Ordner mit ''.lpi'' oder ''.lpg'' Datei in VSCode öffnen - Solution Manager erscheint automatisch in der Activity Bar (links) - Projekt-Baum zeigt Units, Formulare, Packages, Dependencies ==== Neues Projekt erstellen ==== - Bei leerem Workspace öffnet sich der **Unified Project Wizard** automatisch - Alternativ: Command Palette ''Ctrl+Shift+P'' → ''FPC: New Project...'' - Intent wählen (FPC nativ, pas2js Web, bestehendes öffnen) - Projekttyp, Name und Speicherort konfigurieren - Projekt wird erstellt und im Tree View angezeigt Das automatische Öffnen des Wizards lässt sich über die Einstellung ''autoShowStartWizard'' deaktivieren. ==== pas2js Extension-Projekt ==== - Ordner mit ''package.json'' (VSCode Extension Manifest) öffnen - Solution Manager erkennt das Projekt automatisch als virtuelles pas2js-Projekt - Build: ''Ctrl+Shift+B'' oder Tree View → Build ===== Tastenkürzel ===== | Kürzel | Aktion | ^ ''Ctrl+Shift+B'' | Build Project | ^ ''F5'' | Run Project | ^ ''F9'' | Build and Run | ^ ''Shift+F9'' | Rebuild Project | ^ ''Ctrl+Shift+C'' | Clean Project | ^ ''F4'' | Properties | ^ ''F12'' | Toggle Form/Code | ^ ''Ctrl+Shift+A'' | Add Unit | ^ ''Ctrl+Shift+M'' | Select Build Mode | ^ ''Ctrl+Shift+R'' | Refresh Tree | ^ ''Shift+F5'' / ''Ctrl+F2'' | Stop Process | ^ ''Alt+Shift+R'' | Reveal in Explorer | ===== Verifizierung ===== Nach der Installation prüfen: - **Activity Bar:** FPC Solution Manager Icon sichtbar? - **Tree View:** Projekte werden erkannt und angezeigt? - **Build:** ''Ctrl+Shift+B'' kompiliert erfolgreich? - **Output:** ''FPC Solution Manager'' Kanal zeigt Log-Meldungen? ===== Fehlerbehebung ===== ==== Extension wird nicht aktiviert ==== * Prüfen ob ''package.json'', ''.lpi'' oder ''.lpg'' im Workspace vorhanden ist * Output Panel → ''FPC Solution Manager'' Kanal prüfen * VSCode neu laden: ''Developer: Reload Window'' ==== Compiler nicht gefunden ==== * Pfade in den Settings prüfen (''fpc-solution-manager.fpcPath'') * ''Setup Toolchain'' Wizard ausführen * Lazarus-Installation verifizieren: ''fpc -v'' in Terminal ausführen ==== pasls funktioniert nicht ==== * ''fpc-solution-manager.pasls.enabled'' auf ''true'' setzen * Pfad zu ''pasls.exe'' in ''fpc-solution-manager.paslsPath'' setzen * ''fpc-solution-manager.fpcSourcePath'' auf FPC-Quellen zeigen lassen (z.B. ''C:\Lazarus\fpc\3.3.1\source'') * ''fpc-solution-manager.lazarusSourcePath'' muss auf Lazarus-Quellen zeigen * Output Panel → **FPC Solution Manager** Kanal prüfen — Log-Zeile ''pasls initialized successfully.'' bestätigt den Start * Manueller Test: ''echo '{"jsonrpc":"2.0","id":1,"method":"initialize",...}' | pasls.exe'' — muss JSON-Response liefern ===== Siehe auch ===== * [[.:start|WvdS FPC Tools Übersicht]] * [[.:solution-manager|FPC Solution Manager]] * [[.:pas2js-studio|FPC PAS2JS Studio]] * [[.:iss-designer|FPC ISS Designer]]