Moved add-hook calls (for tree-sitter initialization) into their respective modes' config blocks, or nearby, to be consistent with how other, similar tools (like lsp!) are initialized, and does so at runtime, rather than at expansion/compile time, which eval-when! caused.
36 lines
1.2 KiB
EmacsLisp
36 lines
1.2 KiB
EmacsLisp
;;; lang/swift/config.el -*- lexical-binding: t; -*-
|
|
|
|
(after! swift-mode
|
|
(set-repl-handler! 'swift-mode #'run-swift)
|
|
|
|
(when (featurep! +tree-sitter)
|
|
(add-hook 'swift-mode-local-vars-hook #'tree-sitter! 'append)))
|
|
|
|
|
|
(use-package! flycheck-swift
|
|
:when (featurep! :checkers syntax)
|
|
:unless (featurep! +lsp)
|
|
:after swift-mode
|
|
:config (flycheck-swift-setup))
|
|
|
|
|
|
(use-package! company-sourcekit
|
|
:when (featurep! :completion company)
|
|
:unless (featurep! +lsp)
|
|
:after swift-mode
|
|
:config
|
|
(set-company-backend! 'swift-mode '(company-sourcekit company-yasnippet)))
|
|
|
|
|
|
(use-package! lsp-sourcekit
|
|
:when (featurep! +lsp)
|
|
:after swift-mode
|
|
:init (add-hook 'swift-mode-local-vars-hook #'lsp! 'append)
|
|
:config
|
|
(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"))))
|