Replies: 18 comments 65 replies
|
Sounds great, my only thought is that https://github.com/valentjn/ltex-ls has proven to be the ultimate spell and grammar checker, could you integrate that somehow? At the moment it needs some special features to work that are not part of the lsp spec. There is a plugin version for nvim, https://github.com/vigoux/ltex-ls.nvim that implements those features, could it be ported to Helix? |
|
Using tree-sitter to determine what should be spell checked sounds like a good idea to me 👍 Spell-checking in general though is a question mark: there isn't anything built-in at the moment or a way to plug in a checker like aspell. It would probably be worth some discussion whether that even belongs in the core or as a plugin. I think it would be handy if LSP could be used to provide spell-checking capabilities. Maybe languages could inject a language like we do for tree-sitter-comment or markdown in docs and the spelling language server could act on the injected ranges (although currently injected content can't be adressed by a language server afaik). |
|
Microsoft recently released a blog post on how they introduced spell checking to Visual Studio: https://devblogs.microsoft.com/visualstudio/visual-studio-spell-checker-preview-now-available/ |
|
I've come around to the other side on this since my last comment ☝️: I think it's reasonable to have spell-checking as a core feature. Finding system-installed dictionaries is fairly straight-forward and fits well into Spell checking also requires some other advancements in core that we want for other features like running tree-sitter queries across language injections (like for rainbow brackets, textobjects, indents) and segmenting a whole buffer into words efficiently (useful for- but maybe different than lexical autocomplete). Specifically about spell-checking, we really only need the ability to: create an in-memory dictionary from Hunspell The existing options we have (hunspell, nuspell, enchant) are a bit annoying from a build perspective: we would need to depend on the presence of libenchant or hunspell as a library at build-time and use FFI, so spell checking as a feature would probably need to be optional. I'd really like to avoid complicating the build or increasing our dependency on C(++) codebases so as archseer mentions, I'm working on a pure-Rust spell-checker compatible with Hunspell dictionaries. I'll make the repo public and push up an integration branch once the project matures some more. |
|
As #2507 has been released as part of 23.10, could / should this discussion be revisited? :) In my experience, good spellcheck also in a coding environment (not just pure markdown or text) per se is already quite useful at catching a number of "stupid" bugs :) . My questions:
|
|
Nope, it does not. New words could be added to a custom dictionary file
in the project directory.
…On Fri, 2024-01-26 at 06:01 -0800, weakish wrote:
@akhilman Does diagnostic-language-server support code actions (e.g.
replace the word with suggestions, add word to dictionary, etc)?
|
|
Vale now has a language server, and tree sitter based spell checking for comments in programming languages like Rust! https://github.com/errata-ai/vale/releases/tag/v3.5.0 https://github.com/errata-ai/vale-ls (needs vale installed) I have not tried it in Helix yet, but it looks like it could be perfect. |
|
I got vale working in Helix. It's really good. One other one to try out is https://github.com/tekumara/typos-lsp - I was using this beforehand. It has really low false-positive rate but a higher false-negative rate due to the fact that it has a predefined list of common misspellings and only alerts on those. It's fairly comprehensive, though! |
|
I'm using and things appear to be working. |
|
I do not have a My |
|
Use the configuration tool (https://vale.sh/generator) to generate your |
|
One other option that was recently shared on the Helix Matrix chat is Harper. This is the best LSP solution that I've tested so far. It's very fast and can be installed using cargo. Will work for both text based documents as well as comments. Another good option until we have @the-mikedavis's solution. Configuration is in the wiki: https://github.com/helix-editor/helix/wiki/Language-Server-Configurations#harper-ls |
Your mistake may have been trying Vale first. Vale is significantly harder to set-up than Harper. Better documentation for how to set-up a spellchecking LSP could alleviate this issue. |
Harper also uses tree-sitter for spellchecking in code, just like Helix would. |
|
The point of Helix is that batteries ARE INCLUDED. Spell check should be a feature that comes out of the box. It certainly does that from its big brother Vim. If it is not included users might as well use Vim + vendor meta package like AstroNvim. |
|
I am now using codebook https://github.com/blopker/codebook , which takes spellbook https://github.com/helix-editor/spellbook and turns it into a LSP, while integrating with treesitter, logics with camelcase etc. Works like a charm, I can recommend. See the installation instructions at blopker/codebook#30 (comment) . |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
For a bit of background: I've been writing a lot of documentation lately for Phoenix Live View and Helix is my daily driver 🧬 ⚗️
Would the maintainers be interested in accepting a PR to Helix core that adds a built-in spellchecker that uses tree-sitter queries to determine what parts of the document to spellcheck? For example, consider the following Elixir code:
As a user, I would like the text inside of the comment string and the
@docto be spellchecked against my preferred language (in this case, en-US), but not the Elixir identifiers themselves. The tree-sitter queries could look something like this:This would allow for syntax-aware spell checking for each language and would be customizable for each user. Typos could be represented as diagnostics, possibly even with a list of close matches to a known dictionary?
See https://github.com/lewis6991/spellsitter.nvim for an example of what I am thinking of 🙂
All reactions