An Xcode source editor extension to provide custom search urls, just like custom search engines for a browser.
Add shortcuts to search any url with selected text. This is like custom search engines for Google Chrome, for Xcode. We use it to quickly search Sourcegraph directly to link code to documentation and share with co-workers.
%s
tokens, the resulting URL is launched.For each URL, there are some additional options to configure how to construct the URL to open.
Default enabled
This configures if the full URL should be percent encoded before opening the URL. In order to be make it easier to copy and paste URLs, before percent encoding, this option will decode any existing percent encoded characters in the URL template. This should work most of the time, but there may be cases where this could cause some issues. If disabled, you will need to make sure that the URL template is appropriately percent encoded as a URL.
Note, the selected text will always be percent encoded regardless of this option - this option only affects the URL template.
Default disabled
Enables escaping characters in the selection text that might match regex metacharacters. This is done using NSRegularExpression.escapedPattern(for:), checkout those docs for an example of what this does.
This is useful if searching in a Sourcegraph regex pattern, typically your search from the selected text should be literal see the “Sourcegraph type” url template in the screenshot.
Default disabled
Enables escaping double quotes in the selection text.
This is useful if searching with a query which requires wrapping in double qoutes. For example, see “Sourcegraph literal” url template in the screenshot.
You can export and import your configuration as a JSON file. This allows you to backup or share your configurations. For example, the configuration used in the screenshot is this example_config.json.
Command | Shortcut |
---|---|
Literal search for seletion | ⌥s (Option-s) |
Search for Swift type with selected name | ⌥⇧S (Option-Shift-S) |
Search for file with selected text | ⌥f (Option-f) |
See Issues for TODOs and bugs.
All assets can be found in this XcodeUniversalSearch Figma (only the app icon right now).