13

Closed

Support debugging scripts when not in a project

description

Currently you need to have a project for debugging scripts (see http://pytools.codeplex.com/discussions/272102#post669864), we should support debugging even if there isn't a project.

Still has the following issues:
  • File is not saved before starting to debug
  • Command may not be working correctly with multiple files when not invoked through the menu
  • User is prompted to save the solution when closing VS (screenshot attached)

file attachments

comments

swift_dev wrote Jan 7, 2013 at 6:15 PM

Any chance you can get me a version of this for testing? This has been one of my most anticipated features as I was the original reporter. I don't have the time to go install everything to build it myself at the moment.

swift_dev wrote Jan 16, 2013 at 6:12 PM

tap tap tap
Is this thing on?!?

Zooba wrote Jan 16, 2013 at 7:32 PM

Sorry - it may not actually be on... CodePlex is not sending notification emails reliably right now.

Right now, building it yourself is your only option. Our first public release is a little way off yet. We are looking into some ways to do more releases but in a controlled manner (and with a higher expectation for feedback/collaboration than the main releases), so if you'd like to be in on that when it happens I can add you to the list? Otherwise, it's just a case of waiting for now.

swift_dev wrote Jan 16, 2013 at 7:53 PM

The issue right now is I can't see a way to access a devel branch that his this code.

Zooba wrote Jan 16, 2013 at 8:23 PM

The default branch has the change - it went in at http://pytools.codeplex.com/SourceControl/changeset/636b2fc0de34

Internally we use a TFS server and the Mercurial repository is a mirror. This means you don't see a lot of branching and merging in Hg (and you do see "Servicing" folders rather than branches... I'm not entirely happy with this setup myself, but we have to abide by corporate policies that prevent us from changing VCS).

swift_dev wrote Jan 16, 2013 at 8:24 PM

Also yes, add me to the list!

swift_dev wrote Jan 16, 2013 at 8:51 PM

Hmm... okay well then I've already built that and loaded up the hive version of VS using "devenv /rootSuffix Exp".

After opening a python file Debug>Start Debugging is still disabled. Is there something special I need to do in order to debug the currently open script? Is there some documentation on how to use this new feature?

Zooba wrote Jan 16, 2013 at 10:09 PM

No documentation yet, but there'll be a "Debug as Script" option when you right click the tab for the script you want to run. You can set a keyboard shortcut for this if you like - the command name is EditorContextMenus.CodeWindow.DebugasScript - but we don't have a default (yet).

The main menus and shortcuts are staying reserved for projects, which are our main focus.

Zooba wrote Jan 16, 2013 at 10:13 PM

I also added you as an editor on the project, which is where we're tracking "keen volunteers". (It also means you should be able edit the wiki now, if you feel like it.)

swift_dev wrote Jan 16, 2013 at 10:30 PM

Hmm... I tried that but I don't seem to have the option. Is there any other dependency? On the commit it said something about checking for a default project... Do I need to have set up some project first?
Is there any way from inside visual studio to see the version of the plugin I'm using? Maybe the "Python Tools" menu in Options could display it?

Zooba wrote Jan 16, 2013 at 11:26 PM

Help|About will show the version, but unless you've used the BuildRelease.ps1 script then it will be set to a placeholder (0.7.something).

Because our debugging support requires files to be in a project (for interpreter and other settings), if you don't have one we'll use a default. This is completely transparent.

Just to make sure I haven't miscommunicated where the option is, I've attached a screenshot.

swift_dev wrote Jan 17, 2013 at 2:53 PM

Awesome, I got it working. There was something weird going on with my previous (un)install of the release version of 1.5. I reinstalled, uninstalled again and then my built version started working correctly. The version says 1.5.60109.0. One thing is that I would like to build an installer so I can give this to colleagues so they don't have to go through the build process manually. Unfortunately I couldn't get the installer built using the instructions on the wiki.

I did notice the restart button isn't enabled. It would be great if it was enabled and working.

Do you know if there's a way to put conditions on key bindings? I'd like to bind F5 to debug script only when a project isn't loaded. I've used the chord Ctrl+K, F5 for now.

swift_dev wrote Jan 17, 2013 at 2:55 PM

Hmm.. It seems to have gotten stuck on the first file I debugged (namespace.py). I've completely restarted visual studio, closed the original file, opened a new file. Whenever I use the chord or right click on the tab and select a new file for debugging it launches into namespace.py. Any thoughts on how to fix/reset this?

swift_dev wrote Jan 17, 2013 at 3:04 PM

Interesting... there are definitely some minor quirks to work out. I started modifying the file and apparently it was still using the old file contents to run against. Now I'm trying to close visual studio and it stops to prompt me if I want to save the solution.

swift_dev wrote Jan 17, 2013 at 3:05 PM

Prompt screenshot

swift_dev wrote Jan 17, 2013 at 3:11 PM

Ahh.. I just figured out what happened. The editor didn't auto save (or prompt to save) my changes before starting the new debugging session.

swift_dev wrote Jan 17, 2013 at 7:04 PM

I was looking around in the code trying to find where this default solution file might be kept so I can delete it, but I'm not having luck. Any suggestions?

Zooba wrote Jan 17, 2013 at 7:25 PM

Not entirely sure, we'll have to investigate further. I'll reopen this issue and add the new issues to the description.

Zooba wrote Jan 17, 2013 at 7:47 PM

Just tried to repro these quickly, and I can confirm that the file does not save but I can't repro the other issues.

On the installer, could you provide more details on how it's not working? (Maybe start a discussion or email us directly at ptvshelp@microsoft.com rather than having too many threads on this issue.)

swift_dev wrote Jan 23, 2013 at 9:28 PM

Is there a way to specify command line args to pass to the script for debugging? Can we add that?

After a reboot and such the environment seems to be working again. I can now run debugging on any script I choose.

Zooba wrote Jan 24, 2013 at 12:04 AM

The existing way to provide settings for the script is to create a project. Depending on your workflow (e.g. multiple scripts, multiple argument sets, multiple interpreters) it is unlikely that we could set up any UI that is less heavy than the project system.

Internally, we've discussed adding menu items for each installed interpreter, since it currently will always use the default, but to support all of the 'project' settings outside of a project is a much more significant task that is not on our radar right now.

swift_dev wrote Apr 4, 2013 at 5:46 PM

Okay, I just upgraded to the alpha version to check it out.

Quirks:
Editor doesn't save the file before running.
Restart button is disabled and thus can't be used.
If I attempt to debug a script while one is currently running a console starts up but it just sits there doing nothing. At that point I have to manually stop and then start debugging again.

swift_dev wrote Jun 17, 2013 at 6:27 PM

I notice the issue was just closed but I never saw any updates based on my comments from April. Have any of these things been addressed?

ZachA wrote Jun 17, 2013 at 9:14 PM

The fix which has been checked in is to automatically save edited files in the solution when invoking debug as script. It is worth noting that The autosave wil also happen when invoking "start without debugging" and when starting profiling. The fix does not include improvements for the restart scenario. Note the workaround is to make the file to be debugged the startup file for your project.