{"action":"created","issue":{"url":"https://api.github.com/repos/SketchUp/sketchup-ruby-debugger/issues/14","repository_url":"https://api.github.com/repos/SketchUp/sketchup-ruby-debugger","labels_url":"https://api.github.com/repos/SketchUp/sketchup-ruby-debugger/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/SketchUp/sketchup-ruby-debugger/issues/14/comments","events_url":"https://api.github.com/repos/SketchUp/sketchup-ruby-debugger/issues/14/events","html_url":"https://github.com/SketchUp/sketchup-ruby-debugger/issues/14","id":265558847,"number":14,"title":"VSCode workflow questions","user":{"login":"thomthom","id":192418,"avatar_url":"https://avatars0.githubusercontent.com/u/192418?v=4","gravatar_id":"","url":"https://api.github.com/users/thomthom","html_url":"https://github.com/thomthom","followers_url":"https://api.github.com/users/thomthom/followers","following_url":"https://api.github.com/users/thomthom/following{/other_user}","gists_url":"https://api.github.com/users/thomthom/gists{/gist_id}","starred_url":"https://api.github.com/users/thomthom/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomthom/subscriptions","organizations_url":"https://api.github.com/users/thomthom/orgs","repos_url":"https://api.github.com/users/thomthom/repos","events_url":"https://api.github.com/users/thomthom/events{/privacy}","received_events_url":"https://api.github.com/users/thomthom/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2017-10-15T09:43:33Z","updated_at":"2018-02-27T03:55:29Z","closed_at":null,"author_association":"OWNER","body":"I've been trying to set up VS Code with the debugger. So far I've been able to make a task to launch SketchUp in debug mode. And a debug config to connect to it. But I've not been able to put this into a single action.\r\n\r\n## `tasks.json`:\r\n\r\n```\r\n{\r\n  // See https://go.microsoft.com/fwlink/?LinkId=733558\r\n  // for the documentation about the tasks.json format\r\n  \"version\": \"2.0.0\",\r\n  \"tasks\": [\r\n    {\r\n      \"taskName\": \"Debug in SketchUp 2017\",\r\n      \"type\": \"shell\",\r\n      \"command\": \"ruby\",\r\n      \"args\": [\r\n        \"${workspaceFolder}/tools/debug.rb\",\r\n        \"2017\"\r\n      ],\r\n      \"problemMatcher\": []\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\n### `debug.rb`\r\n\r\n```ruby\r\n# Launcher script for starting SketchUp in Ruby Debug mode.\r\nversion = ARGV[0].to_i\r\nport = ARGV[1] || '7000'\r\n\r\nif RUBY_PLATFORM =~ /darwin/\r\n  raise 'Mac support not implemented'\r\nelse\r\n  program_files_32bit = ENV['ProgramFiles(x86)']\r\n  program_files_64bit = ENV['ProgramW6432']\r\n\r\n  # Look for 32bit or 64bit SketchUp in default installation directory.\r\n  paths = [program_files_32bit, program_files_64bit].map { |program_files|\r\n    sketchup_path = File.join(program_files, 'SketchUp', \"SketchUp #{version}\")\r\n    sketchup = File.join(sketchup_path, 'SketchUp.exe')\r\n    File.expand_path(sketchup)\r\n  }\r\n  sketchup = paths.find { |path| File.exist?(path) }\r\n\r\n  raise \"SketchUp #{version} not found.\" if sketchup.nil?\r\n\r\n  command = %(\"#{sketchup}\" -rdebug \"ide port=#{port}\")\r\n  spawn(command)\r\nend\r\n\r\n```\r\n\r\n## `launch.json`:\r\n\r\n```\r\n{\r\n  // Use IntelliSense to learn about possible attributes.\r\n  // Hover to view descriptions of existing attributes.\r\n  // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\r\n  \"version\": \"0.2.0\",\r\n  \"configurations\": [\r\n    {\r\n      \"name\": \"Listen for rdebug-ide\",\r\n      \"type\": \"Ruby\",\r\n      \"request\": \"attach\",\r\n      // \"preLaunchTask\": \"Debug in SketchUp 2017\",\r\n      \"cwd\": \"${workspaceRoot}\",\r\n      \"remoteHost\": \"127.0.0.1\",\r\n      \"remotePort\": \"7000\",\r\n      \"remoteWorkspaceRoot\": \"${workspaceRoot}\"\r\n    }\r\n  ]\r\n}\r\n```\r\n\r\nAs can be seen from `launch.json` I tried to trigger the debug task in `preLaunchTask`. This will start SketchUp, and debugger appear to be running - but not connected.\r\n\r\nWhen I manually test by starting VSCode Ruby debugging without having started SketchUp first I see this in the VSCode console:\r\n\r\n`Debugger error: Client: Error: connect ECONNREFUSED 127.0.0.1:7000`\r\n\r\nIf I launch SketchUp after that the debugger isn't able to detect that and connect. I have to terminate the connection and initiate it again.\r\n\r\nSo it appear that my `preLaunchTask` isn't ready in time for the VSCode debugger when it wants to connect.\r\n\r\nIs this an issue with the VSCode Ruby extension? Or something that can be addressed in the SketchUp debugger interface?\r\n\r\nWith RubyMine I have similar setup, Remote Ruby Debug with a pre-launch task that starts SketchUp. Any ideas?"},"comment":{"url":"https://api.github.com/repos/SketchUp/sketchup-ruby-debugger/issues/comments/368739273","html_url":"https://github.com/SketchUp/sketchup-ruby-debugger/issues/14#issuecomment-368739273","issue_url":"https://api.github.com/repos/SketchUp/sketchup-ruby-debugger/issues/14","id":368739273,"user":{"login":"BugraBarin","id":2589566,"avatar_url":"https://avatars3.githubusercontent.com/u/2589566?v=4","gravatar_id":"","url":"https://api.github.com/users/BugraBarin","html_url":"https://github.com/BugraBarin","followers_url":"https://api.github.com/users/BugraBarin/followers","following_url":"https://api.github.com/users/BugraBarin/following{/other_user}","gists_url":"https://api.github.com/users/BugraBarin/gists{/gist_id}","starred_url":"https://api.github.com/users/BugraBarin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BugraBarin/subscriptions","organizations_url":"https://api.github.com/users/BugraBarin/orgs","repos_url":"https://api.github.com/users/BugraBarin/repos","events_url":"https://api.github.com/users/BugraBarin/events{/privacy}","received_events_url":"https://api.github.com/users/BugraBarin/received_events","type":"User","site_admin":false},"created_at":"2018-02-27T03:55:29Z","updated_at":"2018-02-27T03:55:29Z","author_association":"OWNER","body":"@thomthom Can this be closed?"}}
{"actor":{"display_login":"BugraBarin"}}