feature/Zed IDE Configuration for OBP-API

This commit is contained in:
Marko Milić 2025-09-01 16:27:50 +02:00
parent c7ff855bfc
commit f0bb6f2a2c
6 changed files with 443 additions and 0 deletions

1
.gitignore vendored
View File

@ -8,6 +8,7 @@
.settings
.metals
.vscode
.zed
.classpath
.project
.cache

133
zed/README.md Normal file
View File

@ -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.

81
zed/settings.json Normal file
View File

@ -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"
}
}
}

64
zed/setup-zed.bat Normal file
View File

@ -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

53
zed/setup-zed.sh Executable file
View File

@ -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."

111
zed/tasks.json Normal file
View File

@ -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"]
}
]