Skip to content

bobbylight/SpellChecker

Repository files navigation

SpellChecker

Build CodeQL

SpellChecker is a spell check add-on for RSyntaxTextArea. For programming languages, it spell-checks text in comments, and when editing plain text files, the entire file is spell-checked. Spelling errors are squiggle-underlined in the color of your choosing, and hovering the mouse over a misspelled word displays a tool tip with suggested fixes (if any). You can configure the library to also use a "user dictionary" file, allowing the user to add extra words to the spell check white list.

This add-on is based on Jazzy, a Java spell checker. Indeed, 99% of the code is just Jazzy, with changes made for performance, bug fixes, and Java 8 syntax.

This library is built with Java 8. Using a more recent version of Java will result in compile warnings, but the build should still complete. Cleaning up these warnings is not a priority as long as this library targets Java 8.

Getting a dictionary file

While the SpellingParser class can take any implementation of the SpellDictionary interface, typically English users will use one of the SpellingParser.createEnglishSpellingParser() overloads. These overloads take a zip file containing .dic files for either American or British English. Such a zip file is generated by this library when running ./gradlew clean build - src/main/dist/english_dic.zip. This file is not source controlled, but the .dic files that make up its contents are, so we can easily track added words over time.

Usage

As mentioned above, building this project builds an english_dic.zip file that can be used for both American and British English spellchecking. Using this zip file, the easiest method to add spell checking to RSTA is as follows:

import org.fife.ui.rsyntaxtextarea.spell.*;
// ...
File zip = new File("location/of/generated/english_dic.zip");
boolean usEnglish = true; // "false" will use British English
SpellingParser parser = SpellingParser.createEnglishSpellingParser(zip, usEnglish);
textArea.addParser(parser);

See the SpellCheckerDemo submodule for a working example.

Just like Jazzy itself, this add-on is licensed under the LGPL; see the included LICENSE.md file.

Sister Projects

  • RSyntaxTextArea provides syntax highlighting, code folding, and many other features out-of-the-box.
  • AutoComplete - Adds code completion to RSyntaxTextArea (or any other JTextComponent).
  • RSTALanguageSupport - Code completion for RSTA for the following languages: Java, JavaScript, HTML, PHP, JSP, Perl, C, Unix Shell. Built on both RSTA and AutoComplete.
  • RSTAUI - Common dialogs needed by text editing applications: Find, Replace, Go to Line, File Properties.

About

A spell checker add-on library for RSyntaxTextArea.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages