From d8239a45ee0ca80d252aeb2725aca84e8a495047 Mon Sep 17 00:00:00 2001 From: Nattaaek Wattanuyan Date: Sat, 19 Oct 2019 12:19:53 +0700 Subject: [PATCH] add maximum combo on powermode --- README.md | 2 +- package.json | 5 +++++ src/extension.ts | 8 +++++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 069c2dc..9ce1d25 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ Hopefully power mode will work great for you out of the box, but if it doesn't I * `powermode.customExplosions`: Provide your own gifs to use (And share them [here](https://github.com/hoovercj/vscode-power-mode/issues/1)) * `powermode.customCss`: Changes the CSS applied to the "after" pseudoelement. You can experiment with ways to make it look or perform better. * `powermode.explosionOrder`: `sequential` will cycle through explosions in order, `random` will pick one randomly, and providing a number will select the explosion at that (zero-based) index in the list of explosions. - +* `powermode.maximumCombo`: Change your maximum number for Powermode default value is 9999 ## Known Issues They were right when they said it can't be done. At least not properly. VS Code does not expose the DOM as part of the API. Instead this extension relies on using TextEditorDecorations to set css properties for ranges in the editor. This has a few limitations: diff --git a/package.json b/package.json index 2353778..02c430f 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,11 @@ "type": "number", "description": "The combo number needed to activate POWER MODE!!!" }, + "powermode.maximumCombo": { + "default": 99999, + "type": "number", + "description": "The maximum combo for POWER MODE!" + }, "powermode.comboTimeout": { "default": 10, "type": "number", diff --git a/src/extension.ts b/src/extension.ts index 1afe208..7facefc 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -19,7 +19,7 @@ const DEFAULT_THEME_CONFIG = Particles; let documentChangeListenerDisposer: vscode.Disposable = null; let enabled = false; let comboThreshold: number; - +let maximumCombo: number; // Native plugins let screenShaker: ScreenShaker; let cursorExploder: CursorExploder; @@ -100,7 +100,7 @@ function onDidChangeConfiguration() { enabled = config.get('enabled', false); comboThreshold = config.get('comboThreshold', 0); - + maximumCombo = config.get('maximumCombo', 0); // Switching from disabled to enabled if (!oldEnabled && enabled) { init(config, theme); @@ -150,7 +150,9 @@ function isPowerMode() { } function onDidChangeTextDocument(event: vscode.TextDocumentChangeEvent) { - combo++; + if(combo < maximumCombo) { + combo++; + } const powermode = isPowerMode(); plugins.forEach(plugin => plugin.onDidChangeTextDocument(combo, powermode, event)); }