Vscode-code-runner: Opening html in browser (or, using any command)

Created on 7 Nov 2016  ·  4Comments  ·  Source: formulahendry/vscode-code-runner

Hi, thanks the very neat extension.

I tried to configure the Code Runner to open html files in Chrome, but not working.

Config:

"code-runner.executorMap": {
    "javascript": "node"
},
"code-runner.defaultLanguage": "javascript",
"code-runner.clearPreviousOutput": true,
"code-runner.saveFileBeforeRun": false,
"code-runner.executorMapByFileExtension": {
    ".html": "chrome.exe"
}

But I m getting below error:

[Running] chrome.exe "d:\angular-directive-demo.html"
'chrome.exe' is not recognized as an internal or external command,
operable program or batch file.

[Done] exited with code=1 in 0.176 seconds

I tried given the chrome.exe's complete path as well, but same issue.

Is there any way to invoke any arbitrary command/exe?

Code Runner: 0.4.1
VSCode: 1.7.1
Windows 8.1

Thanks.

question

Most helpful comment

Hi @manikantag , I use below config and work:

"code-runner.executorMapByFileExtension": {
    ".html": "\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\""
}

output:

[Running] "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "d:\Try\test\test.html"

[Done] exited with code=0 in 0.252 seconds

Please check whether you have taken care of the back slash and the space of file path.

All 4 comments

Hi @manikantag , I use below config and work:

"code-runner.executorMapByFileExtension": {
    ".html": "\"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe\""
}

output:

[Running] "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" "d:\Try\test\test.html"

[Done] exited with code=0 in 0.252 seconds

Please check whether you have taken care of the back slash and the space of file path.

@formulahendry Working 👍

I tried and escaped all backslashes, but didn't quoted the whole path again in double quotes. Thanks.

Was this documented? or, did I miss it? If not, better to document this so that one can see in VSCode extension readme.

I have a sample to add interpreter PATH for ruby and php in https://github.com/formulahendry/vscode-code-runner#configuration , but I will add more details for it to take care of the back slash and the space of file path . #28

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ElektroStudios picture ElektroStudios  ·  4Comments

StayFoolisj picture StayFoolisj  ·  5Comments

eegod picture eegod  ·  5Comments

w3adventures picture w3adventures  ·  3Comments

Kelo007 picture Kelo007  ·  3Comments