Files
vscode-extension-samples/contentprovider-sample

References Editor Sample

This is a sample extension that shows how an editor-based representation for the Find References feature can be build.

It is not intended as a product quality extension.

The purpose of the extension is to show a preview of the properties in the declaration block of a CSS rule. To play with the extension:

  • Select a symbol
  • Select F1 > Print References
  • An editor opens to the side and show the references in a textual form

Print References

How it works

  • The extension implements and registers a TextDocumentContentProvider for a particular URI scheme.
  • The content provider uses the vscode.executeReferenceProvider-API command to delegate searching for references to the language extensions, like TypeScript, vscode-go, or C#
  • The generated document initially contains a caption only and incrementally updates as each reference location is resolved.
  • The content provider uses the decoration API to highlight matches inside the generated document