HLS Troubleshooting
This skill should be used when the user mentions "HLS not working", "haskell-language-server issues", "Haskell LSP problems", "no completions in Haskell", "HLS diagnostics not showing", "troubleshoot HLS", "Haskell code analysis not working", or asks why HLS features aren't available in Claude Code.
$ 安裝
git clone https://github.com/m4dc4p/claude-hls /tmp/claude-hls && cp -r /tmp/claude-hls/skills/hls-troubleshooting ~/.claude/skills/claude-hls// tip: Run this command in your terminal to install the skill
name: HLS Troubleshooting description: This skill should be used when the user mentions "HLS not working", "haskell-language-server issues", "Haskell LSP problems", "no completions in Haskell", "HLS diagnostics not showing", "troubleshoot HLS", "Haskell code analysis not working", or asks why HLS features aren't available in Claude Code.
HLS Troubleshooting Guide
This skill provides guidance for diagnosing and resolving Haskell Language Server (HLS) issues in Claude Code.
Overview
HLS provides LSP features for Haskell development: diagnostics, go-to-definition, completions, hover info, and code actions. When HLS isn't working, these features become unavailable for .hs and .lhs files.
Quick Check
Before troubleshooting, run the status command to identify the problem:
/hls:status
This performs three checks: PATH availability, version info, and startup test.
Progressive Troubleshooting
Diagnose issues from simple to complex. Most problems fall into one of three levels.
Level 1: HLS Not Found in PATH
Symptoms:
/hls:statusreports PATH check failed- "command not found" errors
- No LSP features available
Diagnosis:
Check if HLS is installed:
which haskell-language-server-wrapper
Common Fixes:
-
Install via GHCup (recommended):
ghcup install hls -
Add GHCup to PATH - Add to shell config (
.bashrc,.zshrc):export PATH="$HOME/.ghcup/bin:$PATH" -
Verify installation location - Check common paths:
~/.ghcup/bin/haskell-language-server-wrapper~/.local/bin/haskell-language-server-wrapper~/.cabal/bin/haskell-language-server-wrapper
-
Restart Claude Code after PATH changes
Level 2: HLS Started But Unresponsive
Symptoms:
/hls:statusPATH check passes but startup test fails- HLS process visible but no LSP responses
- Long delays before features appear
Diagnosis:
Check if HLS process is running:
ps aux | grep haskell-language-server
Check system resources:
# Memory usage
free -h
# CPU usage
top -b -n 1 | head -20
Common Fixes:
-
Wait for initial indexing - HLS may take several minutes on first load for large projects
-
Check GHC version compatibility - HLS version must match project's GHC:
haskell-language-server-wrapper --version ghc --versionConsult
references/hls-docs.xmlfor the GHC version support matrix. -
Kill stuck processes:
pkill -f haskell-language-server -
Check available memory - HLS requires significant RAM for large projects. Consider:
- Closing other applications
- Increasing swap space
- Using a smaller project subset
-
Review HLS logs - Enable debug logging:
claude --enable-lsp-loggingLogs written to
~/.claude/debug/
Level 3: HLS Running But LSP Commands Failing
Symptoms:
/hls:statusall checks pass- Some features work but others don't
- Intermittent errors or partial responses
Diagnosis:
Test specific LSP features manually. Check project configuration:
# Look for hie.yaml
ls -la hie.yaml
# Check cabal/stack files
ls -la *.cabal cabal.project stack.yaml 2>/dev/null
Common Fixes:
-
Verify project builds - HLS requires a buildable project:
cabal build # or stack buildFix any compilation errors first.
-
Check hie.yaml configuration - For multi-component projects, HLS needs to know which component each file belongs to. Generate implicit config:
gen-hie > hie.yamlSee
references/hls-docs.xmlfor hie.yaml configuration details. -
Cradle errors - If HLS reports cradle loading failures:
- Ensure
cabal.projectorstack.yamlexists at project root - Run
cabal updateto refresh package index - Check for syntax errors in cabal files
- Ensure
-
Enable verbose logging for detailed diagnostics:
claude --enable-lsp-loggingCheck
~/.claude/debug/for HLS communication logs. -
Plugin-specific issues - Some HLS plugins may fail independently. Consult
references/hls-docs.xmlfor plugin configuration.
Platform-Specific Notes
Windows
- Use
whereinstead ofwhichfor PATH checks - PATH separator is
;not: - Common install location:
%APPDATA%\ghcup\bin
macOS
- GHCup installs to
~/.ghcup/bin - May need to allow in System Preferences > Security if blocked
Linux
- GHCup installs to
~/.ghcup/bin - Ensure glibc compatibility for prebuilt binaries
When to Consult Reference Documentation
For detailed information beyond this troubleshooting guide:
- HLS configuration and features: See
references/hls-docs.xml - GHC version issues and compiler errors: See
references/ghc-user.xml - Cabal project setup and build issues: See
references/cabal-docs.xml
These references contain comprehensive documentation for complex issues not covered here.
Summary Checklist
When HLS isn't working:
- Run
/hls:statusfor quick diagnosis - Level 1: Check PATH and installation
- Level 2: Check process state and resources
- Level 3: Check project configuration and builds
- Enable
--enable-lsp-loggingfor detailed debugging - Consult reference docs for complex issues
Repository
