summaryrefslogtreecommitdiff
path: root/lua/lsp/ts-fmt-lint.lua
diff options
context:
space:
mode:
authorChristian Chiarulli <[email protected]>2021-07-24 21:17:11 -0400
committerGitHub <[email protected]>2021-07-24 21:17:11 -0400
commit98f8a77819670ce6012216e01885c135a6d3a289 (patch)
treeb655da889c33e0eb89251878783700a8cd014a27 /lua/lsp/ts-fmt-lint.lua
parent0884dcd84670bc097c34253e983d2cde9c209dfa (diff)
New contract (#1080)
Changes to the global config object O is now lvim user_plugins is now plugins user_autocommands is now autocommands No more lang specific plugins Null-ls has replaced both formatter.nvim and nvim-lint
Diffstat (limited to 'lua/lsp/ts-fmt-lint.lua')
-rw-r--r--lua/lsp/ts-fmt-lint.lua72
1 files changed, 0 insertions, 72 deletions
diff --git a/lua/lsp/ts-fmt-lint.lua b/lua/lsp/ts-fmt-lint.lua
deleted file mode 100644
index 7cebfd86..00000000
--- a/lua/lsp/ts-fmt-lint.lua
+++ /dev/null
@@ -1,72 +0,0 @@
--- Example configuations here: https://github.com/mattn/efm-langserver
-local M = {}
-
-M.setup = function()
- vim.cmd "let proj = FindRootDirectory()"
- local root_dir = vim.api.nvim_get_var "proj"
-
- local get_linter_instance = function()
- -- prioritize local instance over global
- local local_instance = root_dir .. "/node_modules/.bin/" .. O.lang.tsserver.linter
- if vim.fn.executable(local_instance) == 1 then
- return local_instance
- end
- return O.lang.tsserver.linter
- end
-
- local tsserver_args = {}
- local formattingSupported = false
-
- if O.lang.tsserver.linter == "eslint" or O.lang.tsserver.linter == "eslint_d" then
- local eslint = {
- lintCommand = get_linter_instance() .. " -f visualstudio --stdin --stdin-filename ${INPUT}",
- lintStdin = true,
- lintFormats = {
- "%f(%l,%c): %tarning %m",
- "%f(%l,%c): %trror %m",
- },
- lintSource = O.lang.tsserver.linter,
- lintIgnoreExitCode = true,
- }
- table.insert(tsserver_args, eslint)
- -- Only eslint_d supports --fix-to-stdout
- if string.find(get_linter_instance(), "eslint_d") then
- formattingSupported = true
- local eslint_fix = {
- formatCommand = get_linter_instance() .. " --fix-to-stdout --stdin --stdin-filename ${INPUT}",
- formatStdin = true,
- }
- table.insert(tsserver_args, eslint_fix)
- end
- end
-
- require("lspconfig").efm.setup {
- -- init_options = {initializationOptions},
- cmd = { DATA_PATH .. "/lspinstall/efm/efm-langserver" },
- init_options = { documentFormatting = formattingSupported, codeAction = false },
- root_dir = require("lspconfig").util.root_pattern(".git/", "package.json"),
- filetypes = {
- "vue",
- "javascript",
- "javascriptreact",
- "typescript",
- "typescriptreact",
- "javascript.jsx",
- "typescript.tsx",
- },
- settings = {
- rootMarkers = { ".git/", "package.json" },
- languages = {
- vue = tsserver_args,
- javascript = tsserver_args,
- javascriptreact = tsserver_args,
- ["javascript.jsx"] = tsserver_args,
- typescript = tsserver_args,
- ["typescript.tsx"] = tsserver_args,
- typescriptreact = tsserver_args,
- },
- },
- }
-end
-
-return M