Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add maximum combo on powermode #57

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 5 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -100,7 +100,7 @@ function onDidChangeConfiguration() {

enabled = config.get<boolean>('enabled', false);
comboThreshold = config.get<number>('comboThreshold', 0);

maximumCombo = config.get<number>('maximumCombo', 0);
// Switching from disabled to enabled
if (!oldEnabled && enabled) {
init(config, theme);
Expand Down Expand Up @@ -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));
}
Expand Down