SourceKit for Safari
SourceKit for Safari is a Safari extension for GitHub, that enables IDE features like go to definition, or documentation on hover.
This is really proof of concept code--functional proof of concept, but proof of concept nonetheless--and has not been thoroughly tested. Use at your own risk.
Show Document Items
Bring up a list of document items, then select your desired document item to jump to the respective source code location.
Quick Help popup
Hovering the mouse cursor over a symbol shows documentation.
Jumps to Definition
If the text at the mouse cursor is a symbol defined in another file, turn it into a link navigating to the file.
- Download the latest
SourceKit for Safari.appfrom GitHub Releases, run it once to install the extension.
- Open Safari - Preferences - Extension, make sure SourceKit for Safari is checked on the left panel.
SourceKit for Safari depends on SourceKit-LSP. In order to use SourceKit for Safari, you need to install SourceKit-LSP and set the installation location.
If you have installed Xcode 11.4+ or the corresponding Command Line Tools package, the SourceKit-LSP server is included and can be run with
If you are using a toolchain from Swift.org, the SourceKit-LSP server is included and can be run with
xcrun --toolchain swift sourcekit-lsp.
If your toolchain did not come with SourceKit-LSP, you should build it from source.
SourceKit for Safari uses SourceKit-LSP that comes with Xcode 11.4 beta by default.
If you want to use other SourceKit-LSP binary, click the toolbar icon and set its full path to the settings text field.
Hover over symbols in the source code; then, the documentation for that symbol a popup will show or turn it link to the definition (The first may take some time).
How it works
SourceKit for Safari will automatically clone a GitHub repository to your local filesystem (
~/Library/Group Containers/27AEDK3C9F.com.kishikawakatsumi.SourceKitForSafari) when you access there.
Then, when the source file is displayed on the browser, it automatically communicates with SourceKit-LSP to get information about the source code. Then show them with a popup on the browser.
SourceKit for Safari does not automatically update local repositories.
If the local repository is outdated, click the toolbar icon and press the Sync button to update it.
To do that, run the following commands in
Terminal.app. (Node.js development environment such as
npm command must be set up in advance.)
cd ./SafariExtension/js npm install npm run build