config

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

lsp-solidity.el (2306B)


      1 ;;; lsp-solidity.el --- solidity LSP                      -*- lexical-binding: t; -*-
      2 
      3 ;; Copyright (C) 2023  konubinix
      4 
      5 ;; Author: konubinix <konubinixweb@gmail.com>
      6 ;; Keywords: tools
      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 ;;; Code:
     24 
     25 (require 'lsp-mode)
     26 
     27 (lsp-dependency 'solidity-language-server
     28                 '(:system "nomicfoundation-solidity-language-server")
     29                 '(:npm :package "@nomicfoundation/solidity-language-server"
     30                        :path "nomicfoundation-solidity-language-server"))
     31 
     32 
     33 (defun lsp-client--solidity-ls-server-command ()
     34   "Startup command for Solidity language server."
     35   (list (lsp-package-path 'solidity-language-server) "--stdio"))
     36 
     37 
     38 (defgroup lsp-solidity nil
     39   "LSP support for Solidity."
     40   :group 'lsp-mode
     41   :link '(url-link "https://github.com/NomicFoundation/hardhat-vscode/blob/development/server/README.md"))
     42 
     43 
     44 (lsp-register-client
     45  (make-lsp-client :new-connection (lsp-stdio-connection #'lsp-client--solidity-ls-server-command)
     46                   :activation-fn (lsp-activate-on "solidity" "sol")
     47                   :server-id 'solidity
     48                   :notification-handlers
     49                   (ht ("custom/validation-job-status"
     50                        #'lsp-client--solidity-validation-job-status))
     51                   :download-server-fn (lambda (_client callback error-callback _update?)
     52                                         (lsp-package-ensure 'solidity-language-server callback error-callback))))
     53 
     54 (defun lsp-client--solidity-validation-job-status (_workspace _params)
     55   ;; noop until I find out what to do with this
     56   )
     57 
     58 (lsp-consistency-check lsp-solidity)
     59 
     60 (provide 'lsp-solidity)
     61 ;;; lsp-solidity.el ends here