doomemacs/modules/lang/swift/config.el
Henrik Lissner c7ddbe049f
fix(swift): set-eglot-client!: extra argument
And move setter out of condition (it will no-op if :tools lsp +eglot
isn't enabled). Plus, it should be configured even when +lsp isn't
enabled for :lang swift.

Amend: #7567
Close: #7577
Co-authored-by: ncihnegn <ncihnegn@users.noreply.github.com>
2023-12-02 11:34:10 -05:00

40 lines
1.5 KiB
EmacsLisp

;;; lang/swift/config.el -*- lexical-binding: t; -*-
(after! swift-mode
(set-repl-handler! 'swift-mode #'run-swift)
(set-eglot-client! 'swift-mode '("sourcekit-lsp"))
(when (modulep! +lsp)
(add-hook 'swift-mode-local-vars-hook #'lsp! 'append))
(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"))))