doomemacs/modules/lang/swift/config.el
Patrick Norton 9c3d1951e3
fix(swift): don't load lsp-sourcekit with eglot
The `use-package!` declaration for lsp-sourcekit in `config.el` did not
match the `package!` declaration in `packages.el`: this resulted in
`lsp-sourcekit` being loaded but never installed. The removal of this
package also resulted in there no longer being a proper LSP client with
eglot--this has also been fixed.
2023-11-27 21:08:36 -05:00

41 lines
1.5 KiB
EmacsLisp

;;; lang/swift/config.el -*- lexical-binding: t; -*-
(after! swift-mode
(set-repl-handler! 'swift-mode #'run-swift)
(when (modulep! +lsp)
(add-hook 'swift-mode-local-vars-hook #'lsp! 'append)
(when (modulep! :tools lsp +eglot)
(set-eglot-client! swift-mode 'swift-mode '("sourcekit-lsp"))))
(when (modulep! +tree-sitter)
(add-hook 'swift-mode-local-vars-hook #'tree-sitter! 'append)))
(use-package! flycheck-swift
:when (modulep! :checkers syntax)
:unless (modulep! +lsp)
:after swift-mode
:config (flycheck-swift-setup))
(use-package! company-sourcekit
:when (modulep! :completion company)
:unless (modulep! +lsp)
:after swift-mode
:config
(set-company-backend! 'swift-mode '(company-sourcekit company-yasnippet)))
(use-package! lsp-sourcekit
:when (and (modulep! +lsp) (not (modulep! :tools lsp +eglot)))
:after swift-mode
:init (add-hook 'swift-mode-local-vars-hook #'lsp! 'append)
:config
(set-formatter! 'swiftformat '("swiftformat" "--output" "stdout"))
(setq lsp-sourcekit-executable
(cl-find-if #'executable-find
(list lsp-sourcekit-executable ; 'sourcekit-lsp' by default
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/sourcekit-lsp"
"sourcekit"
"/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/sourcekit-lsp"
"/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/sourcekit"))))