VSCode是一款优秀的编辑器,它有着众多实用的功能和插件,让编写代码变得更加简单快捷。

       其中使用谷歌运行调试代码是VSCode中比较重要的功能之一,下面我们就来看看如何使用谷歌运行。

       第一步:安装谷歌浏览器由于谷歌运行是谷歌浏览器的一个内置功能,所以我们需要先安装谷歌浏览器。

       如果你已经安装了谷歌浏览器,可以直接跳过这一步。

       第二步:安装谷歌浏览器插件在VSCode插件市场中,有很多谷歌运行插件可供选择。

       比较常用的有Code Runner和Quokka.js。

       这里以Code Runner插件为例,安装完成后重启VSCode。

       第三步:配置VSCode在VSCode编辑器窗口下方,有一栏终端窗口。

       点击窗口下方的“选项”按钮,打开“setting.json”文件。

       在里面添加一些配置:”code-runner.executorMap”: { “javascript”: “node”, “python”: “python3”, “php”: “php”, “c”: “cd $dir && gcc $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt”, “cpp”: “cd $dir && g++ $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt”, “objective-c”: “cd $dir && gcc -framework Cocoa $fileName -o $fileNameWithoutExt && $dir$fileNameWithoutExt”, “swift”: “cd $dir && swift $fileName”, “r”: “Rscript –vanilla $fullFileName”, “typescript”: “ts-node”, “coffeescript”: “coffee”, “lua”: “lua”, “go”: “go run”, “perl”: “perl”, “ruby”: “ruby”, “groovy”: “groovy”, “powershell”: “powershell -ExecutionPolicy ByPass -File”, “bat”: “cmd /c”, “shellscript”: “bash”, “fsharp”: “dotnet fsi”, “csharp”: “scriptcs”, “haskell”: “runhaskell”, “scala”: “scala”, “kotlin”: “kotlin”, “rust”: “cd $dir && rustc $fileName && $dir$fileNameWithoutExt”}这些配置是为了让Code Runner插件知道怎样运行不同类型的代码文件。

       配置完成后,Ctrl+Shift+P,输入“Preferences: Open Keyboard Shortcuts(JSON)”打开键盘快捷键设置,找到”code-runner.runInTerminal”: true龙门,保存后可以使用Ctrl+Alt+N键来运行你现在窗口中的代码。

       第四步:开始运行在编辑器中选择你的代码,然后按下快捷键Ctrl+Alt+N就可以运行了。

       运行结果将显示在终端窗口中。

       如果没有显示,可以尝试重启VSCode和谷歌浏览器。

       总结:通过以上步骤可以让我们轻松在VSCode中使用谷歌运行调试代码。

       相信对于开发者们,这将会是一个很好的提升编程效率的方式。

       在接下来的编程过程中,尝试使用Code Runner插件,让你的编程任务更加流畅,提高你的工作效率。

#10#