SketchUp / sketchup-ruby-debugger

Ruby API debugger for SketchUp 2014 and later.
MIT License
78 stars 34 forks source link

VSCode tasks.json - & was unexpected at this time #18

Open asouth opened 6 years ago

asouth commented 6 years ago

Hi,

There maybe a simple fix for this but as far as I can tell I followed the instructions here for setting the VSCode environment up for debugging ruby extensions for Sketchup 2016 to the letter.

However with Sketchup closed, when I choose [Tasks -> Run Tasks -> Debug Sketchup 2016] I get the following message in the Terminal:

Executing task: &'C:/Program Files/SketchUp/SketchUp 2016/SketchUp.exe' -rdebug 'ide port=7000' <

& was unexpected at this time. The terminal process terminated with exit code: 1

It seems to be complaining about the & in front of the filepath, but if i remove it just complains about the C:

Can anyone assist with this?

I'm running Sketchup 2016 Pro Version 16.0.19912 64 bit | Windows 7 64bit

Thanks Alex

asouth commented 6 years ago

I just realised the instructions say 2014 Maintenance Version or Later. I'm running 2016 Pro could this be this issue?

BugraBarin commented 6 years ago

This should work in 2016 in theory but I don't have an installation handy to verify. It works on my setup with the following tasks.json:

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Debug SketchUp 2018",
      "type": "shell",
      "windows": {
        "command": "&'C:/Program Files/SketchUp/SketchUp 2018/SketchUp.exe' -rdebug 'ide port=7000'"
      },
      "problemMatcher": []
    }
  ]
}
thomthom commented 6 years ago

What terminal type is your VSCode set up to use? cmd or PowerShell?

thomthom commented 6 years ago

I see you have Windows 7, so you're probably using cmd if you are using default setup.

In Win10 Powershell is default. I think & was for that. You said that removing the & also didn't work, but what is the full error message?

asouth commented 6 years ago

Thanks for the responses. Yes i'm using the standard installation on Windows 7 64 bit.

@thomthom Removing the & produced the following error message: ''C:' is not recognized as an internal or external command, operable program or batch file.

@BugraBarin I tried the following code based on what you posted for SU 2018 but i get the same error message about the &

{
  "version": "2.0.0",
  "tasks": [
    {
      "label": "Debug SketchUp 2016",
      "type": "shell",
      "windows": {
        "command": "&'C:/Program Files/SketchUp/SketchUp 2016/SketchUp.exe' -rdebug 'ide port=7000'"
      },
      "problemMatcher": []
    }
  ]
}

I'll look up on how/if i can switch to PowerShell command line in VSCode and report back.

asouth commented 6 years ago

Ok, I had partial success I think.

In VSCode, I navigated to File > Preferences > Settings and added the following lines to the User Setting on the right pane as follows:

// Use PowerShell if available "terminal.integrated.shell.windows":"C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"

Note that this is only for a Windows 7 installation as I believe Powershell is located in C:\Windows\sysnative\ and not System32 on Windows 10.

Next with Sketchup closed, when I choose [Tasks -> Run Tasks -> Debug Sketchup 2016], Sketchup now starts up as expected, but then it seems to hang. This behavior might be expected; perhaps it's waiting for me to do something in VSCode?

asouth commented 6 years ago

Another update.

The Sketchup hang was simply because it was waiting for me to start the debugger in VSCode once SU and plugin was launched, although I can't see a way to add a Watch or inspect a Variable!!! I guess this is my issue though! Thanks for the nudges in the right direction.

BugraBarin commented 6 years ago

Did you grab the latest version of the DLL? We recently modified it so that SU shouldn't hang at startup by default. There is now a 'wait' command line parameter to get it to wait (check out the readme).

Anyway, glad to hear that you got over the initial problem.

thomthom commented 6 years ago

Maybe you need to alter 'C:/Program Files/SketchUp/SketchUp 2016/SketchUp.exe' to use Windows slashes instead of forward slashes to get cmd to work?

asouth commented 6 years ago

Hi

Before i close this issue - where is the best place to get help using the extension debugger in VS Code?

I'm having issues with not being able to view the value of a variable in the locals and watch windows when stepping (F10). In addition, the stepping doesn't always work. Is there a script i can test to check the vs code is setup properly?

thomthom commented 6 years ago

You mean with the VS Code extension in general? Or in conjunction with SketchUp?

asouth commented 6 years ago

I mean in conjunction with sketchup, although I must admit I’ve not used vscode before only visual studio pro.

thomthom commented 6 years ago

If it might be a bug with the SketchUp debugger then can you open a new issue with a minimal sample to reproduce?

JianboBai commented 5 years ago

Ok, I had partial success I think.

In VSCode, I navigated to File > Preferences > Settings and added the following lines to the User Setting on the right pane as follows:

// Use PowerShell if available "terminal.integrated.shell.windows":"C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"

Note that this is only for a Windows 7 installation as I believe Powershell is located in C:\Windows\sysnative\ and not System32 on Windows 10.

Next with Sketchup closed, when I choose [Tasks -> Run Tasks -> Debug Sketchup 2016], Sketchup now starts up as expected, but then it seems to hang. This behavior might be expected; perhaps it's waiting for me to do something in VSCode?

I don't find the rightway to add the setting. The version of my VSCode is 1.38.