-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use webRoot config for source path resolution #885
Conversation
271ce6d
to
0769ab8
Compare
src/utils.ts
Outdated
@@ -471,6 +471,11 @@ export function getRuntimeConfig(config: Partial<IUserConfig> = {}): IRuntimeCon | |||
} | |||
} | |||
|
|||
// The webRoot config is equivalent to a pathMapping entry of { '/': '${webRoot}' }. | |||
if (!pathMapping.hasOwnProperty('/')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't working for me because I'm getting a pathMapping object back from the settings.get('pathMapping')
call that already has {'/': '${workspaceFolder}'}
. However, I don't have that set in my settings.json file so I'm still trying to figure out where it's coming from.
@mliao95 any idea what might be causing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not off the top of my head. I'll dig into it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bwalderman I think even once we figure out what's going on with settings.get
this may not work as expected since the fallback SETTINGS_DEFAULT_PATH_MAPPING
also specifies a root entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry - got sidetracked, not sure if you already figured it out, but the default value for pathMapping
is {'/': '${workspaceFolder}'}
as defined in the package.json
:
https://github.com/microsoft/vscode-edge-devtools/blob/main/package.json#L217
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had not figured that out - thanks!
@mliao95 any thoughts on what a correct fix would be here given we're often already going to have a default /
specified?
- Should we give precedence to
webRoot
depending on where it originates from? - Or give precedence if it's anything other than our default?
- Or should we abandon this change and advise users to set a
pathMapping
for/
themselves?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In that case I think we should always give precedence to webRoot
. The default webRoot
is {$workspaceFolder}
, so this will not affect the default pathMapping
unless the user has specified something else for webRoot
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO I think the priority based off of my interpretation of user expectations should be:
User defined extension settings > webRoot > default setting value.
Let me know if you agree and we can run with that. Otherwise, open to hear your thoughts.
Edit:
On second thought, I'm okay webRoot
taking precedence over the extension settings. The difference is pretty minor and removes some complexity in the priority logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @mliao95. Based on the issue report, I think user expectations are that existing launch configs with webRoot
properties just work with our extension the way they do for vscode JS debugging sessions. On top of that, the launch config should take priority over the extension setting because any logic on the vscode-js-debug side won't even be aware of our extension settings.
Fixes #787
The
webRoot
config was not being considered when mapping a URL to a path on the filesystem. This prevented file links in the devtools from successfully opening files in the editor. The fix is to treatwebRoot
as an entry inpathMapping
.This fixes the
webRoot
property in Microsoft Edge DevTools' own extension settings, but the extension isn't currently aware ofwebRoot
andpathMapping
properties found inlaunch.json
configs. A separate PR microsoft/vscode-js-debug#1206 plumbs those through to our extension so they will work as expected.