-
-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(swift): mv to swift only support (no xcode tooling here) (#670)
* feat(swift): mv to swift only support (no xcode tooling here) * feat(swift): Add back codelldb * docs(swift): Add note about codelldb in docs --------- Co-authored-by: gacallea <[email protected]> Co-authored-by: Uzair Aftab <[email protected]>
- Loading branch information
1 parent
6633200
commit cfe5e3f
Showing
2 changed files
with
28 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,34 @@ | ||
# Swift Language Pack | ||
|
||
## Note | ||
Requires: | ||
|
||
xbase is a WIP plugin, and the experience provided by this plugin might be | ||
lackluster. | ||
- [sourcekit-lsp](https://github.com/apple/sourcekit-lsp) | ||
|
||
## Requirements | ||
This plugin pack does the following: | ||
|
||
1. Make sure you have [sourcekit-lsp](https://github.com/apple/sourcekit-lsp) | ||
installed on your machine. | ||
- Adds `swift` Treesitter parsers | ||
- Adds `sourcekit` in LSP servers | ||
- Adds `sourcekit` in LSP config | ||
- Adds `codelldb` for debugging | ||
|
||
2. Install Xcode Device Simulators: To enable simulator functionality from | ||
within Neovim, you need to have Xcode Device Simulators installed on your | ||
machine. You can install these simulators from Xcode. | ||
## SwiftLint and SwiftFormat | ||
|
||
3. Mappings: The default mappings for the xbase plugin overlap with AstroNvim's | ||
default. Therefore, you should set the mappings yourself. Refer to | ||
[xBase](https://github.com/kkharji/xbase#neovim-3) documentation for more | ||
options. | ||
When it comes to linting and formatting, Swift is not standardized yet. Thus, | ||
you need to set your favorite configuration in `user/null-ls.lua`. For example: | ||
|
||
```lua | ||
opts = { | ||
-- ... (other options) | ||
|
||
mappings = { | ||
enable = true, | ||
build_picker = "<leader>rb", -- Set to 0 to disable | ||
run_picker = "<leader>ra", -- Set to 0 to disable | ||
watch_picker = 0, -- Set to 0 to disable | ||
all_picker = 0, -- Set to 0 to disable | ||
toggle_split_log_buffer = 0, | ||
toggle_vsplit_log_buffer = "<leader>rs", | ||
}, | ||
|
||
-- ... (other options) | ||
} | ||
[...] | ||
config.sources = { | ||
-- Set a formatter | ||
null_ls.builtins.formatting.swiftformat, -- https://github.com/nicklockwood/SwiftFormat | ||
-- null_ls.builtins.formatting.swift_format, -- https://github.com/apple/swift-format | ||
|
||
-- Set a linter | ||
null_ls.builtins.diagnostics.swiftlint, | ||
} | ||
[...] | ||
``` | ||
|
||
Make sure to install [SwiftLint](https://github.com/realm/SwiftLint) and either | ||
one of [SwiftFormat](https://github.com/nicklockwood/SwiftFormat) **OR** [Apple's | ||
Swift-Format](https://github.com/apple/swift-format). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters