Compare commits

..

21 Commits

Author SHA1 Message Date
5eca3dc3bb chore(main): release 7.0.2 (#1532)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-09-30 18:08:39 +02:00
7821c0e851 fix(python): make venv-selector dap_enabled conditional on nvim-dap-python (#1529) 2023-09-30 17:51:47 +02:00
bd48536335 chore(build): auto-generate vimdoc 2023-09-30 15:48:50 +00:00
1c878b9d06 fix(format): allow custom_format to return early (#1531) 2023-09-30 17:48:19 +02:00
6f9adbd4fb chore(main): release 7.0.1 (#1523)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-09-29 16:52:39 +02:00
ff5f5886db fix(nvim-lint): dont use default configured linters from nvim-lint 2023-09-29 16:49:59 +02:00
300350686f chore(main): release 7.0.0 (#1521)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-09-29 16:14:13 +02:00
718c5c6036 fix(docker): put hadolint in its own spec 2023-09-29 16:09:33 +02:00
31d913697b fix(nvim-lint): use linters for both custom and overriding linters 2023-09-29 15:58:44 +02:00
6bb0d1b66f fix(conform): use formatters for both custom and overriding formatters 2023-09-29 15:56:20 +02:00
0e5ff5c0ab fix(format): wrap custom formatter with error handler 2023-09-29 15:55:29 +02:00
886d49eb89 style: comment the selene example 2023-09-29 15:15:38 +02:00
0f7a009d1c docs: added more docs to nvim-lint extensions 2023-09-29 15:07:29 +02:00
05f45bb720 feat(extras): added extra for nvim-lint 2023-09-29 15:05:01 +02:00
9762e7e431 feat(neo-tree): added support for LSP renaming to NeoTree 2023-09-29 14:14:57 +02:00
aab365a9f8 fix(typescript)!: removed typescript.nvim since it's deprecated 2023-09-29 13:57:04 +02:00
f61a243d1a feat(extras): added conform.nvim extra you can use instead of null-ls/none-ls 2023-09-29 13:37:00 +02:00
6b05ed7dcd fix: remove deprecated leap/flit code checks 2023-09-29 12:00:56 +02:00
a7f68e5e37 refactor(none-ls): make all null-ls usages in extras optional 2023-09-29 12:00:56 +02:00
3c448a1be1 chore(build): auto-generate vimdoc 2023-09-29 09:53:29 +00:00
7cac6f064c feat(null-ls)!: use none-ls instead of null-ls (#1517)
* FEATURE: use none-ls instead of null-ls

Fixes #1516

* fix(none-ls): automatically migrate null-ls to none-ls

* feat(config): show warning if user config contains renamed references

---------

Co-authored-by: Folke Lemaitre <folke.lemaitre@gmail.com>
2023-09-29 11:52:45 +02:00
16 changed files with 323 additions and 62 deletions

View File

@ -1,5 +1,45 @@
# Changelog
## [7.0.2](https://github.com/LazyVim/LazyVim/compare/v7.0.1...v7.0.2) (2023-09-30)
### Bug Fixes
* **format:** allow `custom_format` to return early ([#1531](https://github.com/LazyVim/LazyVim/issues/1531)) ([1c878b9](https://github.com/LazyVim/LazyVim/commit/1c878b9d06fb116135419d098fe5dfde5304b709))
* **python:** make venv-selector `dap_enabled` conditional on `nvim-dap-python` ([#1529](https://github.com/LazyVim/LazyVim/issues/1529)) ([7821c0e](https://github.com/LazyVim/LazyVim/commit/7821c0e85199205af98ceedfb2c4990c96900e46))
## [7.0.1](https://github.com/LazyVim/LazyVim/compare/v7.0.0...v7.0.1) (2023-09-29)
### Bug Fixes
* **nvim-lint:** dont use default configured linters from nvim-lint ([ff5f588](https://github.com/LazyVim/LazyVim/commit/ff5f5886db321679e3fdc5dbb82b12daf6075510))
## [7.0.0](https://github.com/LazyVim/LazyVim/compare/v6.4.3...v7.0.0) (2023-09-29)
### ⚠ BREAKING CHANGES
* **typescript:** removed `typescript.nvim` since it's deprecated
* **null-ls:** use none-ls instead of null-ls ([#1517](https://github.com/LazyVim/LazyVim/issues/1517))
### Features
* **extras:** added `conform.nvim` extra you can use instead of null-ls/none-ls ([f61a243](https://github.com/LazyVim/LazyVim/commit/f61a243d1aca582963aca3f2c2c7c2ae0be16b06))
* **extras:** added extra for nvim-lint ([05f45bb](https://github.com/LazyVim/LazyVim/commit/05f45bb7200a6fd33ab7366553b957fa222e2cdf))
* **neo-tree:** added support for LSP renaming to NeoTree ([9762e7e](https://github.com/LazyVim/LazyVim/commit/9762e7e43110013a0931b8470be2929b54b4b641))
* **null-ls:** use none-ls instead of null-ls ([#1517](https://github.com/LazyVim/LazyVim/issues/1517)) ([7cac6f0](https://github.com/LazyVim/LazyVim/commit/7cac6f064c5b30f6b0ae4dffab62100aa6fe2568))
### Bug Fixes
* **conform:** use `formatters` for both custom and overriding formatters ([6bb0d1b](https://github.com/LazyVim/LazyVim/commit/6bb0d1b66ffe6d0a77ad96d0f945113ddcb9fdb3))
* **docker:** put hadolint in its own spec ([718c5c6](https://github.com/LazyVim/LazyVim/commit/718c5c6036f2aff6534501e151dd3e5ff13a42fa))
* **format:** wrap custom formatter with error handler ([0e5ff5c](https://github.com/LazyVim/LazyVim/commit/0e5ff5c0ab6930190122df086db5e3f91d8b38b8))
* **nvim-lint:** use `linters` for both custom and overriding linters ([31d9136](https://github.com/LazyVim/LazyVim/commit/31d913697bc9b731bc941362021ce06617f627d3))
* remove deprecated leap/flit code checks ([6b05ed7](https://github.com/LazyVim/LazyVim/commit/6b05ed7dcd729322e2e5b6752655a9491cd17f86))
* **typescript:** removed `typescript.nvim` since it's deprecated ([aab365a](https://github.com/LazyVim/LazyVim/commit/aab365a9f8b6405c6c5a938cb4745e9b770f2261))
## [6.4.3](https://github.com/LazyVim/LazyVim/compare/v6.4.2...v6.4.3) (2023-09-28)

View File

@ -1,4 +1,4 @@
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 28
*LazyVim.txt* For Neovim >= 0.8.0 Last change: 2023 September 30
==============================================================================
Table of Contents *LazyVim-table-of-contents*

View File

@ -79,6 +79,8 @@ local defaults = {
M.renames = {
["windwp/nvim-spectre"] = "nvim-pack/nvim-spectre",
["jose-elias-alvarez/null-ls.nvim"] = "nvimtools/none-ls.nvim",
["null-ls.nvim"] = "none-ls.nvim",
}
---@type LazyVimConfig
@ -181,6 +183,14 @@ function M.init()
local add = Plugin.Spec.add
Plugin.Spec.add = function(self, plugin, ...)
if type(plugin) == "table" and M.renames[plugin[1]] then
require("lazy.core.util").warn(
("Plugin `%s` was renamed to `%s`.\nPlease update your config for `%s`"):format(
plugin[1],
M.renames[plugin[1]],
self.importing or "LazyVim"
),
{ title = "LazyVim" }
)
plugin[1] = M.renames[plugin[1]]
end
return add(self, plugin, ...)

View File

@ -59,6 +59,27 @@ return {
},
},
config = function(_, opts)
opts.event_handlers = opts.event_handlers or {}
local function on_move(data)
local clients = vim.lsp.get_active_clients()
for _, client in ipairs(clients) do
if client:supports_method("workspace/willRenameFiles") then
local resp = client.request_sync("workspace/willRenameFiles", {
files = { { oldUri = vim.uri_from_fname(data.source), newUri = vim.uri_from_fname(data.destination) } },
}, 1000)
if resp and resp.result ~= nil then
vim.lsp.util.apply_workspace_edit(resp.result, client.offset_encoding)
end
end
end
end
local events = require("neo-tree.events")
vim.list_extend(opts.event_handlers, {
{ event = events.FILE_MOVED, handler = on_move },
{ event = events.FILE_RENAMED, handler = on_move },
})
require("neo-tree").setup(opts)
vim.api.nvim_create_autocmd("TermClose", {
pattern = "*lazygit",
@ -212,30 +233,6 @@ return {
end,
},
-- disable old installations of leap and flit. Optional so it doesn't appear under disabled plugins
{
"ggandor/leap.nvim",
enabled = function()
vim.schedule(function()
local Config = require("lazy.core.config")
if Config.spec.disabled["leap.nvim"] or Config.spec.disabled["flit.nvim"] then
require("lazy.core.util").warn(
[[`flash.nvim` is now the default **LazyVim** jump plugin.
**leap.nvim** and **flit.nvim** have been disabled.
Please remove the plugins from your config.
If you rather use leap/flit instead, you can add the leap extra:
`lazyvim.plugins.extras.editor.leap`
]],
{ title = "LazyVim" }
)
end
end)
return false
end,
optional = true,
},
{ "ggandor/flit.nvim", enabled = false, optional = true },
-- Flash enhances the built-in search functionality by showing labels
-- at the end of each match, letting you quickly jump to a specific
-- location.

View File

@ -0,0 +1,42 @@
return {
{
"stevearc/conform.nvim",
dependencies = { "mason.nvim" },
lazy = true,
cmd = "ConformInfo",
init = function()
-- Install the conform formatter on VeryLazy
require("lazyvim.util").on_very_lazy(function()
require("lazyvim.plugins.lsp.format").custom_format = function(buf)
return require("conform").format({ bufnr = buf })
end
end)
end,
opts = {
formatters_by_ft = {
lua = { "stylua" },
fish = { "fish_indent" },
sh = { "shfmt" },
},
-- LazyVim will merge the options you set here with builtin formatters.
-- You can also define any custom formatters here.
---@type table<string,table>
formatters = {
-- -- Example of using dprint only when a dprint.json file is present
-- dprint = {
-- condition = function(ctx)
-- return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1]
-- end,
-- },
},
},
config = function(_, opts)
opts.formatters = opts.formatters or {}
for f, o in pairs(opts.formatters) do
local ok, formatter = pcall(require, "conform.formatters." .. f)
opts.formatters[f] = vim.tbl_deep_extend("force", {}, ok and formatter or {}, o)
end
require("conform").setup(opts)
end,
},
}

View File

@ -6,10 +6,35 @@ return {
end,
},
{
"jose-elias-alvarez/null-ls.nvim",
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
local nls = require("null-ls")
table.insert(opts.sources, nls.builtins.formatting.prettierd)
end,
},
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
["javascript"] = { { "prettierd", "prettier" } },
["javascriptreact"] = { { "prettierd", "prettier" } },
["typescript"] = { { "prettierd", "prettier" } },
["typescriptreact"] = { { "prettierd", "prettier" } },
["vue"] = { { "prettierd", "prettier" } },
["css"] = { { "prettierd", "prettier" } },
["scss"] = { { "prettierd", "prettier" } },
["less"] = { { "prettierd", "prettier" } },
["html"] = { { "prettierd", "prettier" } },
["json"] = { { "prettierd", "prettier" } },
["jsonc"] = { { "prettierd", "prettier" } },
["yaml"] = { { "prettierd", "prettier" } },
["markdown"] = { { "prettierd", "prettier" } },
["markdown.mdx"] = { { "prettierd", "prettier" } },
["graphql"] = { { "prettierd", "prettier" } },
["handlebars"] = { { "prettierd", "prettier" } },
},
},
},
}

View File

@ -8,7 +8,8 @@ return {
end,
},
{
"jose-elias-alvarez/null-ls.nvim",
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
local nls = require("null-ls")
opts.sources = opts.sources or {}
@ -17,6 +18,15 @@ return {
})
end,
},
{
"mfussenegger/nvim-lint",
optional = true,
opts = {
linters_by_ft = {
cmake = { "cmakelint" },
},
},
},
{
"mason.nvim",
opts = function(_, opts)

View File

@ -8,7 +8,15 @@ return {
end,
},
{
"jose-elias-alvarez/null-ls.nvim",
"mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "hadolint" })
end,
},
{
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
local nls = require("null-ls")
opts.sources = opts.sources or {}
@ -16,12 +24,14 @@ return {
nls.builtins.diagnostics.hadolint,
})
end,
dependencies = {
"mason.nvim",
opts = function(_, opts)
opts.ensure_installed = opts.ensure_installed or {}
vim.list_extend(opts.ensure_installed, { "hadolint" })
end,
},
{
"mfussenegger/nvim-lint",
optional = true,
opts = {
linters_by_ft = {
dockerfile = { "hadolint" },
},
},
},
{

View File

@ -83,7 +83,8 @@ return {
},
-- Ensure Go tools are installed
{
"jose-elias-alvarez/null-ls.nvim",
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
if type(opts.sources) == "table" then
local nls = require("null-ls")
@ -96,6 +97,15 @@ return {
end
end,
},
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
go = { "goimports", "gofumpt" },
},
},
},
{
"mfussenegger/nvim-dap",
optional = true,

View File

@ -9,12 +9,28 @@ return {
end,
},
{
"jose-elias-alvarez/null-ls.nvim",
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
local nls = require("null-ls")
table.insert(opts.sources, nls.builtins.formatting.csharpier)
end,
},
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
cs = { "csharpier" },
},
formatters = {
csharpier = {
command = "dotnet-csharpier",
args = { "--write-stdout" },
},
},
},
},
{
"williamboman/mason.nvim",
opts = function(_, opts)

View File

@ -61,15 +61,19 @@ return {
{
"linux-cultist/venv-selector.nvim",
cmd = "VenvSelect",
opts = {
name = {
"venv",
".venv",
"env",
".env",
},
dap_enabled = true, -- Ensure that the venv selector affect PythonPath in nvim-dap as well!
},
opts = function(_, opts)
if require("lazyvim.util").has("nvim-dap-python") then
opts.dap_enabled = true
end
return vim.tbl_deep_extend("force", opts, {
name = {
"venv",
".venv",
"env",
".env",
},
})
end,
keys = { { "<leader>cv", "<cmd>:VenvSelect<cr>", desc = "Select VirtualEnv" } },
},
}

View File

@ -25,7 +25,8 @@ return {
},
},
{
"jose-elias-alvarez/null-ls.nvim",
"nvimtools/none-ls.nvim",
optional = true,
opts = function(_, opts)
if type(opts.sources) == "table" then
local null_ls = require("null-ls")
@ -36,4 +37,25 @@ return {
end
end,
},
{
"mfussenegger/nvim-lint",
optional = true,
opts = {
linters_by_ft = {
terraform = { "terraform_validate" },
tf = { "terraform_validate" },
},
},
},
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
terraform = { "terraform_fmt" },
tf = { "terraform_fmt" },
["terraform-vars"] = { "terraform_fmt" },
},
},
},
}

View File

@ -13,15 +13,25 @@ return {
-- correctly setup lspconfig
{
"neovim/nvim-lspconfig",
dependencies = { "jose-elias-alvarez/typescript.nvim" },
opts = {
-- make sure mason installs the server
servers = {
---@type lspconfig.options.tsserver
tsserver = {
keys = {
{ "<leader>co", "<cmd>TypescriptOrganizeImports<CR>", desc = "Organize Imports" },
{ "<leader>cR", "<cmd>TypescriptRenameFile<CR>", desc = "Rename File" },
{
"<leader>co",
function()
vim.lsp.buf.code_action({
apply = true,
context = {
only = { "source.organizeImports.ts" },
diagnostics = {},
},
})
end,
desc = "Organize Imports",
},
},
settings = {
typescript = {
@ -44,20 +54,8 @@ return {
},
},
},
setup = {
tsserver = function(_, opts)
require("typescript").setup({ server = opts })
return true
end,
},
},
},
{
"jose-elias-alvarez/null-ls.nvim",
opts = function(_, opts)
table.insert(opts.sources, require("typescript.extensions.null-ls.code-actions"))
end,
},
{
"mfussenegger/nvim-dap",
optional = true,

View File

@ -0,0 +1,66 @@
return {
{
"mfussenegger/nvim-lint",
event = "BufReadPost",
opts = {
-- Event to trigger linters
events = { "BufWritePost", "BufReadPost", "InsertLeave" },
linters_by_ft = {
fish = { "fish" },
},
-- LazyVim extension to easily override linter options
-- or add custom linters.
---@type table<string,table>
linters = {
-- -- Example of using selene only when a selene.toml file is present
-- selene = {
-- -- `condition` is another LazyVim extension that allows you to
-- -- dynamically enable/disable linters based on the context.
-- condition = function(ctx)
-- return vim.fs.find({ "selene.toml" }, { path = ctx.filename, upward = true })[1]
-- end,
-- },
},
},
config = function(_, opts)
local M = {}
local lint = require("lint")
for name, linter in pairs(opts.linters) do
lint.linters[name] = vim.tbl_deep_extend("force", lint.linters[name] or {}, linter)
end
lint.linters_by_ft = opts.linters_by_ft
function M.debounce(ms, fn)
local timer = vim.loop.new_timer()
return function(...)
local argv = { ... }
timer:start(ms, 0, function()
timer:stop()
vim.schedule_wrap(fn)(unpack(argv))
end)
end
end
function M.lint()
local lint = require("lint")
local names = lint.linters_by_ft[vim.bo.filetype] or {}
local ctx = { filename = vim.api.nvim_buf_get_name(0) }
ctx.dirname = vim.fn.fnamemodify(ctx.filename, ":h")
names = vim.tbl_filter(function(name)
local linter = lint.linters[name]
return linter and not (linter.condition and not linter.condition(ctx))
end, names)
if #names > 0 then
lint.try_lint(names)
end
end
vim.api.nvim_create_autocmd(opts.events, {
group = vim.api.nvim_create_augroup("nvim-lint", { clear = true }),
callback = M.debounce(100, M.lint),
})
end,
},
}

View File

@ -5,6 +5,11 @@ local M = {}
---@type PluginLspOpts
M.opts = nil
-- Allow plugins to set a custom formatter for a buffer.
-- See the conform extra for an example.
---@type fun(bufnr:number):boolean
M.custom_format = nil
function M.enabled()
return M.opts.autoformat
end
@ -30,6 +35,12 @@ function M.format(opts)
return
end
if M.custom_format and Util.try(function()
return M.custom_format(buf)
end, { msg = "Custom formatter failed" }) then
return
end
local formatters = M.get_formatters(buf)
local client_ids = vim.tbl_map(function(client)
return client.id

View File

@ -205,7 +205,7 @@ return {
-- formatters
{
"jose-elias-alvarez/null-ls.nvim",
"nvimtools/none-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
dependencies = { "mason.nvim" },
opts = function()