Ir al contenido principal
Versión: Siguiente

Swift

Install Syntax Highlighting‚Äč

:TSInstall swift

Install Language Server‚Äč

:LspInstall sourcekit

Configure Lunarvim‚Äč

The sourcekit language server is disabled (overridden) by default because of the conflict with clangd

Lsp Configuration‚Äč

Create a file called ~/.config/lvim/ftplugin/swift.lua:

local opts = {}
require("lvim.lsp.manager").setup("sourcekit", opts)

The default settings for the sourcekit lsp is:

default_config = {
cmd = { "sourcekit-lsp" }
filetypes = { "swift", "c", "cpp", "objective-c", "objective-cpp" }
root_dir = root_pattern("Package.swift", ".git")
}

Supported formatters‚Äč

  • swiftformat