V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  formulahendry  ›  全部回复第 45 页 / 共 45 页
回复总数  888
1 ... 36  37  38  39  40  41  42  43  44  45  
@XYxe 目前对文件类型的判断是直接调用 VS Code 的 API , VS Code 并没有对 python 2 和 python 3 有区分。而且 shebang 在 Windows 上并没有吧。不过可以考虑当作个 feature 来做。欢迎到 github 给我提这个 feature ,如果你想自己实现的话,也非常欢迎 PR !
@XYxe Python2 和 3 的文件都是.py 吧?似乎并不能自动区分出来。如果只是不同的 Workspace 会用不同 python 版本,可以在 File-> Preferences->Workspace Settings 设置不同的 python 解释器,这样不知道能满足需求吗?如果在同一个 Workspace 会用不同 python 版本,可以考虑使用 custom command :"code-runner.customCommand": "python3"
@cdwyd 唉, python 真的有这个问题唉,其他语言倒是能实时输出的😅不过有办法可以 workaround ,在 user settings 设置使用 ntegrated Terminal :
"code-runner.runInTerminal": true
@XYxe
关于乱码,有两个解决方法:
1. 设置 PYTHONIOENCODING ,参考 https://github.com/formulahendry/vscode-code-runner/issues/33#issuecomment-263131627
"code-runner.executorMap": {
"python": "set PYTHONIOENCODING=utf8 && python"
}
2. 设置使用 built-in terminal ,参考 https://github.com/formulahendry/vscode-code-runner/issues/25#issuecomment-257123682
"code-runner.runInTerminal": true

关于区分 Python2 和 Python3 ,可以在 user settings 自定义 code-runner.executorMap ,参考 https://github.com/formulahendry/vscode-code-runner#configuration
@blanu 对滴!而且能选择运行 code snippet ,快捷轻巧😎
@KiriGiri VIM 没怎么用过,能具体说下吗?比如说,运行 var a = 1 + 2 ,然后把代码替换为 var a = 3?
@langmoe @kchum 我们这个 Code Runner 可是免费跨平台的哦😁
2016-12-18 12:35:15 +08:00
回复了 bboysoul 创建的主题 程序员 在 github 上搭建博客用什么比较好
Hexo 大法好,再使用 AppVeyor 做 CI ,轻松惬意: https://formulahendry.github.io/2016/12/04/hexo-ci/
2016-12-09 16:27:29 +08:00
回复了 mikicomo 创建的主题 问与答 VS Code 如何直接在执行 python 代码
可以使用 Code Runner 插件: https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner
Ctrl+Alt+N 直接运行,不需要如何配置~ 如果有任何建议或者发现 bug ,可以到 GitHub 给我发 issue : https://github.com/formulahendry/vscode-code-runner/issues
1 ... 36  37  38  39  40  41  42  43  44  45  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4504 人在线   最高记录 6543   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 20ms · UTC 09:48 · PVG 17:48 · LAX 02:48 · JFK 05:48
Developed with CodeLauncher
♥ Do have faith in what you're doing.