feat(lsp): Language Server Protocol (LSP)#11187
feat(lsp): Language Server Protocol (LSP)#11187mmsaki wants to merge 63 commits intofoundry-rs:masterfrom
lsp): Language Server Protocol (LSP)#11187Conversation
- Add linting by running forge lint --json on current file buffer on save and on file open
|
Thanks for carrying the torch on this, I have wanted a solid LSP for what feels like ages. The fact that |
It's so underrated. Already used the LSP to remove 84 unused imports in uniswap v4-core 👀 see PR Uniswap/v4-core#979, refactoring 45 files really easy with the LSP even without all the other features. @0xClandestine Thanks for your work on forge lint too. |
|
@mmsaki Lol, I had a similar PR the other day This actually solves one of my main frustrations when running Anyways, I was able to get it to work with vscode (and cursor) using the following extension and config if others are interested in trying it out: [
{
"languageId": "solidity",
"command": "forge",
"fileExtensions": [
".sol"
],
"args": [
"lsp"
]
}
]
|
|
@0xClandestine Thanks for testing it on vscode! Looks amazing 🙌. |
lsp): Language Server Protocol (LSP)
DaniPopes
left a comment
There was a problem hiding this comment.
Hi, thanks for your contribution. We would like to hold off on this for the moment as we have plans of implementing it upstream in solar. In this current state it won't work well for large projects, but we will certainly integrate parts of this PR upstream.
|
Happy to see this getting pick up upstream! LFG 🙌 |
|
FYI this is tracked in paradigmxyz/solar#394. |
|
thank you! this one is superseded by #11619 implementation in Solar |

Motivation
This PR introduces native Language Server Protocol (LSP) support to Foundry via a new
forge lspcommand.The motivation behind this is to provide a first-class developer experience for Solidity projects using Foundry by exposing core compiler features (like linting, syntax errors, remappings, etc.) directly to LSP-compatible editors such as Neovim and VSCode.
Previously, users had to rely on external plugins or custom tooling to get real-time feedback while editing Solidity code. This native integration unlocks accurate diagnostics, contextual tooling, and seamless integration with Forge projects out of the box.
Solution
This PR adds:
forge lsptokio-based LSP server implementation using tower-lspcrates/lsp, and registered as a new Forge subcommand.hover, andcode actionsis planned.forge lintnotification via "textDocument/publishDiagnostics" requests with streaming updatesPR Checklist
Done
Planned