forge-lsp

Crates.ioforge-lsp
lib.rsforge-lsp
version0.0.7
created_at2025-12-09 00:39:09.119086+00
updated_at2025-12-15 20:23:38.874216+00
descriptionLanguage Server Protocol implementation for Solidity
homepagehttps://github.com/mmsaki/forge-lsp
repositoryhttps://github.com/mmsaki/forge-lsp
max_upload_size
id1974619
size188,693
msakiart (mmsaki)

documentation

README

Solidity LSP

A Language Server Protocol (LSP) implementation for Solidity development using Foundry's compilation and linting infrastructure.

This work is a continuation from foundry-rs/foundry PR #11187.

Install

Install binary from crates.io

cargo install forge-lsp

Usage

Start the LSP server using:

forge-lsp --stdio

Features

  • forge lint errors
  • Diagnostics (compilation errors and warnings)
  • Go-to-definition
  • Symbol search and references

Development

Building

cargo build --release

Testing

cargo test

VSCode or Cursor

You can add the following to VSCode (or cursor) using a lsp-proxy extension see comment here:

[
  {
    "languageId": "solidity",
    "command": "forge-lsp",
    "fileExtensions": [
      ".sol"
    ],
  }
]

Neovim

If you have neovim 0.11+ installed add these to your config

-- lsp/forge_lsp.lua
return {
  cmd = { "forge-lsp" },
  filetypes = { "solidity" },
  root_markers = { "foundry.toml", ".git" },
  root_dir = vim.fs.root(0, { "foundry.toml", ".git" }),
}
-- init.lua
vim.lsp.enable("forge_lsp")

Debugging in neovim

Lsp logs are stored in ~/.local/state/nvim/lsp.log

To clear lsp logs run:

> -f ~/.local/state/nvim/lsp.log

To monitor logs in real time run:

tail -f ~/.local/state/nvim/lsp.log

Enable traces in neovim to view full traces in logs:

:lua vim.lsp.set_log_level("trace")

Contributing

Check out the foundry contribution guide.

Commit count: 0

cargo fmt