iamcco / diagnostic-languageserver

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

How to register stylua as lua formatter ? #67

Closed pittcat closed 3 years ago

pittcat commented 3 years ago

Neoformat code about stylua is as follow:

function! neoformat#formatters#lua#stylua() abort
    return {
        \ 'exe': 'stylua',
        \ 'args': ['--search-parent-directories', '--stdin-filepath', '"%:p"', '--', '-'],
        \ 'stdin': 1,
        \ }
endfunction
pittcat commented 3 years ago

I have tried this code:

          "stylua": {
            "command": "stylua",
            "args": ["--search-parent-directories", "--stdin-filepath", "%filepath"]
          }

But it don't take any effect.

yaegassy commented 3 years ago

@pittcat Did you solve the problem, please add "--" and "-" to the args and try again

e.g. :

      "stylua": {
        "command": "stylua",
        "args": ["--search-parent-directories", "--stdin-filepath", "%filepath", "--", "-"]
      }
pittcat commented 3 years ago

Yes, I solved the problem. Thank you.