an-sh / flow-minor-mode

Emacs minor mode for editing flowtype files.
BSD 3-Clause "New" or "Revised" License
47 stars 16 forks source link

cannot find .flowconfig #23

Open vladp opened 5 years ago

vladp commented 5 years ago

I am starting emacs from /home/v/devel/mine/proj1/rnweb/app1/csr/

that directory has .flowconfig (VSCode uses that too).

However, for some reason that flowconfig is ingored, and instead I get:

Could not open_in_bin: '/home/v/devel/mine/proj1/.flowconfig' ((Sys_error "/home/v/devel/mine/proj1/.flowconfig: No such file or directory"))

Process flow-ls stderr finished

I also have put .projectfile file into /home/v/devel/mine/proj1/rnweb/app1/csr/

In the hope that it will instruct LSP, and therefore JS2-mode, and therefore this minor mode, that /home/v/devel/mine/proj1/rnweb/app1/csr/

But that's not working. Are there options to instruct a component that's invoking flow to use .flowconfig from directory I need ?

Other information: emacs 27.0.50 flow: 0.105.2 lsp is using javascript-typescript-langserver

Relevant .emacs config:


(use-package lsp-mode
  :commands lsp
  :hook (prog-mode . lsp)
  :init (setq lsp-auto-guess-root t)
  )

(defun my/hide-frame-line-numbers (frame _window)
  "Display line numbers from a specific frame in a window."
  (select-frame frame)
  (display-line-numbers-mode 1)
  )

(use-package lsp-ui
  :commands lsp-ui-mode
  :hook (lsp-mode . lsp-ui-mode)
  :config
  (setq lsp-ui-sideline-ignore-duplicate t)
  )

(use-package company-lsp
  :commands company-lsp
  :config
  (push 'company-lsp company-backends)
  (setq company-lsp-async t
        company-lsp-cache-candidates 'auto
        company-lsp-enable-recompletion t))

;; lsp-javascript specific start
(use-package js2-mode
  :mode "\\.js\\'"
  :init
  (add-hook 'js2-mode-hook #'js2-imenu-extras-mode)
  (setf js2-mode-indent-inhibit-undo t)
  :config
  (with-eval-after-load "lsp-javascript-typescript"
    (add-hook 'js2-mode-hook #'lsp)))
;; for flow start
(add-hook 'js2-mode-hook 'flow-minor-enable-automatically)
;; for flow end 

;; JSON
(use-package json-mode
  :defer t)
;; lsp javascript specific-end
gitonthescene commented 4 years ago

I don't know if you found a solution here, but all this uses is the elisp (locate-dominating-file) function. My best guess is that your .flowconfig is a dead symlink. Maybe you can run something like the following to debug:

$ junk pwd
/tmp/junk
$  junk find . -ls        
8627313060        0 drwxr-xr-x    6 douglasmennella  wheel                 192 Nov 29 09:03 .  
8627333212        0 drwxr-xr-x    2 douglasmennella  wheel                  64 Nov 29 08:49 ./touch
8627333219        0 drwxr-xr-x    3 douglasmennella  wheel                  96 Nov 29 09:01 ./subdir
8627341971        0 lrwxr-xr-x    1 douglasmennella  wheel                   7 Nov 29 09:01 ./subdir/.flowconfig -> garbage
8627342016        0 -rw-r--r--    1 douglasmennella  wheel                   0 Nov 29 09:03 ./.flowconfig
8627313064        8 -rw-r--r--    1 douglasmennella  wheel                 789 Nov 28 19:39 ./x.sh
$  junk cd subdir 
$  subdir ls -al
total 0
drwxr-xr-x  3 douglasmennella  wheel   96 Nov 29 09:01 .
drwxr-xr-x  6 douglasmennella  wheel  192 Nov 29 09:03 ..
lrwxr-xr-x  1 douglasmennella  wheel    7 Nov 29 09:01 .flowconfig -> garbage
$ subdir emacs -Q -batch --eval '(message (locate-dominating-file default-directory ".flowconfig"))'
/tmp/junk/
$ subdir