rokucommunity / vscode-brightscript-language

A Visual Studio Code extension for Roku's BrightScript language
MIT License
104 stars 41 forks source link

How does "brightscript" task pick node version? #546

Open elliot-nelson opened 4 months ago

elliot-nelson commented 4 months ago

Recently, we've had some folks using debug tasks configured as BrightScript tasks, for example:

    {
      "type": "brightscript",
      "request": "launch",
      "name": "SDK ReferenceApp",
      "stopOnEntry": false,
      "host": "${env:ROKU_IP}",
      "password": "${env:ROKU_PASSWORD}",
      "rootDir": "${workspaceFolder}/sandbox/app/build/prod",
      "outDir": "${workspaceFolder}/sandbox/app/out",
      "files": ["*", "**"],
      "enableDebuggerAutoRecovery": false,
      "stopDebuggerOnAppExit": false,
      "preLaunchTask": "Build ReferenceApp",
      "injectRaleTrackerTask": false
    }

But, it keeps starting this task with node "16.0.0", even though the .nvmrc file in the repo says 16.15.0, and the user sets nvm alias default 16.15.0.

Is there a way to configure a "brightscript" task to use the "default" node version, similar to the way that tasks of type "node" can configure their runtimeVersion as "default"?

TwitchBronBron commented 4 months ago

Vscode ships with a specific node version (which can be seen in the "about vscode" window. Mine is currently running node 18.17.1). The language server and debug server and the extension itself all run with that bundled node version, and we have no control over that.

The preLaunchTask , if configured to be run as "shell", should run whatever node version your shell discovers. Running that task directly from vscode (i.e. "command pallet" -> run task -> "Build ReferenceApp") should be run in the exact same context as if the launch command has triggered it, so hopefully that provides some insight into what's going on.

In both cases, we don't actually pick the node version at all.