From cde52c88f697130b8f94af242729ce11456e82ad Mon Sep 17 00:00:00 2001 From: kiennq Date: Mon, 1 Apr 2024 10:40:34 -0700 Subject: [PATCH] Delay load yasnippet even more (#4413) --- clients/lsp-erlang.el | 2 +- clients/lsp-rust.el | 2 +- lsp-mode.el | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/clients/lsp-erlang.el b/clients/lsp-erlang.el index aa3c314c10a..0d000614c1c 100644 --- a/clients/lsp-erlang.el +++ b/clients/lsp-erlang.el @@ -206,7 +206,7 @@ tokens legend." :modifiers ,(lsp-erlang-elp--semantic-modifiers)) :server-id 'elp - :custom-capabilities `((experimental . ((snippetTextEdit . ,(and lsp-enable-snippet (featurep 'yasnippet)))))) + :custom-capabilities `((experimental . ((snippetTextEdit . ,(and lsp-enable-snippet (fboundp 'yas-minor-mode)))))) :download-server-fn (lambda (_client callback error-callback _update?) (lsp-package-ensure 'erlang-language-platform callback error-callback)))) diff --git a/clients/lsp-rust.el b/clients/lsp-rust.el index 5f4c19bf460..f1b7dc235c4 100644 --- a/clients/lsp-rust.el +++ b/clients/lsp-rust.el @@ -1760,7 +1760,7 @@ https://github.com/rust-lang/rust-analyzer/blob/master/docs/dev/lsp-extensions.m :semantic-tokens-faces-overrides `( :discard-default-modifiers t :modifiers ,(lsp-rust-analyzer--semantic-modifiers)) :server-id 'rust-analyzer - :custom-capabilities `((experimental . ((snippetTextEdit . ,(and lsp-enable-snippet (featurep 'yasnippet)))))) + :custom-capabilities `((experimental . ((snippetTextEdit . ,(and lsp-enable-snippet (fboundp 'yas-minor-mode)))))) :download-server-fn (lambda (_client callback error-callback _update?) (lsp-package-ensure 'rust-analyzer callback error-callback)))) diff --git a/lsp-mode.el b/lsp-mode.el index fafc423e51a..c03b0e37dc4 100644 --- a/lsp-mode.el +++ b/lsp-mode.el @@ -56,7 +56,6 @@ (require 'xref) (require 'minibuffer) (require 'help-mode) -(require 'yasnippet nil t) (require 'lsp-protocol) (defgroup lsp-mode nil @@ -3680,7 +3679,7 @@ disappearing, unset all the variables related to it." (resolveSupport . ((properties . ["edit" "command"]))) (dataSupport . t))) (completion . ((completionItem . ((snippetSupport . ,(cond - ((and lsp-enable-snippet (not (featurep 'yasnippet)) t) + ((and lsp-enable-snippet (not (fboundp 'yas-minor-mode))) (lsp--warn (concat "Yasnippet is not installed, but `lsp-enable-snippet' is set to `t'. " "You must either install yasnippet, or disable snippet support.")) @@ -4479,6 +4478,7 @@ from language server.") "Wrapper of `yas-expand-snippet' with all of it arguments. The snippet will be convert to LSP style and indent according to LSP server result." + (require 'yasnippet nil t) (let* ((inhibit-field-text-motion t) (yas-wrap-around-region nil) (yas-indent-line 'none)