This extension provides support for the Cairo programming language. Cairo is the first Turing-complete language for creating provable programs for general computation.
Cairo Language Server is alpha-grade software. Things are moving rapidly. Expect bugs and crashes from time to time.
- code completion with imports insertion
- automatic, incremental analysis
- diagnostic reporting of build warnings and errors
- go to definition
- semantic syntax highlighting
- documentation lookup on hover
- function signature provider
- code formatter
- supports Scarb, the Cairo package manager
- can be configured to use Dojo Engine-specific tooling
Gm! 👋
Whether you are new to Cairo or an experienced Cairo Pharaoh, we hope you will find this extension fitting your needs and making your Cairo development experience more enjoyable.
- Install latest Scarb, preferably via asdf.
- Install the VS Code Cairo extension.
- Open a workspace containing Scarb.toml or just open any Cairo file to automatically activate the extension.
- The extension depends on the Cairo Language Server, which comes bundled with Scarb. The version of Scarb used in the workspace determines the version of Cairo and Cairo Language Server used by the extension.
Happy coding!
This extension can be configured through VS Code's configuration settings.
All settings all under the cairo1.*
section.
Consult the settings UI in VS Code for more documentation.
For questions or inquiries about Cairo, Cairo Language Server and this extension, reach out to us on Discord.
If you run into issues with the extension, try these debugging steps:
- Make sure you have the latest version of the extension installed.
- Make sure you have the latest version of Scarb installed.
- Make sure the problem is also not appearing while running
scarb build
. - Try the latest nightly release of Scarb, to verify the bug is not fixed yet.
This is simple to do with asdf:
And restart VS Code.
asdf install scarb latest:nightly asdf local scarb latest:nightly
- Check out debug logs for hints on what could go wrong.
In normal operation mode, both this extension and Cairo Language Server are pretty silent in their logs. Logs are emitted to the Output panel in VS Code.
You can enable debug logging to learn more about what's going on. By default, the extension is trying to start the language server with the same logging level as the extension is running itself. To change the logging level, do the following:
- Open the Command Palette (
F1
orCtrl+Shift+P
). - Run the
>Developer: Set Log Level...
command - Find the
Cairo
extension on the list. - Choose the
Debug
level. - Restart VS Code, by running the
>Developer: Reload Window
command.
When sending logs to developers to debug, please include full logs from both the extension and the language server. If you feel brave enough, you can try some of the more advanced debugging techniques described in CairoLS contribution guidelines.