ev3dev / vscode-ev3dev-browser

Visual Studio Code extension for browsing ev3dev devices
https://marketplace.visualstudio.com/items?itemName=ev3dev.ev3dev-browser
MIT License
39 stars 11 forks source link

Pressing F5 does not download any files when using global launch configuration (set in global user settings) #76

Closed ndward closed 5 years ago

ndward commented 5 years ago

I've just tried the latest (18 Feb 2019) image and noticed that pressing F5 no longer causes any scripts to be downloaded to the brick! Therefore each time I change my script I have to click the 'Send workspace to device' icon before I can run the script (by pressing F5). Can you confirm this? Is this a deliberate change? It seems hugely annoying to me, though I would be in favor of not having to download the entire project folder to the brick each time I modify just one file. Maybe the best would be to have F5 download the entire folder as before and a different key such as F6 could download and run just the active script?

This is my user settings file (settings.json) which worked fine before (in the absence of project settings):

{
    "launch": {
        "version": "0.2.0",
        "configurations": [{
            "name": "Download and Run",
            "type": "ev3devBrowser",
            "request": "launch",
            "program": "/home/robot/${workspaceRootFolderName}/${relativeFile}"
        },
        {
            "name": "Python: Current File (Integrated Terminal)",
            "type": "python",
            "request": "launch",
            "program": "${file}",
            "console": "integratedTerminal"
        }]
    },
    "git.ignoreMissingGitWarning": true,
    "ev3devBrowser.confirmDelete": false,
    "editor.autoClosingBrackets": "never",
    "editor.autoClosingQuotes": "never",
    "files.eol": "\n",
    "ev3devBrowser.download.exclude": "{**/.*,LICENSE,README.md}",
    "editor.fontSize": 15,
}
dlech commented 5 years ago

Pressing F5 still works for me.

dlech commented 5 years ago

Which debug configuration do you have selected when you press F5?

image

Did you change any settings or install any other extensions that would override what F5 does?

ndward commented 5 years ago

I'm experiencing the same problem with the March 4 release. I'm using the Download and Run configuration as defined above. The only extensions installed are Python and EV3 Device Browser. I have no other settings other than those in User Settings as above (settings.json). I do not have a .vscode folder or a settings.json file in my project folder.

The error message that I receive after pressing F5 while a file starter.py is active and contained in a project folder called 'ev3_python_scripts' is:

Starting: brickrun --directory="/home/robot/ev3_python_scripts" "/home/robot/ev3_python_scripts/starter.py"
Started.
----------
Starting remote process failed: Failed to change to directory '/home/robot/ev3_python_scripts' (No such file or directory)
----------
Exited with error code 1.

There is no indication in the VS Code status bar that VS Code is downloading anythIng to the EV3.

ndward commented 5 years ago

Here's a video to demonstrate the problem: https://youtu.be/qgOoXCyolj4

Note that I don't usually have a .vscode folder (and thus no launch.json file) in my project folder, only User settings i.e. a settings.json file associated with VS Code that contains launch configurations. But for this video I had a launch.json file in the project folder to show that that works while the other configuration in User settings does not (it used to until a month or two ago).

dlech commented 5 years ago

Thanks for the video. It is helpful to understand the problem better. Can you post both the global and project launch.json files?

ndward commented 5 years ago

I posted the global settings.json in my opening comment - it includes launch configurations. The project launch.json contains:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Download and Run",
            "type": "ev3devBrowser",
            "request": "launch",
            //"program": "/home/robot/${workspaceRootFolderName}/hello.py"
            "program": "/home/robot/${workspaceRootFolderName}/${relativeFile}"
       }
    ]
}

BTW, the global launch configuration correctly handles the local launching of non-ev3 python scripts when F5 is pressed, after selecting the configuration 'Python: Current File (Integrated Terminal)'.

dlech commented 5 years ago

Regression was introduced in 940b5970a9a2495c197a203a562a1e0fcfbaa967. When using a global launch configuration as suggested in #64, VS Code does not provide a reference the current project to the debugger.

ndward commented 5 years ago

I'm sorry - I don't understand either of those two sentences. Are you saying that it is no longer possible to launch EV3 Python scripts using a global launch configuration (set in global user settings)? If so, then do I need to go back to including a .vscode folder in each project folder, with a launch.json inside that? If it IS still possible to launch EV3 Python scripts using a global launch configuration (set in global user settings) then is there something I need to do differently? If the possibility of using a global launch configuration (set in global user settings) was lost in a certain upgrade to EV3dev then which version was the last version that included that option? Thanks in advance for clarifying this.

dlech commented 5 years ago

Well, I'm still not convinced that using the global configuration is the best idea, but the problem should be fixed (in v1.0.2 of the VS Code extension). Those 2 sentences just mean that I found the source of the problem.

ndward commented 5 years ago

Did you just release 1.0.2? That was quick, and it seems to have solved the problem! Thanks very much. Should I assume that the extension now downloads only the active or named file rather than all the (unexcluded) files in the project folder?

dlech commented 5 years ago

Did you just release 1.0.2?

a couple days ago, yes

Should I assume that the extension now downloads only the active or named file rather than all the (unexcluded) files in the project folder?

It should filter the downloaded files based on the ev3devBrowser.download.include and ev3devBrowser.download.exclude settings, but you should try it to be sure. (I don't recommend making assumptions.)

ndward commented 5 years ago

I did notice one annoying new 'feature' of the latest extension(s): VS Code switches into debug mode every time you press F5 to run a script. This was not the case before and surely this is not very useful because EV3 Python scripts running remotely cannot be debugged like locally run scripts?

dlech commented 5 years ago

Please don't confuse new VS Code features for extension features. This is a new feature of VS Code itself and there is a new configuration option to restore the old behavior.

You should be able to add this to your settings.json

"debug.openDebug": "neverOpen"