config

Personal configuration.
git clone git://code.dwrz.net/config
Log | Files | Refs

lsp-racket.el (2506B)


      1 ;;; lsp-racket.el --- lsp-mode racket integration    -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (C) 2020 lsp-mode maintainers
      4 
      5 ;; Author: lsp-mode maintainers
      6 ;; Keywords: languages
      7 
      8 ;; This program is free software; you can redistribute it and/or modify
      9 ;; it under the terms of the GNU General Public License as published by
     10 ;; the Free Software Foundation, either version 3 of the License, or
     11 ;; (at your option) any later version.
     12 
     13 ;; This program is distributed in the hope that it will be useful,
     14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
     15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16 ;; GNU General Public License for more details.
     17 
     18 ;; You should have received a copy of the GNU General Public License
     19 ;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
     20 
     21 ;;; Commentary:
     22 
     23 ;; Client for the Racket language server.
     24 
     25 ;;; Code:
     26 
     27 (require 'ht)
     28 (require 'lsp-mode)
     29 
     30 
     31 ;; racket-langserver
     32 
     33 (defgroup lsp-racket-langserver nil
     34   "LSP support for Racket, using racket-langserver"
     35   :group 'lsp-mode
     36   :link '(url-link "https://github.com/jeapostrophe/racket-langserver"))
     37 
     38 (defcustom lsp-racket-langserver-command '("racket" "--lib" "racket-langserver")
     39   "Command to start the server."
     40   :type 'string
     41   :package-version '(lsp-mode . "8.0.0"))
     42 
     43 (lsp-register-client
     44  (make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-racket-langserver-command))
     45                   :major-modes '(racket-mode)
     46                   :priority 1
     47                   :server-id 'racket-langserver))
     48 
     49 
     50 ;; Theia
     51 
     52 (defgroup lsp-racket-language-server nil
     53   "LSP support for Racket, using racket-language-server."
     54   :group 'lsp-mode
     55   :link '(url-link "https://github.com/theia-ide/racket-language-server"))
     56 
     57 (defcustom lsp-racket-language-server-path "racket-language-server"
     58   "Executable path for the server."
     59   :type 'string
     60   :package-version '(lsp-mode . "8.0.0"))
     61 
     62 (defun lsp-racket-language-server-colorize-handler (&rest _args)
     63   "Handler for the colorize notification."
     64   ;; TODO:
     65   nil)
     66 
     67 (lsp-register-client
     68  (make-lsp-client :new-connection (lsp-stdio-connection (lambda () lsp-racket-language-server-path))
     69                   :major-modes '(racket-mode)
     70                   :priority -1
     71                   :notification-handlers (ht ("racket/colorize" #'lsp-racket-language-server-colorize-handler))
     72                   :server-id 'racket-language-server))
     73 
     74 (lsp-consistency-check lsp-racket)
     75 
     76 (provide 'lsp-racket)
     77 ;;; lsp-racket.el ends here