LSP finally working a decent amount
This commit is contained in:
parent
518951ec2f
commit
9c884fb841
15 changed files with 489 additions and 112 deletions
|
@ -1,55 +1,60 @@
|
|||
-- npm install -g cspell@latest
|
||||
|
||||
local output = vim.fn.system {
|
||||
"which",
|
||||
"cspell",
|
||||
}
|
||||
local output = vim.fn.system({
|
||||
"which",
|
||||
"cspell",
|
||||
})
|
||||
if output == nil or output == "" then
|
||||
-- if v:shell_error != 0 then
|
||||
vim.fn.system {
|
||||
"npm",
|
||||
"install",
|
||||
"-g",
|
||||
"cspell@latest",
|
||||
}
|
||||
-- if v:shell_error != 0 then
|
||||
vim.fn.system({
|
||||
"npm",
|
||||
"install",
|
||||
"-g",
|
||||
"cspell@latest",
|
||||
})
|
||||
end
|
||||
|
||||
return {
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
dependencies = "williamboman/mason.nvim",
|
||||
opts = function(_, config)
|
||||
require('util').ensure_installed_mason({
|
||||
"stylua",
|
||||
"prettier",
|
||||
"rustfmt",
|
||||
})
|
||||
{
|
||||
"jose-elias-alvarez/null-ls.nvim",
|
||||
after = { "williamboman/mason.nvim" },
|
||||
opts = function(_, config)
|
||||
|
||||
-- config variable is the default definitions table for the setup function call
|
||||
local null_ls = require "null-ls"
|
||||
-- config variable is the default definitions table for the setup function call
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
-- Check supported formatters and linters
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
config.sources = {
|
||||
-- Set a formatter
|
||||
null_ls.builtins.formatting.prettier,
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.rustfmt,
|
||||
-- null_ls.builtins.formatting.python,
|
||||
-- null_ls.builtins.code_actions.proselint, -- TODO looks interesting
|
||||
null_ls.builtins.code_actions.cspell.with {
|
||||
config = {
|
||||
find_json = function() return vim.fn.findfile("cspell.json", vim.fn.environ().HOME .. "/.config/nvim/lua/user/;") end,
|
||||
},
|
||||
},
|
||||
null_ls.builtins.diagnostics.cspell.with {
|
||||
extra_args = { "--config", "~/.config/nvim/lua/user/cspell.json" },
|
||||
},
|
||||
-- Check supported formatters and linters
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/formatting
|
||||
-- https://github.com/jose-elias-alvarez/null-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics
|
||||
config.sources = {
|
||||
-- Set a formatter
|
||||
null_ls.builtins.formatting.prettier, -- typescript/javascript
|
||||
null_ls.builtins.formatting.stylua,
|
||||
null_ls.builtins.formatting.rustfmt,
|
||||
null_ls.builtins.formatting.black, -- python
|
||||
-- null_ls.builtins.code_actions.proselint, -- TODO looks interesting
|
||||
null_ls.builtins.code_actions.cspell.with({
|
||||
config = {
|
||||
find_json = function()
|
||||
return vim.fn.findfile("cspell.json", vim.fn.environ().HOME .. "/.config/nvim/lua/user/;")
|
||||
end,
|
||||
},
|
||||
}),
|
||||
null_ls.builtins.diagnostics.cspell.with({
|
||||
extra_args = { "--config", "~/.config/nvim/lua/user/cspell.json" },
|
||||
}),
|
||||
}
|
||||
|
||||
config.update_in_insert = true
|
||||
config.debug = true
|
||||
|
||||
return config
|
||||
end,
|
||||
},
|
||||
{
|
||||
"jay-babu/mason-null-ls.nvim",
|
||||
opts = {
|
||||
ensure_installed = { "rustfmt", "stylelua", "prettier", "black" }
|
||||
}
|
||||
|
||||
config.update_in_insert = true
|
||||
config.debug = true
|
||||
|
||||
return config
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue