-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Question
When auto-format = false, it still automatically formats upon saving and does not follow my .swiftformat configuration.
Context
I use LazyVim, and currently the configuration changes are very few; the terminal emulator I use is kitty; the configuration for swift.nvim uses the FULL_CONFIG.lua from the examples and has all dependencies enabled, with no other changes.
What I've Tried
At first, I set auto-format = true, tool = "swiftformat", but it was not formatted as expected using my formatting configuration, so I tried to explicitly specify config_file, the result was still ineffective. Finally, I had no choice but to turn off auto-format, but the problem still remained.
I tried to run :checkhealth swift, but it caused the Neovim session to get stuck directly.
Additionally, although the project is set up for automatic detection, it doesn't show a notification when I open a Swift project, but instead shows up when I open Explorer Snacks (<Space>E). Moreover, in a Swift project, <Space>e doesn't work and shows up like this:
- I've read the documentation
- I've searched existing issues
- I've run
:checkhealth swiftin Neovim
Additional Information
dependencies = {
-- Only if you already have these plugins installed; otherwise swift.nvim works without them
"neovim/nvim-lspconfig", -- Optional: for LSP
"hrsh7th/nvim-cmp", -- Optional: for completions
"L3MON4D3/LuaSnip", -- Optional: for snippets
},
...
formatter = {
enabled = true,
auto_format = false, -- true = format automatically on save
format_on_save = false, -- Alias for auto_format
tool = "swiftformat", -- "swift-format" or "swiftformat"
-- swift-format options
swift_format = {
path = nil, -- nil = auto-detect
args = {}, -- Additional arguments
config_file = nil, -- Path to .swift-format (nil = search in project)
},
-- swiftformat options
swiftformat = {
path = nil, -- nil = auto-detect
args = {}, -- Additional arguments
config_file = "~/Documents/Dev/Swift/.swiftformat", -- Path to .swiftformat (nil = search in project)
},
},
...
project_detector = {
enabled = true,
auto_detect = true,
show_notification = true,
cache_results = true,
},