Salesforce reference extension for VSCode

James Hill June 9, 2020

Looking up Salesforce developer documentation a bit of a process: leaving your dev environment, keying in a search string, waiting for the Angular.js app that drives the documentation to load, finding the right method or subheading in the doc... It's time-consuming and can break your flow quite severely.

To speed up the process of finding the relevant doc, and reduce the friction of leaving your dev environment, this new extension for VSCode allows you to search a variety of different dev documentation types from within VSCode, and be taken directly to the corresponding documentation heading in your browser. You can do this both by typing a specific query in the command palette or by running a search based on the current word or selection in your editor.

Read on for more information and if you'd like to provide any input on the future direction of the plugin request support for a different type of documentation, or otherwise provide feedback: get in touch by visiting the repo at https://github.com/Oblongmana/vscode-salesforce-doc-lookup.

 

Current Features

Choose a documentation type, and type in your search.

The following new commands allow you to search Salesforce Dev documentation in VSCode, and be taken directly to the corresponding entries in your browser:

  • Salesforce Reference: Apex
  • Salesforce Reference: Visualforce
  • Salesforce Reference: Lightning Console
  • Salesforce Reference: Classic Console
  • Salesforce Reference: Metadata API
image

The first time you call any of these commands, the Extension will call out to Salesforce to get an index of that documentation type. This will be cached, and future uses of the command will be instant.

If you need to invalidate the cache for any reason, there is a command for doing so:

  • Salesforce Reference: Invalidate Cache

Search dev documentation for a word or selection in your editor
With your cursor over a word in your editor, or with something in your editor selected, you can choose a documentation type and search for that string, using the new command:

  • Salesforce Reference: Search for current word or selection
image

Installing

In VSCode or the Extension Marketplace
Search for "Salesforce Reference" in the Extensions view (Ctrl + Shift + X) in VSCode, or install at our VSCode Extension Marketplace page.

Manually (with use cases/caveats)
If you would prefer to install outside of the VSCode Marketplace, I'll try to make vsix files available with each release. If I forget, just open an issue on github.

If you're doing this for use in an environment without an internet connection, or a limited connection, please note that this plugin interacts with the web in the following ways:

  1. When using any of the documentation commands for the first time after install or running the cache invalidation command, the documentation Table of Contents will be retrieved from developer.salesforce.com
  2. When choosing an item from a documentation command, the documentation page will open in your default web browser

If you feel passionately about being able to access doc offline, note there are some ideas in NOTES.md and ROADMAP.md.

Go to https://github.com/Oblongmana/vscode-salesforce-doc-lookup/releases and download your desired version as a vsix file.

Using the Install from VSIX command in the Extensions view command drop-down, or the Extensions: Install from VSIX command in the Command Palette, point to the .vsix file.

Alternatively, install it using the following command, and RESTART VSCode AFTERWARDS.

code --install-extension [path to the downloaded vsix]

Alternatively, you can build it yourself, but instructions for that are outside the scope of this README.

Known Issues

Adblockers and loading links - NOFIX:
Because Salesforce's Doc website is an Angular app that dynamically loads content into the page after the page itself has loaded, anchor links appear to be managed in such a way that the Angular app (rather than the browser) handles the scrolling to the requested item. e.g. https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_methods_system_string.htm#apex_System_String_substring - the section after the # is the anchor link, trying to take you directly to substring. This Salesforce Angular App functionality may play a little poorly with some adblockers such as "uBlock Origin". If you find commands are not scrolling you to the item you request, this may be fixed by disabling your adblocker on the Salesforce doc site, if you are comfortable with doing so.

Notable Differences to the original Sublime Text 3 version

See DIFFERENCES.md for information on the differences between this and the original plugin. Also note the Current Features list above.

Release Notes

1.0.0 - Initial Release

  • New command: Salesforce Reference: Apex
  • New command: Salesforce Reference: Visualforce
  • New command: Salesforce Reference: Lightning Console
  • New command: Salesforce Reference: Classic Console
  • New command: Salesforce Reference: Metadata API
  • New command: Salesforce Reference: Search for current word or selection
  • New command: Salesforce Reference: Invalidate Cache
  • Tables of Contents for each Documentation type are cached after first use. This cache can be wiped by running the Salesforce Reference: Invalidate Cache command

Unpublished

  • All up-to-date

0.4.0 - Beta

  • Add an extension icon
  • Show error if trying to retrieve reference Tables of Contents while offline, and another message if unexpected errors occur

0.3.0 - Beta

  • Add a command for searching for the current word, or selected text
  • Add caching for documentation so repeated lookups won't require retrieving the index from Salesforce every time
  • Add a cache invalidation command
  • Better gif for Apex lookup, and one for the new current word/selection command
  • Fix names for doc types that could appear in a few places, and tweak some command naming
  • Backend fixes - better code reuse and structure

0.2.0 - Beta

  • Basic implementation of Visualforce Doc Lookup
  • Basic implementation of Salesforce Lightning Console Lookup
  • Basic implementation of Salesforce Classic Console Lookup
  • Basic implementation of Salesforce Metadata Lookup

0.1.1 - Beta

  • Basic implementation of Apex Doc Lookup

Roadmap

A rough roadmap is available at ROADMAP.md

Contributing

See the Roadmap in ROADMAP.md for details on existing aims. Some not-particularly-tidy notes can be found in NOTES.md. Contributions welcome, though I suggest opening an issue ticket on github to discuss before hand.

Design Notes

Notes on design, future aims etc available in NOTES.md

License

Salesforce Reference VSCode Extension

Copyright (c) 2014-2020 James Hill me@jameshill.io

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Credits

All Salesforce Documentation is © Copyright 2000–2020 salesforce.com, inc.

Thanks to Marco Zeuli for his contributions in the original repo to making extra types of documentation available in the plugin

Credit to Luke McFarlane for the inspiration!

For the original post on Visual Studio Marketplace please visit the following link: https://marketplace.visualstudio.com/items?itemName=oblongmana.vscode-salesforce-doc-lookup

Please Note: this is a community-made plugin, and is not affiliated with Salesforce. If the extension breaks, please open a github issue to let me know, there's a chance Salesforce may change its doc approach, necessitating an update to the plugin

James Hill

James Hill