swift-objc-language-server
VSCode extension + Language Server Protocol (LSP) server for Swift and Objective-C files.
Supported features
- Swift (
.swift) and Objective-C (.m, .h, .mm) documents
- Document Symbol (
@ in VSCode quick open): lists symbols for current file
- Breadcrumb symbol path: shows the current Swift / Objective-C class and function or method in the editor path bar when Breadcrumbs are enabled
- Go to Definition (
F12 / cmd-click): resolves symbols from open documents, then falls back to full-project scan when needed
- Workspace Symbol (
# in quick open): searches open documents first, then falls back to full-project scan when no match is found
- Quick Symbol Search in Project (editor right-click menu): searches the workspace from the word under cursor and provides jump targets
Current scope intentionally focuses on symbols that are already opened in VSCode.
Architecture
src/extension.ts: VSCode Language Client
src/server.ts: Node-based LSP server
src/symbols.ts: Swift / Objective-C symbol parsing and cursor word extraction
This follows the standard VSCode Language Client + Language Server split architecture.
Install dependencies
npm install
Build
npm run compile
Release Notes
0.1.12
- Fixed parsing: avoid duplicate Objective-C symbols when a function and variable share the same identifier on the same line.
- Improved Swift/ObjC position calculation to use regex match offsets for more accurate ranges.
- Added tests and sample files for nested comments, raw/triple-quoted strings, and complex ObjC parameters.
- Packaged a VSIX for local testing (note: consider adding a .vscodeignore to reduce package size).
0.1.11
- Fixed Breadcrumbs for C-style functions declared inside Objective-C implementation files.
- Breadcrumbs now correctly show functions such as
stream_interrupt_cb while the cursor is inside the function body.
0.1.10
- Fixed Swift Breadcrumbs for multiline function signatures where the opening brace appears on a later line.
- Breadcrumbs now correctly show functions such as
execute while the cursor is inside the function body.
0.1.9
- Fixed Objective-C Breadcrumbs for multiline method signatures where the opening brace appears on a later line.
- Breadcrumbs now correctly show methods such as
writeVideoPacket while the cursor is inside the method body.
0.1.8
- Fixed project-wide symbol search for nested Swift symbols, including methods declared inside
extension blocks.
- Quick Symbol Search in Project now finds nested Swift symbols even when only the parent file is open.
0.1.7
- Added dedicated Output and Trace channels for language-server logs in VS Code.
- Startup failures and uncaught server errors are now written to Output and revealed automatically on error.
0.1.6
- Added hierarchical
DocumentSymbol output for both Swift and Objective-C.
- Breadcrumbs can now show the current class and function or method path at the top of the editor.
- Improved symbol ranges so current scope detection works inside method and function bodies.
Run in VSCode (manual review)
- Open this repository in VSCode.
- Run
npm run compile.
- Press
F5 to launch an Extension Development Host.
- In the new window, open a Swift or Objective-C file.
- Verify:
Cmd+Shift+O (or quick open with @) shows symbols from current file.
- Breadcrumbs show the current symbol path for Swift and Objective-C files when
breadcrumbs.enabled is on.
F12 on a symbol jumps to its definition when the defining file is currently open.
Package and install in local VSCode
- Install VSCE:
npm install -D @vscode/vsce
- Create VSIX:
npx vsce package
- Install VSIX:
code --install-extension swift-objc-language-server-0.1.11.vsix
| |