emacs-lsp / lsp-mode

Emacs client/library for the Language Server Protocol
https://emacs-lsp.github.io/lsp-mode
GNU General Public License v3.0
4.79k stars 890 forks source link

[Help] Writing a swift lsp client #220

Closed jojojames closed 6 years ago

jojojames commented 6 years ago

Was trying to take a stab at writing a client for swift using https://github.com/RLovelett/langserver-swift.

(use-package lsp-mode :ensure t
  :config
  (lsp-define-stdio-client lsp-swift
                           "swift"
                           #'projectile-project-root
                           '("langserver-swift"))

  (add-hook 'swift-mode-hook #'lsp-swift-enable))

Hard to tell if it should work/not work or not (or if I'm making any mistakes).

If I try to use company-lsp -> M-x company-diag, I get an error message.

company-call-backend-raw: Company: backend (company-lsp :with company-yasnippet company-dabbrev-code) error "Wrong type argument: lsp--workspace, nil" with args (prefix)

Any help appreciated! Thanks.

vibhavp commented 6 years ago

Did you try native completion?

jojojames commented 6 years ago

Hmnn, yeah, works for me. Was an unrelated issue.

xenodium commented 6 years ago

I'm likely missing something. I'm getting:

Error from the Language Server: Could not find path/to/some/File.swift in the workspace. (Server Start Error)

(use-package lsp-mode :ensure t
  :config
  (lsp-define-stdio-client lsp-swift
                           "swift"
                           #'projectile-project-root
                           '("path/to/langserver-swift/.build/x86_64-apple-macosx10.10/debug/langserver-swift")))

Enabled with

M-x lsp-swift-enable

jojojames commented 6 years ago

@xenodium lsp works for me, the language server, however, doesn't. Same error you got.

xenodium commented 6 years ago

@jojojames thanks for confirming the same server issue.

lsp works for me

Do you mean you have some lsp Swift support working? Completion/jump to definition? Mind sharing your config?

jojojames commented 6 years ago

The swift language server doesn't work for me. Emacs' lsp client does work though (as in, I don't think this not working has anything to do with emacs-lsp).

xenodium commented 6 years ago

Got it. Thank you.