spacemacs
spacemacs copied to clipboard
[Feature Request] [Layer] [swift] Add LSP support for swift
there is a recent LSP server for the swift language here
It would be nice to have swift support for this.
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.
alright, reported upstream https://github.com/emacs-lsp/lsp-mode/issues/472
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")))
Thanks for that. i'll see if that works in the meantime.
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.
We might be able to use that when it's in MELPA.
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
Yaay for @yyoncho.
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.
I just want to note that thanks to @danielmartin there is debugger support for swift in dap-mode
. Here it is screenshot:
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!
Could this be reopened, please? lsp-sourcekit is now available on melpa. (Many thanks to all involved.)
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.
@johalun what is your issue when you do M-x lsp
in swift mode file?
@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.
I got it working! I think what was missing was load-path to lsp-sourcekit folder.
@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.
@electricRGB https://emacs-lsp.github.io/lsp-sourcekit/
@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)))
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!
Any updates here? It's been a couple years - maybe things have progressed?