SwiftLint for VSCode
Scope
The extension runs SwiftLint in the workspace extension host. This supports local folders, Remote SSH, WSL, dev containers, and Codespaces where SwiftLint is installed with the source. It is intentionally not a web extension: SwiftLint requires an executable and local workspace files.
The project will publish the same VSIX to the Visual Studio Marketplace and Open VSX. That makes it available to VS Code, VSCodium, and Cursor; a GitHub release VSIX remains the fallback for manually managed installations.
Local development
npm install
npm run check
npm run package
Open this folder in VS Code and press F5 with Run SwiftLint Extension selected. VS Code runs the build task first, then opens an Extension Development Host. Open a Swift workspace there and ensure SwiftLint is installed in that workspace environment, or configure swiftlint.path in user settings.
Use Terminal: Run Task for setup, build, watch, test, check, package, and clean. The workspace recommends ESLint, Prettier, and Vitest Explorer; its TypeScript service uses the pinned local compiler.
Settings
All settings are under the swiftlint. prefix and are resource-scoped (folder, workspace, or user) unless noted otherwise.
| Setting |
Type |
Default |
Description |
swiftlint.enable |
boolean |
true |
Enable SwiftLint diagnostics. |
swiftlint.path |
string \| string[] |
"swiftlint" |
SwiftLint executable and optional fixed arguments. Machine-overridable, so it can be locked down in untrusted workspaces. |
swiftlint.additionalParameters |
string[] |
[] |
Additional arguments passed to SwiftLint. |
swiftlint.strict |
boolean |
false |
Treat warnings as errors, as SwiftLint's --strict flag does. Applies to lint runs, not fix runs. |
swiftlint.onlyEnableWithConfig |
boolean |
false |
Only lint or fix when a SwiftLint config file is present. Checks swiftlint.configSearchPaths when set, otherwise looks for .swiftlint.yml/.swiftlint.yaml starting at the file (or, for whole-folder runs, each Swift file) and walking up to the workspace folder root, matching SwiftLint's own nested configuration resolution. |
swiftlint.configSearchPaths |
string[] |
[] |
Config file paths passed to SwiftLint as --config, resolved relative to the workspace folder. Only entries that exist on disk are used. Setting this disables SwiftLint's own nested configuration resolution. |
swiftlint.lintOnSave |
boolean |
true |
Lint Swift documents after saving. |
swiftlint.lintOnOpen |
boolean |
true |
Lint Swift documents when opened, including documents already open when the extension activates. |
swiftlint.lintOnType |
boolean |
false |
Lint Swift documents while typing, debounced by swiftlint.lintDelay. |
swiftlint.lintDelay |
number |
250 |
Milliseconds to wait after a document change before linting it. |
swiftlint.autoLintWorkspace |
boolean |
true |
Lint the whole workspace folder when the extension activates, in addition to any already-open documents. |
Compatibility policy
Existing swiftlint.* settings and command IDs are retained where they remain safe and useful. This project will not perform an automatic SwiftPM build at activation: installing/building a tool is an explicit user decision.
Next steps
- Add extension-host integration tests and a VS Code/VSCodium/Cursor release matrix.
- Establish Marketplace and Open VSX publisher ownership before the first public release.