Use LSP4IJ (by Red Hat) to connect java-functional-lsp to IntelliJ IDEA. Works on both Community and Ultimate editions.
-
Install the LSP server:
# Homebrew brew install aviadshiber/tap/java-functional-lsp # pip pip install java-functional-lsp
-
Verify it's on your PATH:
java-functional-lsp --help
If not on PATH, note the full path (e.g.,
which java-functional-lsp).
- Open IntelliJ IDEA
- Go to Settings → Plugins → Marketplace
- Search for "LSP4IJ"
- Click Install and restart the IDE
- Go to Settings → Languages & Frameworks → Language Servers
- Click the
+button to add a new server - Configure:
| Field | Value |
|---|---|
| Name | Java Functional LSP |
| Command | java-functional-lsp |
PATH issues? If IntelliJ can't find the binary, use the full path:
- Homebrew:
/opt/homebrew/bin/java-functional-lsp- pip:
~/.local/bin/java-functional-lsp(or check withwhich java-functional-lsp)On macOS, you can also use:
sh -c java-functional-lsp
In the Mappings tab of the server configuration, add mappings so the LSP server activates for Java files. Set up all three sub-tabs:
Language tab:
- Click
+→ select Java
File type tab:
- Click
+→ select Java
File name patterns tab:
- Click
+to add a pattern - Set File name patterns:
*.java - Set Language Id:
java
- Open any
.javafile in your project - Check the bottom status bar — you should see the LSP server connecting
- Write code that triggers a rule (e.g.,
return null;) — a warning should appear
Project-level rules are configured via .java-functional-lsp.json in your project root. See the main README for details.
The server automatically detects JetBrains IDEs and disables the jdtls proxy — IntelliJ provides its own Java language features (completions, hover, go-to-definition, compile errors). Only the 17 custom functional programming rules run, and they appear alongside IntelliJ's built-in inspections.
- Check Settings → Languages & Frameworks → Language Servers → select your server → Traces tab for error logs
- Verify the binary works: run
java-functional-lsp check --helpin a terminal
- Ensure the file mapping is set to Language:
Java, Language ID:java - Check that
.java-functional-lsp.jsondoesn't have rules set to"off" - Try restarting the language server: Language Servers (search it in intellij Actions [Double Shift on keyboard]) → click on java-functional-lsp → Restart
- If diagnostics worked before but stopped, the jdtls proxy may be interfering. Set
JAVA_FUNCTIONAL_LSP_JDTLS=offin the server command environment to force-disable jdtls. The server auto-detects JetBrains IDEs and disables jdtls by default (since IntelliJ provides native Java support), but this can be overridden withJAVA_FUNCTIONAL_LSP_JDTLS=on.
- IntelliJ may not inherit your shell's PATH. Use the full absolute path to the binary in the server command.