提交 28011c36 编写于 作者: I isidor

debug: debounce launch.json decorations

上级 ce74d20e
......@@ -14,6 +14,8 @@ const decoration = vscode.window.createTextEditorDecorationType({
color: '#b1b1b1'
});
let pendingLaunchJsonDecoration: NodeJS.Timer;
export function activate(context): void {
//keybindings.json command-suggestions
......@@ -26,7 +28,10 @@ export function activate(context): void {
context.subscriptions.push(vscode.window.onDidChangeActiveTextEditor(editor => updateLaunchJsonDecorations(editor), null, context.subscriptions));
context.subscriptions.push(vscode.workspace.onDidChangeTextDocument(event => {
if (vscode.window.activeTextEditor && event.document === vscode.window.activeTextEditor.document) {
updateLaunchJsonDecorations(vscode.window.activeTextEditor);
if (pendingLaunchJsonDecoration) {
clearTimeout(pendingLaunchJsonDecoration);
}
pendingLaunchJsonDecoration = setTimeout(() => updateLaunchJsonDecorations(vscode.window.activeTextEditor), 1000);
}
}, null, context.subscriptions));
updateLaunchJsonDecorations(vscode.window.activeTextEditor);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册