Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Code Runner 插件配置少一关键参数,如下 #1

Closed
mapleriver opened this issue Oct 20, 2018 · 9 comments
Closed

Code Runner 插件配置少一关键参数,如下 #1

mapleriver opened this issue Oct 20, 2018 · 9 comments
Labels
enhancement New feature or request

Comments

@mapleriver
Copy link

"code-runner.terminalRoot": "/mnt/"

@spencerwooo
Copy link
Owner

我在这里做了一些更改,看一下 这个链接

我这样表述没问题吧?

@spencerwooo spencerwooo added the enhancement New feature or request label Oct 20, 2018
@mapleriver
Copy link
Author

没有问题

@spencerwooo
Copy link
Owner

其实我刚才没设置之前也没出问题,运行的时候路径都没问题,Python 和 C/C++ 都能正常编译,不过 code-runner 确实明确说了:

For Windows system, replaces the Windows style drive letter in the command with a Unix style root when using a custom shell as the terminal, like Bash or Cgywin. Example: Setting this to '/mnt/' will replace 'C:\path' with '/mnt/c/path'

为什么呢?有点玄学。

@mapleriver
Copy link
Author

你修改过"code-runner.executorMap"参数吗? 默认是不会将windows的盘符路径替换掉啊

@spencerwooo
Copy link
Owner

改了 C/C++ 的,但是没改 Python 的。不过 Python 确实路径正常,我刚刚特意试了一下。

PS:感觉 code-runner 是个挺重要的插件,明天我把这个单独分一个页面写吧,各种语言基本都能用它来编译运行。然后再看看 code-runner 到底怎么判定这个路径的。感谢您的建议!👏👏👏

@mapleriver
Copy link
Author

我刚才测试了一下,我这边去掉/mnt/后,跑python路径也是不正确的。很期待你明天的工作成果

@spencerwooo
Copy link
Owner

新增了一个页面,单独介绍 Code Runner,在 这里

今天详细看了一下 Code Runnner 下面的 Issue,有关 WSL 的里面确实有几个重点说明了这个路径问题。Issue #106 解决了这个问题,就是如果让 Code Runner 在集成终端中运行,集成终端默认用的是 Bash on Windows,那么 Code Runner 会自动将路径切换至 Linux 路径。

@garytyler Did you set WSL for the VS Code terminal? If yes, the Code Runner would automatically change the file path. Refer to #106

这里的 code-runner.terminalRoot 看来是为了重点解决使用 WSL 和使用 Git Bash 的用户的路径冲突问题(根目录路径一个是 /mnt/c,一个是 /c)。无论如何,这里设置一下还是有益无害的,确保正常运行。感谢建议!👏👏👏

没什么问题的话我就把这个 Issue 关掉了~

@mapleriver
Copy link
Author

原来这样,谢谢告知,issue可以关了

@Tracker647
Copy link

我在这里做了一些更改,看一下 这个链接

我这样表述没问题吧?

修改root路径确实能解决问题,但如果我要修改回powershell的话怎么办呢,最好有个方法能够根据终端不同动态修改路径。

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants