Search WordPress Docs is a VS Code extension that allows you to select text inside the VS Code editor and search the WordPress Codex/Code Reference sites for a matching function, class, method, or hook.
The extension takes your selected text and opens google's first result that matches.
To make a search
Open/Create a PHP file. The extension will ignore other languages.
Select some text in the editor, for example a function like get_posts.
For best results, select text only, no symbols.
Now you can choose how to invoke the search:
Context Menu: Right click on the editor and click on "Search in WordPress Docs...".
key Binding: Ctrl+Alt+F by default.
Command Palette: You can do a search directly from the Command Palette, pressing Ctrl+Shift+P, then typing "WordPress" to filter the commands.
You can use the setting searchwpdocs.site to change the url to use for the search. The text you have selected will be appended to the url.
The extension relies on Google's "I'm feeling lucky" functionality when searching the new WP Developer Resource. This allows retrieving the function page directly instead of opening a search results page, but it also adds an element of unpredictability. I have had no issues so far with it though. If you find an issue let me know know by posting it on github.
If you set the search to the WordPress Codex, some function will still redirect tot he new Developer Resource site. This is out of the control of this plugin, as the Developer Resource is meant to replace the older Codex site.