mirror of
https://github.com/microsoft/vscode-extension-samples.git
synced 2026-06-13 07:10:26 +08:00
decorator sample: polish
This commit is contained in:
@ -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: [] },
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
.vscode/**
|
||||
typings/**
|
||||
**/*.ts
|
||||
**/*.map
|
||||
.gitignore
|
||||
tslint.json
|
||||
tsconfig.json
|
||||
vsc-extension-quickstart.md
|
||||
|
||||
@ -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.
|
||||
|
||||

|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
Reference in New Issue
Block a user