尝试使用代码运行器扩展在输出选项卡中显示脚本输出。之前正在工作,但进行了一些修改,看看我是否可以在终端中解决脚本问题。现在无法恢复。
Visual Studio 设置的 JSON 设置:
{
"workbench.colorTheme": "Visual Studio Dark",
"workbench.startupEditor": "none",
"debug.console.fontSize": 24,
"markdown.preview.fontSize": 24,
"scm.inputFontSize": 24,
"editor.fontSize": 24,
"terminal.integrated.fontSize": 12,
"editor.mouseWheelZoom": true,
"workbench.settings.openDefaultSettings": true,
"telemetry.enableTelemetry": false,
"telemetry.enableCrashReporter": false,
"editor.accessibilitySupport": "off",
// CODE RUNNER SETTINGS
"code-runner.clearPreviousOutput": true,
"code-runner.ignoreSelection": true,
"code-runner.saveAllFilesBeforeRun": false,
"code-runner.saveFileBeforeRun": true,
"code-runner.showExecutionMessage": false,
"code-runner.executorMap": {
"python": "python3 -u"
}
}
Code Runner Extension 已重新安装多次,但我无法在输出选项卡中获取要运行的脚本的输出。相反,尽管指定不这样做,它还是显示在终端中。
我注意到的一件事是,如果不重新启动 Visual Studio,更改似乎不会生效......
但是,即使重新启动此问题也没有任何变化。
这几乎不是一个解决方案(更像是再次打开和关闭它),而且很可能有点矫枉过正,但这就是我所做的:
rm -rf ~/.vscode*
rm -rf ~/Library/Application\ Support/Code
rm -rf ~/Library/Saved\ Application\ State/com.microsoft.VSCode.savedState
rm -rf ~/Library/Preferences/com.microsoft.VSCode.helper.plist
rm -rf ~/Library/Preferences/com.microsoft.VSCode.plist
rm -rf ~/Library/Caches/com.microsoft.VSCode
rm -rf ~/Library/Caches/com.microsoft.VSCode.ShipIt
sudo rm -rf /Applications/Visual\ Studio\ Code.app
重新安装 VScode 和 Code Runner。
而不是直接搞乱 JSON。只是使用默认复选框
[![在此处输入图像描述][1]][1]
JSON 输出:
{
"code-runner.executorMap": {
"javascript": "node",
"java": "cd $dir && javac $fileName && java $fileNameWithoutExt",
"c": "cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"zig": "zig run",
"cpp": "cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"objective-c": "cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"php": "php",
"python": "python3 -u",
"perl": "perl",
"perl6": "perl6",
"ruby": "ruby",
"go": "go run",
"lua": "lua",
"groovy": "groovy",
"powershell": "powershell -ExecutionPolicy ByPass -File",
"bat": "cmd /c",
"shellscript": "bash",
"fsharp": "fsi",
"csharp": "scriptcs",
"vbscript": "cscript //Nologo",
"typescript": "ts-node",
"coffeescript": "coffee",
"scala": "scala",
"swift": "swift",
"julia": "julia",
"crystal": "crystal",
"ocaml": "ocaml",
"r": "Rscript",
"applescript": "osascript",
"clojure": "lein exec",
"haxe": "haxe --cwd $dirWithoutTrailingSlash --run $fileNameWithoutExt",
"rust": "cd $dir && rustc $fileName && $dir$fileNameWithoutExt",
"racket": "racket",
"scheme": "csi -script",
"ahk": "autohotkey",
"autoit": "autoit3",
"dart": "dart",
"pascal": "cd $dir && fpc $fileName && $dir$fileNameWithoutExt",
"d": "cd $dir && dmd $fileName && $dir$fileNameWithoutExt",
"haskell": "runghc",
"nim": "nim compile --verbosity:0 --hints:off --run",
"lisp": "sbcl --script",
"kit": "kitc --run",
"v": "v run",
"sass": "sass --style expanded",
"scss": "scss --style expanded",
"less": "cd $dir && lessc $fileName $fileNameWithoutExt.css",
"FortranFreeForm": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"fortran-modern": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"fortran_fixed-form": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"fortran": "cd $dir && gfortran $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt",
"sml": "cd $dir && sml $fileName",
"mojo": "mojo run",
"erlang": "escript",
"spwn": "spwn build",
"pkl": "cd $dir && pkl eval -f yaml $fileName -o $fileNameWithoutExt.yaml",
"gleam": "gleam run -m $fileNameWithoutExt"
},
"code-runner.clearPreviousOutput": true,
"code-runner.showExecutionMessage": false
}