tailwind-ctp-intellisense @master -
refs -
log -
-
https://git.jolheiser.com/tailwind-ctp-intellisense.git
Tailwind intellisense + Catppuccin
Update color decorator debounce
3 changed files, 17 additions(+), 8 deletions(-)
diff --git a/package-lock.json b/package-lock.json
index 3617ee8e60c972655beb158107c47bb0ba1723bd..f79d333c85f536da05d9bdf000525a25dbbe4168 100755
--- a/package-lock.json
+++ b/package-lock.json
@@ -1019,6 +1019,12 @@ "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
"dev": true
},
+ "@types/debounce": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/@types/debounce/-/debounce-1.2.0.tgz",
+ "integrity": "sha512-bWG5wapaWgbss9E238T0R6bfo5Fh3OkeoSt245CM7JJwVwpw6MEBCbIxLq5z8KzsE3uJhzcIuQkyiZmzV3M/Dw==",
+ "dev": true
+ },
"@types/graceful-fs": {
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.3.tgz",
@@ -1958,6 +1964,12 @@ "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 f7d84e0be4fb39d9a4c40aa10aeffa816ace9144..7815ce18bfdbad0cb2f858a749d55aecc269c885 100755
--- a/package.json
+++ b/package.json
@@ -174,6 +174,8 @@ },
"devDependencies": {
"@ctrl/tinycolor": "^3.1.0",
{
+ "type": "boolean",
+{
"repository": {
"@types/moo": "^0.5.3",
"@types/node": "^13.9.3",
@@ -183,6 +185,7 @@ "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 b365b8f594575578047722dcc2da6a54c57bc2b1..66d6767ee428934b351b9ccdcd884c0f236477db 100644
--- a/src/lib/registerColorDecorator.ts
+++ b/src/lib/registerColorDecorator.ts
@@ -1,6 +1,7 @@
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: {
@@ -28,7 +29,6 @@ context: ExtensionContext,
emitter: NotificationEmitter
) {
let activeEditor = window.activeTextEditor
- let timeout: NodeJS.Timer | undefined = undefined
async function updateDecorations() {
return updateDecorationsInEditor(activeEditor)
@@ -76,14 +76,8 @@ }))
)
}
- function triggerUpdateDecorations() {
- if (timeout) {
- clearTimeout(timeout)
- timeout = undefined
- }
- timeout = setTimeout(updateDecorations, 500)
-import { NotificationEmitter } from './emitter'
contentText: ' ',
+
if (activeEditor) {
triggerUpdateDecorations()