编者语 : 本系列文章已经被Perfect官方引用了,这种感觉很好,感恩!Thx all !
Visual Studio Code是一个轻量级的编辑器,但也功能丰富,通过插件你可以完成如Cordova,ReactNative,NodeJS,PHP,ASP.NET Core 的开发。上文通过Visual Studio Code对Perfect文件进行编辑,但编译过程还是在终端中完成。其实通过对Visual Studio Code 添加tasks.json就可以完成对Perfect项目的编译工作。
这里有个疑问,为何选择Visual Studio Code ? 这是一个好复杂的三角关系,如图:
Microsoft + Swift + Linux = True Love
(当然你可以说哥有所固执,但是这是爱,而且微软代表的是生产力啊!)
我们继续引用上篇博客中的例子(这里建议在root账号下进行)
1. Ctrl+Shit+P 之后输入Configure Task Runner 回车后就会生成tasks.json文件
2. 配置tasks.json 由于是编译成动态库, 所以我们可以把task.json按照C++的编译方式进行配置
{ "version": "0.1.0", "command": "make", "isShellCommand": true, "tasks": [ { "taskName": "makefile", // Make this the default build command. "isBuildCommand": true, // Show the output window only if unrecognized errors occur. "showOutput": "always", // No args "args": ["all"], // Use the standard less compilation problem matcher. "problemMatcher": { "owner": "cpp", "fileLocation": ["relative", "${workspaceRoot}"], "pattern": { "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$", "file": 1, "line": 2, "column": 3, "severity": 4, "message": 5 } } } ] }3. 保存tasks.json后你就可以直接编译你的Perfect项目了
注意: 当然你也可以通过他去排错,但遗憾一点就是不能debug。(这个问题已经和Perfect的团队提及了,希望能尽早跟进)。
好,接下来的博客我会谈谈项目实战,欢迎世界各地的朋友继续留意,也给我更多的反馈!