This repo is mainly for debugging and experimentation.
binscontains the binaries for the demo with acompilerthat loads the plugin in memory andls(Language Server).contractscontains a minimal Cairo project that uses the plugin.plugincontains the source code for the demo plugin and compiler to extends Cairo and Scarb. The very simple plugin just rewrites implementations found into a module with a#[custom::contract]attribute.selfis automatically added by the plugin, or you can preciser: Rto injectref self: ContractStateinstead. If the implementation is namedbad, the plugin will emit a diagnostic. Also, if a statement in a function starts withlet fail = 1, the plugin will emit a diagnostic.
- Install Rust.
cargo build -r --workspaceorcargo run -r --bin compiler -- --manifest-path contracts/Scarb.toml
- Build the language server with
cargo build -r --bin demo-ls. - Install the Cairo extension for VSCode (
2.8.0). - Adjust the paths inside
settings.jsonand use this file setting into VSCode. - Open the folder
contracts. - Open the file
lib.cairo. - Make some changes inside the function and the diagnostics should appear inside the
PROBLEMStag, but not inside the editor panel. - A plugin diagnostic seems to be correctly handled by the language server, remove the
let fail = 1;for something else that generates a diagnostics, and it should not appear inside the editor panel.