loganch / AutoIt-VSCode

AutoIt Extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=Damien.autoit
MIT License
74 stars 25 forks source link

How to test the extension? #98

Open vanowm opened 2 years ago

vanowm commented 2 years ago

This extension seems to have different "format" and I'm unable test it in my VSCode using official tutorial.

Can someone please post a tutorial how to setup VSCode to test this extension?

Danp2 commented 2 years ago

It's been a while since I switched to using this extension with VSCode, but I don't recall having difficulties with getting it up and running. What specific issues have you encountered?

vanowm commented 2 years ago

So, my launch.json looks like this:

{
  // Use IntelliSense to learn about possible attributes.
  // Hover to view descriptions of existing attributes.
  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
  "version": "0.2.0",
  "configurations": [

    {
      "args": [
        "--disable-extensions",
        "--extensionDevelopmentPath=${workspaceFolder}",
      ],
      "name": "Launch Extension",
      "outFiles": ["${workspaceFolder}/dist/**/*.js"],
      "preLaunchTask": "npm: webpack",
      "request": "launch",
      "type": "pwa-extensionHost",
      "smartStep": true
    }
  ]
}

This gives error:

> Executing task: npm run webpack <

> autoit@1.0.8 webpack      
> webpack --mode development

node:internal/crypto/hash:67
  this[kHandle] = new _Hash(algorithm, xofLen);
                  ^

Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:135:10)
    at BulkUpdateDecorator.hashFactory (C:\Users\dev\Documents\AutoIt-VSCode\node_modules\webpack\lib\util\createHash.js:145:18)
    at BulkUpdateDecorator.update (C:\Users\dev\Documents\AutoIt-VSCode\node_modules\webpack\lib\util\createHash.js:46:50)
    at SourceMapSource.updateHash (C:\Users\dev\Documents\AutoIt-VSCode\node_modules\webpack-sources\lib\SourceMapSource.js:233:8)
    at NormalModule._initBuildHash (C:\Users\dev\Documents\AutoIt-VSCode\node_modules\webpack\lib\NormalModule.js:868:17)
    at handleParseResult (C:\Users\dev\Documents\AutoIt-VSCode\node_modules\webpack\lib\NormalModule.js:934:10)
    at C:\Users\dev\Documents\AutoIt-VSCode\node_modules\webpack\lib\NormalModule.js:1026:4
    at processResult (C:\Users\dev\Documents\AutoIt-VSCode\node_modules\webpack\lib\NormalModule.js:743:11)
    at C:\Users\dev\Documents\AutoIt-VSCode\node_modules\webpack\lib\NormalModule.js:807:5 {
  opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
}

Node.js v17.8.0
The terminal process "C:\Program Files\PowerShell\7\pwsh.exe -Command npm run webpack" terminated with exit code: 1.

Searched for the error found in several place people suggsting use NODE_OPTIONS="--openssl-legacy-provider", which I tried by entering in PS console: $env:NODE_OPTIONS="--openssl-legacy-provider" This didn't help. Another suggestion was to downgrade nodejs to v16, but I'm skeptical about this.

vanowm commented 2 years ago

And of course, as soon as I posted that, I found another suggestion to add that line before executing webpack. In package.json:

  "scripts": {
    "webpack": "SET NODE_OPTIONS=--openssl-legacy-provider && webpack --mode development",
    "webpack-dev": "SET NODE_OPTIONS=--openssl-legacy-provider && webpack --mode development --watch",
    "vscode:prepublish": "SET NODE_OPTIONS=--openssl-legacy-provider && webpack --mode production"
  }

And it seems to be working now.

Danp2 commented 2 years ago
    "--disable-extensions",

This isn't in the original launch.json. Did you manually add this?

 "webpack": "SET NODE_OPTIONS=--openssl-legacy-provider && webpack --mode development",

Glad you found a workaround, but I didn't need to make this change on you system.

Another suggestion was to downgrade nodejs to v16

Hmmm.... I wonder if that could be the issue as I'm running v16.15.1. What version do you have?

vanowm commented 2 years ago
    "--disable-extensions",

This isn't in the original launch.json. Did you manually add this?

Yes, I have 20+ extensions installed, to properly test I figured they should be disabled.

Hmmm.... I wonder if that could be the issue as I'm running v16.15.1. What version do you have? 17.8.0

Danp2 commented 2 years ago

Strange that v17 doesn't even appear on the release schedule. You may want to try the current LTS release.

vanowm commented 2 years ago

Since it's not so straight forward to downgrade nodejs, I first upgraded it to latest v18.4.0. The issue with default scripts remains.

Latest LTS 16.15.1 works fine.