+(defun tide-project-root ()
+ (or
+ tide-project-root
+ (let ((root (or (locate-dominating-file default-directory "tsconfig.json")
+ (locate-dominating-file default-directory "jsconfig.json")
+ (locate-dominating-file default-directory ".git")
+ (locate-dominating-file default-directory "package.json"))))
+ (unless root
+ (message (tide-join (list "Couldn't locate JavaScript project root folder. Using '" default-directory "' as project root.")))
+ (setq root default-directory))
+ (let ((full-path (expand-file-name root)))
+ (setq tide-project-root full-path)
+ full-path))))
+