From f52b29ac98b543a7d1b6cfb3885c0d3113346a4a Mon Sep 17 00:00:00 2001 From: Mika Vilpas Date: Thu, 6 Jun 2024 16:27:16 +0300 Subject: [PATCH 1/2] docs: add a contributing guide for typos-lsp 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. --- CONTRIBUTING-typos-lsp.md | 45 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 CONTRIBUTING-typos-lsp.md diff --git a/CONTRIBUTING-typos-lsp.md b/CONTRIBUTING-typos-lsp.md new file mode 100644 index 0000000..25c03f5 --- /dev/null +++ b/CONTRIBUTING-typos-lsp.md @@ -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 + + From eb2841623173d5634a65719abed6ce70cd8ff462 Mon Sep 17 00:00:00 2001 From: Oliver Mannion <125105+tekumara@users.noreply.github.com> Date: Fri, 7 Jun 2024 21:35:29 +1000 Subject: [PATCH 2/2] rename to CONTRIBUTING.md --- CONTRIBUTING-typos-lsp.md => CONTRIBUTING.md | 0 README.md | 4 ++++ 2 files changed, 4 insertions(+) rename CONTRIBUTING-typos-lsp.md => CONTRIBUTING.md (100%) diff --git a/CONTRIBUTING-typos-lsp.md b/CONTRIBUTING.md similarity index 100% rename from CONTRIBUTING-typos-lsp.md rename to CONTRIBUTING.md diff --git a/README.md b/README.md index 55240ff..cae20d2 100644 --- a/README.md +++ b/README.md @@ -53,3 +53,7 @@ Config files will be read from the workspace folder or its parents. If there is ## Why aren't my misspellings being corrected? To minimise false-positives `typos` only suggests corrections for known misspellings, rather than unknown words like a traditional spell-checker. For more info see [Why was ... not corrected?](https://github.com/crate-ci/typos?tab=readme-ov-file#why-was--not-corrected). + +## Contributing + +See [CONTRIBUTING.md](CONTRIBUTING.md) to get started.