mirror of
https://github.com/doomemacs/doomemacs.git
synced 2026-04-20 11:51:12 -07:00
The current HEAD on https://github.com/alex-pinkus/tree-sitter-swift does not include generated files. Use a tag that does. The solution proposed in the repository of downloading artifacts from an action is not feasible as they expire and become unavailable.
47 lines
1.6 KiB
EmacsLisp
47 lines
1.6 KiB
EmacsLisp
;;; lang/swift/config.el -*- lexical-binding: t; -*-
|
|
|
|
(use-package! swift-mode
|
|
:defer t
|
|
:init
|
|
(when (modulep! +tree-sitter)
|
|
(set-tree-sitter! 'swift-mode 'swift-ts-mode
|
|
'((swift :url "https://github.com/alex-pinkus/tree-sitter-swift"
|
|
:rev "0.7.1-with-generated-files"))))
|
|
|
|
:config
|
|
(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)))
|
|
|
|
|
|
(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 (modulep! +lsp)
|
|
:when (modulep! :tools lsp -eglot)
|
|
:defer t
|
|
: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"))))
|