-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlsp-start-plain.el
70 lines (50 loc) · 2.31 KB
/
lsp-start-plain.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
;;; lsp-start-plain.el --- LSP mode quick starter -*- lexical-binding: t; -*-
;; Copyright (C) 2018 Ivan Yonchovski
;; Author: Zhu Zihao <[email protected]>
;; Keywords: languages
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
;;; Commentary:
;; This file is a helper to start a minimal lsp environment.
;; To use this, start your Emacs with "emacs -q" and load this file.
;; It will install `lsp-mode', `lsp-ui' and `company-lsp'
;; with their depedencies to start a minimal lsp environment.
;; And it forces Emacs to load `.el' files rather than `.elc' files
;; for more readable backtrace.
;;; Code:
(require 'package)
(setq debug-on-error t)
(let* ((package-archives '(("melpa" . "https://melpa.org/packages/")
("gnu" . "https://elpa.gnu.org/packages/")))
(no-byte-compile t)
(package-user-dir (expand-file-name (make-temp-name "lsp-tmp-elpa")
user-emacs-directory))
(custom-file (expand-file-name "custom.el" package-user-dir))
(pkg-list '(lsp-mode lsp-ui vue-mode flycheck typescript-mode)))
(package-initialize)
(package-refresh-contents)
(mapcar (lambda (pkg)
(unless (package-installed-p pkg)
(package-install pkg))
(require pkg))
pkg-list)
(add-hook 'kill-emacs-hook `(lambda ()
(delete-directory ,package-user-dir t)))
(setq
lsp-prefer-flymake nil
lsp-ui-flycheck-enable t
;; not necessary but vue-mode is ugly without this
mmm-submode-decoration-level 0)
(add-to-list 'auto-mode-alist '("\\.vue\\'" . vue-mode))
(add-hook 'vue-mode-hook 'lsp)
(global-flycheck-mode))
(provide 'lsp-start-plain)
;;; lsp-start-plain.el ends here