-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy patheglot-grammarly.el
67 lines (49 loc) · 2.3 KB
/
eglot-grammarly.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
;;; eglot-grammarly.el --- Eglot Clients for Grammarly -*- lexical-binding: t; -*-
;; Copyright (C) 2021-2025 Shen, Jen-Chieh
;; Created date 2021-03-04 11:34:54
;; Author: Shen, Jen-Chieh <[email protected]>
;; URL: https://github.com/emacs-grammarly/eglot-grammarly
;; Version: 0.1.0
;; Package-Requires: ((emacs "24.3") (eglot "1.4"))
;; Keywords: convenience eglot grammarly checker
;; This file is NOT part of GNU Emacs.
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;;
;; Eglot server implementation for Grammarly
;;
;;; Code:
(require 'eglot)
(defgroup eglot-grammarly nil
"Settings for the Grammarly Language Server.
Link: https://github.com/znck/grammarly"
:group 'eglot
:link '(url-link "https://github.com/emacs-grammarly/eglot-grammarly"))
(defcustom eglot-grammarly-active-modes
'(text-mode latex-mode org-mode markdown-mode)
"List of major mode that work with Grammarly."
:type 'list
:group 'eglot-grammarly)
(defun eglot-grammarly--server-command ()
"Generate startup command for Grammarly language server."
(list 'eglot-grammarly-server "grammarly-languageserver" "--stdio"))
(add-to-list 'eglot-server-programs
`(,eglot-grammarly-active-modes . ,(eglot-grammarly--server-command)))
(defclass eglot-grammarly-server (eglot-lsp-server) ()
:documentation "A custom class for grammarly langserver.")
(defconst eglot-grammarly-client-id "client_BaDkMgx4X19X9UxxYRCXZo"
"Client ID is required for language server's activation.")
(cl-defmethod eglot-initialization-options ((server eglot-grammarly-server))
"Passes through required grammarly initialization options"
(list :clientId eglot-grammarly-client-id))
(provide 'eglot-grammarly)
;;; eglot-grammarly.el ends here