Skip to main content

Module utils

Module utils 

Source

Enums§

PositionEncoding
How the LSP client counts column offsets within a line.

Functions§

byte_offset_to_position
Convert a byte offset in source to an (line, column) pair whose column unit depends on the negotiated PositionEncoding.
encoding
Read the negotiated encoding (falls back to UTF-16 if never set).
find_git_root
Returns the path of the top-level directory of the working git tree.
find_project_root
Finds the foundry project root by walking up from path looking for foundry.toml, bounded by the git root. Falls back to the git root if no foundry.toml is found.
is_valid_solidity_identifier
position_to_byte_offset
Convert an LSP (line, character) position back to a byte offset, where character is interpreted according to the negotiated PositionEncoding.
set_encoding
Store the negotiated encoding. Called exactly once from the LSP initialize handler. Subsequent calls are silently ignored.