solidity-lsp
Solidity language server providing smart contract development support including compilation, linting, security analysis, and code intelligence for .sol files. Use when working with Ethereum smart contracts, Substrate pallets, or any Solidity code that needs compilation, security
Installation
Pick a client and clone the repository into its skills directory.
Installation
About this skill
Solidity language server providing smart contract development support including compilation, linting, security analysis, and code intelligence for .sol files. Use when working with Ethereum smart contracts, Substrate pallets, or any Solidity code that needs compilation, security checks, gas optimization, or code navigation. Essential for ClawChain pallet development.
How to use
Zainstaluj kompilator Solidity (solc) i linter (solhint) globalnie za pomocą npm: npm install -g solc oraz npm install -g solhint. Zweryfikuj instalację uruchamiając solcjs --version i solhint --version.
Aby skompilować kontrakt, użyj komendy solcjs --bin --abi contract.sol. Jeśli chcesz włączyć optymalizację, dodaj flagę --optimize: solcjs --optimize --bin --abi contract.sol.
Uruchom linter na pojedynczym pliku komendą solhint contracts/MyContract.sol. Aby przeskanować cały projekt, użyj wzorca: solhint 'contracts/**/*.sol'.
Dla zaawansowanej analizy bezpieczeństwa zainstaluj slither-analyzer (wymaga Pythona): pip3 install slither-analyzer, a następnie uruchom slither contracts/.
Skonfiguruj reguły lintingu tworząc plik .solhint.json w katalogu głównym projektu. Użyj predefiniowanej konfiguracji "solhint:recommended" i dostosuj reguły, takie jak compiler-version czy func-visibility, do wymagań Twojego projektu.
Zintegruj narzędzie z edytorem obsługującym Language Server Protocol, aby uzyskać podświetlanie składni, detekcję błędów w czasie rzeczywistym i nawigację po kodzie podczas pisania kontraktów.