ZED IDE Setup for OBP-API Development

September 2, 2025 ยท View on GitHub

Complete ZED IDE integration for the Open Bank Project API

This folder contains everything needed to set up ZED IDE with full Scala language server support, automated build tasks, and streamlined development workflows for OBP-API.

๐Ÿš€ Quick Setup (5 minutes)

Prerequisites

  • Java 17+ (OpenJDK recommended)
  • Maven 3.6+
  • ZED IDE (latest version)

Single Setup Script

cd OBP-API
./zed/setup-zed-ide.sh

This unified script automatically:

  • โœ… Installs missing dependencies (Coursier, Bloop)
  • โœ… Compiles the project and resolves dependencies
  • โœ… Generates dynamic Bloop configurations
  • โœ… Sets up Metals language server
  • โœ… Copies ZED configuration files to .zed/ folder
  • โœ… Configures build and run tasks
  • โœ… Sets up manual-only code formatting

๐Ÿ“ What's Included

zed/
โ”œโ”€โ”€ README.md                   # This comprehensive guide
โ”œโ”€โ”€ setup-zed-ide.sh           # Single unified setup script
โ”œโ”€โ”€ generate-bloop-config.sh    # Dynamic Bloop config generator
โ”œโ”€โ”€ settings.json               # ZED IDE settings template
โ”œโ”€โ”€ tasks.json                  # Pre-configured build/run tasks
โ”œโ”€โ”€ .metals-config.json         # Metals language server config
โ””โ”€โ”€ setup-zed.bat              # Windows setup script

โŒจ๏ธ Essential Keyboard Shortcuts

ActionLinuxmacOS/WindowsPurpose
Command PaletteCtrl+Shift+PCmd+Shift+PAccess all tasks
Go to DefinitionF12F12Navigate to symbol definition
Find ReferencesShift+F12Shift+F12Find all symbol usages
Quick Open FileCtrl+PCmd+PFast file navigation
Format CodeCtrl+Shift+ICmd+Shift+IAuto-format Scala code
Symbol SearchCtrl+TCmd+TSearch symbols project-wide

๐Ÿ› ๏ธ Available Development Tasks

Access via Command Palette (Ctrl+Shift+P on Linux, Cmd+Shift+P on macOS/Windows) โ†’ "task: spawn" (Linux) or "Tasks: Spawn" (macOS/Windows):

Core Development Tasks

TaskPurposeDurationWhen to Use
Quick Build DependenciesBuild only dependencies1-3 minFirst step, after dependency changes
[1] Run OBP-API ServerStart development server3-5 minDaily development
๐Ÿ”จ Build OBP-APIFull project build2-5 minAfter code changes
Run TestsExecute test suite5-15 minBefore commits
[3] Compile OnlyQuick syntax check30s-1 minDuring development

Utility Tasks

TaskPurpose
[4] Clean Target FoldersRemove build artifacts
๐Ÿ”„ Continuous Compile (Scala)Auto-recompile on changes
[2] Test API Root EndpointVerify server status
๐Ÿ”ง Kill Server on Port 8080Stop stuck processes
๐Ÿ” Check DependenciesVerify Maven dependencies

๐Ÿ—๏ธ Development Workflow

Daily Development

  1. Start Development Session

    • Linux: Ctrl+Shift+P โ†’ "task: spawn" โ†’ "Quick Build Dependencies"
    • macOS: Cmd+Shift+P โ†’ "Tasks: Spawn" โ†’ "Quick Build Dependencies"
  2. Start API Server

    • Use task "[1] Run OBP-API Server"
    • Server runs on: http://localhost:8080
    • Test endpoint: http://localhost:8080/obp/v5.1.0/root
  3. Code Development

    • Edit Scala files in obp-api/src/main/scala/
    • Use F12 for Go to Definition
    • Auto-completion with Ctrl+Space
    • Real-time error highlighting
    • Format code with Ctrl+Shift+I
  4. Testing & Validation

    • Quick compile: "[3] Compile Only" task
    • Run tests: "Run Tests" task
    • API testing: "[2] Test API Root Endpoint" task

๐Ÿ”ง Configuration Details

ZED IDE Settings (settings.json)

  • Format on Save: DISABLED (manual formatting only - use Ctrl+Shift+I)
  • Scala LSP: Optimized Metals configuration
  • Maven Integration: Proper MAVEN_OPTS for Java 17+
  • UI Preferences: One Dark theme, consistent layout
  • Inlay Hints: Enabled for better code understanding

Build Tasks (tasks.json)

All tasks include proper environment variables:

MAVEN_OPTS="-Xss128m --add-opens=java.base/java.util.jar=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED"

Metals LSP (.metals-config.json)

  • Build Tool: Maven
  • Bloop Integration: Dynamic configuration generation
  • Scala Version: 2.12.20
  • Java Target: Java 11 (compatible with Java 17)

๐Ÿšจ Troubleshooting

Common Issues

ProblemSymptomSolution
Language Server Not WorkingNo go-to-definition, no autocompleteRestart ZED, wait for Metals initialization
Compilation ErrorsRed squiggly lines, build failuresCheck Problems panel, run "Clean Target Folders"
Server Won't StartPort 8080 busyRun "Kill Server on Port 8080" task
Out of MemoryBuild fails with heap space errorAlready configured in tasks
Missing DependenciesImport errorsRun "Check Dependencies" task

Recovery Procedures

  1. Full Reset:

    ./zed/setup-zed-ide.sh  # Re-run complete setup
    
  2. Regenerate Bloop Configurations:

    ./zed/generate-bloop-config.sh  # Regenerate configs
    
  3. Clean Restart:

    • Clean build with "Clean Target Folders" task
    • Restart ZED IDE
    • Wait for Metals to reinitialize (2-3 minutes)

Platform-Specific Notes

Linux Users

  • Use "task: spawn" in command palette (not "Tasks: Spawn")
  • Ensure proper Java permissions for Maven

macOS/Windows Users

  • Use "Tasks: Spawn" in command palette
  • Windows users can also use setup-zed.bat

๐ŸŒ API Development

Project Structure

OBP-API/
โ”œโ”€โ”€ obp-api/                    # Main API application
โ”‚   โ””โ”€โ”€ src/main/scala/         # Scala source code
โ”‚       โ””โ”€โ”€ code/api/           # API endpoint definitions
โ”‚           โ”œโ”€โ”€ v5_1_0/         # Latest API version
โ”‚           โ”œโ”€โ”€ v4_0_0/         # Previous versions
โ”‚           โ””โ”€โ”€ util/           # Utility functions
โ”œโ”€โ”€ obp-commons/                # Shared utilities and models
โ”‚   โ””โ”€โ”€ src/main/scala/         # Common Scala code
โ””โ”€โ”€ .zed/                       # ZED IDE configuration (generated)

Adding New API Endpoints

  1. Navigate to obp-api/src/main/scala/code/api/v5_1_0/
  2. Find appropriate API trait (e.g., OBPAPI5_1_0.scala)
  3. Follow existing endpoint patterns
  4. Use F12 to navigate to helper functions
  5. Test with API test task

Testing Endpoints

# Root API information
curl http://localhost:8080/obp/v5.1.0/root

# Health check
curl http://localhost:8080/obp/v5.1.0/config

# Banks list (requires proper setup)
curl http://localhost:8080/obp/v5.1.0/banks

๐ŸŽฏ Pro Tips

Code Navigation

  • Quick file access: Ctrl+P then type filename
  • Symbol search: Ctrl+T then type function/class name
  • Project-wide text search: Ctrl+Shift+F

Efficiency Shortcuts

  • Ctrl+/ - Toggle line comment
  • Ctrl+D - Select next occurrence
  • Ctrl+Shift+L - Select all occurrences
  • F2 - Rename symbol
  • Alt+โ†/โ†’ - Navigate back/forward

Performance Optimization

  • Close unused files to reduce memory usage
  • Use "Continuous Compile" for faster feedback
  • Limit test runs to specific modules during development

๐Ÿ“š Additional Resources

Documentation

Learning Resources

๐Ÿ†˜ Getting Help

Diagnostic Commands

# Check Java version
java -version

# Check Maven
mvn -version

# Check Bloop status
bloop projects

# Test compilation
bloop compile obp-commons obp-api

# Check ZED configuration
ls -la .zed/

Common Error Messages

ErrorCauseSolution
"Java module system" errorsJava 17+ module restrictionsAlready handled in MAVEN_OPTS
"Port 8080 already in use"Previous server still runningUse "Kill Server" task
"Metals not responding"Language server crashedRestart ZED IDE
"Compilation failed"Dependency issuesRun "Check Dependencies"

๐ŸŽ‰ Getting Started Checklist

  • Install Java 17+, Maven 3.6+, ZED IDE
  • Clone OBP-API repository
  • Run ./zed/setup-zed-ide.sh (single setup script)
  • Open project in ZED IDE
  • Wait for Metals initialization (2-3 minutes)
  • Run "Quick Build Dependencies" task
  • Start server with "[1] Run OBP-API Server" task
  • Test API at http://localhost:8080/obp/v5.1.0/root
  • Try "Go to Definition" (F12) on Scala symbol
  • Format code manually with Ctrl+Shift+I (auto-format disabled)
  • Make a small code change and test compilation

Welcome to productive OBP-API development with ZED IDE! ๐Ÿš€


This setup provides a complete, optimized development environment for the Open Bank Project API using ZED IDE with full Scala language server support.