From d2324d14e166a17b2573006485fd3e4e8c971100 Mon Sep 17 00:00:00 2001 From: maxime50 <51096534+maxime50@users.noreply.github.com> Date: Sun, 4 Jul 2021 18:22:10 -0400 Subject: Better JS/TS Development Experience (#667) Co-authored-by: Maxime --- lua/lsp/ts-fmt-lint.lua | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) (limited to 'lua/lsp/ts-fmt-lint.lua') diff --git a/lua/lsp/ts-fmt-lint.lua b/lua/lsp/ts-fmt-lint.lua index 3ca97d71..5cca9c60 100644 --- a/lua/lsp/ts-fmt-lint.lua +++ b/lua/lsp/ts-fmt-lint.lua @@ -17,46 +17,18 @@ M.setup = function() } end - -- TODO global eslint? - - local eslint = { - lintCommand = "./node_modules/.bin/eslint -f unix --stdin --stdin-filename ${INPUT}", - lintIgnoreExitCode = true, - lintStdin = true, - lintFormats = {"%f:%l:%c: %m"}, - -- formatCommand = "./node_modules/.bin/eslint -f unix --fix --stdin-filename ${INPUT}", -- TODO check if eslint is the formatter then add this - formatStdin = true - } - - if O.lang.tsserver.formatter == 'prettier' then - table.insert(tsserver_args, prettier) - end - - if O.lang.tsserver.linter == 'eslint' then - 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 = { - "javascriptreact", "javascript", "typescript", "typescriptreact", - "html", "css", "yaml", "vue" - }, + filetypes = {"html", "css", "yaml", "vue"}, settings = { rootMarkers = {".git/", "package.json"}, languages = { - javascript = tsserver_args, - javascriptreact = tsserver_args, - typescript = tsserver_args, - typescriptreact = tsserver_args, html = {prettier}, css = {prettier}, json = {prettier}, yaml = {prettier} - -- javascriptreact = {prettier, eslint}, - -- javascript = {prettier, eslint}, -- markdown = {markdownPandocFormat, markdownlint}, } } -- cgit v1.2.3 From 0b251be44cf941cde2d49909b29855e97bc97d45 Mon Sep 17 00:00:00 2001 From: Chris Date: Sun, 4 Jul 2021 22:49:47 -0400 Subject: shelfing null-ls for now, seems to slow things down significantly --- lua/lsp/ts-fmt-lint.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lua/lsp/ts-fmt-lint.lua') diff --git a/lua/lsp/ts-fmt-lint.lua b/lua/lsp/ts-fmt-lint.lua index 5cca9c60..1ebf2e20 100644 --- a/lua/lsp/ts-fmt-lint.lua +++ b/lua/lsp/ts-fmt-lint.lua @@ -21,7 +21,7 @@ M.setup = function() -- init_options = {initializationOptions}, cmd = {DATA_PATH .. "/lspinstall/efm/efm-langserver"}, init_options = {documentFormatting = true, codeAction = false}, - filetypes = {"html", "css", "yaml", "vue"}, + filetypes = {"html", "css", "yaml", "vue", "javascript", "javascriptreact", "typescript", "typescriptreact"}, settings = { rootMarkers = {".git/", "package.json"}, languages = { @@ -29,7 +29,6 @@ M.setup = function() css = {prettier}, json = {prettier}, yaml = {prettier} - -- markdown = {markdownPandocFormat, markdownlint}, } } } -- cgit v1.2.3 From bd9296c4e86b9223cce9ee3dd0d04c3f9e7cc370 Mon Sep 17 00:00:00 2001 From: Robin Kautz Date: Mon, 5 Jul 2021 09:21:41 +0200 Subject: fixes condition to use local prettier (#678) --- lua/lsp/ts-fmt-lint.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lua/lsp/ts-fmt-lint.lua') diff --git a/lua/lsp/ts-fmt-lint.lua b/lua/lsp/ts-fmt-lint.lua index 1ebf2e20..36d4ca8a 100644 --- a/lua/lsp/ts-fmt-lint.lua +++ b/lua/lsp/ts-fmt-lint.lua @@ -10,7 +10,7 @@ M.setup = function() formatStdin = true } - if vim.fn.glob("node_modules/.bin/prettier") then + if vim.fn.glob("node_modules/.bin/prettier") ~= "" then prettier = { formatCommand = "./node_modules/.bin/prettier --stdin-filepath ${INPUT}", formatStdin = true -- cgit v1.2.3