add eslint_d/prettierd

This commit is contained in:
Michael Peters 2022-10-19 23:56:02 -07:00
parent 3575007c7b
commit 3cbb6ce825
5 changed files with 35 additions and 34 deletions

View File

@ -4,3 +4,6 @@ vim.api.nvim_create_user_command('Black', 'call Black()', {})
-- Insert IPDB statement
vim.api.nvim_create_user_command('IPDB', 'norm oimport ipdb; ipdb.set_trace() # fmt:skip', {})
-- Format the document
vim.api.nvim_create_user_command('Format', 'lua vim.lsp.buf.format()', {})

View File

@ -86,12 +86,12 @@ function M.config()
lsp_highlight_document(client)
end
local sumneko_root_path = '/home/peters/builds/lua-language-server'
local sumneko_binary = sumneko_root_path.."/bin/lua-language-server"
-- local sumneko_root_path = '/home/peters/builds/lua-language-server'
-- local sumneko_binary = sumneko_root_path.."/bin/lua-language-server"
-- lua-language-server
-- pacman -S lua-language-server
lspconfig.sumneko_lua.setup {
cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
-- cmd = { sumneko_binary, "-E", sumneko_root_path .. "/main.lua" },
on_attach = on_attach,
settings = {
Lua = {
@ -148,7 +148,6 @@ function M.config()
lspconfig.tsserver.setup {
on_attach = on_attach,
}
end
return M

View File

@ -6,31 +6,20 @@ function M.config()
return
end
-- Check supported formatters
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
local formatting = null_ls.builtins.formatting
-- Check supported linters
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
local diagnostics = null_ls.builtins.diagnostics
null_ls.setup {
debug = false,
sources = {
-- Set a formatter
--formatting.prettierd,
--TODO: formatting.black,
-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md
-- Set a linter
--diagnostics.eslint_d,
--TODO: pylint
},
-- Format before save
on_attach = function(client)
if client.resolved_capabilities.document_formatting then
vim.cmd "autocmd BufWritePre <buffer> lua vim.lsp.buf.formatting_sync()"
end
end,
-- sudo pacman -S prettierd
null_ls.builtins.formatting.prettierd,
-- sudo pacman -S eslint_d
null_ls.builtins.diagnostics.eslint_d.with({
diagnostic_config = { -- see also :help vim.diagnostic.config()
virtual_text = false,
}
}),
}
}
end

14
lua/configs/prettier.lua Normal file
View File

@ -0,0 +1,14 @@
local M = {}
function M.config()
local status_ok, prettier = pcall(require, "prettier")
if not status_ok then
return
end
prettier.setup({
bin = 'prettierd'
})
end
return M

View File

@ -94,7 +94,7 @@ packer.startup {
use { 'JoosepAlviste/nvim-ts-context-commentstring', after = 'nvim-treesitter' }
-- Show context
use { 'nvim-treesitter/nvim-treesitter-context', config = function() require'configs.treesitter-context'.config() end }
--use { 'nvim-treesitter/nvim-treesitter-context', config = function() require'configs.treesitter-context'.config() end }
--
-- LSP
@ -113,13 +113,6 @@ packer.startup {
config = function() require'configs.lspconfig'.config() end
}
-- Formatting + Linting
use {
'jose-elias-alvarez/null-ls.nvim',
event = 'BufRead',
config = function() require'configs.null-ls'.config() end
}
-- TODO: LSP Enhancer
use {
'tami5/lspsaga.nvim',
@ -129,6 +122,9 @@ packer.startup {
-- TODO: Symbols Outline
-- use { 'simrat39'/symbols-outline.nvim', cmd = 'SymbolsOutline', setup = function ... }
-- null-ls LSP injector
use { 'jose-elias-alvarez/null-ls.nvim', config = function() require'configs.null-ls'.config() end }
--
-- Autocompletion
--