iamcco / diagnostic-languageserver

diagnostic language server integrate with linters
MIT License
418 stars 28 forks source link

parseJson: how to correct use %filepath in the path to errorsRoot #15

Closed przepompownia closed 2 years ago

przepompownia commented 4 years ago

Let's see an output of phpstan on some old project:

 $ phpstan analyze --level max --error-format=json php/PHPCD.php         
{                                                                                                                                                                             
  "totals": {                                                                                                                                                                 
    "errors": 0,                                                                                                                                                              
    "file_errors": 41                                                                                                                                                         
  },                                                                                                                                                                          
  "files": {                                                                                                                                                                  
    "/home/user/phpcd.vim/php/PHPCD.php": {                                                                                                                              
      "errors": 41,                                                                                                                                                           
      "messages": [                                                                                                                                                           
        {                                                                                                                                                                     
          "message": "Method PHPCD\\PHPCD::setServer() has no return typehint specified.",                                                                                    
          "line": 100,                                                                                                                                                        
          "ignorable": true                                                                                                                                                   
        }
      ]
    }
  }
}

In the shell the filtering this output by | jq '.files["/home/user/phpcd.vim/php/PHPCD.php"].messages' works.

I tried to make something similar in coc config, e.g. use "errorsRoot": "files[\"%filepath\"].messages" but it does not work. Please update examples with the correct usage if using %filepath in erorsRoot is possible.

I successfully made working equivalent fo phpcs but it can take stdin (phpstan seems to cannot it) and so there is no need to use the filename in the path.

iamcco commented 4 years ago

Not support yet.