Fix project mode definitions
This commit is contained in:
parent
22e3baf184
commit
3ac1d382be
10 changed files with 113 additions and 93 deletions
|
@ -165,13 +165,12 @@
|
|||
|
||||
"REACTIONS" "BODYPARTS_ALL" "RESOURCES_ALL" "COLORS_ALL"))
|
||||
|
||||
;; TODO
|
||||
;; (def-project! screeps "screeps"
|
||||
;; :match "/screeps/.+$"
|
||||
;; :modes (nodejs-project-mode))
|
||||
(def-project-mode! +javascript-screeps-mode
|
||||
:match "/screeps/.+$"
|
||||
:modes (+javascript-npm-mode))
|
||||
|
||||
;; (add-hook! screeps-project-mode
|
||||
;; (when (eq major-mode 'js2-mode)
|
||||
;; (add-to-list 'flycheck-disabled-checkers 'javascript-jshint)
|
||||
;; (setq js2-additional-externs (append '("_") screeps-objects screeps-constants))))
|
||||
(add-hook! '+javascript-screeps-mode-hook
|
||||
(when (eq major-mode 'js2-mode)
|
||||
(push 'javascript-jshint flycheck-disabled-checkers)
|
||||
(setq js2-additional-externs (append '("_") screeps-objects screeps-constants))))
|
||||
|
||||
|
|
|
@ -19,3 +19,17 @@
|
|||
(unless (executable-find "tern")
|
||||
(sh "npm -g install tern")))
|
||||
|
||||
(defvar +javascript-npm-conf (make-hash-table :test 'equal))
|
||||
|
||||
;;;###autoload
|
||||
(defun +javascript-npm-conf (&optional project-root refresh-p)
|
||||
"Retrieves an alist of this project's 'package.json'. If REFRESH-P is non-nil
|
||||
ignore the cache."
|
||||
(let ((project-root (or project-root (doom-project-root))))
|
||||
(or (and (not refresh-p)
|
||||
(gethash project-root +javascript-npm-conf))
|
||||
(let ((package-file (expand-file-name "package.json" project-root)))
|
||||
(when-let (json (and (file-exists-p package-file)
|
||||
(json-read-file package-file)))
|
||||
(puthash project-root json +javascript-npm-conf))))))
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;; lang/javascript/config.el
|
||||
|
||||
;; TODO (load! +screeps)
|
||||
(load! +screeps)
|
||||
|
||||
(def-package! js2-mode
|
||||
:mode "\\.js$"
|
||||
|
@ -88,15 +88,19 @@
|
|||
;; Projects
|
||||
;;
|
||||
|
||||
;; (project! npm
|
||||
;; :modes (web-mode js2-mode)
|
||||
;; :files ("package.json")
|
||||
;; :config
|
||||
;; (let* ((project-path (doom-project-root))
|
||||
;; (hash (gethash project-path npm-conf))
|
||||
;; (package-file (expand-file-name "package.json" project-path))
|
||||
;; deps)
|
||||
;; (when-let (json (and (not hash) (file-exists-p package-file)
|
||||
;; (ignore-errors (json-read-file package-file))))
|
||||
;; (puthash project-path json npm-conf))))
|
||||
(def-project-mode! +javascript-npm-mode
|
||||
:modes (web-mode js-mode markdown-mode)
|
||||
:files "package.json")
|
||||
|
||||
(def-project-mode! +javascript-lb6-mode
|
||||
:modes (web-mode js-mode nxml-mode markdown-mode)
|
||||
:match "\\.lb\\(action\\|ext\\)/"
|
||||
:init
|
||||
;; TODO
|
||||
;; (when IS-MAC
|
||||
;; (set! :build 'launchbar-action '+javascript-lb6-mode
|
||||
;; (lambda ()
|
||||
;; (when-let (dir (f-traverse-upwards (lambda (f) (f-ext? f "lbaction"))))
|
||||
;; (shell-command (format "open '%s'" dir))))))
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue