PTVS code map feature


I am new to PTVS and visual studio, however I decided to try it out today, but I ran into a problem. Whenever I start debugging and open 'code map' it gives me an error:
The XML content in this document cannot be viewed as a graph because it contains unexpected errors. If you Open the XML Editor and fix these errors then this view will update automatically.
The actual error found is described below.
  This method is not implemented
Call Stack:
   at Microsoft.PythonTools.Debugger.DebugEngine.AD7DocumentContext.Microsoft.VisualStudio.Debugger.Interop.IDebugDocumentContext2.GetSourceRange(TEXT_POSITION[] pBegPosition, TEXT_POSITION[] pEndPosition)
   at Microsoft.VisualStudio.Progression.DebuggerHelper.DecorateFrameNodeWithSourceLocation(IVsSolutionDebuggingAssistant debugAssistant, CallStackFrameNode frameNode, IDebugStackFrame2 frame)
   at Microsoft.VisualStudio.Progression.CallStackGenerationBase.GetCallstackStep(ActionContext previous)
   at Microsoft.VisualStudio.Progression.GraphGenerationController.RunStepMain(Int32 stepNumber, GraphGenerationStep step)
Is it just me or PTVS doesn't support code map for python projects? If so, are there any similar features or software that provides visual debugging, as this was something I was looking forward to when switching from PyCharm to VS.
Closed Jun 24 at 6:06 PM by Zooba
Fixed with crwilcox's contribution.


Zooba wrote Feb 18 at 3:28 PM

Looks like we don't support it:
The actual error found is described below.
  This method is not implemented
Our development approach typically involves implementing the bare minimum we need to get the desired functionality working, rather than filling in every gap. This is simply a gap that we didn't realize we needed, so now we know about it, we can put it on the list of features to consider.

(And if someone wants to go ahead and provide an implementation for us, we're more than happy to take it.)

metacore wrote Feb 18 at 4:07 PM

Is there a source code that I could start working on? How can this feature be implemented? Perhaps, all we need is to modify already existing code for other languages and just port it for python. Any suggestions where to start?

Zooba wrote Feb 18 at 5:30 PM

We have a build instructions page (which should be up to date, but let us know if it isn't).

The file with that function is Python/Product/Debugger/Debugger/DebugEngine/AD7DocumentContext.cs and it looks like the fix may be really easy - we've implemented GetStatementRange just below GetSourceRange, and I don't see any reason why they would be different ranges for Python. There may be other functions needed after this one as well - I have no idea what is involved.

Probably the most important thing this change will need is some sort of test (preferably automated) so we can ensure that it works and keeps working into the future. That said, this is probably a hard one to test automatically. If you've got a range of source code that exercises the code map (things like multiple statements on a single line, implicit/explicit line continuations, etc.) then I can turn that into an automated test.

metacore wrote Feb 19 at 8:15 AM

I see you are quite familiar with this source code, perhaps I could ask you to implement the code map feature? That is of course, if you are willing to and have some little free time. I would love to do this myself, but I am not that good in other programming languages besides python, I just recently began learning, so this is too difficult for me to do.
Thanks again for considering this :) I would be forever in your debt if you took some time to get this feature working ^^

Zooba wrote Feb 19 at 1:12 PM

Understandable, it's quite a complex codebase :)

I'm familiar with it because I've been working on it full time for some years now. Unfortunately, that also means that I follow our planning processes (mostly...), so until this is picked for a release, it probably won't get done. Code Map is a lower priority than a lot of other bugs and features (especially bugs).

Maybe someone will see this and make a start on it.

crwilcox wrote Feb 23 at 7:16 PM

I have a fix and test in my fork. I just submitted a pull request this morning.