An open API service indexing awesome lists of open source software.

https://github.com/bobbylight/spellchecker

A spell checker add-on library for RSyntaxTextArea.
https://github.com/bobbylight/spellchecker

Last synced: 6 months ago
JSON representation

A spell checker add-on library for RSyntaxTextArea.

Awesome Lists containing this project

README

          

# SpellChecker
![Build](https://github.com/bobbylight/SpellChecker/actions/workflows/gradle.yml/badge.svg)
![CodeQL](https://github.com/bobbylight/SpellChecker/actions/workflows/codeql-analysis.yml/badge.svg)
![Maven Central](https://maven-badges.herokuapp.com/maven-central/com.fifesoft/spellchecker/badge.svg)
[![codecov](https://codecov.io/gh/bobbylight/SpellChecker/graph/badge.svg?token=xzoUjtmmjf)](https://codecov.io/gh/bobbylight/SpellChecker)

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](http://jazzy.sourceforge.net), 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 17, but runs on Java 8 and later.

## 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:

```java
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](https://github.com/bobbylight/SpellChecker/blob/master/LICENSE.md) file.

## Sister Projects

* [RSyntaxTextArea](https://github.com/bobbylight/RSyntaxTextArea) provides syntax highlighting, code folding, and many other features out-of-the-box.
* [AutoComplete](https://github.com/bobbylight/AutoComplete) - Adds code completion to RSyntaxTextArea (or any other JTextComponent).
* [RSTALanguageSupport](https://github.com/bobbylight/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](https://github.com/bobbylight/RSTAUI) - Common dialogs needed by text editing applications: Find, Replace, Go to Line, File Properties.