Skip to content

vlabo/cspell-lsp

Repository files navigation

Spell Checker LSP

This lsp performs spell checking in source code files, using the cspell library.

This is a fork of vscode-spell-checker and adapted to work with the
This was intended as a fork to but its now rewritten to be general basic spell check LSP. Tested on Helix text editor, Neovim.
Community support for Zed by @mantou132 zed-cspell

Install

npm install -g @vlabo/cspell-lsp

Arguments

--config, -c -> path to cspell.json config file. If not supplied the lsp will try to create a file in the root of the project. (optional)
--sortWords  -> Sorts the words in the config file (optional)
--stdio      -> Type of communication with the editor. 

Helix config

helix/languages.toml:

[language-server.cspell]
command = "cspell-lsp"
args = ["--stdio", "--config", "<path to cspell.json>"] # If the --config parameter is missing it will use the project cspell.json file.

# Add for every language that you want to spell check
[[language]]
name = "rust"
language-servers = ["rust-analyzer", "cspell"]

[[language]]
name = "cpp"
language-servers = [ "clangd", "cspell" ]

[[language]]
name = "markdown"
language-servers = [ "marksman", "cspell" ]

For reference https://github.com/helix-editor/helix/blob/86023cf1e6c9ab12446061e40c838335c5790979/languages.toml

Neovim config - Zero LSP

local lsp_configurations = require('lspconfig.configs')

if not lsp_configurations.cspell_lsp then
  lsp_configurations.cspell_lsp = {
    default_config = {
      cmd = {"<path-to-cspell-lsp>", "--stdio", "--config", "<path to cspell.json>"}, -- If the --config parameter is missing it will use the project cspell.json file.
      filetypes = {"go", "rust", "js", "ts", "html", "css", "json", "yaml", "markdown", "gitcommit"},
      root_dir = require('lspconfig.util').root_pattern('.git')
    }
  }
end
require('lspconfig').cspell_lsp.setup({})

Build

npm install
npm run build

About

A simple source code spell checker for helix

Resources

License

Stars

Watchers

Forks

Contributors 54