lang/javascript: conform to naming conventions; refactor tide config

This commit is contained in:
Henrik Lissner 2018-04-18 18:04:49 -04:00
parent 8af94e8731
commit cc5bfc6dc0
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395
2 changed files with 25 additions and 25 deletions

View file

@ -75,30 +75,18 @@ Run this for any buffer you want to skewer."
(if skewer-html-mode (skewer-html-mode -1)))))
;;;###autoload
(defun add-node-modules-path ()
(defun +javascript|add-node-modules-path ()
"Search the current buffer's parent directories for `node_modules/.bin`.
If it's found, then add it to the `exec-path'."
(defvar add-node-modules-path-debug nil)
(interactive)
(let* ((root (locate-dominating-file
(or (buffer-file-name) default-directory)
"node_modules"))
(path (and root
(expand-file-name "node_modules/.bin/" root))))
(if root
(progn
(make-local-variable 'exec-path)
(add-to-list 'exec-path path)
(when add-node-modules-path-debug
(message (concat "added " path " to exec-path"))))
(when add-node-modules-path-debug
(message (concat "node_modules not found in " root))))))
;;;###autoload
(defun set-up-tide-mode ()
(interactive)
(tide-setup)
(if company-mode (push 'company-tide company-backends))
(eldoc-mode +1)
(tide-hl-identifier-mode +1)
)
(if-let* ((root (locate-dominating-file
(or (buffer-file-name) default-directory)
"node_modules"))
(path (expand-file-name "node_modules/.bin/" root)))
(progn
(make-local-variable 'exec-path)
(cl-pushnew path exec-path :test #'string=)
(when doom-debug-mode
(message "Added %s to exec-path" path)))
(when doom-debug-mode
(message "node_modules not found in %s" root))))