Skip to content

Solidity LSP server#

Woke implements an LSP server for Solidity. The only currently supported communication channel is TCP.

Woke LSP server can be run using:

woke lsp

Or with an optional --port argument:

woke lsp --port 1234

Info

Multi-root workspaces are not currently supported.

Projects using Woke LSP server#

Configuration options#

Server configuration options are loaded using the standard interface from LSP clients. The process of setting the configuration options is client specific. Configuration changes are handled by the server, and the project is recompiled if the compilation options change.

The full list of supported configuration options can be found in the configuration section.

Warning

Configuration options are not loaded from woke.toml files by the LSP server.

Supported commands#

Woke LSP server implements the command execution provider as specified by the LSP specification. The following commands are supported:

Command Arguments Description
woke.lsp.force_recompile Force recompile the opened project/files. Useful after modifying files outside the IDE (e.g. after installing npm packages).
woke.lsp.force_rerun_detectors Force rerun detectors on the opened project/files.
woke.generate.control_flow_graph 0: URI of the document containing the function
1: canonical name of the function
Generate a control flow graph for the given function or modifier. Returns the source code of the graph in Graphviz (DOT) format.
woke.generate.inheritance_graph 0: URI of the document containing the contract
1: name of the contract
Generate an inheritance graph for the given contract. Returns the source code of the graph in Graphviz (DOT) format.
woke.generate.inheritance_graph_full Generate an inheritance graph for the whole project. A workspace must be opened. Returns the source code of the graph in Graphviz (DOT) format.
woke.generate.linearized_inheritance_graph 0: URI of the document containing the contract
1: name of the contract
Generate a linearized inheritance graph for the given contract. Returns the source code of the graph in Graphviz (DOT) format.

Features#

Go to definition#

Go to definition preview

Go to type definition#

Go to type definition preview

Go to implementation#

Finds implementations of an unimplemented function or modifier.

Go to implementation preview

Find references#

Find references preview

Type hierarchy#

Contract type hierarchy preview

Also works for virtual functions.

Function type hierarchy preview

Document links preview

Hover#

Includes links to documentation for OpenZeppelin contracts.

Hover preview

Code lens#

Number of references is shown above each declaration.

Code lens preview

Document symbols#

Document symbols preview

Diagnostics#

Diagnostics preview

Diagnostics preview

Together with compiler errors, diagnostics also include results from Woke vulnerability detectors.

Diagnostics preview

Diagnostics preview

Rename#

Rename preview

Debugging#

Woke LSP server can be debugged using:

woke --debug lsp