diff options
Diffstat (limited to 'lua/lsp')
| -rw-r--r-- | lua/lsp/ts-fmt-lint.lua | 37 | 
1 files changed, 24 insertions, 13 deletions
| diff --git a/lua/lsp/ts-fmt-lint.lua b/lua/lsp/ts-fmt-lint.lua index 8a6c366c..f6b37136 100644 --- a/lua/lsp/ts-fmt-lint.lua +++ b/lua/lsp/ts-fmt-lint.lua @@ -5,30 +5,41 @@ local M = {}  M.setup = function()    local tsserver_args = {} -  local prettier = { -    formatCommand = "prettier --stdin-filepath ${INPUT}", -    formatStdin = true, -  } - -  if vim.fn.glob "node_modules/.bin/prettier" ~= "" then -    prettier = { -      formatCommand = "./node_modules/.bin/prettier --stdin-filepath ${INPUT}", +  if O.lang.tsserver.linter == "eslint" or O.lang.tsserver.linter == "eslint_d" then +    local eslint = { +      lintCommand = O.lang.tsserver.linter .. " -f unix --stdin --stdin-filename   {INPUT}", +      lintStdin = true, +      lintFormats = { "%f:%l:%c: %m" }, +      lintIgnoreExitCode = true, +      formatCommand = O.lang.tsserver.linter .. " --fix-to-stdout --stdin  --stdin-filename=${INPUT}",        formatStdin = true,      } +    table.insert(tsserver_args, eslint)    end    require("lspconfig").efm.setup {      -- init_options = {initializationOptions},      cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },      init_options = { documentFormatting = true, codeAction = false }, -    filetypes = { "html", "css", "yaml", "vue", "javascript", "javascriptreact", "typescript", "typescriptreact" }, +    filetypes = { +      "vue", +      "javascript", +      "javascriptreact", +      "typescript", +      "typescriptreact", +      "javascript.jsx", +      "typescript.tsx", +    },      settings = {        rootMarkers = { ".git/", "package.json" },        languages = { -        html = { prettier }, -        css = { prettier }, -        json = { prettier }, -        yaml = { prettier }, +        vue = tsserver_args, +        javascript = tsserver_args, +        javascriptreact = tsserver_args, +        ["javascript.jsx"] = tsserver_args, +        typescript = tsserver_args, +        ["typescript.tsx"] = tsserver_args, +        typescriptreact = tsserver_args,        },      },    } | 
