Skip to content
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

Support local overrides with in-editor debugging #2079

Open
LoganTann opened this issue Sep 9, 2024 · 3 comments
Open

Support local overrides with in-editor debugging #2079

LoganTann opened this issue Sep 9, 2024 · 3 comments
Assignees
Labels
feature-request Request for new features or functionality info-needed Issue requires more information from poster

Comments

@LoganTann
Copy link

Is your feature request related to a problem? Please describe.

I'm a front-end developer working on a live website, and don't have access to the back-end nor ability to work locally. To ease testing, I'm using chrome's local overrides feature. I would like to also use vscode in-editor debugging feature, so I don't have to switch windows to add a breakpoint or a logpoint.

Issue / Current behavior : When I add a breakpoint, the file open in the editor is a copied read-only file from the debugger, and not the local file.

Describe the feature you'd like

Ability to add local overrides from the extension. Adding a breakpoint in the local file adds it in the mocked remote resource. When the execution is paused, I would like to be able to edit the opened file.

I'm not expecting the changes to also hot-update the file. As long as I can add breakpoints, edit the file and save locally + reload live website, it's fine. But it could be a nice addition too.

Appendices

launch.json

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "chrome",
            "request": "launch",
            "name": "Debug live on VsCode",
            "url": "https://live-website.example.com/",
            "webRoot": "${workspaceFolder}/live-website.example.com",
            "userDataDir": false
        }
    ]
}

Related question : https://stackoverflow.com/questions/62921375/can-i-use-chrome-debugger-with-a-live-website-and-local-overrides

@LoganTann LoganTann added the feature-request Request for new features or functionality label Sep 9, 2024
@connor4312
Copy link
Member

connor4312 commented Sep 9, 2024

There is no "local overrides" feature in this debugger because this debugger inherently already works from a local file system and maps local files to files in the runtime by default. You will just need to set up your launch configuration such that paths are able to be mapped successfully.

When I add a breakpoint, the file open in the editor is a copied read-only file from the debugger, and not the local file.

You can set enableContentVerification: false to disable this behavior.

@connor4312 connor4312 added the info-needed Issue requires more information from poster label Sep 9, 2024
@LoganTann
Copy link
Author

Hello, thanks for the quick reply !

the debugger maps local files to files in the runtime by default

webRoot parameter seems to be set-up correctly. Will it work if the remote file :

  1. has a content slightly different from the local file, despite having the same file name ?
  2. don't have a file extension
  3. has special characters such as &query=params

I will do a second try tomorrow and keep you in touch.

@LoganTann
Copy link
Author

I will do a second try tomorrow

I can add breakpoints from vscode and it applies it on the browser correctly, which means that the debugger could link the remote resource with the local one.

"enableContentValidation" parameter did not fix the issue for me. I also tried "enableContentVerification".

The remote file is still not overridden by the local file and when the execution is paused by a breakpoint, the file is opened as a new tab in vscode.

image

My updated launch.js with the folder tree is the following :

{
    /*
    workspace folder
    ├───.vscode
    │   └───**launch.json**
    ├───[other folders]
    └───example.com
        └───wilojs.axd%3Fpageid=dashboard_8acc5285ae1644a0baf9149254b05f0d&site=Development&localeid=16128a3f-8550-4241-bad1-2f928f594891&v=2024.1.73.7
    */
    "version": "0.2.0",
    "configurations": [
        {
            "type": "chrome",
            "request": "launch",
            "name": "Debug MHP on VsCode",
            "url": "https://example.com/dashboard.aspx?dashboardlayoutid=8acc5285-ae16-44a0-baf9-149254b05f0d&id=cd19b180-4be6-48fc-9196-8a3432fa8953&Site=Development",
            "webRoot": "${workspaceFolder}/myhealthpartner.be",
            "userDataDir": false,
            "smartStep": true,
            "enableContentValidation": false,
        },
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

2 participants