Project Perfect让Swift在server端跑起来-Perfect in Visual Studio Code (四)

编者语 : 本系列文章已经被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的团队提及了。希望能尽早跟进)。

          好。接下来的博客我会谈谈项目实战。欢迎世界各地的朋友继续留意,也给我很多其它的反馈!

          

       

       

       

原文地址:https://www.cnblogs.com/gccbuaa/p/7149380.html