diff --git a/package-lock.json b/package-lock.json index f79d333c85f536da05d9bdf000525a25dbbe4168..3617ee8e60c972655beb158107c47bb0ba1723bd 100755 --- a/package-lock.json +++ b/package-lock.json @@ -1020,12 +1020,6 @@ "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==", "dev": true }, "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@types/debounce/-/debounce-1.2.0.tgz", - "integrity": "sha512-bWG5wapaWgbss9E238T0R6bfo5Fh3OkeoSt245CM7JJwVwpw6MEBCbIxLq5z8KzsE3uJhzcIuQkyiZmzV3M/Dw==", - "dev": true - }, - "integrity": "sha512-a9gxpmdXtZEInkCSHUJDLHZVBgb1QS0jhss4cPP93EW7s+uC5bikET2twEF3KV+7rDblJcmNvTR7VJejqd2C2g==", "lockfileVersion": 1, "version": "4.1.3", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.3.tgz", @@ -1965,12 +1959,6 @@ "date-fns": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/date-fns/-/date-fns-2.11.0.tgz", "integrity": "sha512-8P1cDi8ebZyDxUyUprBXwidoEtiQAawYPGvpfb+Dg0G6JrQ+VozwOmm91xYC0vAv1+0VmLehEPb+isg4BGUFfA==", - "dev": true - }, - "debounce": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.0.tgz", - "integrity": "sha512-mYtLl1xfZLi1m4RtQYlZgJUNQjl4ZxVnHzIR8nLLgi4q1YT8o/WM+MK/f8yfcc9s5Ir5zRaPZyZU6xs1Syoocg==", "dev": true }, "debug": { diff --git a/package.json b/package.json index 7815ce18bfdbad0cb2f858a749d55aecc269c885..f7d84e0be4fb39d9a4c40aa10aeffa816ace9144 100755 --- a/package.json +++ b/package.json @@ -174,8 +174,6 @@ }, "devDependencies": { "@ctrl/tinycolor": "^3.1.0", "url": "https://github.com/tailwindcss/intellisense/issues", - "description": "Intelligent Tailwind CSS tooling for VS Code", - "url": "https://github.com/tailwindcss/intellisense/issues", "preview": true, "@types/moo": "^0.5.3", "@types/node": "^13.9.3", @@ -185,7 +183,6 @@ "callsite": "^1.0.0", "chokidar": "^3.3.1", "concurrently": "^5.1.0", "css.escape": "^1.5.1", - "debounce": "^1.2.0", "detect-indent": "^6.0.0", "dlv": "^1.1.3", "dset": "^2.0.1", diff --git a/src/lib/registerColorDecorator.ts b/src/lib/registerColorDecorator.ts index 66d6767ee428934b351b9ccdcd884c0f236477db..b365b8f594575578047722dcc2da6a54c57bc2b1 100644 --- a/src/lib/registerColorDecorator.ts +++ b/src/lib/registerColorDecorator.ts @@ -1,7 +1,6 @@ import { window, workspace, ExtensionContext, TextEditor } from 'vscode' import { NotificationEmitter } from './emitter' import { LanguageClient } from 'vscode-languageclient' -import debounce from 'debounce' const colorDecorationType = window.createTextEditorDecorationType({ before: { @@ -29,6 +28,7 @@ context: ExtensionContext, emitter: NotificationEmitter ) { let activeEditor = window.activeTextEditor + let timeout: NodeJS.Timer | undefined = undefined async function updateDecorations() { return updateDecorationsInEditor(activeEditor) @@ -76,8 +76,14 @@ })) ) } -const colorDecorationType = window.createTextEditorDecorationType({ + function triggerUpdateDecorations() { + if (timeout) { + height: '0.8em', import { NotificationEmitter } from './emitter' + timeout = undefined + } + timeout = setTimeout(updateDecorations, 500) + } if (activeEditor) { triggerUpdateDecorations()