nicollasricas / vscode-deck

Enables Stream Deck integration with Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=nicollasr.vscode-streamdeck
MIT License
81 stars 12 forks source link

Not connecting when vscode is running on WSL #9

Closed logm closed 3 years ago

logm commented 4 years ago

Streamdeck will not connect or activate when I am working on WSL vscode. It works fine when I run vscode locally on windows.

The stream deck output just spams Connecting to Stream Deck Disconnected from Stream Deck.

SharedScreenshot

It would be great to get this working, your app is very useful!

logm commented 4 years ago

I tested this some more and believe the issue is WSL2 network related. The app works fine when running VSCode from WSL1, but due to how WSL2 is separate from windows there is an issue.
https://docs.microsoft.com/en-us/windows/wsl/compare-versions#accessing-network-applications

nicollasricas commented 4 years ago

Try to change the "streamdeck.serverHost" in VS Code settings to 0.0.0.0 or the IP from "ip adr" as mentioned in the documentation.

jastend commented 4 years ago

I'm having the same problem. After trying 0.0.0.0 (just in case), I went ahead and tried these instructions: https://docs.microsoft.com/en-us/windows/wsl/compare-versions#accessing-windows-networking-apps-from-linux-host-ip

So I ran:

jastend@KNST:/etc$ ip addr | grep eth0
4: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    inet 172.28.5.203/20 brd 172.28.15.255 scope global eth0

I added this IP to the VSCode Remote setting, but it's still not connecting.

Just in case, I also created the settings.ini and bound it to 0.0.0.0 (so it listens to all):

[general]
host=0.0.0.0
port=48969

The Windows VSCode is connecting, but it does not work inside WSL2. Unfortunately, I don't understand enough about the intricacies of the VSCode WSL2 to host system communication, so I'm unable to troubleshoot this further on my own.

Ajwah commented 4 years ago

Here are relevant logs that I see for: ~/Library/Logs/StreamDeck/StreamDeck0.log

02:27:55.7834          auto ESDCustomPlugin::StartPlugin(): The plugin 'Visual Studio Code' crashed with code 1:6
02:27:55.7835          auto ESDCustomPlugin::StartPlugin(): Restarting plugin 'Visual Studio Code'
02:27:55.7889          void ESDCustomPluginCommunication::onMessageReceived(): Plugin F88E900C14202DD8C1D24563A0BE2ED4 is now connected
02:27:56.0651          auto ESDCustomPlugin::StartPlugin(): The plugin 'Visual Studio Code' crashed with code 1:6
02:27:59.9289          void EGQTSWUpdateDialog::checkForUpdate(): Check for update 2: https://gc-updates.elgato.com/mac/sd-update/final/app-version-check.json
02:27:59.9300          void EGQTSWUpdateDownloader::startDownload(): Download task name: Update File, file URL: https://gc-updates.elgato.com/mac/sd-update/final/app-version-check.json
02:28:00.0432          virtual EGQTSWUpdateDialog::UpdateState EGQTSWUpdateDialog::shouldUpdate(): current SW Ver: 4.7.0.12981, remote SW Ver: 4.7.0.12981
02:28:00.0434          bool EGQTSWUpdateDialog::handleUpdateFileDownloaded(): No update available
02:28:12.3367          void ESDActionsGridViewModel::onKeyPressed(): emit keyPressed idx: 0
02:28:12.5476          void ESDActionsGridViewModel::onKeyReleased(): emit keyReleased idx: 0
02:28:14.8759          void ESDAppStoreManager::UpdateAppStorePlugins(): Check for Plugin Store updates
02:28:15.4315          void ESDActionsGridViewModel::onKeyPressed(): emit keyPressed idx: 4
02:28:15.7358          void ESDActionsGridViewModel::onKeyReleased(): emit keyReleased idx: 4
02:28:18.7791          void ESDActionsGridViewModel::onKeyPressed(): emit keyPressed idx: 11
02:28:19.1322          void ESDActionsGridViewModel::onKeyReleased(): emit keyReleased idx: 11
02:28:21.8211          void ESDActionsGridViewModel::onKeyPressed(): emit keyPressed idx: 0
02:28:22.1256          void ESDActionsGridViewModel::onKeyReleased(): emit keyReleased idx: 0
02:28:23.6998          void ESDActionsGridViewModel::onKeyPressed(): emit keyPressed idx: 2
02:28:23.7013          virtual bool KA_Execute::ProcessKeyDown(): execute: file:///Applications/1Password%207.app
02:28:23.9028          void ESDActionsGridViewModel::onKeyReleased(): emit keyReleased idx: 2
02:28:55.8758          auto ESDCustomPlugin::StartPlugin(): Restarting plugin 'Visual Studio Code' after one minute
02:28:56.3954          void ESDCustomPluginCommunication::onMessageReceived(): Plugin 7BBC1313DFFEB7FB46575BE5E342BB44 is now connected
02:37:41.7826          void ESDActionsGridViewModel::onKeyPressed(): emit keyPressed idx: 0
02:37:41.9896          void ESDActionsGridViewModel::onKeyReleased(): emit keyReleased idx: 0
JorgenSmith commented 3 years ago

Hey, had the same issue and I just figured this out. For WSL2 you need to connect to the IP address of the Win10 host itself, so run e.g. ipconfig /all and you'll find a local interface say 192.168.0.25 on one of your adapters and with the correct one configured the plugin will connect.

Also I used the Extension Settings configurator from the gear icon on the Extensions list; you'll have 3 settings tabs there, the remote is the one you want to modify.

Hope this helps! The StreamDeck is such an awesome productivity tool, can't wait to fully explore VSCode configurations now.

JorgenSmith commented 3 years ago

@jastend Just discovered that it's also important that the host is configured to listen to 0.0.0.0. I had it set to a different temporary IP before, and my config stopped working. So I've updated my PR to include the following WSL2 section, it now works perfectly both from Win10 and WSL2:

Windows WSL2

1) It is important that %appdata%\Elgato\StreamDeck\Plugins\com.nicollasr.streamdeckvsc.sdPlugin\settings.ini is listening on 0.0.0.0:

[general]
host=0.0.0.0
port=48969

2) Next, configure ~/.vscode-server/data/Machine/settings.json to the IP address of the Win10 host, as identified by ipconfig /all from a CMD Prompt - e.g.:

{
    "streamdeck.serverHost": "192.168.0.25"
}
samuelhwilliams commented 3 years ago

I am struggling to get vscode-streamdeck to connect when installed in WSL2 also. I've followed the instructions in the readme from @JorgenSmith to no avail.

/home/sam/.vscode-server/data/Machine/settings.json

{
    ...,
    "streamdeck.serverHost": "172.30.112.1",
    "streamdeck.serverPort": 48969
}

C:\Users\swill\AppData\Roaming\Elgato\StreamDeck\Plugins\com.nicollasr.streamdeckvsc.sdPlugin\settings.ini

[general]
host=0.0.0.0
port=48969

vscode-streamdeck logs just say

[4/9/2021, 2:37:30 PM] Connecting to Stream Deck
[4/9/2021, 2:37:31 PM] Registering session b67b3cc7-6802-46ba-8382-40d1124661ab1617975433836
[4/9/2021, 2:37:53 PM] Configuration changed, restarting...
[4/9/2021, 2:37:53 PM] Connecting to Stream Deck
[4/9/2021, 2:37:57 PM] Configuration changed, restarting...
[4/9/2021, 2:37:57 PM] Connecting to Stream Deck
[4/9/2021, 2:40:10 PM] Disconnected from Stream Deck.
[4/9/2021, 2:40:10 PM] Connecting to Stream Deck
[4/9/2021, 2:42:23 PM] Disconnected from Stream Deck.
[4/9/2021, 2:42:23 PM] Connecting to Stream Deck
[4/9/2021, 2:44:36 PM] Disconnected from Stream Deck.
[4/9/2021, 2:44:36 PM] Connecting to Stream Deck

Is there anything else that needs to be done? 🤔

nicollasricas commented 3 years ago

Could you please try this version? It has a fix made by @sploders101 that changes the kind of the extension to UI removing the need for port forwarding.

I don't use WSL and most of the opened issues so far were because of it, so if this fixes it would be awesome for those who use it, let me know if it works.

vscode-streamdeck-4.1.6.zip