-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add a contributing guide for typos-lsp (#70)
This includes a basic guide for setting up the development environment in terms of the rust side (server) as well as the editor side (client). Currently instructions are provided for Neovim. I verified the setup works for me (as in, I see errors in neovim 🙂) and also consulted what seemed to be your dotfiles for reference ([link](https://github.com/tekumara/setup/blob/master/dotfiles/.config/nvim/init.lua#L21-L39)) --------- Co-authored-by: Oliver Mannion <[email protected]>
- Loading branch information
1 parent
1710e72
commit d05fad0
Showing
2 changed files
with
49 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Contributing to `typos-lsp` | ||
|
||
This document contains information on how to contribute to the `typos-lsp` crate, which is the implementation of the Language Server Protocol (LSP) server. | ||
|
||
The source code of `typos-lsp` can be found in the [crates/typos-lsp/](./crates/typos-lsp/) directory. | ||
|
||
Make sure you have installed the rust toolchain with [rustup](https://rust-lang.github.io/rustup/index.html). | ||
|
||
## Setting up your development environment | ||
|
||
### How to run tests | ||
|
||
```sh | ||
cargo test | ||
``` | ||
|
||
### How to run the LSP server locally for development | ||
|
||
First, compile the LSP server: | ||
|
||
```sh | ||
cargo build | ||
``` | ||
|
||
Next, configure your editor to launch the LSP server. | ||
|
||
#### Running locally in Neovim | ||
|
||
For example, in Neovim, you can use the [sample neovim LSP config](docs/neovim-lsp-config.md) in the following way: | ||
|
||
```lua | ||
-- Set the path of the LSP server to the compiled binary on your disk | ||
require('lspconfig').typos_lsp.setup({ | ||
-- ... other settings from the example | ||
cmd = { "/Users/me/git/typos-lsp/target/debug/typos-lsp" }, | ||
}) | ||
``` | ||
|
||
To test your configuration, you can use the following methods: | ||
|
||
- open e.g. [crates/typos-lsp/tools/test.txt](crates/typos-lsp/tools/test.txt). You should see errors when opening the file. | ||
- you can also run `:LspInfo` in Neovim to see the status of the LSP server. | ||
- you can run `cargo clean` in the root directory of the project. After this, you can make sure Neovim displays errors when opening a file. Once finished, run `cargo build` to fix this | ||
|
||
<!-- markdownlint-disable-file line-length --> |
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