microsoft / vscode-debugadapter-node

Debug adapter protocol and implementation for VS Code.
Other
273 stars 79 forks source link

Debug Protocol: Allow passing back a `path` AND a `sourceReference` #60

Closed roblourens closed 6 years ago

roblourens commented 8 years ago

When using inlined sources from the sourceMap, the Node adapter passes a sourceReference, and keeps the mapped path in adapterData. I'd really like to surface this to the user, but if 'path' is set, then vscode tries to read the file off disk, fails, and shows an error message in the editor pane. When users have a weird source config, it would make it easier to find out what the SourceMap claims the path is, ie by hovering over the callstack frame or editor title, which makes it easier to find the fix. Putting it in the 'name' field doesn't look right as-is.

I think it would make sense for vscode to test whether the path exists, and if not, do a sourceRequest with the sourceReference.

But, maybe it's confusing to show a 'path' when that path doesn't exist. And in some cases it will be a URL or something which isn't a valid path.

Thoughts?

roblourens commented 8 years ago

Although honestly if we just showed a truncated string in the callstack when the name is too long (atm you have to resize the sidebar to be really wide until you see the path at all) then it might be ok to just put it in the name prop.

hbenl commented 8 years ago

I also see the need for a long and a short name for sources that don't correspond to local files. What I'm currently doing is to extract the filename from the url for such a source (if a url exists) and put that in the name property. Now one of my users bemoaned that in his case this filename is not unique and he would like to have a way to see the full url. For local files vscode shows the filename in the tab and the full path in a tooltip when the mouse hovers over the tab. I'd like to have the same user experience for sources that don't correspond to local files. This could be achieved by putting the url in the name property and let vscode shorten it for the tabs and the stacktrace. However I think that it would be better to let the adapter decide how the url should be shortened, so I vote for adding a "longName" or "sourceUrl" or whatever property to Source (and keep the "name" property for the short name).

roblourens commented 6 years ago

This is allowed now.