zedapp / zed

Rethinking code editing.
http://zedapp.org
MIT License
2.22k stars 162 forks source link

Spell-checker #67

Open ijaaz opened 10 years ago

ijaaz commented 10 years ago

I could really use a spell-checker sometimes when I write. Chrome has a good inbuilt spell-checker, but Zed's input area is not recognised as a text field.

I was wondering if there is an easy fix for that, and if not, maybe adding a spell-checker would require some major changes, so better to think about it now.

zefhemel commented 10 years ago

I'm interested in this too, since I do quite a bit of writing in Zed these days (markdown mostly).

There is this: https://github.com/ajaxorg/ace/blob/master/lib/ace/ext/spellcheck.js but looking at the code I'd have no idea how it can possibly do spell checking -- it seems to do some hacky thing with the hidden text area, so I suspect it tries to use the native spell checker somehow. I tried getting to work but I failed, perhaps @nightwing knows about how to use it and what its limitations are?

Alternatively I can just build in something like typo.js: https://github.com/cfinke/Typo.js to do the spell checking and use Zed's new inline_annotation feature (https://github.com/zedapp/zed/blob/master/app/js/lib/inline_annotation.js) to mark misspelled words (and then some context menu hack, or key combo to correct the misspelled word). Shouldn't be all that hard and actually a good test of its extension capabilities.

nightwing commented 10 years ago

Spellcheck.js is only for showing suggestions in browser context menu, for cases when replacing contextmenu isn't possible. Typo.js or similar is still needed to show the markers.

There are several applications using Ace which have spellcheking https://github.com/benweet/stackedit https://github.com/bardsoftware/ace/tree/latex_spellchecking https://www.sharelatex.com/

ijaaz commented 10 years ago

Here is the spell checker that stackedit uses https://github.com/benweet/stackedit/blob/master/public/res/extensions/spellCheck.js.

zefhemel commented 10 years ago

@loveless01 I pushed a super basic version to the spell branch if you want to try. It currently underlines misspelled words in markdown and text files, there's no way to correct yet or to add a word to the dictionary yet. For that I need to add some Zed infrastructure (perhaps a generic "autofix" feature).

ijaaz commented 10 years ago

For some reason I am not able to test your github Zed versions, heres a couple pics to illustrate my problem: screenshot 2014-01-30 at 1 42 29 pm screenshot 2014-01-30 at 1 43 05 pm

zefhemel commented 10 years ago

Did you run the scripts/install_deps.sh script?— Zef

Sent from my iPhone

On Thu, Jan 30, 2014 at 7:44 PM, loveless01 notifications@github.com wrote:

For some reason I am not able to test your github Zed versions, heres a couple pics to illustrate my problem: screenshot 2014-01-30 at 1 42 29 pm

screenshot 2014-01-30 at 1 43 05 pm

Reply to this email directly or view it on GitHub: https://github.com/zedapp/zed/issues/67#issuecomment-33718899

ijaaz commented 10 years ago

Nope, thanks

ijaaz commented 10 years ago

So I just tested it out, and I can see one thing that could be fixed. Your spell checker seems to think that "1984" and any other number is a misspelling :)

I feel that the best way to implement the spell correction is by using the same type of popup that you used for the code suggestions.

zefhemel commented 10 years ago

Fixed the number misspelling issue now.

ijaaz commented 10 years ago

Thanks! By the way, are you thinking of creating a way to access and invoke popups, because I can imagine some great uses for that type of access (say, a keyboard shortcut which showed relevant synonyms and antonyms).

zefhemel commented 10 years ago

Yes, that's exactly what I'm thinking off. A complete-like pop up triggered with a command/key. — Zef

Sent from my iPhone

On Sat, Feb 1, 2014 at 5:53 AM, Muhammad Tello notifications@github.com wrote:

Thanks!

By the way, are you thinking of creating a way to access and a way to invoke popups, because I can imagine some great uses for that type of access (say, a keyboard shortcut which showed relevant synonyms and antonyms).

Reply to this email directly or view it on GitHub: https://github.com/zedapp/zed/issues/67#issuecomment-33863743

zefhemel commented 10 years ago

I've now merged the spell checker into master, but it's disabled by default. To enable, set the spellCheck preference to true, e.g. in your user.json:

{
    "imports": [
        "/default.json"
     ],
    "preferences": {
        "spellCheck": true
    },
    "modes": {},
    "keys": {},
    "commands": {},
    "events": {}
}
zefhemel commented 10 years ago

Once I get to this again, these are left to do before this issue can be closed (IMO):

sagefic commented 10 years ago

Can this still be turned on by the "spellCheck":true flag? Or is there now a different way to get this? an extension? Spellcheck for prose in markdown would be pretty awesome.

zefhemel commented 10 years ago

I've moved it to a separate package, it's still not great, though. To install, run the Tools:Zpm:Install command and enter: gh:zedapp/spellchecker to install it, after that, switching spellCheck to true should enable spellchecking in text and markdown documents.

machocam commented 8 years ago

Hello, speaking to you from the future here. Was this issue taken care of in the version out now? I don't seem to have spell checking available in the stable version out now.