Commit 6f874bf8 authored by marc0s's avatar marc0s

feat: use lsp

parent b6ba2f1f
......@@ -356,6 +356,10 @@ work here..."
"Open a browser on the MDN page for SEARCHSTRING."
(interactive (list (read-string "Search: " (thing-at-point 'symbol))))
(browse-url (format "https://developer.mozilla.org/en-US/search?q=%s&topic=js" searchString)))
(defun marc0s/js2-lsp ()
"Run lsp when entering js2-mode."
(lsp))
:init
(setq-local compile-command "gulp")
:config
......@@ -371,10 +375,11 @@ work here..."
(add-hook 'js2-mode-hook #'add-node-modules-path)
(add-hook 'js2-mode-hook #'marc0s/fix-js2-indent)
(add-hook 'js2-mode-hook #'marc0s/js2-flycheck)
(add-hook 'js2-mode-hook #'setup-tide-mode)
(add-hook 'js2-mode-hook #'marc0s/js2-lsp)
;; (add-hook 'js2-mode-hook #'setup-tide-mode)
;; (add-hook 'js2-mode-hook #'tern-mode)
;; open up the documentation from symbol at point
(define-key js-mode-map (kbd "<C-f1>") #'tide-documentation-at-point)
;; (define-key js-mode-map (kbd "<C-f1>") #'tide-documentation-at-point)
(define-key js-mode-map (kbd "C-c m") #'marc0s/mdn-search))
;; (use-package company-tern
......@@ -439,6 +444,37 @@ work here..."
:ensure t
:bind ("C-x v p" . git-messenger:popup-message))
;; lsp
(use-package lsp-mode
:ensure t
:commands lsp
:init
(setq lsp-auto-configure t))
(use-package lsp-ui
:ensure t
:commands lsp-ui-mode
:init
(add-hook 'lsp-mode-hook 'lsp-ui-mode))
(use-package company-lsp
:ensure t
:commands company-lsp)
(use-package lua-mode
:ensure t
:config
(defun marc0s/lua-indent ()
"Sets the indentation to use tabs"
(setq indent-tabs-mode t
tab-width lua-indent-level))
(add-hook 'lua-mode-hook 'marc0s/lua-indent)
;; (defun marc0s/lua-at-most-one-indent (old-function &rest arguments)
;; (let ((old-res (apply old-function arguments)))
;; (if (> old-res 2) 2 old-res)))
;; (advice-add #'lua-calculate-indentation-block-modifier :around #'marc0s/lua-at-most-one-indent)
)
(use-package plantuml-mode
:ensure t
:init
......@@ -561,17 +597,21 @@ work here..."
;; configure javascript-tide checker to run after your default javascript checker
;; (flycheck-add-next-checker 'javascript-eslint 'javascript-tide 'append)
(defun setup-tide-mode ()
(interactive)
(tide-setup)
(flycheck-mode +1)
(setq flycheck-check-syntax-automatically '(save mode-enabled))
(eldoc-mode +1)
(tide-hl-identifier-mode +1)
(company-mode +1)
(setq tide-sort-completions-by-kind t)
(setq tide-hl-identifier-idle-time 0.1)
(setq tide-always-show-documentation t))
;; (defun setup-tide-mode ()
;; "Set up tide configuration."
;; (interactive)
;; (tide-setup)
;; (flycheck-mode +1)
;; (setq flycheck-check-syntax-automatically '(save mode-enabled))
;; (eldoc-mode +1)
;; (tide-hl-identifier-mode +1)
;; (company-mode +1)
;; (defvar tide-sort-completions-by-kind)
;; (defvar tide-hl-identifier-idle-time)
;; (defvar tide-always-show-documentation)
;; (setq tide-sort-completions-by-kind t)
;; (setq tide-hl-identifier-idle-time 0.1)
;; (setq tide-always-show-documentation t))
;; aligns annotation to the right hand side
(setq company-tooltip-align-annotations t)
......@@ -770,5 +810,8 @@ Version 2017-03-12"
(add-hook 'scss-mode-hook 'xah-syntax-color-hex)
(add-hook 'html-mode-hook 'xah-syntax-color-hex)
;; (add-to-list 'load-path "~/Projects/LocalSoftware/indium")
;; (require 'indium)
(provide 'init)
;;; init.el ends here
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment