VSCode Linux task.json MQL4编译

问题描述

我正在从MetaEditor切换到VSCode,以便为MetaTrader4开发。

我正在通过Wine在Linux中使用MetaTrader4和MetaEditor。 (并且MetaEditor在Wine中运行非常糟糕)

我想创建一个编译代码的任务,并希望将相同的错误日志返回给VSCode来进一步调试代码,就像使用MetaEditor一样。

我已经使用了这篇文章来弄清楚使用了什么CLI命令来编译MQL4: Compiling MQL4 via command line through wine metaeditor.exe

/usr/bin/wine /path/to/MT4/Metaeditor.exe /compile:"Z:\path\to\MT4\MQL4\Experts\Foo\Bar_EA.mq4" /include:"Z:\path\to\MT4\MQL4" /log

我的问题是我不理解,找不到任何能够解释task.json文件中“命令”的作用或可用变量列表的资源。像“ / include:”或“ presentation”:,$ {file}等

所以我做了一些猜测,然后将其拼凑成到目前为止的样子:

{
    "version": "2.0.0","tasks": [
        {
            "label": "MQL4 Compile","type": "shell","command": "/usr/bin/wine /.wine/drive_c/Program Files (x86)/FXChoice MetaTrader 4/Metaeditor.exe","args": [
                "/compile:${file}"
            ]
        }
    ]
}

它可能不太正确。 感谢您的帮助,谢谢

解决方法

{
  "version": "2.0.0","tasks": 
  [
    {
      "label": "MQL4-Compile","group": 
      {
        "kind"      : "build","isDefault" : true
      },"presentation": 
      {
        "echo"  : true,"reveal": "always","focus" : true,"panel" : "shared"
      },"promptOnClose" : true,"type"          : "process","osx"           : 
      { 
        "command" : "wine","args"    : 
        [ 
          "/Users/SVG/.wine/drive_c/Program Files/MetaTrader/metaeditor.exe","/compile:${fileBasename}","/log:${fileBasenameNoExtension}.log",]
      },"windows"   : 
      { 
        "command" : "C:\\Program Files (x86)\\MetaTrader\\metaeditor.exe","args"    : 
        [ 
          "/compile:${fileBasename}",}
  ]
}