Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add options to use LanguageTool API and premium features #72

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,21 @@ testing, so please open issue when the ssl/tls connection is not working.
(setq langtool-http-server-stream-type 'tls)
```

*Note:* you can use the free plan with the following settings:
```
(setq langtool-http-server-host "api.languagetoolplus.com"
langtool-http-server-port 443
langtool-http-server-stream-type 'tls)

```

Also, if you have a premium account, setup:
```
(setq langtool-http-username "<username>"
;; https://languagetool.org/editor/settings/access-tokens
langtool-http-apiKey "<your-apiKey>")
```

## Optional settings

* Key binding if you desired.
Expand Down
29 changes: 28 additions & 1 deletion langtool.el
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,18 @@ Valid arguments are same to above except `nil'. This means `plain'."
:group 'langtool
:type 'symbol)

(defcustom langtool-http-server-username nil
"Username to access premium features"
:group 'langtool
:type 'string)

(defcustom langtool-http-server-apiKey nil
"Access token to access premium features
https://languagetool.org/editor/settings/access-tokens"
:group 'langtool
:type 'string)


(defcustom langtool-java-classpath nil
"Custom classpath to use on special environment. (e.g. Arch Linux)
Do not set both of this variable and `langtool-language-tool-jar'.
Expand Down Expand Up @@ -337,6 +349,14 @@ String that separated by comma or list of string."
(list string)
string))

(defcustom langtool-level nil
"If set to picky, additional rules will be activated"
:group 'langtool
:type '(choice
(const nil)
(const default)
(const picky)))

(defcustom langtool-user-arguments nil
"Similar to `langtool-java-user-arguments' except this list is appended
after `-jar' argument.
Expand Down Expand Up @@ -1238,7 +1258,14 @@ Ordinary no need to change this."
("text" ,text)
,@(and langtool-mother-tongue
`(("motherTongue" ,langtool-mother-tongue)))
("disabledRules" ,disabled-rules)))
("disabledRules" ,disabled-rules)
,@(and langtool-http-server-username
`(("username" ,langtool-http-server-username)))
,@(and langtool-http-server-apiKey
`(("username" ,langtool-http-server-apiKey)))
,@(and langtool-level
`(("level" ,langtool-level)))
))
query-string)
(when (and langtool-client-filter-query-function
(functionp langtool-client-filter-query-function))
Expand Down