Vscode-code-runner: 在浏览器中打开 html(或使用任何命令)

创建于 2016-11-07  ·  4评论  ·  资料来源: formulahendry/vscode-code-runner

嗨,感谢非常简洁的扩展。

我尝试将 Code Runner 配置为在 Chrome 中打开 html 文件,但无法正常工作。

配置:

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

但我收到以下错误:

[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

我也尝试了 chrome.exe 的完整路径,但同样的问题。

有没有办法调用任意命令/exe?

代码运行器:0.4.1
VSCode:1.7.1
视窗 8.1

谢谢。

question

最有用的评论

@manikantag ,我使用以下配置并工作:

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

输出:

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

[Done] exited with code=0 in 0.252 seconds

请检查您是否处理了反斜杠和文件路径的空间。

所有4条评论

@manikantag ,我使用以下配置并工作:

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

输出:

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

[Done] exited with code=0 in 0.252 seconds

请检查您是否处理了反斜杠和文件路径的空间。

@formulahendry工作👍

我尝试转义了所有反斜杠,但没有用双引号再次引用整个路径。 谢谢。

这有记录吗? 或者,我错过了吗? 如果没有,最好记录下来,以便在 VSCode 扩展自述文件中看到。

我有一个示例可以在https://github.com/formulahendry/vscode-code-runner#configuration 中为 ruby​​ 和 php 添加解释器 PATH,但我会为其添加更多详细信息以处理反斜杠和文件路径 。 #28

此页面是否有帮助?
0 / 5 - 0 等级