Skip to content

feat(forge): add editor clients and LSP launcher - #16730

Open
0xKarl98 wants to merge 8 commits into
foundry-rs:masterfrom
0xKarl98:lsp_extension
Open

0xKarl98 wants to merge 8 commits into
foundry-rs:masterfrom
0xKarl98:lsp_extension

Conversation

@0xKarl98

@0xKarl98 0xKarl98 commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Forge already embeds the Solar language server. This PR adds the editor clients and lets users open VS Code directly with forge lsp.

  • Run forge lsp in a terminal from any Solidity project directory to open that project in a VS Code Extension Development Host. Open a .sol file to get diagnostics, Go to Definition, hover and formatting.
  • Include the compiled VS Code extension in Forge. Users need a Forge build containing this change and VS Code installed; they do not need a Foundry checkout, Node/npm, a separate Solar binary or an F5 step. The launcher caches the extension and uses a separate VS Code profile so existing editor settings are preserved.
  • Bring Solar's VS Code and Zed clients into editors/ so they can be maintained alongside Forge. Both use the same selected Forge executable for the language server, formatting and background checks. Keep the original licenses, attribution and command IDs, and provide migration messages for settings that previously selected standalone Solar.
  • Keep forge lsp --stdio as the server entry point for editor clients. Bare forge lsp also stays in server mode when stdin is redirected; --vscode explicitly opens VS Code.
  • Keep Node tooling out of normal Cargo builds. Commit the generated client bundle and check that it matches the source in editor CI.

For a user with this build installed, the starting point is their own project:

cd /path/to/solidity-project
forge lsp

Import the Solar VS Code and Zed clients with their grammar resources,
licenses and source attribution. Use one resolved Forge executable for
forge lsp, formatting and automatic Forge checks, preserving existing
settings and command identifiers with explicit executable-path migration.

Add isolated development hosts, independent client builds and CI, local
packaging instructions and real Forge regression coverage for unsaved
diagnostics, navigation and project-aware formatting.

Developed with AI assistance for implementation, tests and documentation.
@github-actions

github-actions Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

✅ Changelog found

The deterministic check will validate the changed entry.

@0xKarl98
0xKarl98 marked this pull request as draft September 8, 2026 08:08
@0xKarl98
0xKarl98 marked this pull request as ready for review September 8, 2026 08:29
Comment thread editors/vscode/src/extension.ts Outdated
Comment thread crates/forge/src/cmd/lsp/editor.rs
Comment thread crates/forge/src/cmd/lsp/editor.rs
@DaniPopes

DaniPopes commented Sep 8, 2026

Copy link
Copy Markdown
Member

please symlink the licenses from root dir not copy, and delete the dist dirs

The LSP server can close its output after exit before the test client enqueues its local Stop event, making successful shutdown panic with ServiceStopped. Remove the redundant event and wait for EOF while retaining protocol error and child exit-status checks.
@0xKarl98
0xKarl98 requested review from mablr and mattsse September 8, 2026 13:30
DaniPopes added a commit to paradigmxyz/solar that referenced this pull request Sep 8, 2026
Foundry PR #16730 moves the VS Code and Zed clients into Foundry and
makes `forge lsp` the editor entry point. Remove the duplicated clients
from Solar so there is one maintained implementation and keep the Solar
LSP server that Foundry embeds.

This removes the tracked VS Code and Zed client sources, grammar assets,
package metadata, and the VS Code Dependabot update block. It keeps
`editors/README.md` as a migration page for existing links, updates the
root README to point users to Foundry, and removes stale workspace links
to the deleted Zed crate. Historical changelog entries remain unchanged.

The Solar `crates/lsp` implementation, CLI entry point, tests, and
benchmarks are untouched.

Related: foundry-rs/foundry#16730

---------

Co-authored-by: DaniPopes <57450786+DaniPopes@users.noreply.github.com>
@socket-security

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

4 participants