decorator sample: polish

This commit is contained in:
Martin Aeschlimann
2018-10-29 08:34:37 +01:00
parent f52562ae3b
commit 354ae4ffe5
4 changed files with 5 additions and 5 deletions

View File

@ -52,7 +52,7 @@ const samples = [{
path: 'decorator-sample',
guide: null,
apis: ['TextEditor.setDecorations', 'DecorationOptions', 'DecorationInstanceRenderOptions', 'ThemableDecorationInstanceRenderOptions', 'window.createTextEditorDecorationType', 'TextEditorDecorationType'],
contributions: []
contributions: [ 'colors']
},
// { description: 'extension-deps-sample', path: 'extension-deps-sample', guide: null, apis: [], contributions: [] },
// { description: 'hellocode-minimal-sample', path: 'hellocode-minimal-sample', guide: null, apis: [], contributions: [] },

View File

@ -1,7 +1,6 @@
.vscode/**
typings/**
**/*.ts
**/*.map
.gitignore
tslint.json
tsconfig.json
vsc-extension-quickstart.md

View File

@ -6,7 +6,7 @@ The sample creates a decoration for each number that appears in the active edito
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. This is the recommended way when using cololrs as it allows users (and themes) to configure the color in the user settings.
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](preview.png)

View File

@ -24,6 +24,7 @@ export function activate(context: vscode.ExtensionContext) {
// create a decorator type that we use to decorate large numbers
const largeNumberDecorationType = vscode.window.createTextEditorDecorationType({
cursor: 'crosshair',
// use a themable color. See package.json for the declaration and default values.
backgroundColor: { id: 'myextension.largeNumberBackground' }
});
@ -45,7 +46,7 @@ export function activate(context: vscode.ExtensionContext) {
}
}, null, context.subscriptions);
let timeout = null;
let timeout : NodeJS.Timer | null = null;
function triggerUpdateDecorations() {
if (timeout) {
clearTimeout(timeout);