syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.64k stars 4.89k forks source link

[Feature Request] [Layer] [swift] Add LSP support for swift #11604

Closed fiveNinePlusR closed 1 day ago

fiveNinePlusR commented 5 years ago

there is a recent LSP server for the swift language here

It would be nice to have swift support for this.

sdwolfz commented 5 years ago

I think you need to ask someone from https://github.com/emacs-lsp to implement a package for swift, after which we can integrate it.

fiveNinePlusR commented 5 years ago

alright, reported upstream https://github.com/emacs-lsp/lsp-mode/issues/472

jamartin9 commented 5 years ago

As potential work around in the meantime you may be able to investigate using eglot with a custom server command and swift-mode ex.

(add-to-list 'eglot-server-programs
             `(swift-mode . ("sourcekit-lsp" "--args")))
fiveNinePlusR commented 5 years ago

Thanks for that. i'll see if that works in the meantime.

fiveNinePlusR commented 5 years ago

they have something working here: https://github.com/danielmartin/emacs-sourcekit-lsp

not sure what the final plan is for it but it's up and running there.

sdwolfz commented 5 years ago

We might be able to use that when it's in MELPA.

fiveNinePlusR commented 5 years ago

seems like they are moving it to a different repository and hopefully will be up on melpa shortly.

edit: the link https://github.com/emacs-lsp/lsp-sourcekit

sdwolfz commented 5 years ago

Yaay for @yyoncho.

yyoncho commented 5 years ago

I asked @danielmartin to move it under emacs-lsp - https://github.com/emacs-lsp/lsp-mode/issues/472#issuecomment-440949055 . If user @danielmartin agrees I could do that and do the onboarding melpa request.

yyoncho commented 5 years ago

I just want to note that thanks to @danielmartin there is debugger support for swift in dap-mode. Here it is screenshot:

swift
github-actions[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

dato commented 4 years ago

Could this be reopened, please? lsp-sourcekit is now available on melpa. (Many thanks to all involved.)

johalun commented 3 years ago

Do we have any updates on this? Trying to get things working by manually configuring but no luck so far. I'm on Linux btw.

yyoncho commented 3 years ago

@johalun what is your issue when you do M-x lsp in swift mode file?

johalun commented 3 years ago

@johalun what is your issue when you do M-x lsp in swift mode file?

Got LSP[Disconnected] in status bar.

Have this in user-config

  (eval-after-load 'lsp-mode
    (progn
     (require 'lsp-sourcekit)
      (setq lsp-sourcekit-executable
            "/home/johalun/swift/swift/usr/bin/sourcekit-lsp")))

  (add-hook 'swift-mode-hook (lambda () (lsp)))

and lsp-sourcekit installed via package-install.

johalun commented 3 years ago

I got it working! I think what was missing was load-path to lsp-sourcekit folder.

adudenamedruby commented 3 years ago

@johalaun would you mind posting all the code you used to get it working? Is you .spacemacs online by any chance? I'm trying to do this right now and having trouble.

lebensterben commented 3 years ago

@electricRGB https://emacs-lsp.github.io/lsp-sourcekit/

johalun commented 3 years ago

@electricRGB I installed the emacs part of sourcekit from elpa and added this to user-config. Make sure you use the correct path for your installs.

  (add-to-list 'load-path "/home/johalun/.emacs.d/elpa/27.1/develop/lsp-sourcekit-20210404.1624")

  (eval-after-load 'lsp-mode
    (progn
      (require 'lsp-sourcekit)
      (setq lsp-sourcekit-executable
            "/home/johalun/swift/swift/usr/bin/sourcekit-lsp")))

  (add-hook 'swift-mode-hook (lambda () (lsp)))
github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!

schell commented 1 year ago

Any updates here? It's been a couple years - maybe things have progressed?

smile13241324 commented 1 week ago

Adding lsp support should be straight forward but I may need someone to test this on a mac though

schell commented 1 week ago

@smile13241324 I would, but I'm no longer using spacemacs :(

smile13241324 commented 1 day ago

LSP support for swift has been added. Someone with an apple would need to test this though.