forked from FuelLabs/sway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for LSP with different IDEs (FuelLabs#4801)
## Description Closes FuelLabs#4276 Screenshots: ![Screenshot 2023-07-14 at 2 10 47 PM](https://github.com/FuelLabs/sway/assets/47993817/aa2bd354-98ed-4254-b69e-c1a8b38ffea6) ![Screenshot 2023-07-14 at 2 10 57 PM](https://github.com/FuelLabs/sway/assets/47993817/f565af29-3360-4c90-a4da-fa294c80b386) ![Screenshot 2023-07-14 at 2 11 02 PM](https://github.com/FuelLabs/sway/assets/47993817/6853fa8d-2595-4fd9-8510-7dae20dcff48) ![Screenshot 2023-07-14 at 2 11 12 PM](https://github.com/FuelLabs/sway/assets/47993817/6517793c-6fcf-4829-8c29-32fd4489e324) ## Checklist - [x] I have linked to any relevant issues. - [ ] I have commented my code, particularly in hard-to-understand areas. - [ ] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] I have added tests that prove my fix is effective or that my feature works. - [ ] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [ ] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [ ] I have requested a review from the relevant team or maintainers. --------- Co-authored-by: Joshua Batty <[email protected]>
- Loading branch information
1 parent
55cb408
commit 6b50f9d
Showing
5 changed files
with
94 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Features | ||
|
||
## Code Actions | ||
|
||
_Source:_ [code_actions](https://github.com/FuelLabs/sway/tree/master/sway-lsp/src/capabilities/code_actions) | ||
|
||
Quickly generate boilerplate code and code comments for functions, structs, and ABIs. | ||
|
||
## Completion | ||
|
||
_Source:_ [completion.rs](https://github.com/FuelLabs/sway/blob/master/sway-lsp/src/capabilities/completion.rs) | ||
|
||
Suggests code to follow partially written statements for functions and variables. | ||
|
||
## Diagnostics | ||
|
||
_Source:_ [diagnostic.rs](https://github.com/FuelLabs/sway/blob/master/sway-lsp/src/capabilities/diagnostic.rs) | ||
|
||
Displays compiler warnings and errors inline. | ||
|
||
## Syntax Highlighting | ||
|
||
_Source:_ [highlight.rs](https://github.com/FuelLabs/sway/blob/master/sway-lsp/src/capabilities/highlight.rs) | ||
|
||
Highlights code based on type and context. | ||
|
||
## Hover | ||
|
||
_Source:_ [hover](https://github.com/FuelLabs/sway/tree/master/sway-lsp/src/capabilities/hover) | ||
|
||
Provides documentation, compiler diagnostics, and reference links when hovering over functions and variables. | ||
|
||
## Inlay Hints | ||
|
||
_Source:_ [inlay_hints.rs](https://github.com/FuelLabs/sway/blob/master/sway-lsp/src/capabilities/inlay_hints.rs) | ||
|
||
Displays the implied type of a variable next to the variable name. Configurable in Settings. | ||
|
||
## Rename | ||
|
||
_Source:_ [rename.rs](https://github.com/FuelLabs/sway/blob/master/sway-lsp/src/capabilities/rename.rs) | ||
|
||
Renames a symbol everywhere in the workspace. | ||
|
||
## Run | ||
|
||
_Source:_ [runnable.rs](https://github.com/FuelLabs/sway/blob/master/sway-lsp/src/capabilities/runnable.rs) | ||
|
||
Shows a button above a runnable function or test. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Sway LSP | ||
|
||
Welcome to the documentation for Sway LSP, the language server designed specifically for the Sway programming language. This documentation serves as a comprehensive guide to help you understand and utilize the powerful features provided by Sway LSP. | ||
|
||
Sway LSP is built on the [Language Server Protocol](https://microsoft.github.io/language-server-protocol/) (LSP), a standardized protocol for enabling rich programming language support in editor and IDE environments. It acts as a bridge between your favorite code editor or integrated development environment and the Sway programming language, offering advanced semantic analysis and a wide range of features to enhance your development experience. | ||
|
||
With Sway LSP, you can expect a seamless and efficient coding experience while working with the Sway programming language. It provides intelligent code completion, precise symbol navigation, type information, and other smart features that empower you to write clean and error-free code. By leveraging the power of Sway LSP, you can increase productivity, reduce debugging time, and write high-quality code with confidence. | ||
|
||
In this documentation, you will find detailed information about how to set up Sway LSP in your preferred code editor or IDE, configure its settings to match your coding style, and take advantage of its various features. We will guide you through the installation process, provide examples of typical configuration setups, and walk you through the usage of each feature supported by Sway LSP. | ||
|
||
Whether you are a beginner or an experienced Sway developer, this documentation aims to be your go-to resource for understanding and maximizing the capabilities of Sway LSP. So let's dive in and unlock the full potential of the Sway programming language with Sway LSP! | ||
|
||
- [Installation](./installation.md) | ||
- [Features](./lsp/features.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Installation | ||
|
||
The Sway language server is contained in the [forc-lsp](../forc/plugins/forc_lsp.md) binary, which is installed as part of the [Fuel toolchain](../introduction/fuel_toolchain.md). Once installed, it can be used with a variety of IDEs. It must be installed for any of the IDE plugins to work. | ||
|
||
> **Note**: There is no need to manually run `forc-lsp` (the plugin will automatically start it), however both `forc` and `forc-lsp` must be in your `$PATH`. To check if `forc` is in your `$PATH`, type `forc --help` in your terminal. | ||
## VS Code | ||
|
||
This is the best supported editor at the moment. | ||
|
||
You can install the latest release of the plugin from the [marketplace](https://marketplace.visualstudio.com/items?itemName=FuelLabs.sway-vscode-plugin). | ||
|
||
Note that we only support the most recent version of VS Code. | ||
|
||
## vim / neovim | ||
|
||
Follow the documentation for [sway.vim](https://github.com/FuelLabs/sway.vim) to install. | ||
|
||
## helix | ||
|
||
[Install helix](https://docs.helix-editor.com/install.html) and Sway LSP will work out of the box. | ||
|
||
Sway support is built into helix using [tree-sitter-sway](https://github.com/FuelLabs/tree-sitter-sway). | ||
|
||
## Emacs | ||
|
||
Coming soon! Feel free to [contribute](https://github.com/FuelLabs/sway/issues/3527). |