iamcco / coc-diagnostic

diagnostic-languageserver extension for coc.nvim
245 stars 22 forks source link

add support for richq/cmake-lint? #27

Closed cogig closed 1 year ago

iamcco commented 4 years ago

I do not use cmake-lint but maybe others can help, or you can add it support by yourself.

cogig commented 4 years ago

Thanks for your reply.

  "languageserver": {
    "dls": {
      "command": "diagnostic-languageserver",
      "args": ["--stdio"],
      "filetypes": ["cmake"],
      "initializationOptions": {
        "linters": {
          "cmakelint": {
            "command": "cmakelint",
            "args": [ "--filter=-whitespace/indent"],
            "debounce": 100,
            "offsetLine": 0,
            "offsetColumn": 1,
            "sourceName": "cmakelint",
            "formatLines": 1,
            "formatPattern": [
              "(.*)\\s+on\\s+line\\s+(\\d+)\\s+at\\s+column\\s+(\\d+)\\s*$",
              {
                "line": 2,
                "column": 3,
                "message": 1
              }
            ]
          }
        },
        "filetypes": {
          "cmake": "cmakelint"
        }
      }
    }
  },

I tried to add the snippets into coc-setting.json,but it seems like that it doesn't work.

iamcco commented 4 years ago

You should not register custom lsp if you use this extension, you should just config diagnostic-languageserver.linters for linters.

iamcco commented 4 years ago

for example

"diagnostic-languageserver.linters": {
    "cmakelint": {
            "command": "cmakelint",
            "args": [ "--filter=-whitespace/indent"],
            "debounce": 100,
            "offsetLine": 0,
            "offsetColumn": 1,
            "sourceName": "cmakelint",
            "formatLines": 1,
            "formatPattern": [
              "(.*)\\s+on\\s+line\\s+(\\d+)\\s+at\\s+column\\s+(\\d+)\\s*$",
              {
                "line": 2,
                "column": 3,
                "message": 1
              }
            ]
          }
},
"diagnostic-languageserver.filetypes": {
   "cmake": "cmakelint"
 },
Freed-Wu commented 1 year ago

Similar issue: https://github.com/regen100/cmake-language-server/issues/79

Freed-Wu commented 1 year ago

It has been supported. https://github.com/iamcco/coc-diagnostic/blob/master/src/config.ts#L972