Ace: Syntax aware spell checking.

Created on 19 Aug 2014  路  8Comments  路  Source: ajaxorg/ace

I want a spell checker that takes into account the mode's syntax, e.g., on Markdown I don't want it to spell check inside code blocks, on LaTeX I don't what it to check the macros, etc.

Of course, this would require information to be added to the syntax files saying what has to be checked or not, like Vim's @spell.

It does not need to take into account the browser's dictionary: a completely separate one could be used instead (possibly with word addition by user). This is not important to me now.

I notice that there is the ext-spellcheck, but I don't know what it does, and I haven't been able to get it to work.

1) Does it do what I want?
2) If yes, how to get it working?

If not, consider this a feature request for the syntax aware spell checking.

I have tried:

  • git clone, then ./static.py, then http://localhost:8888/kitchen-sink.html. It seems that spellcheck is enabled on the kitchen sink at this line , but I see nothing on modes like Markdown or Text. Do I need to do something else?
  • a minimal test case from the build. npm install, node ./Makefile.dryice.js, then take build/src, and use the following file:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>ACE in Action</title>
<style type="text/css" media="screen">
    #editor {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
    }
</style>
</head>
<body>
<div id="editor">right wrongg</div>
<script src="ace/build/src/ace.js"></script>
<script src="ace/build/src/ext-spellcheck.js"></script>
<script>
    var editor = ace.edit('editor');
    editor.setOption('spellcheck', true);
</script>
</body>
</html>

Are those methods working for anyone? Can anyone provide a minimal test case that works?

Related issues:

Most helpful comment

+1 for this feature request

All 8 comments

spellcheck extension only shows suggestions in browser context menu, to get underlines working typo.js or a similar library is required. Comments at https://github.com/zedapp/zed/issues/67#issuecomment-33396045 might be useful.

@nightwing Thanks. IIUC, that thread talks about enabling the browser's textarea spell check on ACE. What I really wanted was a built-in spell check by ACE, which takes into account the syntax, e.g., does not spell check inside Markdown code blocks. I will update the question to explain that better, it there is no other feature request for that, let's consider this the feature request.

ext-spellcheck doesn't do what you want. it is only for integration with browsers menu.
Several people have created extensions for doing what you want, links to that extensions can be found from the thread i showed you.

+1 for this feature request

+1 for this feature request

+1 for this feature request

This works on Firefox:
If you add these attributes to editor's div element, Firefox will check for spelling:

contenteditable="true" spellcheck="true"

Although @rigon's solution seems to work for Firefox, it doesn't seem to have any effect on Chrome or Safari. Does anyone know how to enable built-in spellchecking for ace using those (and other) browsers?

EDIT - the solution in question is adding contenteditable="true" spellcheck="true" to the editor div element.

@nightwing has there been any progress in integrating spell checking in ace?

Was this page helpful?
0 / 5 - 0 ratings