standard / vscode-standard

VS Code extension for JavaScript Standard Style (`standard`) with automatic fixing
https://marketplace.visualstudio.com/items?itemName=standard.vscode-standard
MIT License
123 stars 24 forks source link

TypeError: callback is not a function #465

Closed bestpika closed 1 year ago

bestpika commented 2 years ago

What version of this package are you using?

What operating system, Node.js, and npm version?

What happened?

When I try to use the auto-fix feature of this extension, I get the following error message.

TypeError: callback is not a function
    at c:\Users\...\.vscode-insiders\extensions\standard.vscode-standard-2.1.2\server\out\server.js:667:17

What did you expect to happen?

Are you willing to submit a pull request to fix this bug?

arimgibson commented 2 years ago

Looking into this right now, might be able to submit a PR

Edit: couldn't figure out how to effectively debug the extension with the instructions given in the README, so I'm not going to be able to solve the issue or PR 😞

theoludwig commented 2 years ago

Hello, thanks for your report! @bestpika I don't have time currently to investigate and fix the issue, but would be happy to review a PR that fixes this.

theoludwig commented 2 years ago

Looking into this right now, might be able to submit a PR

Edit: couldn't figure out how to effectively debug the extension with the instructions given in the README, so I'm not going to be able to solve the issue or PR disappointed

Hey! @arimgibson The instructions to develop the extension are the README: https://github.com/standard/vscode-standard#how-to-develop. Feel free to post here what are your problems, so we can help you. Note that, you should first uninstall the extension, before running your "own" develop build of the extension. Thanks for your interest to contribute.

arimgibson commented 2 years ago

Thanks @Divlo! I'm happy to help if I can get the development figured out 😛

I've followed those instructions and have the repo cloned. However, it appears like VSCode/Node can't attach to the server. I've tried with port 6009 (specified in launch.json) on the command line and get failed to connect, please retry. Firewall is off, although it shouldn't make a difference because both are running on the same computer

theoludwig commented 2 years ago

I tried to reproduce the issue, indeed, there is an error when triggering auto-fix, nevertheless, it seems to work weirdly. Peek 2022-09-20 17-16

@arimgibson I don't really know what is the issue. Steps I use to develop the extension:

git clone git@github.com:standard/vscode-standard.git
cd vscode-standard
npm install
code .

Once I'm inside VSCode, I go to the "Run and Debug" tab, and start "Launch Client" task, then another VSCode is opening and I can open any folder, for example, the folder in client/testFixture/standard where I can also do npm install to install standard itself. Hopefully, it helps you to get it working. :smile: Screenshot from 2022-09-20 17-10-06

arimgibson commented 2 years ago

Hmmm... I'll give the VSCODE debugging another go and will see if I can PR this :)

holopekochan commented 2 years ago

The function in the waterfall has been modified to an async function. However, the auto fix features still work with the error with or without async in line https://github.com/standard/vscode-standard/blob/d8b17ac408d0f5fe86ff324ea936acfb961ccbee/server/src/server.ts#L996

async is add-in commit 3a6d1988cd8e78b817dbdfbbfdefd554a8b3e263

josegutierro commented 2 years ago

+1 with this issue

theoludwig commented 1 year ago

Thank you everyone for your help! The issue should be resolved since v2.1.3 that just released. Please reopen an issue if the issue persists. :smile: