sway-lsp

Crates.iosway-lsp
lib.rssway-lsp
version0.66.5
sourcesrc
created_at2022-03-10 18:01:26.3797
updated_at2024-11-20 22:57:25.608275
descriptionLSP server for Sway.
homepagehttps://fuel.network/
repositoryhttps://github.com/FuelLabs/sway
max_upload_size
id547726
size670,963
(fuel-service-user)

documentation

README

Sway Language Server

Visual Studio Marketplace Version discord

This extension provides LSP support for the Sway smart contract programming language.

Features

  • go-to type definition
  • types and documentation on hover
  • inlay hints for types and parameter names
  • semantic syntax highlighting
  • symbol renaming
  • code actions
  • imports insertion

Coming Soon

  • code completion
  • apply suggestions from errors
  • find all references, workspace symbol search
  • ... and many more

Quick start

  1. Install the Fuel toolchain.
  2. Ensure forc-lsp is installed correctly by entering forc-lsp --version into your terminal.
  3. Install the Sway VSCode plugin.

Trying out the local version

To try out the local LSP version:

  1. Install the local version of the server: cargo install --path ./forc-plugins/forc-lsp.
  2. Open VSCode settings and set the Sway-lsp › Diagnostic: Bin Path to the installed forc-lsp binary. The path to the binary will be listed at the end of the cargo install command and is usually: /home/<user>/.cargo/bin/forc-lsp.
  3. Open an arbitrary Sway project. E.g., ./examples/arrays.
  4. Open the Output window in VSCode and select Sway Language Server from the drop down menu.
  5. Start coding and observe the LSP output in the Output window. This window will also show any dbg! or eprintln! lines.
Commit count: 3142

cargo fmt