diff --git a/.gitignore b/.gitignore index 8d4567230..ee0ff72bc 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ .settings .metals .vscode +.zed .classpath .project .cache diff --git a/zed/README.md b/zed/README.md new file mode 100644 index 000000000..01060b8f2 --- /dev/null +++ b/zed/README.md @@ -0,0 +1,133 @@ +# Zed IDE Configuration for OBP-API + +This folder contains the recommended Zed IDE configuration for the OBP-API project. Each developer can set up their own personalized Zed environment while maintaining consistent project settings. + +## Quick Setup + +Run the setup script to copy the configuration files to your local `.zed` folder: + +**Linux/macOS:** +```bash +./zed/setup-zed.sh +``` + +**Windows:** +```cmd +zed\setup-zed.bat +``` + +This will create a `.zed` folder in the project root with the recommended settings. + +## What's Included + +### ๐Ÿ“ Configuration Files + +- **`settings.json`** - IDE settings optimized for Scala/OBP-API development +- **`tasks.json`** - Predefined tasks for building, running, and testing the project + +### โš™๏ธ Key Settings + +- **Format on save: DISABLED** - Preserves your code formatting choices +- **Scala LSP (Metals) configuration** - Optimized for Maven-based Scala projects +- **UI preferences** - Consistent theme, font sizes, and panel layout +- **Semantic highlighting** - Enhanced code readability + +## Available Tasks + +Access tasks in Zed with `Cmd/Ctrl + Shift + P` โ†’ "task: spawn" + +### ๐Ÿš€ Development Tasks + +| Task | Command | Description | +|------|---------|-------------| +| **[1] Run OBP-API Server** | `mvn jetty:run -pl obp-api` | Starts the OBP-API server on port 8080 | +| **[2] Test API Root Endpoint** | `curl http://localhost:8080/obp/v5.1.0/root` | Quick API health check | +| **[3] Compile Only** | `mvn compile -pl obp-api` | Compiles the project without running tests | + +### ๐Ÿ”จ Build Tasks + +| Task | Command | Description | +|------|---------|-------------| +| **[4] Build OBP-API** | `mvn install -pl .,obp-commons -am -DskipTests` | Full build excluding tests | +| **[5] Clean Target Folders** | `mvn clean` | Removes all compiled artifacts | + +### ๐Ÿงช Testing & Validation + +| Task | Command | Description | +|------|---------|-------------| +| **[7] Run Tests** | `mvn test -pl obp-api` | Executes the project test suite | +| **[8] Maven Validate** | `mvn validate` | Validates project structure and dependencies | +| **[9] Check Dependencies** | `mvn dependency:resolve` | Downloads and verifies all dependencies | + +### ๐Ÿ› ๏ธ Utility Tasks + +| Task | Command | Description | +|------|---------|-------------| +| **[6] Kill OBP-API Server** | `lsof -ti:8080 \| xargs kill -9` | Terminates any process running on port 8080 | + +## Typical Development Workflow + +1. **Initial Setup**: `[4] Build OBP-API` - Build the project +2. **Development**: `[3] Compile Only` - Quick compilation during development +3. **Testing**: `[1] Run OBP-API Server` โ†’ `[2] Test API Root Endpoint` +4. **Cleanup**: `[6] Kill OBP-API Server` when done + +## Maven Configuration + +All Maven tasks use optimized JVM settings: +``` +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" +``` + +These settings resolve Java module system compatibility issues with newer JDK versions. + +## Customization + +The `.zed` folder is in `.gitignore`, so you can: + +- Modify settings without affecting other developers +- Add personal tasks or shortcuts +- Adjust themes, fonts, and UI preferences +- Configure additional language servers + +### Example Customizations + +**Add a custom task** (in `.zed/tasks.json`): +```json +{ + "label": "My Custom Task", + "command": "echo", + "args": ["Hello World"], + "use_new_terminal": false +} +``` + +**Change theme** (in `.zed/settings.json`): +```json +{ + "theme": "Ayu Dark" +} +``` + +## Troubleshooting + +### Port 8080 Already in Use +```bash +# Use task [6] or run manually: +lsof -ti:8080 | xargs kill -9 +``` + +### Metals LSP Issues +1. Restart Zed IDE +2. Run `[8] Maven Validate` to ensure project structure is correct +3. Check that Java 11+ is installed and configured + +### Build Failures +1. Run `[5] Clean Target Folders` +2. Run `[9] Check Dependencies` +3. Run `[4] Build OBP-API` + +## Support + +For Zed IDE-specific issues, consult the [Zed documentation](https://zed.dev/docs). +For OBP-API project issues, refer to the main project README. \ No newline at end of file diff --git a/zed/settings.json b/zed/settings.json new file mode 100644 index 000000000..bc099bd3a --- /dev/null +++ b/zed/settings.json @@ -0,0 +1,81 @@ +{ + "format_on_save": "off", + "tab_size": 2, + "terminal": { + "env": { + "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" + } + }, + "project_panel": { + "dock": "left", + "default_width": 300 + }, + "outline_panel": { + "dock": "right" + }, + "theme": "One Dark", + "ui_font_size": 14, + "buffer_font_size": 14, + "soft_wrap": "editor_width", + "show_whitespaces": "selection", + "tabs": { + "git_status": true, + "file_icons": true + }, + "gutter": { + "line_numbers": true + }, + "scrollbar": { + "show": "auto" + }, + "indent_guides": { + "enabled": true + }, + "lsp": { + "metals": { + "initialization_options": { + "compileOnSave": true, + "debuggingProvider": true, + "decorationProvider": true, + "didFocusProvider": true, + "doctorProvider": "html", + "executeClientCommandProvider": true, + "inputBoxProvider": true, + "quickPickProvider": true, + "renameProvider": true, + "statusBarProvider": "on", + "treeViewProvider": true, + "buildTool": "maven" + }, + "settings": { + "metals.ammoniteJvmProperties": ["-Xmx1G"], + "metals.buildServer.version": "2.0.0", + "metals.javaFormat.eclipseConfigPath": "", + "metals.javaFormat.eclipseProfile": "", + "metals.superMethodLensesEnabled": true, + "metals.testUserInterface": "Code Lenses", + "metals.bloopSbtAlreadyInstalled": true, + "metals.gradleScript": "", + "metals.mavenScript": "", + "metals.millScript": "", + "metals.sbtScript": "", + "metals.scalafmtConfigPath": ".scalafmt.conf", + "metals.enableSemanticHighlighting": true, + "metals.allowMultilineStringFormatting": false, + "metals.formattingProvider": "none", + "metals.inlayHints.enabled": true, + "metals.inlayHints.hintsInPatternMatch.enabled": true, + "metals.inlayHints.implicitArguments.enabled": true, + "metals.inlayHints.implicitConversions.enabled": true, + "metals.inlayHints.inferredTypes.enabled": true, + "metals.inlayHints.typeParameters.enabled": true + } + } + }, + "languages": { + "Scala": { + "language_servers": ["metals"], + "format_on_save": "off" + } + } +} diff --git a/zed/setup-zed.bat b/zed/setup-zed.bat new file mode 100644 index 000000000..303e49d8e --- /dev/null +++ b/zed/setup-zed.bat @@ -0,0 +1,64 @@ +@echo off +setlocal enabledelayedexpansion + +REM Zed IDE Setup Script for OBP-API (Windows) +REM This script copies the recommended Zed configuration to your local .zed folder + +echo ๐Ÿ”ง Setting up Zed IDE configuration for OBP-API... + +set "SCRIPT_DIR=%~dp0" +set "PROJECT_ROOT=%SCRIPT_DIR%.." +set "ZED_DIR=%PROJECT_ROOT%\.zed" + +REM Create .zed directory if it doesn't exist +if not exist "%ZED_DIR%" ( + echo ๐Ÿ“ Creating .zed directory... + mkdir "%ZED_DIR%" +) else ( + echo ๐Ÿ“ .zed directory already exists +) + +REM Copy settings.json +if exist "%SCRIPT_DIR%settings.json" ( + echo โš™๏ธ Copying settings.json... + copy "%SCRIPT_DIR%settings.json" "%ZED_DIR%\settings.json" >nul + if !errorlevel! equ 0 ( + echo โœ… settings.json copied successfully + ) else ( + echo โŒ Error copying settings.json + exit /b 1 + ) +) else ( + echo โŒ Error: settings.json not found in zed folder + exit /b 1 +) + +REM Copy tasks.json +if exist "%SCRIPT_DIR%tasks.json" ( + echo ๐Ÿ“‹ Copying tasks.json... + copy "%SCRIPT_DIR%tasks.json" "%ZED_DIR%\tasks.json" >nul + if !errorlevel! equ 0 ( + echo โœ… tasks.json copied successfully + ) else ( + echo โŒ Error copying tasks.json + exit /b 1 + ) +) else ( + echo โŒ Error: tasks.json not found in zed folder + exit /b 1 +) + +echo. +echo ๐ŸŽ‰ Zed IDE setup completed successfully! +echo. +echo Your Zed configuration includes: +echo โ€ข Format on save: DISABLED (preserves your code formatting) +echo โ€ข Scala/Metals LSP configuration optimized for OBP-API +echo โ€ข 9 predefined tasks for building, running, and testing +echo. +echo To see available tasks in Zed, use: Ctrl + Shift + P โ†’ 'task: spawn' +echo. +echo Note: The .zed folder is in .gitignore, so you can customize settings +echo without affecting other developers. + +pause \ No newline at end of file diff --git a/zed/setup-zed.sh b/zed/setup-zed.sh new file mode 100755 index 000000000..e5d66601e --- /dev/null +++ b/zed/setup-zed.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +# Zed IDE Setup Script for OBP-API +# This script copies the recommended Zed configuration to your local .zed folder + +set -e + +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PROJECT_ROOT="$(dirname "$SCRIPT_DIR")" +ZED_DIR="$PROJECT_ROOT/.zed" + +echo "๐Ÿ”ง Setting up Zed IDE configuration for OBP-API..." + +# Create .zed directory if it doesn't exist +if [ ! -d "$ZED_DIR" ]; then + echo "๐Ÿ“ Creating .zed directory..." + mkdir -p "$ZED_DIR" +else + echo "๐Ÿ“ .zed directory already exists" +fi + +# Copy settings.json +if [ -f "$SCRIPT_DIR/settings.json" ]; then + echo "โš™๏ธ Copying settings.json..." + cp "$SCRIPT_DIR/settings.json" "$ZED_DIR/settings.json" + echo "โœ… settings.json copied successfully" +else + echo "โŒ Error: settings.json not found in zed folder" + exit 1 +fi + +# Copy tasks.json +if [ -f "$SCRIPT_DIR/tasks.json" ]; then + echo "๐Ÿ“‹ Copying tasks.json..." + cp "$SCRIPT_DIR/tasks.json" "$ZED_DIR/tasks.json" + echo "โœ… tasks.json copied successfully" +else + echo "โŒ Error: tasks.json not found in zed folder" + exit 1 +fi + +echo "" +echo "๐ŸŽ‰ Zed IDE setup completed successfully!" +echo "" +echo "Your Zed configuration includes:" +echo " โ€ข Format on save: DISABLED (preserves your code formatting)" +echo " โ€ข Scala/Metals LSP configuration optimized for OBP-API" +echo " โ€ข 9 predefined tasks for building, running, and testing" +echo "" +echo "To see available tasks in Zed, use: Cmd/Ctrl + Shift + P โ†’ 'task: spawn'" +echo "" +echo "Note: The .zed folder is in .gitignore, so you can customize settings" +echo " without affecting other developers." \ No newline at end of file diff --git a/zed/tasks.json b/zed/tasks.json new file mode 100644 index 000000000..9407f3488 --- /dev/null +++ b/zed/tasks.json @@ -0,0 +1,111 @@ +[ + { + "label": "[1] Run OBP-API Server", + "command": "mvn", + "args": ["jetty:run", "-pl", "obp-api"], + "env": { + "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" + }, + "use_new_terminal": true, + "allow_concurrent_runs": false, + "reveal": "always", + "tags": ["run", "server"] + }, + { + "label": "[2] Test API Root Endpoint", + "command": "curl", + "args": [ + "-X", + "GET", + "http://localhost:8080/obp/v5.1.0/root", + "-H", + "accept: application/json" + ], + "use_new_terminal": false, + "allow_concurrent_runs": true, + "reveal": "always", + "tags": ["test", "api"] + }, + { + "label": "[3] Compile Only", + "command": "mvn", + "args": ["compile", "-pl", "obp-api"], + "env": { + "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" + }, + "use_new_terminal": false, + "allow_concurrent_runs": false, + "reveal": "always", + "tags": ["compile", "build"] + }, + { + "label": "[4] Build OBP-API", + "command": "mvn", + "args": [ + "install", + "-pl", + ".,obp-commons", + "-am", + "-DskipTests", + "-Ddependency-check.skip=true" + ], + "env": { + "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" + }, + "use_new_terminal": false, + "allow_concurrent_runs": false, + "reveal": "always", + "tags": ["build"] + }, + { + "label": "[5] Clean Target Folders", + "command": "mvn", + "args": ["clean"], + "use_new_terminal": false, + "allow_concurrent_runs": false, + "reveal": "always", + "tags": ["clean", "build"] + }, + { + "label": "[6] Kill OBP-APIServer on Port 8080", + "command": "bash", + "args": [ + "-c", + "lsof -ti:8080 | xargs kill -9 || echo 'No process found on port 8080'" + ], + "use_new_terminal": false, + "allow_concurrent_runs": true, + "reveal": "always", + "tags": ["utility"] + }, + { + "label": "[7] Run Tests", + "command": "mvn", + "args": ["test", "-pl", "obp-api"], + "env": { + "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" + }, + "use_new_terminal": false, + "allow_concurrent_runs": false, + "reveal": "always", + "tags": ["test"] + }, + { + "label": "[8] Maven Validate", + "command": "mvn", + "args": ["validate"], + "use_new_terminal": false, + "allow_concurrent_runs": false, + "reveal": "always", + "tags": ["validate"] + }, + { + "label": "[9] Check Dependencies", + "command": "mvn", + "args": ["dependency:resolve"], + "use_new_terminal": false, + "allow_concurrent_runs": false, + "reveal": "always", + "tags": ["dependencies"] + } +]