2019-02-21 16:08:27 -05:00
|
|
|
;;; feature/lsp/autoload.el -*- lexical-binding: t; -*-
|
|
|
|
|
2019-05-21 00:34:32 -04:00
|
|
|
;;;###autodef
|
2019-06-29 00:28:13 +02:00
|
|
|
(defun lsp! (&optional arg)
|
|
|
|
"Enable `lsp-mode' in the current buffer.
|
|
|
|
|
|
|
|
Meant to be a lighter alternative to `lsp', which is too eager about
|
|
|
|
initializing lsp-ui-mode, company, yasnippet and flycheck. Instead, these have
|
|
|
|
been moved out to their respective modules, or these hooks:
|
|
|
|
|
2019-07-28 23:29:22 +02:00
|
|
|
+ `+lsp-init-company-h' (on `lsp-mode-hook')
|
|
|
|
+ `+lsp-init-ui-flycheck-or-flymake-h' (on `lsp-ui-mode-hook')"
|
2019-06-30 12:15:04 +02:00
|
|
|
(require 'lsp-mode)
|
2019-07-05 19:08:11 +02:00
|
|
|
(unless lsp-mode
|
|
|
|
(when lsp-auto-configure
|
|
|
|
(require 'lsp-clients))
|
|
|
|
(when (and (buffer-file-name)
|
2019-07-28 23:29:22 +02:00
|
|
|
(setq-local
|
|
|
|
lsp--buffer-workspaces
|
|
|
|
(or (lsp--try-open-in-library-workspace)
|
|
|
|
(lsp--try-project-root-workspaces
|
|
|
|
(equal arg '(4))
|
|
|
|
(and arg (not (equal arg 1)))))))
|
2019-09-02 21:43:12 -04:00
|
|
|
(prog1 (lsp-mode 1)
|
|
|
|
(lsp--info
|
|
|
|
"Connected to %s."
|
|
|
|
(apply
|
|
|
|
#'concat (mapcar
|
|
|
|
(lambda (it) (format "[%s]" (lsp--workspace-print it)))
|
|
|
|
lsp--buffer-workspaces)))))))
|