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

Set env to extensionHost type in launch.json did not work #22150

Closed
leozdgao opened this issue Mar 7, 2017 · 11 comments
Closed

Set env to extensionHost type in launch.json did not work #22150

leozdgao opened this issue Mar 7, 2017 · 11 comments
Assignees
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@leozdgao
Copy link

leozdgao commented Mar 7, 2017

  • VSCode Version: 1.10.1
  • OS Version: MacOS 10.12.3

Steps to Reproduce:

I'm working on a vscode extension development, and my launch.json here:

{
    "version": "0.1.0",
    "configurations": [
        {
            "name": "Launch Extension",
            "type": "extensionHost",
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
            "stopOnEntry": false,
            "env": {
                "NODE_ENV": "development"
            }
        }
    ]
}

And env seems not to be set. I try to follow the prompt here:

"node2" is no longer supported, use "node" instead and set the "protocol" attribute to "inspector".

And modify my launch.json like this:

{
    "version": "0.1.0",
    "configurations": [
        {
            "name": "Launch Extension",
            "type": "node",
            "protocol": "inspector",
            "request": "launch",
            "runtimeExecutable": "${execPath}",
            "args": ["--extensionDevelopmentPath=${workspaceRoot}" ],
            "stopOnEntry": false,
            "env": {
                "NODE_ENV": "development"
            }
        }
    ]
}

But got the connection timeout error here:

Cannot connect to runtime process, timeout after 10000 ms - (reason: Cannot connect to the target: connect ECONNREFUSED 127.0.0.1:28486).
@roblourens
Copy link
Member

That error message about 'node2' is wrong. I think it was fixed by #21596, but the problem is that 'extensionHost' doesn't support the attribute 'env'. Right @isidorn?

@ramya-rao-a ramya-rao-a added the debug Debug viewlet, configurations, breakpoints, adapter issues label Mar 7, 2017
@ramya-rao-a
Copy link
Contributor

@leozdgao Can you debug your extension using your initial launch.json configuration but without the env attribute?

@leozdgao
Copy link
Author

leozdgao commented Mar 8, 2017

@ramya-rao-a I'm not sure. I just want to find an approach to judge the debugging environment, so I could load some development configuration. Is there anyway to do so without set env? 😕

@ramya-rao-a
Copy link
Contributor

I was currently trying to narrow down if debugging the extension works at all to begin with. Hence the question about trying without the env attribute.

@leozdgao
Copy link
Author

leozdgao commented Mar 8, 2017

@ramya-rao-a Oh, debugging the extension works well. But the env configuration did not work.

@isidorn
Copy link
Contributor

isidorn commented Mar 8, 2017

@roblourens not sure if extensionHost supports env, forwarding to @weinand

@isidorn isidorn assigned weinand and unassigned isidorn Mar 8, 2017
@weinand
Copy link
Contributor

weinand commented Mar 8, 2017

The extensionHost debugger doesn't yet support setting the env (but it is planned for this milestone).

But the nasty problem is that the error squiggly is completely misleading:

2017-03-08_12-46-29

It flags the type "extensionHost" as wrong and not the illegal use of "env".

If the key value pair "foo":"bar" is removed from the env structure the error is flagged correctly:

2017-03-08_12-52-03

@aeschli Is there a way to let your validator know that the "type" attribute is special (and has higher priority)?

@weinand weinand added the feature-request Request for new features or functionality label Mar 8, 2017
@weinand weinand added this to the March 2017 milestone Mar 8, 2017
@leozdgao
Copy link
Author

leozdgao commented Mar 8, 2017

@weinand BTW, is there anyway to know the code is running in the debug environment besides set env?

@weinand
Copy link
Contributor

weinand commented Mar 8, 2017

Currently this feature is blocked by #22233

@aeschli
Copy link
Contributor

aeschli commented Mar 8, 2017

@weinand It's difficult for the JSON validator to know which variant ('any of') is the right one.
Please file an issue against JSON.

@weinand
Copy link
Contributor

weinand commented Mar 9, 2017

@leozdgao with the latest Insiders build you can now access env variables in the extension that are defined in the launch config.

@weinand weinand added the verification-needed Verification of issue is requested label Mar 27, 2017
@isidorn isidorn added the verified Verification succeeded label Mar 29, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
debug Debug viewlet, configurations, breakpoints, adapter issues feature-request Request for new features or functionality verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

6 participants