stkb / Rewrap

Rewrap extension for VSCode and Visual Studio
https://marketplace.visualstudio.com/items/stkb.rewrap
Other
506 stars 62 forks source link

Rewrap crashes with Solidity (.sol) files #379

Open mirayashi opened 1 year ago

mirayashi commented 1 year ago

Using pre-release version 17.8.0 (also reproducible with stable version 1.16.3). VSCode version 1.81.0 on Ubuntu 22.04

Rewrapping comments in Solidity files (.sol extension) results in the following stack trace:

[Extension Host] TypeError: e.System.Collections.IEnumerator.MoveNext is not a function
    at $b0ad0042444761d9$export$2344b14b097df817 (/home/mirayashi/.vscode/extensions/stkb.rewrap-17.8.0/dist/Extension.js:6975:69)
    at $9bfe09d0c22a9837$export$47bd1dafac8b8c58 (/home/mirayashi/.vscode/extensions/stkb.rewrap-17.8.0/dist/Extension.js:9073:12)
    at /home/mirayashi/.vscode/extensions/stkb.rewrap-17.8.0/dist/Extension.js:12666:148
    at $b0ad0042444761d9$export$d65cb303b863e3bf (/home/mirayashi/.vscode/extensions/stkb.rewrap-17.8.0/dist/Extension.js:7083:17)
    at $1411aa09fbe321df$export$78262f0a7b75cf50 (/home/mirayashi/.vscode/extensions/stkb.rewrap-17.8.0/dist/Extension.js:12666:92)
    at $1411aa09fbe321df$export$2e6c959c16ff56b8 (/home/mirayashi/.vscode/extensions/stkb.rewrap-17.8.0/dist/Extension.js:12673:49)
    at $9d0d59b10020735c$export$6cb9d9886761bf2b (/home/mirayashi/.vscode/extensions/stkb.rewrap-17.8.0/dist/Extension.js:13127:23)
    at $289a06abe5f10607$export$6cb9d9886761bf2b (/home/mirayashi/.vscode/extensions/stkb.rewrap-17.8.0/dist/Extension.js:13230:129)
    at $09ff662961d6d81c$var$doWrap (/home/mirayashi/.vscode/extensions/stkb.rewrap-17.8.0/dist/Extension.js:15444:22)
    at $09ff662961d6d81c$var$rewrapCommentCommand (/home/mirayashi/.vscode/extensions/stkb.rewrap-17.8.0/dist/Extension.js:15406:5)
    at /usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:120:20443
    at Object.edit (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:100:51097)
    at /usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:120:20430
    at a.h (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:102:77777)
    at a.$executeContributedCommand (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:102:78637)
    at t.N (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:7983)
    at t.M (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:7749)
    at t.H (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:6830)
    at t.G (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:5906)
    at r.value (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:114:4736)
    at f.w (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:1902)
    at f.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:2119)
    at y.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:79:13931)
    at r.value (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:130:30355)
    at f.w (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:1902)
    at f.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:63:2119)
    at y.fire (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:79:13931)
    at MessagePortMain.<anonymous> (/usr/share/code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:130:28635)
    at MessagePortMain.emit (node:events:513:28)
    at MessagePortMain._internalPort.emit (node:electron/js2c/utility_init:2:367)

With stable version (1.16.3), this error happens straight on startup if a .sol file is open when VSCode starts, which cause the extension to be entirely unavailable:

Activating extension 'stkb.rewrap' failed: e.System.Collections.IEnumerator.MoveNext is not a function.

Which results in the following when doing Alt+Q:

command 'rewrap.rewrapComment' not found
matthiasgeihs commented 1 year ago

Having same issue. Any solution available?

mirayashi commented 1 year ago

Having same issue. Any solution available?

The only workaround that I found is to manually change the language of the current file (for exemple to JavaScript), do Alt+Q, then switch back to Solidity. You should be using either pre-release or downgrade to stable 1.15 in order to avoid the startup crash and the command not found error.

Unfortunately I have little hope for a long-term fix as the repository seems no longer actively maintained (last commit 1.5 years ago), and there doesn't seem to be any other extensions out there available as an alternative.

matthiasgeihs commented 1 year ago

ah, wasn't aware that it's not maintained anymore.

thx for the workaround tip.

i'm wondering: maybe the problem is not too hard to fix? any idea what might be causing it?