Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

ericglau/cairo-ls

Repository files navigation

Cairo Language Server

VS Code vim/nvim LSP

Note: This project is deprecated in favour of vscode-cairo for Cairo 1.0.

Code assistance for writing Cairo smart contracts for StarkNet.

Works with any IDE or text editor that supports the Language Server Protocol.

Features

  • Compiler support for .cairo files
  • Live diagnostic highlighting for compile errors
  • Quick fixes with suggestions provided by Cairo/StarkNet compiler
  • Go to definitions for imports
  • Code completion for imports

IDE support

  • Prerequisites:
    • Install node on your local machine.

VS Code

VS Code extension

Vim

CoC extension with setup instructions.

Helix

Helix setup instructions

How to use with other IDEs

Language server

  1. In an empty directory, run the following to install the language server:
npm install cairo-ls
  1. Configure a language client for your IDE to launch the language server with the following command (replace YOUR_DIRECTORY with the directory where you ran the command in step 1):
node YOUR_DIRECTORY/cairo-ls/node_modules/cairo-ls/out/server.js --stdio
  1. Install Nile by following its Getting started steps, or follow the Cairo environment setup steps.
  2. Open a .cairo file in your IDE or text editor.
  3. If your project's contracts directory is in a subfolder such as src, set the folder name using the sourceDir setting in your IDE or language client settings.