-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmonitor_lsp.sh
More file actions
executable file
·64 lines (59 loc) · 1.91 KB
/
monitor_lsp.sh
File metadata and controls
executable file
·64 lines (59 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/bin/bash
# Monitor LSP activity during testing
# Usage: ./monitor_lsp.sh
echo "=========================================="
echo "Veld LSP Monitor"
echo "=========================================="
echo ""
echo "This script monitors LSP server activity in real-time."
echo "Keep this running while you test the VSCode extension."
echo ""
echo "Press Ctrl+C to stop monitoring"
echo ""
echo "=========================================="
echo ""
# Check if log file exists
if [ ! -f "lsp_server.log" ]; then
echo "⚠️ Warning: lsp_server.log not found yet."
echo " The log will be created when the LSP starts."
echo ""
echo "Waiting for log file to be created..."
echo ""
fi
# Function to colorize output
colorize_log() {
while IFS= read -r line; do
# Color ERROR lines red
if echo "$line" | grep -q "ERROR"; then
echo -e "\033[0;31m$line\033[0m"
# Color WARN lines yellow
elif echo "$line" | grep -q "WARN"; then
echo -e "\033[0;33m$line\033[0m"
# Color INFO lines green
elif echo "$line" | grep -q "INFO"; then
echo -e "\033[0;32m$line\033[0m"
# Color DEBUG lines blue
elif echo "$line" | grep -q "DEBUG"; then
echo -e "\033[0;36m$line\033[0m"
# Highlight request types
elif echo "$line" | grep -q "textDocument/"; then
echo -e "\033[1;35m$line\033[0m"
# Highlight initialization
elif echo "$line" | grep -q "initialize\|initialized"; then
echo -e "\033[1;32m$line\033[0m"
# Default
else
echo "$line"
fi
done
}
# Wait for file and tail it
tail -f lsp_server.log 2>/dev/null | colorize_log || {
# If tail fails, wait for file to be created
while [ ! -f "lsp_server.log" ]; do
sleep 1
done
echo "✅ Log file created! Monitoring..."
echo ""
tail -f lsp_server.log | colorize_log
}