eglot-booster 项目使用教程

eglot-booster 项目使用教程

eglot-boosterBoost eglot using lsp-booster项目地址:https://gitcode.com/gh_mirrors/eg/eglot-booster

1. 项目的目录结构及介绍

eglot-booster/
├── LICENSE
├── README.md
├── eglot-booster.el
  • LICENSE: 项目的许可证文件,采用 GPL-3.0 许可证。
  • README.md: 项目的说明文档,包含项目的基本介绍和使用方法。
  • eglot-booster.el: 项目的主要文件,用于增强 eglot 的功能。

2. 项目的启动文件介绍

项目的主要启动文件是 eglot-booster.el。该文件包含了增强 eglot 功能的代码。以下是文件的主要内容和功能介绍:

;; eglot-booster.el
(eval-when-compile (require 'cl-lib))
(require 'seq)
(require 'eglot)
(require 'jsonrpc)

(defun eglot-server-programs)
(cond ((functionp (cdr entry))
       (cl-incf cnt)
       (let ((fun (cdr entry)))
         (setcdr entry (lambda (&rest r)
                         (let ((res (apply fun r)))
                           (if (eglot-booster-plain-command res)
                               (append boost res)
                             res))))))
      ((eglot-booster-plain-command (cdr entry))
       (cl-incf cnt)
       (setcdr entry (append boost (cdr entry)))))

(defalias 'jsonrpc--json-read (lambda ()
                                (or (and (= (following-char) #)
                                         (let ((bytecode (read (current-buffer))))
                                           (when (byte-code-function-p bytecode)
                                             (funcall bytecode))))
                                    (funcall orig-read))))

(message "Boosted %d eglot-server-programs" cnt))
(put 'eglot-server-programs 'lsp-booster-p t)))

(defun eglot-booster-reset ()
  (put 'eglot-server-programs 'lsp-booster-p nil))

(provide 'eglot-booster)
  • eval-when-compile: 用于在编译时加载 cl-lib 库。
  • require: 加载 seq, eglot, jsonrpc 库。
  • defun eglot-server-programs: 定义了增强 eglot 服务器程序的函数。
  • defalias jsonrpc--json-read: 重定义了 jsonrpc--json-read 函数,用于增强 JSON-RPC 的读取功能。
  • message: 输出增强的 eglot 服务器程序数量。
  • provide: 提供 eglot-booster 模块。

3. 项目的配置文件介绍

项目的配置文件主要是 eglot-booster.el 中的配置项。以下是一些关键的配置项:

(use-package eglot-booster
  :ensure t
  :straight (:type git :host github :repo "jdtsmith/eglot-booster")
  :after eglot
  :config (eglot-booster-mode))
  • use-package eglot-booster: 使用 use-package 宏来加载和配置 eglot-booster
  • :ensure t: 确保包被安装。
  • :straight: 使用 straight.el 来管理包的安装。
  • :after eglot: 确保在 eglot 加载后加载 eglot-booster
  • :config (eglot-booster-mode): 启用 eglot-booster 模式。

通过以上配置,可以确保 eglot-boostereglot 加载后被正确加载和启用,从而增强 eglot 的功能。

eglot-boosterBoost eglot using lsp-booster项目地址:https://gitcode.com/gh_mirrors/eg/eglot-booster

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

余怡桔Solomon

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值