Closed sei40kr closed 6 years ago
Here's source code with some type annotations.
export type Props = {
onClickButton: () => void,
};
Is it something we can fix at the Spacemacs level or is it a general
problem emacs-lsp
?
Seong Yong-ju notifications@github.com writes:
Description :octocat:
lsp-javascript-flow
used in files with/* @flow */
pragma. Becauselsp-mode
can use only one lsp server per project.Reproduction guide :beetle:
- Start Emacs.
- Create a JavaScript file with
/* @flow */
pragma.- Restart Emacs and open the created file.
- Insert some code with type annotations.
Observed behaviour: :eyes: :broken_heart:
- The server warns that type annotations are available only in .ts files. (TypeScript server is used in a Flow file)
Expected behaviour: :heart: :smile:
- The Flow language server accepts it.
I think
lsp-mode
should support multiple servers in single project. But anyway, Spacemacs should check the Flow pragma and decide which server to use.System Info :computer:
- OS: darwin
- Emacs: 27.0.50
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. fe7cc15a8)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
((spell-checking :variables spell-checking-enable-by-default nil) syntax-checking (auto-completion :variables auto-completion-enable-snippets-in-popup t auto-completion-return-key-behavior 'complete auto-completion-tab-key-behavior 'complete) helm (ibuffer :variables ibuffer-group-buffers-by 'projects) (org :variables org-want-todo-bindings t org-enable-github-support t) react ruby-on-rails japanese (c-c++ :variables c-c++-enable-clang-support t c-c++-enable-google-style t c-c++-enable-google-newline t c-c++-enable-clang-format-on-save t c-c++-enable-c++11 t c-c++-default-mode-for-headers 'c++-mode) csv emacs-lisp (go :variables go-use-gometalinter t) gpu (haskell :variables haskell-enable-hindent t) html java (javascript :variables javascript-backend 'lsp) json ipython-notebook kotlin latex lua major-modes markdown perl5 perl6 php plantuml purescript (python :variables python-backend 'lsp) (ruby :variables ruby-enable-enh-ruby-mode t ruby-version-manager 'rbenv) (rust :variables rust-format-on-save t) (scala :variables scala-enable-eldoc t scala-auto-insert-asterisk-in-comments t scala-auto-start-ensime t) shell-scripts sql (typescript :variables typescript-fmt-tool 'typescript-formatter typescript-backend 'lsp) yaml floobits (git :variables git-magit-status-fullscreen t) github (version-control :variables version-control-global-margin t version-control-diff-tool 'diff-hl version-control-diff-side 'left) (gtags :variables gtags-enable-by-default nil) colors themes-megapack theming ansible chrome (cmake :variables cmake-enable-cmake-ide-support t) (dash :variables helm-dash-docset-newpath "~/.local/share/Zeal/Zeal/docsets") (deft :variables deft-directory "~/Dropbox/notes") docker imenu-list lsp nginx (node :variables node-add-modules-path t) restclient (shell :variables shell-default-shell 'multi-term shell-default-height 30 shell-default-position 'bottom) terraform tmux (transmission :variables transmission-auto-refresh-all t) vagrant xclipboard evil-commentary (evil-snipe :variables evil-snipe-enable-alternate-f-and-t-behaviors t evil-snipe-repeat-scope t) search-engine better-c-cpp better-javascript lsp-intellij spacemacs-ghq spacemacs-quickrun (spacemacs-solidity :variables solidity-flycheck-solc-checker-active t) custom)
- System configuration features: RSVG IMAGEMAGICK NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES THREADS
-- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/syl20bnr/spacemacs/issues/10716
I think Spacemacs can use flow-bin
instead since it just wraps flow-language-server
.
And we can extract the Flow features to individual layer.
It is hard to create a layer, there is no package associated wit flow feature in the javascript layer I believe.
Now that's weird that the TypeScript server is enabled on a .js file.
Seong Yong-ju notifications@github.com writes:
I think we can
flow-bin
instead since it just wrapsflow-language-server
. And we can extract the Flow features to individual layer.-- You are receiving this because you commented. Reply to this email directly or view it on GitHub: https://github.com/syl20bnr/spacemacs/issues/10716#issuecomment-391566329
Has anyone had any luck getting around this issue?
@syl20bnr It's okay to use TypeScript server in a .js file because it supports JavaScript syntax too. But it warns type annotations in a .js file. So I want to disable it in a Flow file.
In conclusion, I'm using tern and my flow-type layer now.
@tavurth I'm using tern and it has no conflict with flow-minor-mode.
I'm closing this because the latest develop branch has no flow-language-server support.
@sei40kr I can't find the support for flow-language-server in the latest develop. Could you describe how to use it, please?
@sei40kr Also interested in this, can we re-open this until a good solution is found, or should I open another issue?
@tavurth I'm no longer writing Flow, but AFAIK
flow
binary provides more features)lsp-mode
in the buffer. (Annotation detection is already implemented: https://github.com/an-sh/flow-minor-mode)company-flow
, flycheck-flow
, flow-for-emacs
can replace the server.@tavurth I think we should discuss about Flow as Feature Request, and there already opened.
I've added a Pull Request for lsp-javascript-flow
support in the javascript layer
https://github.com/syl20bnr/spacemacs/pull/11659
Description :octocat:
lsp-javascript-typescript
used in files with/* @flow */
pragma. Becauselsp-mode
can use only one lsp server per project.Reproduction guide :beetle:
/* @flow */
pragma.Observed behaviour: :eyes: :broken_heart:
Expected behaviour: :heart: :smile:
I think
lsp-mode
should support multiple servers in single project. But anyway, Spacemacs should check the Flow pragma and decide which server to use.System Info :computer: