我正在使用nodejs和可视代码编辑器处理JavaScript项目。我想知道是否可以为C ++项目配置这么好的代码编辑器。
我想链接调试器并制作一些热键来构建项目的debug/release
版本。
C ++项目是否可能,我应该为它做什么/阅读?
答案 0 :(得分:1)
我想链接调试器
目前无法使用公共扩展程序API。我预计它会在今年11月或12月到来。
我想[...]制作一些热键来构建项目的调试/发布版本。
如果您只想在工作区中编译一个项目,则可以立即执行此操作。 这是怎么做的:
release/debug
的参数,并根据传递的参数值在发布或调试模式下编译项目.vscode
目录,则在您自己的将文件tasks.json
添加到包含此内容的文件夹中:
{
"version": "0.1.0",
"command": "${workspaceRoot}/CompileProject.bat",
"tasks": [
{
"taskName": "Compile debug build",
"args": [
"debug"
],
"isTestCommand": true
},
{
"taskName": "Compile release build",
"args": [
"release"
],
"isBuildCommand": true
}
]
}
您可以使用Compile debug build
触发CTRL + Shift + T
,Compile release build
触发CTRL + Shift + B
。
您可以转到File -> Preferences -> Keyboard Shortcuts
更改键绑定,并为命令workbench.action.tasks.test
和workbench.action.tasks.build
定义首选快捷方式。
例如:
[
{ "key": "f5", "command": "workbench.action.tasks.test" },
{ "key": "f6", "command": "workbench.action.tasks.build" }
]
答案 1 :(得分:0)
在tasks.json文件中使用以下内容,根据需要更改“helloworld”字符串。
// Available variables which can be used inside of strings.
// ${workspaceRoot}: the root folder of the team
// ${file}: the current opened file
// ${fileBasename}: the current opened file's basename
// ${fileDirname}: the current opened file's dirname
// ${fileExtname}: the current opened file's extension
// ${cwd}: the current working directory of the spawned process
{
"version": "0.1.0",
"command": "gcc",
"args": ["-Wall", "helloWorld.c", "-o", "helloWorld"],
"problemMatcher": {
"owner": "cpp",
"fileLocation": ["relative", "${workspaceRoot}"],
"pattern": {
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"message": 5
}
}
}
编辑:这需要gcc在路径上可用。可以使用Ctrl + shift + b
触发构建。
调试器尚不可用AFAIK