hoovercj / vscode-power-mode

Your code is powerful, unleash it! The extension made popular by Code in the Dark has finally made its way to VS Code.
MIT License
1.07k stars 88 forks source link

"In Editor" Combo Combo Meter #25

Closed cabbruzzese closed 2 years ago

cabbruzzese commented 6 years ago

Would love to see Combo Mode as implemented in Atom

https://atom.io/packages/activate-power-mode

combo mode

hoovercj commented 6 years ago

Me too! Unfortunately I don't think it is possible to have the combos be shown like that in the corner of the window. I've tried a couple times but failed :-(

Maybe somebody else has ideas, though, and can make it work.

11zi commented 6 years ago

I also want this

sandyeveliz commented 6 years ago

+1 👍 this combo mode is awesome =D

jrod-disco commented 4 years ago

👍 Bump. I'll take a look at this and see if I can get it working. @hoovercj do you have any branches with WIP to this end?

Looking at the capabilities I would think we could at least pop a new webview or perhaps put the combo numbers into a docked panel on the left column -- that would be sweet enough.

jrod-disco commented 4 years ago

Ah... I realize this repo is a bit stale eh? I can't seem to build/run the without running into a number of errors. It could be my local environment but maybe starting fresh would be the way to go.


### VS Code Extension Test Run ###
Current working directory: /Volumes/Kali/REPO/vscode-power-mode
Downloading VS Code into "/Volumes/Kali/REPO/vscode-power-mode/.vscode-test" from: https://vscode-update.azurewebsites.net/1.44.2/darwin/stable
Running extension tests: /Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/MacOS/Electron /Volumes/Kali/REPO/vscode-power-mode/test --extensionDevelopmentPath=/Volumes/Kali/REPO/vscode-power-mode --extensionTestsPath=/Volumes/Kali/REPO/vscode-power-mode/test
[main 2020-05-01T19:56:39.464Z] update#setState idle

(node:88434) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

(node:88434) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

(node:88434) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information
(node:88434) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

(node:88434) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

(node:88434) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

jumpToAliasFile extension start

Error: Error: Cannot find module '/Volumes/Kali/REPO/vscode-power-mode/test'
Require stack:
- /Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js
- /Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js
- /Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork.js
    at h._doHandleExtensionTests (/Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:791:405)

Error: Cannot find module '/Volumes/Kali/REPO/vscode-power-mode/test'
Require stack:
- /Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js
- /Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js
- /Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork.js: Error: Error: Cannot find module '/Volumes/Kali/REPO/vscode-power-mode/test'
Require stack:
- /Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/Resources/app/out/vs/loader.js
- /Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-amd.js
- /Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork.js
    at h._doHandleExtensionTests (/Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:791:405)

jumpToAliasFile extension activing

(node:88780) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information
(node:88780) Electron: Loading non context-aware native modules in the renderer process is deprecated and will stop working at some point in the future, please see https://github.com/electron/electron/issues/18397 for more information

[main 2020-05-01T19:56:43.108Z] [uncaught exception in main]: Error: write EPIPE
[main 2020-05-01T19:56:43.109Z] Error: write EPIPE
    at afterWriteDispatched (internal/stream_base_commons.js:146:25)
    at writeGeneric (internal/stream_base_commons.js:137:3)
    at Socket._writeGeneric (net.js:698:11)
    at Socket._write (net.js:710:8)
    at doWrite (_stream_writable.js:418:12)
    at writeOrBuffer (_stream_writable.js:402:5)
    at Socket.Writable.write (_stream_writable.js:302:11)
    at h.write (/Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:196:490)
    at p._writeNow (/Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:186:502)
    at Immediate.<anonymous> (/Volumes/Kali/REPO/vscode-power-mode/.vscode-test/Visual Studio Code.app/Contents/Resources/app/out/vs/code/electron-main/main.js:186:440)
    at processImmediate (internal/timers.js:439:21)

Tests exited with code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vscode-power-mode@2.2.0 test: `node ./node_modules/vscode/bin/test`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vscode-power-mode@2.2.0 test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/jrvisualsllc/.npm/_logs/2020-05-01T19_56_43_402Z-debug.log
hoovercj commented 4 years ago

@jrod-disco thanks for taking an interest and being willing to look into the code! I just opened the master branch in vscode 1.44.2 and pressed F5 and the extension development host loaded and the extension ran just fine.

From the output you shared, though, it looks like you might be trying "npm test" or something? There is a test script in the package.json, but it doesn't do anything. It is part of the initial vscode extension template and I never removed it. As you can see, I also never wrote a "Contributing.md" file or any other documentation because I didn't expect to get almost 200,000 downloads 😂

The following information reflects my understanding as of the last time I updated this extension 2 years ago. Things may have changed, but a quick look through the api docs suggest that is not the case;

So the problem here is that vscode doesn't have an api for drawing arbitrarily to the screen. Atom directly exposed the canvas used to render the editor which allowed them to create the initial power mode, but the closest thing that VS Code gives you is "text decorations", which allow you to specify a range within the editor and apply some styling to it using DecorationRenderOptions. The way vscode-powermode works is by applying a text decoration to each typed character to have "position: relative" and then the "before" pseudo-element to "position: absolute" and setting the size, background, color, etc. on the before element.

So this works OK for the explosions, but it presents a couple unique challenges for the combo bar.

So 2 years ago there was a proposed api called TextEditorVisibleRangesChangeEvent which I started experimenting with. It seems that api is now stable, so I can share my branch. The main problem it has right now is that as you type and scroll, the "combo" text disappears if the first and only the number stays if the first visible line in the editor is empty. I don't really know why. So if you want to play with this branch and look at combo-meter.ts and figure it out, that would be great. Edit: See new comment

Once that is figured out, then adding configuration to turn the combo on/off is the biggest priority (there are plenty of examples in the code for that). After that, the next most important things are styling, changing colors, adjusting the size with each keypress to somewhat simulate pulsing, etc. Basically the "flavor" needed to make it look like the original "combo mode" counter. There's probably also some other polish and edge case handling (I think the gif shows it going off the screen to the right).

But right now, this is what the branch looks like:

combometer

hoovercj commented 4 years ago

I've fixed the issue with the combo disappearing.

The minimum required change now to merge this into master is to add configuration so it can be enabled and disabled which I can hopefully do this weekend

jonbonazza commented 4 years ago

Hi @hoovercj did you ever get around to finishing this off? Would love to see this supported. Would also love to see an option to put combo down in the status bar instead

hoovercj commented 4 years ago

@jonbonazza I need to check the performance again and make sure it is acceptable before publishing this, but the version in the store already has a combo meter down in the status bar as well as a timer. You can find the configuration for them in the vscode settings/preferences editor

hoovercj commented 2 years ago

I finally came back to this and shipped v3.0 with a new combo-meter and several other features! Feel free to check it out. I look forward to seeing all the new bugs I created 😄

ShaheerAli1000 commented 3 months ago

There's any possibility to adjust the position of Combos, what happens that in my VS code, combos appears on top left corner, really annoying coming in front of my code. I usually don't use VS code on Full screen view. I want those combos to be appeared at right top, or right bottom of my screen instead of left-top.