Lazy-load yasnippet harder for faster first-file load time
+ Rather than waiting for the first "interactive" major mode to be visited to activate yas-minor-mode, we wait until the first time the user invokes a snippet command to activate yas-global-mode. + yas-reload-all is one of the bottlenecks when loading a file for the first time. Deferring it further should help with this. + yas-global-mode reaches more major modes than our former list of hooks (fixes #5140). Closes #5140
This commit is contained in:
parent
5038ba9826
commit
60b595321e
4 changed files with 10 additions and 17 deletions
|
@ -17,22 +17,14 @@
|
|||
yas-new-snippet
|
||||
yas-visit-snippet-file
|
||||
yas-activate-extra-mode
|
||||
yas-deactivate-extra-mode)
|
||||
yas-deactivate-extra-mode
|
||||
yas-maybe-expand-abbrev-key-filter)
|
||||
:init
|
||||
;; Remove default ~/.emacs.d/snippets
|
||||
(defvar yas-snippet-dirs nil)
|
||||
|
||||
(unless (daemonp)
|
||||
;; Ensure `yas-reload-all' is called as late as possible. Other modules
|
||||
;; could have additional configuration for yasnippet. For example,
|
||||
;; file-templates.
|
||||
(add-transient-hook! 'yas-minor-mode-hook (yas-reload-all)))
|
||||
|
||||
(add-hook! '(text-mode-hook
|
||||
prog-mode-hook
|
||||
conf-mode-hook
|
||||
snippet-mode-hook)
|
||||
#'yas-minor-mode-on)
|
||||
;; Lazy load yasnippet until it is needed
|
||||
(add-transient-hook! #'company-yasnippet (require 'yasnippet))
|
||||
|
||||
:config
|
||||
(add-to-list 'doom-debug-variables '(yas-verbosity . 3))
|
||||
|
@ -125,7 +117,7 @@
|
|||
(smartparens-mode 1)))))
|
||||
|
||||
;; If in a daemon session, front-load this expensive work:
|
||||
(if (daemonp) (yas-reload-all)))
|
||||
(yas-global-mode +1))
|
||||
|
||||
|
||||
(use-package! auto-yasnippet
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue