Files
vscode-extension-samples/decorator-sample
Matt Bierner 0b26276bb6 Use vscode/@types for most extension samples
Fixes #180

Changes from using `vscode` to `@types/vscode` for the majority of extension samples. The `@types/vscode` package is much smaller and does not pull in any dependencies.

Other changes:

- Remove so empty test files
- Bump engine versions to match @types/vscode versions
- Use `npm run compile` for most `vscode:prepublish` scripts
2019-05-09 14:52:38 -07:00
..
2015-11-05 17:33:07 +01:00
2018-10-29 08:34:37 +01:00
2018-10-28 22:29:18 +01:00
2018-10-28 22:29:18 +01:00
2018-10-28 22:29:18 +01:00

Decorator Sample

This folder contains a sample VS code extension that demonstrates the editor decorator API.

The sample creates a decoration for each number that appears in the active editor. It demonstrates some of the decorator features such as borders, background colors, cursors and hovers.

The sample also shows the use of a user defined themeable color. Instead of hardcoding a color value this allows users (and themes) to redefine the color in the user settings.

sample

VSCode API

The sample code show the usage of the vscode.TextEditor.setDecorations and vscode.window.createTextEditorDecorationType APIs as well as the colors contribution point.

Running the Sample

  • npm install to initialize the project
  • npm run watch to start the compiler in watch mode
  • open this folder in VS Code and press F5
  • this will open the [Extension Development Host] window, running the extension:
    • Open any document that contains single and multi-digit numbers.
    • The extension will decorate single and multiple-digit numbers as shown in the screenshot above.
    • In the user settings, add
      "workbench.colorCustomizations": {
          "myextension.largeNumberBackground": "#ff00ff"
      }
      
      to customize the large number decoration color.