0

I'm using spacemacs @develop (branch). I can't use lsp and lsp-ui. In vscode everything works (using flow lsp mode). With company-flow I can also make it working.

When opening a .js file with // @flow comment the lsp mode is activating automatically and tries to run the flow server and crashes:

Server flow-ls:7818 status:starting exited with status exit. Do you want to restart it? (y or n) y

Each time I'm trying to restart I see the same thing. So the type inspection and type checks doesn't work. Syntax is highlighted but I think it doesn't work (when I set js2-mode-show-parse-errors nil variable in the layers variable I see different view (eg the import type is not highlighted in red).

I'm running the latest version of flow, and have flow-bin installed (same version) in the package (node_modules) and globally. flow binary is in the PATH.

  • If the LSP server crashes, the problem is a bug in the LSP server, not in Emacs. – Stefan Feb 15 at 13:23
0
  1. Check the corresponding stderr log
  2. Make sure the language server runs in the terminal
|improve this answer|||||
  • I was making a test both with flow and flow lsp run in terminal. In each case Emacs tries spaw it's own flow process (it calls it flow-ls) without success - the message in the *Messages* buffer is: flow-ls<1> has exited (exited abnormally with code 3) – Robert Zaremba Feb 20 at 19:26
  • OK, I've sorted it out. Please see the other answer. We don't need to run the language server (flow lsp) ourselves. lsp-mode will do it for us. – Robert Zaremba Feb 20 at 21:12
0
  1. Install flow-bin (globally or as a dependency in your package.json).
  2. Make sure that the LSP project root is the same as your JavaScript project and you have the .flowconfig file there. (that was my initial error)
  3. Install flow-js2-mode package to your Emacs.
  4. Enable flow-js2-mode in javascript files - this is to enable Flow syntax.

    (add-hook 'js2-mode-hook #'flow-js2-mode))
    
  5. All JavaScript files in the flow mode must have // @flow comment at the beginning of the file.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.