zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
39.48k stars 2.06k forks source link

Spell Checking #5305

Open rkusa opened 1 year ago

rkusa commented 1 year ago

Is your feature request related to a problem? Please describe. I regularely make a lot of typos in code comments, docs, but also in variable names. It is always annoying if pull-requests get post-poned just because of typos reviewers found.

Describe the solution you'd like I find it tremendously helpful if Zed could spell checks my code. I personally rely a lot on this in e.g.:

Things the spell checker might check:

Additional useful features:

I'd find it especially neat if the spell check would use native system APIs so that I can expect consistent behaviour between the editor and other apps on my system.

Screenshots

Sublime Text:

image

VSCode Code Spell Checker extension:

image

iamnbutler commented 1 year ago

My dream would be to embed something like Grammarly right in Zed :)

rkusa commented 1 year ago

Just came along the following code spelling library written in Rust. Just dropping the link in case it would help: https://github.com/crate-ci/typos

jaydenseric commented 5 months ago

I just tried setting up Zed today and this was the showstopper issue that made me go back to VS Code. Spell check is a critical concern of an editor; it's generally too complex to enforce correct spelling cross-platform via CLI and CI with any degree of confidence and you may be contributing spelling errors to projects with tooling and CI not in your control. I am hopelessly dependent on spellcheck when writing hundreds of words worth of comments and docs per day, or when naming things like types, functions, and variables.

VS Code spell check is quite poor because it's via an extension (https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker) and not the native macOS spellcheck system, so the spell check UI is inconsistent with other apps and the learned words and not in sync with every other app on your system. But at least it has a solution.

There are non VS Code editors out there that have really nice native OS based spell check, so it's possible.

SpyrosMourelatos commented 4 months ago

I would prefer LanguageTool to Grammarly as it FOSS and supports more languages

JosephTLyons commented 3 months ago

This feature feels like a rather large one to add to Zed, when considering all of the things you should be able to do with spell check. What does a good first pass look like? What would be the bare minimum needed to ship something useable?

Some unknowns:

Bonus points

Spell checking in Zed's chat editor.

Future AI ideas

A distant future goal might be to somehow leverage the supported AI models in Zed to fill suggestions for mispelled words, if the suggestions provided by some crate aren't the greatest.

bajtos commented 3 months ago

How do we want to surface the spelling errors? Is it just another red squiggly line and do we have a way to suggest a fix?

In VS Code, the Grammarly extension integrates with the "suggested fix" feature provided by language servers. I can use the same keyboard shortcut to fix ESlint violations and spelling/grammar mistakes.

jansol commented 3 months ago

Vale is an offline rule-based "prose linter" (spelling & style checker) with an official LSP implementation. It is also code-aware so it can check code comments and won't get confused by markdown or HTML. Seems like a great fit?

arthur-st commented 3 months ago

Testing Vale this week, and it works quite well on the CLI level. The configuration might be a bit tricky to set up, but should be fine sailing afterwards.

phaynes commented 3 months ago

Future AI ideas

A distant future goal might be to somehow leverage the supported AI models in Zed to fill suggestions for mispelled words, if the suggestions provided by some crate aren't the greatest.

I frequently switch among Zed, ChatGPT, Gemini, etc., for Markdown editing, focusing on three key tasks:

  1. Proofing: My standard response settings are tailored for specific styles, as exemplified below. I need the proofreading to adhere to a distinct style based on the context—basic questions, formal responses, and technical discourse—and to be delivered in Markdown format using British English spelling.

For example, part of my chatGPT response template is - "Basic questions should be concise and direct, emulating the style of the Australian Daily Telegraph, without colloquialisms. Formal responses should be brief and direct, utilizing a military writing style. Technical responses should cater to a postgraduate audience and remain technical." Ideally, I'd like the option to easily select the level of proofing required right after highlighting the text I've just written. i.e a "quick proof", followed by a more reasoned proof, where I give the AI's more context to assist in their feedback.

  1. Argument Improvement & Revision: I alternate between AI tools to refine and enhance my work. Direct integration of such feedback within Zed would streamline my editing process.

  2. Post-Production: The final adjustments include ensuring APA v7 compliance for references, adding document headers, and formatting the output to specific standards (PDF/HTML or voice script).

Incorporating these features into Zed would significantly enhance my editing workflow, minimizing the need to switch between different tools for each task, and negate the need for inline spelling checks

brandondrew commented 1 week ago

I would prefer LanguageTool to Grammarly as it FOSS and supports more languages

Yeah, I've never been overly impressed with the feedback I get from Grammarly.