mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-22 04:21:08 +00:00
Compare commits
45 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
459a4c3b10 | ||
|
|
c10948c50b | ||
|
|
35f56b9189 | ||
|
|
6eb16e730d | ||
|
|
b30c0312ea | ||
|
|
c429ebb628 | ||
|
|
b830a523b5 | ||
|
|
fa88241e2f | ||
|
|
58089db8b1 | ||
|
|
2dc527e511 | ||
|
|
dc6240f4d5 | ||
|
|
7c1301b895 | ||
|
|
d840410047 | ||
|
|
cdc47ae615 | ||
|
|
d92692309c | ||
|
|
83d90f339d | ||
|
|
ef272ff7cc | ||
|
|
d07070bf2f | ||
|
|
85afbbc94b | ||
|
|
96f4f18d7d | ||
|
|
2a5c892835 | ||
|
|
6d0da34de9 | ||
|
|
6dadcc2065 | ||
|
|
8bcb620802 | ||
|
|
59126caa31 | ||
|
|
4e9eac57ab | ||
|
|
9029d928d2 | ||
|
|
1b4be534f1 | ||
|
|
8764dfbc8f | ||
|
|
76cb567e5c | ||
|
|
53f4eabd77 | ||
|
|
ad25b31e51 | ||
|
|
e54689ebdc | ||
|
|
242f0983de | ||
|
|
fbf52d5496 | ||
|
|
3b3d649333 | ||
|
|
5450006ccd | ||
|
|
36f594716b | ||
|
|
e6f26f0f23 | ||
|
|
b2830cfcc5 | ||
|
|
50159fe344 | ||
|
|
6055e59613 | ||
|
|
954d8746e5 | ||
|
|
31caef21fd | ||
|
|
d0fe8c896f |
30 changed files with 657 additions and 407 deletions
2
.github/.release-please-manifest.json
vendored
2
.github/.release-please-manifest.json
vendored
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
".": "15.14.0"
|
||||
".": "16.0.0"
|
||||
}
|
||||
|
|
|
|||
61
CHANGELOG.md
61
CHANGELOG.md
|
|
@ -1,5 +1,66 @@
|
|||
# Changelog
|
||||
|
||||
## [16.0.0](https://github.com/LazyVim/LazyVim/compare/v15.15.0...v16.0.0) (2026-05-27)
|
||||
|
||||
|
||||
### ⚠ BREAKING CHANGES
|
||||
|
||||
* **refactoring:** conform to upstream breaking changes on 2.0 branch ([#7124](https://github.com/LazyVim/LazyVim/issues/7124))
|
||||
|
||||
### Features
|
||||
|
||||
* **keymaps:** added leader+bi to delete invisible buffers ([58089db](https://github.com/LazyVim/LazyVim/commit/58089db8b198fc81f91789b6f12d0617cae21437))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **autocmds:** correct version check for nvim-0.13 ([#7184](https://github.com/LazyVim/LazyVim/issues/7184)) ([6eb16e7](https://github.com/LazyVim/LazyVim/commit/6eb16e730d1a686224dca41b05ba125cfd62c1bb))
|
||||
* **autocmds:** replace `vim.hl.on_yank` with `vim.hl.hl_op` for `nvim-0.13` and above ([#7171](https://github.com/LazyVim/LazyVim/issues/7171)) ([b30c031](https://github.com/LazyVim/LazyVim/commit/b30c0312ea1c5bed6b28e72d930059622b0525f8))
|
||||
* **go:** use semanticTokens if setup in gopls config init_options ([#7172](https://github.com/LazyVim/LazyVim/issues/7172)) ([b830a52](https://github.com/LazyVim/LazyVim/commit/b830a523b5973c300639d4d9c4fea7d92fa04dc3))
|
||||
* **hipatterns:** don't color #add (use it too often as a private function in TS) ([dc6240f](https://github.com/LazyVim/LazyVim/commit/dc6240f4d56ae0d40cd0e673ca740dda50c4bf3b))
|
||||
* **oxc:** prefer top-level oxlint root_dir in monorepos ([d840410](https://github.com/LazyVim/LazyVim/commit/d840410047d20a8f93fb8d473599209ebe95584e))
|
||||
* **refactoring:** conform to upstream breaking changes on 2.0 branch ([#7124](https://github.com/LazyVim/LazyVim/issues/7124)) ([d926923](https://github.com/LazyVim/LazyVim/commit/d92692309c41581e1f839033fbccd745be732c7e))
|
||||
|
||||
## [15.15.0](https://github.com/LazyVim/LazyVim/compare/v15.14.0...v15.15.0) (2026-04-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **biome:** enable biome lsp for linting ([b2830cf](https://github.com/LazyVim/LazyVim/commit/b2830cfcc5c9c09ebbf9545beb3947a55ce89dbd))
|
||||
* **biome:** move biome extra from formatting.biome -> lang.typescript.biome ([242f098](https://github.com/LazyVim/LazyVim/commit/242f0983de9fdb70f0d82057a8039e32bc171764))
|
||||
* **lazydev:** make lspconfig types available on word `lspconfig.settings` ([36f5947](https://github.com/LazyVim/LazyVim/commit/36f594716bcb0bec84a05a6c55f702134d2e89c3))
|
||||
* **lsp:** auto add organizeImport keymaps for LSPs that support it ([e54689e](https://github.com/LazyVim/LazyVim/commit/e54689ebdc5458cb30f4a48b954c710bb381cd01))
|
||||
* **oxc:** added oxc extra for oxfmt and oxlint ([4e9eac5](https://github.com/LazyVim/LazyVim/commit/4e9eac57aba1ea575ef008a503cba8327257e4a4))
|
||||
* **sidekick:** ctrl+. focuses sidekick, but when already inside sidekick, hides it ([50159fe](https://github.com/LazyVim/LazyVim/commit/50159fe344d93329a569cee136c0323e48b0d3da))
|
||||
* **typescript:** set `vim.g.lazyvim_ts_lsp = "tsgo"` to use the much faster experimental lsp server ([e6f26f0](https://github.com/LazyVim/LazyVim/commit/e6f26f0f23e9cb4c6bcc351b06474f4863319aff))
|
||||
* **typescript:** split typescript extra in main, vtsls and tsgo ([9029d92](https://github.com/LazyVim/LazyVim/commit/9029d928d2f7b7f76f132b618d2931499c9b6eb9))
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **biome:** added recommendation when root has biome config file ([ad25b31](https://github.com/LazyVim/LazyVim/commit/ad25b31e512892ca51a1fa3ffa96d1375c391039))
|
||||
* **biome:** biome mason install is no longer needed ([5450006](https://github.com/LazyVim/LazyVim/commit/5450006ccdd7df341f7f60dded58ea4a87aa9c15))
|
||||
* **biome:** use biome-check in conform that also fixes linting issues and sorts imports ([954d874](https://github.com/LazyVim/LazyVim/commit/954d8746e5cf1266d93cf4210c00c1506f20423b))
|
||||
* **lsp:** sort server names before setting keymaps ([6d0da34](https://github.com/LazyVim/LazyVim/commit/6d0da34de9c4a82170e3359d4e7853bf89a557b3))
|
||||
* **oxc:** added `fixKind = "all"` ([85afbbc](https://github.com/LazyVim/LazyVim/commit/85afbbc94bb45891799a4851b2edf753b51f18b0))
|
||||
* **r:** recommend for *.qmd instead of *qmd files ([3b3d649](https://github.com/LazyVim/LazyVim/commit/3b3d6493332798674fb7b82aea600bab18eaf311))
|
||||
* **terminal:** use Snacks.terminal.focus() for <C-/> mapping ([96f4f18](https://github.com/LazyVim/LazyVim/commit/96f4f18d7d81c786ac0df5723bc7aca058bf2165)), closes [#7048](https://github.com/LazyVim/LazyVim/issues/7048)
|
||||
* **treesitter:** `nvim-treesitter` on longer support nvim-0.11, so pin when needed. Fixes [#7092](https://github.com/LazyVim/LazyVim/issues/7092) ([ef272ff](https://github.com/LazyVim/LazyVim/commit/ef272ff7cc9b53d48baf6544618b5923d65c0282))
|
||||
* **tsgo:** disable inlayHints.functionLikeReturnTypes by default. Too noisy ([8bcb620](https://github.com/LazyVim/LazyVim/commit/8bcb6208021bd4e4257de64c9598c6b78688be28))
|
||||
* **tsgo:** remove some noisy inlay hints ([d07070b](https://github.com/LazyVim/LazyVim/commit/d07070bf2ff83ae513097d02d71460920af85a91))
|
||||
* **typescript:** remove keymaps for non-existing code actions ([53f4eab](https://github.com/LazyVim/LazyVim/commit/53f4eabd7723faba2d7c14afe53226d8c18bf16c))
|
||||
* **util.plugin:** single imports for extras ([1b4be53](https://github.com/LazyVim/LazyVim/commit/1b4be534f1d8959480ba1f622a457654bd737ce5))
|
||||
|
||||
|
||||
### Performance Improvements
|
||||
|
||||
* **extras:** never load nested extras ([8764dfb](https://github.com/LazyVim/LazyVim/commit/8764dfbc8fcb8923397153eb3a2cfcac7ea988f1))
|
||||
|
||||
|
||||
### Reverts
|
||||
|
||||
* **lsp:** revert changes for [#6456](https://github.com/LazyVim/LazyVim/issues/6456). Closes [#6779](https://github.com/LazyVim/LazyVim/issues/6779) ([d0fe8c8](https://github.com/LazyVim/LazyVim/commit/d0fe8c896f4dca003e8d56e2091ee5ec7da7af75))
|
||||
|
||||
## [15.14.0](https://github.com/LazyVim/LazyVim/compare/v15.13.0...v15.14.0) (2026-03-01)
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
*LazyVim.txt* LazyVim docs
|
||||
For Neovim Last change: 2026 June 02
|
||||
|
||||
==============================================================================
|
||||
Table of Contents *LazyVim-table-of-contents*
|
||||
|
|
@ -78,22 +79,26 @@ Try it with Docker ~
|
|||
Install the LazyVim Starter ~
|
||||
|
||||
- Make a backup of your current Neovim files:
|
||||
>sh
|
||||
|
||||
>sh
|
||||
mv ~/.config/nvim ~/.config/nvim.bak
|
||||
mv ~/.local/share/nvim ~/.local/share/nvim.bak
|
||||
<
|
||||
<
|
||||
- Clone the starter
|
||||
>sh
|
||||
|
||||
>sh
|
||||
git clone https://github.com/LazyVim/starter ~/.config/nvim
|
||||
<
|
||||
<
|
||||
- Remove the `.git` folder, so you can add it to your own repo later
|
||||
>sh
|
||||
|
||||
>sh
|
||||
rm -rf ~/.config/nvim/.git
|
||||
<
|
||||
<
|
||||
- Start Neovim!
|
||||
>sh
|
||||
|
||||
>sh
|
||||
nvim
|
||||
<
|
||||
<
|
||||
Refer to the comments in the files on how to customize **LazyVim**.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -18,7 +18,11 @@ vim.api.nvim_create_autocmd({ "FocusGained", "TermClose", "TermLeave" }, {
|
|||
vim.api.nvim_create_autocmd("TextYankPost", {
|
||||
group = augroup("highlight_yank"),
|
||||
callback = function()
|
||||
(vim.hl or vim.highlight).on_yank()
|
||||
if vim.fn.has("nvim-0.13") == 1 then
|
||||
vim.hl.hl_op()
|
||||
else
|
||||
(vim.hl or vim.highlight).on_yank()
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ _G.LazyVim = require("lazyvim.util")
|
|||
---@class LazyVimConfig: LazyVimOptions
|
||||
local M = {}
|
||||
|
||||
M.version = "15.14.0" -- x-release-please-version
|
||||
M.version = "16.0.0" -- x-release-please-version
|
||||
LazyVim.config = M
|
||||
|
||||
---@class LazyVimOptions
|
||||
|
|
@ -348,13 +348,81 @@ function M.init()
|
|||
M.json.load()
|
||||
end
|
||||
|
||||
---@alias LazyVimDefault {name: string, extra: string, enabled?: boolean, origin?: "global" | "default" | "extra" }
|
||||
|
||||
---@alias LazyVimDefault {name: string, group: string, extra: string, import: string, enabled?: boolean, origin?: "global" | "default" | "extra" }
|
||||
---
|
||||
local default_extras ---@type table<string, LazyVimDefault>
|
||||
|
||||
---@param name string
|
||||
---@param extras LazyVimDefault[]
|
||||
function M.register_defaults(name, extras)
|
||||
assert(default_extras, "defaults should be loaded by now, this should never happen")
|
||||
local valid = vim.tbl_map(function(extra)
|
||||
return extra.name
|
||||
end, extras) --[[@as string[] ]]
|
||||
|
||||
local origin = "default"
|
||||
local ret ---@type LazyVimDefault?
|
||||
local use ---@type string?
|
||||
|
||||
local global = vim.g["lazyvim_" .. name]
|
||||
if vim.tbl_contains(valid, global) then
|
||||
origin = "global" -- was set by the user in their config
|
||||
use = global
|
||||
else
|
||||
if global and global ~= "auto" then
|
||||
vim.notify(
|
||||
("Invalid value for `vim.g.lazyvim_%s`: `%s`\nValid options are: %s"):format(
|
||||
name,
|
||||
global,
|
||||
table.concat(valid, ", ")
|
||||
),
|
||||
vim.log.levels.ERROR,
|
||||
{ title = "LazyVim" }
|
||||
)
|
||||
end
|
||||
for _, extra in ipairs(extras) do
|
||||
if LazyVim.has_extra(extra.extra) then
|
||||
use = extra.name -- was imported by the user in their lazy spec or added by LazyExtras
|
||||
origin = "extra"
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
use = use or valid[1] -- fallback to the first one if nothing was set
|
||||
|
||||
for _, extra in ipairs(extras) do
|
||||
local import = "lazyvim.plugins.extras." .. extra.extra
|
||||
extra = vim.deepcopy(extra)
|
||||
extra.enabled = extra.name == use
|
||||
extra.import = import
|
||||
extra.group = name
|
||||
if extra.enabled then
|
||||
extra.origin = origin
|
||||
ret = extra
|
||||
end
|
||||
default_extras[import] = extra
|
||||
end
|
||||
|
||||
return assert(ret, "One of the extras should be enabled, this should never happen")
|
||||
end
|
||||
|
||||
---@param group string
|
||||
---@return LazyVimDefault?
|
||||
function M.get_default(group)
|
||||
for _, extra in pairs(M.get_defaults()) do
|
||||
if extra.group == group and extra.enabled then
|
||||
return extra
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.get_defaults()
|
||||
if default_extras then
|
||||
return default_extras
|
||||
end
|
||||
default_extras = {}
|
||||
|
||||
---@type table<string, LazyVimDefault[]>
|
||||
local checks = {
|
||||
picker = {
|
||||
|
|
@ -378,36 +446,10 @@ function M.get_defaults()
|
|||
table.insert(checks.explorer, 1, table.remove(checks.explorer, 2))
|
||||
end
|
||||
|
||||
default_extras = {}
|
||||
for name, check in pairs(checks) do
|
||||
local valid = {} ---@type string[]
|
||||
for _, extra in ipairs(check) do
|
||||
if extra.enabled ~= false then
|
||||
valid[#valid + 1] = extra.name
|
||||
end
|
||||
end
|
||||
local origin = "default"
|
||||
local use = vim.g["lazyvim_" .. name]
|
||||
use = vim.tbl_contains(valid, use or "auto") and use or nil
|
||||
origin = use and "global" or origin
|
||||
for _, extra in ipairs(use and {} or check) do
|
||||
if extra.enabled ~= false and LazyVim.has_extra(extra.extra) then
|
||||
use = extra.name
|
||||
break
|
||||
end
|
||||
end
|
||||
origin = use and "extra" or origin
|
||||
use = use or valid[1]
|
||||
for _, extra in ipairs(check) do
|
||||
local import = "lazyvim.plugins.extras." .. extra.extra
|
||||
extra = vim.deepcopy(extra)
|
||||
extra.enabled = extra.name == use
|
||||
if extra.enabled then
|
||||
extra.origin = origin
|
||||
end
|
||||
default_extras[import] = extra
|
||||
end
|
||||
for name, extras in pairs(checks) do
|
||||
M.register_defaults(name, extras)
|
||||
end
|
||||
|
||||
return default_extras
|
||||
end
|
||||
|
||||
|
|
|
|||
|
|
@ -43,6 +43,9 @@ end, { desc = "Delete Buffer" })
|
|||
map("n", "<leader>bo", function()
|
||||
Snacks.bufdelete.other()
|
||||
end, { desc = "Delete Other Buffers" })
|
||||
map("n", "<leader>bi", function()
|
||||
Snacks.bufdelete.invisible()
|
||||
end, { desc = "Delete Invisible Buffers" })
|
||||
map("n", "<leader>bD", "<cmd>:bd<cr>", { desc = "Delete Buffer and Window" })
|
||||
|
||||
-- Clear search and stop snippet on escape
|
||||
|
|
@ -189,8 +192,8 @@ map("n", "<leader>L", function() LazyVim.news.changelog() end, { desc = "LazyVim
|
|||
-- floating terminal
|
||||
map("n", "<leader>fT", function() Snacks.terminal() end, { desc = "Terminal (cwd)" })
|
||||
map("n", "<leader>ft", function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" })
|
||||
map({"n","t"}, "<c-/>",function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" })
|
||||
map({"n","t"}, "<c-_>",function() Snacks.terminal(nil, { cwd = LazyVim.root() }) end, { desc = "which_key_ignore" })
|
||||
map({"n","t"}, "<c-/>",function() Snacks.terminal.focus(nil, { cwd = LazyVim.root() }) end, { desc = "Terminal (Root Dir)" })
|
||||
map({"n","t"}, "<c-_>",function() Snacks.terminal.focus(nil, { cwd = LazyVim.root() }) end, { desc = "which_key_ignore" })
|
||||
|
||||
-- windows
|
||||
map("n", "<leader>-", "<C-W>s", { desc = "Split Window Below", remap = true })
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ return {
|
|||
{ path = "LazyVim", words = { "LazyVim" } },
|
||||
{ path = "snacks.nvim", words = { "Snacks" } },
|
||||
{ path = "lazy.nvim", words = { "LazyVim" } },
|
||||
{ path = "nvim-lspconfig", words = { "lspconfig.settings" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -70,60 +70,58 @@ return {
|
|||
end,
|
||||
},
|
||||
|
||||
vim.g.ai_cmp
|
||||
and {
|
||||
-- copilot cmp source
|
||||
vim.g.ai_cmp and {
|
||||
-- copilot cmp source
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
optional = true,
|
||||
dependencies = { -- this will only be evaluated if nvim-cmp is enabled
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
optional = true,
|
||||
dependencies = { -- this will only be evaluated if nvim-cmp is enabled
|
||||
"zbirenbaum/copilot-cmp",
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
local copilot_cmp = require("copilot_cmp")
|
||||
copilot_cmp.setup(opts)
|
||||
-- attach cmp source whenever copilot attaches
|
||||
-- fixes lazy-loading issues with the copilot cmp source
|
||||
Snacks.util.lsp.on({ name = "copilot" }, function()
|
||||
copilot_cmp._on_insert_enter({})
|
||||
end)
|
||||
end,
|
||||
specs = {
|
||||
{
|
||||
"zbirenbaum/copilot-cmp",
|
||||
opts = {},
|
||||
config = function(_, opts)
|
||||
local copilot_cmp = require("copilot_cmp")
|
||||
copilot_cmp.setup(opts)
|
||||
-- attach cmp source whenever copilot attaches
|
||||
-- fixes lazy-loading issues with the copilot cmp source
|
||||
Snacks.util.lsp.on({ name = "copilot" }, function()
|
||||
copilot_cmp._on_insert_enter({})
|
||||
end)
|
||||
end,
|
||||
specs = {
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
optional = true,
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, 1, {
|
||||
name = "copilot",
|
||||
group_index = 1,
|
||||
priority = 100,
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
optional = true,
|
||||
dependencies = { "fang2hou/blink-copilot" },
|
||||
opts = {
|
||||
sources = {
|
||||
default = { "copilot" },
|
||||
providers = {
|
||||
copilot = {
|
||||
"hrsh7th/nvim-cmp",
|
||||
optional = true,
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, 1, {
|
||||
name = "copilot",
|
||||
module = "blink-copilot",
|
||||
score_offset = 100,
|
||||
async = true,
|
||||
},
|
||||
},
|
||||
group_index = 1,
|
||||
priority = 100,
|
||||
})
|
||||
end,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
or nil,
|
||||
},
|
||||
},
|
||||
{
|
||||
"saghen/blink.cmp",
|
||||
optional = true,
|
||||
dependencies = { "fang2hou/blink-copilot" },
|
||||
opts = {
|
||||
sources = {
|
||||
default = { "copilot" },
|
||||
providers = {
|
||||
copilot = {
|
||||
name = "copilot",
|
||||
module = "blink-copilot",
|
||||
score_offset = 100,
|
||||
async = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
} or nil,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,8 +82,8 @@ return {
|
|||
{ "<leader>a", "", desc = "+ai", mode = { "n", "v" } },
|
||||
{
|
||||
"<c-.>",
|
||||
function() require("sidekick.cli").toggle() end,
|
||||
desc = "Sidekick Toggle",
|
||||
function() require("sidekick.cli").focus() end,
|
||||
desc = "Sidekick Focus",
|
||||
mode = { "n", "t", "i", "x" },
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,20 +53,6 @@ return {
|
|||
cyclic = true,
|
||||
})
|
||||
|
||||
local weekdays = augend.constant.new({
|
||||
elements = {
|
||||
"Monday",
|
||||
"Tuesday",
|
||||
"Wednesday",
|
||||
"Thursday",
|
||||
"Friday",
|
||||
"Saturday",
|
||||
"Sunday",
|
||||
},
|
||||
word = true,
|
||||
cyclic = true,
|
||||
})
|
||||
|
||||
local months = augend.constant.new({
|
||||
elements = {
|
||||
"January",
|
||||
|
|
@ -86,15 +72,6 @@ return {
|
|||
cyclic = true,
|
||||
})
|
||||
|
||||
local capitalized_boolean = augend.constant.new({
|
||||
elements = {
|
||||
"True",
|
||||
"False",
|
||||
},
|
||||
word = true,
|
||||
cyclic = true,
|
||||
})
|
||||
|
||||
return {
|
||||
dials_by_ft = {
|
||||
css = "css",
|
||||
|
|
@ -116,11 +93,12 @@ return {
|
|||
augend.integer.alias.decimal_int, -- nonnegative and negative decimal number
|
||||
augend.integer.alias.hex, -- nonnegative hex number (0x01, 0x1a1f, etc.)
|
||||
augend.date.alias["%Y/%m/%d"], -- date (2022/02/19, etc.)
|
||||
augend.constant.alias.en_weekday, -- Mon, Tue, ..., Sat, Sun
|
||||
augend.constant.alias.en_weekday_full, -- Monday, Tuesday, ..., Saturday, Sunday
|
||||
ordinal_numbers,
|
||||
weekdays,
|
||||
months,
|
||||
capitalized_boolean,
|
||||
augend.constant.alias.bool, -- boolean value (true <-> false)
|
||||
augend.constant.alias.Bool, -- boolean value (True <-> False)
|
||||
logical_alias,
|
||||
},
|
||||
vue = {
|
||||
|
|
|
|||
|
|
@ -1,95 +1,64 @@
|
|||
local pick = function()
|
||||
local refactoring = require("refactoring")
|
||||
if LazyVim.pick.picker.name == "telescope" then
|
||||
return require("telescope").extensions.refactoring.refactors()
|
||||
elseif LazyVim.pick.picker.name == "fzf" then
|
||||
local fzf_lua = require("fzf-lua")
|
||||
local results = refactoring.get_refactors()
|
||||
|
||||
local opts = {
|
||||
fzf_opts = {},
|
||||
fzf_colors = true,
|
||||
actions = {
|
||||
["default"] = function(selected)
|
||||
refactoring.refactor(selected[1])
|
||||
end,
|
||||
},
|
||||
}
|
||||
fzf_lua.fzf_exec(results, opts)
|
||||
else
|
||||
refactoring.select_refactor()
|
||||
if LazyVim.has_extra("editor.refactoring") then
|
||||
if vim.fn.has("nvim-0.12") == 0 then
|
||||
LazyVim.error("refactoring.nvim requires Neovim 0.12 or higher", { title = "refactoring.nvim" })
|
||||
return {}
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
{ "lewis6991/async.nvim", lazy = true },
|
||||
|
||||
{
|
||||
"ThePrimeagen/refactoring.nvim",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>r", "", desc = "+refactor", mode = { "n", "x" } },
|
||||
{
|
||||
"<leader>rs",
|
||||
pick,
|
||||
function()
|
||||
return require("refactoring").select_refactor()
|
||||
end,
|
||||
mode = { "n", "x" },
|
||||
desc = "Refactor",
|
||||
desc = "Select Refactor",
|
||||
},
|
||||
{
|
||||
"<leader>ri",
|
||||
function()
|
||||
return require("refactoring").refactor("Inline Variable")
|
||||
return require("refactoring").inline_var()
|
||||
end,
|
||||
mode = { "n", "x" },
|
||||
desc = "Inline Variable",
|
||||
expr = true,
|
||||
},
|
||||
{
|
||||
"<leader>rb",
|
||||
function()
|
||||
return require("refactoring").refactor("Extract Block")
|
||||
end,
|
||||
mode = { "n", "x" },
|
||||
desc = "Extract Block",
|
||||
expr = true,
|
||||
},
|
||||
{
|
||||
"<leader>rf",
|
||||
function()
|
||||
return require("refactoring").refactor("Extract Block To File")
|
||||
end,
|
||||
mode = { "n", "x" },
|
||||
desc = "Extract Block To File",
|
||||
expr = true,
|
||||
},
|
||||
{
|
||||
"<leader>rP",
|
||||
function()
|
||||
require("refactoring").debug.printf({ below = false })
|
||||
return require("refactoring.debug").print_loc({ output_location = "below" })
|
||||
end,
|
||||
desc = "Debug Print",
|
||||
desc = "Debug Print Location",
|
||||
expr = true,
|
||||
},
|
||||
{
|
||||
"<leader>rp",
|
||||
function()
|
||||
require("refactoring").debug.print_var({ normal = true })
|
||||
return require("refactoring.debug").print_var({ output_location = "below" }) .. "iw"
|
||||
end,
|
||||
mode = { "n", "x" },
|
||||
desc = "Debug Print Variable",
|
||||
expr = true,
|
||||
},
|
||||
{
|
||||
"<leader>rc",
|
||||
function()
|
||||
require("refactoring").debug.cleanup({})
|
||||
return require("refactoring.debug").cleanup({ restore_view = true }) .. "ag"
|
||||
end,
|
||||
desc = "Debug Cleanup",
|
||||
expr = true,
|
||||
},
|
||||
{
|
||||
"<leader>rf",
|
||||
function()
|
||||
return require("refactoring").refactor("Extract Function")
|
||||
return require("refactoring").extract_func()
|
||||
end,
|
||||
mode = { "n", "x" },
|
||||
desc = "Extract Function",
|
||||
|
|
@ -98,7 +67,7 @@ return {
|
|||
{
|
||||
"<leader>rF",
|
||||
function()
|
||||
return require("refactoring").refactor("Extract Function To File")
|
||||
return require("refactoring").extract_func_to_file()
|
||||
end,
|
||||
mode = { "n", "x" },
|
||||
desc = "Extract Function To File",
|
||||
|
|
@ -107,52 +76,13 @@ return {
|
|||
{
|
||||
"<leader>rx",
|
||||
function()
|
||||
return require("refactoring").refactor("Extract Variable")
|
||||
return require("refactoring").extract_var()
|
||||
end,
|
||||
mode = { "n", "x" },
|
||||
desc = "Extract Variable",
|
||||
expr = true,
|
||||
},
|
||||
{
|
||||
"<leader>rp",
|
||||
function()
|
||||
require("refactoring").debug.print_var()
|
||||
end,
|
||||
mode = { "n", "x" },
|
||||
desc = "Debug Print Variable",
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
prompt_func_return_type = {
|
||||
go = false,
|
||||
java = false,
|
||||
cpp = false,
|
||||
c = false,
|
||||
h = false,
|
||||
hpp = false,
|
||||
cxx = false,
|
||||
},
|
||||
prompt_func_param_type = {
|
||||
go = false,
|
||||
java = false,
|
||||
cpp = false,
|
||||
c = false,
|
||||
h = false,
|
||||
hpp = false,
|
||||
cxx = false,
|
||||
},
|
||||
printf_statements = {},
|
||||
print_var_statements = {},
|
||||
show_success_message = true, -- shows a message with information about the refactor on success
|
||||
-- i.e. [Refactor] Inlined 3 variable occurrences
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("refactoring").setup(opts)
|
||||
if LazyVim.has("telescope.nvim") then
|
||||
LazyVim.on_load("telescope.nvim", function()
|
||||
require("telescope").load_extension("refactoring")
|
||||
end)
|
||||
end
|
||||
end,
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ return {
|
|||
event = "LazyFile",
|
||||
config = function(_, _)
|
||||
require("conjure.main").main()
|
||||
require("conjure.mapping")["on-filetype"]()
|
||||
end,
|
||||
init = function()
|
||||
-- print color codes if baleia.nvim is available
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ return {
|
|||
opts = {
|
||||
servers = {
|
||||
gopls = {
|
||||
init_options = {
|
||||
semanticTokens = true,
|
||||
},
|
||||
settings = {
|
||||
gopls = {
|
||||
gofumpt = true,
|
||||
|
|
@ -46,7 +49,6 @@ return {
|
|||
completeUnimported = true,
|
||||
staticcheck = true,
|
||||
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
|
||||
semanticTokens = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -56,7 +58,12 @@ return {
|
|||
-- workaround for gopls not supporting semanticTokensProvider
|
||||
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
|
||||
Snacks.util.lsp.on({ name = "gopls" }, function(_, client)
|
||||
if not client.server_capabilities.semanticTokensProvider then
|
||||
if
|
||||
client.config
|
||||
and client.config.init_options
|
||||
and client.config.init_options.semanticTokens
|
||||
and not client.server_capabilities.semanticTokensProvider
|
||||
then
|
||||
local semantic = client.config.capabilities.textDocument.semanticTokens
|
||||
client.server_capabilities.semanticTokensProvider = {
|
||||
full = true,
|
||||
|
|
|
|||
|
|
@ -38,23 +38,8 @@ return {
|
|||
logLevel = "error",
|
||||
},
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>co",
|
||||
LazyVim.lsp.action["source.organizeImports"],
|
||||
desc = "Organize Imports",
|
||||
},
|
||||
},
|
||||
},
|
||||
ruff_lsp = {
|
||||
keys = {
|
||||
{
|
||||
"<leader>co",
|
||||
LazyVim.lsp.action["source.organizeImports"],
|
||||
desc = "Organize Imports",
|
||||
},
|
||||
},
|
||||
},
|
||||
ruff_lsp = {},
|
||||
},
|
||||
setup = {
|
||||
[ruff] = function()
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ return {
|
|||
recommended = function()
|
||||
return LazyVim.extras.wants({
|
||||
ft = "r",
|
||||
root = { "*.R", "*.Rmd", "*qmd" },
|
||||
root = { "*.R", "*.Rmd", "*.qmd" },
|
||||
})
|
||||
end,
|
||||
{
|
||||
|
|
|
|||
|
|
@ -23,15 +23,7 @@ return {
|
|||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
svelte = {
|
||||
keys = {
|
||||
{
|
||||
"<leader>co",
|
||||
LazyVim.lsp.action["source.organizeImports"],
|
||||
desc = "Organize Imports",
|
||||
},
|
||||
},
|
||||
},
|
||||
svelte = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
---@module "conform"
|
||||
|
||||
---@diagnostic disable: inject-field
|
||||
if lazyvim_docs then
|
||||
-- Enable this option to avoid conflicts with Prettier.
|
||||
|
|
@ -8,6 +10,7 @@ end
|
|||
local supported = {
|
||||
"astro",
|
||||
"css",
|
||||
"scss",
|
||||
"graphql",
|
||||
-- "html",
|
||||
"javascript",
|
||||
|
|
@ -23,24 +26,35 @@ local supported = {
|
|||
}
|
||||
|
||||
return {
|
||||
recommended = function()
|
||||
return LazyVim.extras.wants({
|
||||
root = { "biome.json", "biome.jsonc" },
|
||||
})
|
||||
end,
|
||||
|
||||
{
|
||||
"mason-org/mason.nvim",
|
||||
opts = { ensure_installed = { "biome" } },
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
---@type lspconfig.settings.biome
|
||||
biome = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
---@param opts ConformOpts
|
||||
---@param opts conform.setupOpts
|
||||
opts = function(_, opts)
|
||||
opts.formatters_by_ft = opts.formatters_by_ft or {}
|
||||
for _, ft in ipairs(supported) do
|
||||
opts.formatters_by_ft[ft] = opts.formatters_by_ft[ft] or {}
|
||||
table.insert(opts.formatters_by_ft[ft], "biome")
|
||||
table.insert(opts.formatters_by_ft[ft], "biome-check")
|
||||
end
|
||||
|
||||
opts.formatters = opts.formatters or {}
|
||||
opts.formatters.biome = {
|
||||
opts.formatters["biome-check"] = {
|
||||
require_cwd = true,
|
||||
}
|
||||
end,
|
||||
171
lua/lazyvim/plugins/extras/lang/typescript/init.lua
Normal file
171
lua/lazyvim/plugins/extras/lang/typescript/init.lua
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
if lazyvim_docs then
|
||||
-- LSP Server to use for TypeScript.
|
||||
---@type "vtsls" | "tsgo"
|
||||
vim.g.lazyvim_ts_lsp = "vtsls" -- currently the default
|
||||
|
||||
-- To use the newer, much faster `tsgo` LSP server, either:
|
||||
-- * enable the `tsgo` extra, or
|
||||
-- * set `vim.g.lazyvim_ts_lsp = "tsgo"` in your `options.lua`
|
||||
end
|
||||
|
||||
local extra = LazyVim.config.register_defaults("ts_lsp", {
|
||||
{ name = "vtsls", extra = "lang.typescript.vtsls" },
|
||||
{ name = "tsgo", extra = "lang.typescript.tsgo" },
|
||||
})
|
||||
|
||||
return {
|
||||
recommended = function()
|
||||
return LazyVim.extras.wants({
|
||||
ft = {
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"javascript.jsx",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"typescript.tsx",
|
||||
},
|
||||
root = { "tsconfig.json", "package.json", "jsconfig.json" },
|
||||
})
|
||||
end,
|
||||
|
||||
{ import = extra.import },
|
||||
|
||||
-- correctly setup lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = function(_, opts)
|
||||
local lsp = extra.name or "vtsls"
|
||||
local servers = { "tsserver", "ts_ls", "vtsls", "tsgo", lsp }
|
||||
for _, server in ipairs(servers) do
|
||||
opts.servers[server] = opts.servers[server] or {}
|
||||
opts.servers[server].enabled = server == lsp
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
{
|
||||
"mason-org/mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
table.insert(opts.ensure_installed, "js-debug-adapter")
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts = function()
|
||||
local dap = require("dap")
|
||||
|
||||
for _, adapterType in ipairs({ "node", "chrome", "msedge" }) do
|
||||
local pwaType = "pwa-" .. adapterType
|
||||
|
||||
if not dap.adapters[pwaType] then
|
||||
dap.adapters[pwaType] = {
|
||||
type = "server",
|
||||
host = "localhost",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = "js-debug-adapter",
|
||||
args = { "${port}" },
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
-- Define adapters without the "pwa-" prefix for VSCode compatibility
|
||||
if not dap.adapters[adapterType] then
|
||||
dap.adapters[adapterType] = function(cb, config)
|
||||
local nativeAdapter = dap.adapters[pwaType]
|
||||
|
||||
config.type = pwaType
|
||||
|
||||
if type(nativeAdapter) == "function" then
|
||||
nativeAdapter(cb, config)
|
||||
else
|
||||
cb(nativeAdapter)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local js_filetypes = { "typescript", "javascript", "typescriptreact", "javascriptreact" }
|
||||
|
||||
local vscode = require("dap.ext.vscode")
|
||||
vscode.type_to_filetypes["node"] = js_filetypes
|
||||
vscode.type_to_filetypes["pwa-node"] = js_filetypes
|
||||
|
||||
for _, language in ipairs(js_filetypes) do
|
||||
if not dap.configurations[language] then
|
||||
local runtimeExecutable = nil
|
||||
if language:find("typescript") then
|
||||
runtimeExecutable = vim.fn.executable("tsx") == 1 and "tsx" or "ts-node"
|
||||
end
|
||||
dap.configurations[language] = {
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
program = "${file}",
|
||||
cwd = "${workspaceFolder}",
|
||||
sourceMaps = true,
|
||||
runtimeExecutable = runtimeExecutable,
|
||||
skipFiles = {
|
||||
"<node_internals>/**",
|
||||
"node_modules/**",
|
||||
},
|
||||
resolveSourceMapLocations = {
|
||||
"${workspaceFolder}/**",
|
||||
"!**/node_modules/**",
|
||||
},
|
||||
},
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "attach",
|
||||
name = "Attach",
|
||||
processId = require("dap.utils").pick_process,
|
||||
cwd = "${workspaceFolder}",
|
||||
sourceMaps = true,
|
||||
runtimeExecutable = runtimeExecutable,
|
||||
skipFiles = {
|
||||
"<node_internals>/**",
|
||||
"node_modules/**",
|
||||
},
|
||||
resolveSourceMapLocations = {
|
||||
"${workspaceFolder}/**",
|
||||
"!**/node_modules/**",
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
-- chrome adapter is deprecated, use js-debug-adapter instead
|
||||
automatic_installation = { exclude = { "chrome" } },
|
||||
},
|
||||
},
|
||||
|
||||
-- Filetype icons
|
||||
{
|
||||
"nvim-mini/mini.icons",
|
||||
opts = {
|
||||
file = {
|
||||
[".eslintrc.js"] = { glyph = "", hl = "MiniIconsYellow" },
|
||||
[".node-version"] = { glyph = "", hl = "MiniIconsGreen" },
|
||||
[".prettierrc"] = { glyph = "", hl = "MiniIconsPurple" },
|
||||
[".yarnrc.yml"] = { glyph = "", hl = "MiniIconsBlue" },
|
||||
["eslint.config.js"] = { glyph = "", hl = "MiniIconsYellow" },
|
||||
["package.json"] = { glyph = "", hl = "MiniIconsGreen" },
|
||||
["tsconfig.json"] = { glyph = "", hl = "MiniIconsAzure" },
|
||||
["tsconfig.build.json"] = { glyph = "", hl = "MiniIconsAzure" },
|
||||
["yarn.lock"] = { glyph = "", hl = "MiniIconsBlue" },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
68
lua/lazyvim/plugins/extras/lang/typescript/oxc.lua
Normal file
68
lua/lazyvim/plugins/extras/lang/typescript/oxc.lua
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
local supported = {
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"json",
|
||||
"jsonc",
|
||||
"vue",
|
||||
"svelte",
|
||||
"astro",
|
||||
}
|
||||
|
||||
return {
|
||||
recommended = function()
|
||||
return LazyVim.extras.wants({
|
||||
root = {
|
||||
".oxlintrc.json",
|
||||
".oxlintrc.jsonc",
|
||||
"oxlint.config.ts",
|
||||
".oxfmtrc.json",
|
||||
".oxfmtrc.jsonc",
|
||||
"oxfmt.config.ts",
|
||||
},
|
||||
})
|
||||
end,
|
||||
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
servers = {
|
||||
---@type lspconfig.settings.oxlint
|
||||
oxlint = {
|
||||
root_dir = function(bufnr, on_dir)
|
||||
-- prefer the top-level oxlint config if it exists (monorepo support)
|
||||
local git = vim.fs.root(bufnr, ".git")
|
||||
local markers = { ".oxlintrc.json", ".oxlintrc.jsonc", "oxlint.config.ts" }
|
||||
local root = git and vim.fs.root(git, markers) or vim.fs.root(bufnr, markers)
|
||||
if root then
|
||||
on_dir(root)
|
||||
end
|
||||
end,
|
||||
settings = {
|
||||
fixKind = "all",
|
||||
},
|
||||
},
|
||||
--- disable the oxfmt lsp server since we use conform for formatting
|
||||
oxfmt = { enabled = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
"mason-org/mason.nvim",
|
||||
opts = { ensure_installed = { "oxfmt" } },
|
||||
},
|
||||
|
||||
{
|
||||
"stevearc/conform.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
opts.formatters_by_ft = opts.formatters_by_ft or {}
|
||||
for _, ft in ipairs(supported) do
|
||||
opts.formatters_by_ft[ft] = opts.formatters_by_ft[ft] or {}
|
||||
table.insert(opts.formatters_by_ft[ft], "oxfmt")
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
58
lua/lazyvim/plugins/extras/lang/typescript/tsgo.lua
Normal file
58
lua/lazyvim/plugins/extras/lang/typescript/tsgo.lua
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
return {
|
||||
recommended = function()
|
||||
return LazyVim.extras.wants({
|
||||
ft = {
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"javascript.jsx",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"typescript.tsx",
|
||||
},
|
||||
root = { "tsconfig.json", "package.json", "jsconfig.json" },
|
||||
})
|
||||
end,
|
||||
|
||||
-- correctly setup lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {
|
||||
-- make sure mason installs the server
|
||||
servers = {
|
||||
---@type lspconfig.settings.tsgo
|
||||
tsgo = {
|
||||
-- explicitly add default filetypes, so that we can extend
|
||||
-- them in related extras
|
||||
filetypes = {
|
||||
"javascript",
|
||||
"javascriptreact",
|
||||
"javascript.jsx",
|
||||
"typescript",
|
||||
"typescriptreact",
|
||||
"typescript.tsx",
|
||||
},
|
||||
settings = {
|
||||
typescript = {
|
||||
inlayHints = {
|
||||
enumMemberValues = { enabled = true },
|
||||
functionLikeReturnTypes = { enabled = false },
|
||||
parameterNames = {
|
||||
enabled = "literals",
|
||||
suppressWhenArgumentMatchesName = true,
|
||||
},
|
||||
parameterTypes = { enabled = true },
|
||||
propertyDeclarationTypes = { enabled = true },
|
||||
variableTypes = { enabled = false },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
-- correctly setup lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
|
|
@ -19,14 +19,6 @@ return {
|
|||
opts = {
|
||||
-- make sure mason installs the server
|
||||
servers = {
|
||||
--- @deprecated -- tsserver renamed to ts_ls but not yet released, so keep this for now
|
||||
--- the proper approach is to check the nvim-lspconfig release version when it's released to determine the server name dynamically
|
||||
tsserver = {
|
||||
enabled = false,
|
||||
},
|
||||
ts_ls = {
|
||||
enabled = false,
|
||||
},
|
||||
vtsls = {
|
||||
-- explicitly add default filetypes, so that we can extend
|
||||
-- them in related extras
|
||||
|
|
@ -90,21 +82,11 @@ return {
|
|||
end,
|
||||
desc = "File References",
|
||||
},
|
||||
{
|
||||
"<leader>co",
|
||||
LazyVim.lsp.action["source.organizeImports"],
|
||||
desc = "Organize Imports",
|
||||
},
|
||||
{
|
||||
"<leader>cM",
|
||||
LazyVim.lsp.action["source.addMissingImports.ts"],
|
||||
desc = "Add missing imports",
|
||||
},
|
||||
{
|
||||
"<leader>cu",
|
||||
LazyVim.lsp.action["source.removeUnused.ts"],
|
||||
desc = "Remove unused imports",
|
||||
},
|
||||
{
|
||||
"<leader>cD",
|
||||
LazyVim.lsp.action["source.fixAll.ts"],
|
||||
|
|
@ -125,16 +107,6 @@ return {
|
|||
},
|
||||
},
|
||||
setup = {
|
||||
--- @deprecated -- tsserver renamed to ts_ls but not yet released, so keep this for now
|
||||
--- the proper approach is to check the nvim-lspconfig release version when it's released to determine the server name dynamically
|
||||
tsserver = function()
|
||||
-- disable tsserver
|
||||
return true
|
||||
end,
|
||||
ts_ls = function()
|
||||
-- disable tsserver
|
||||
return true
|
||||
end,
|
||||
vtsls = function(_, opts)
|
||||
Snacks.util.lsp.on({ name = "vtsls" }, function(buffer, client)
|
||||
client.commands["_typescript.moveToFileRefactoring"] = function(command, ctx)
|
||||
|
|
@ -194,129 +166,9 @@ return {
|
|||
},
|
||||
},
|
||||
|
||||
-- correctly setup lspconfig
|
||||
{
|
||||
"mfussenegger/nvim-dap",
|
||||
optional = true,
|
||||
dependencies = {
|
||||
{
|
||||
"mason-org/mason.nvim",
|
||||
opts = function(_, opts)
|
||||
opts.ensure_installed = opts.ensure_installed or {}
|
||||
table.insert(opts.ensure_installed, "js-debug-adapter")
|
||||
end,
|
||||
},
|
||||
},
|
||||
opts = function()
|
||||
local dap = require("dap")
|
||||
|
||||
for _, adapterType in ipairs({ "node", "chrome", "msedge" }) do
|
||||
local pwaType = "pwa-" .. adapterType
|
||||
|
||||
if not dap.adapters[pwaType] then
|
||||
dap.adapters[pwaType] = {
|
||||
type = "server",
|
||||
host = "localhost",
|
||||
port = "${port}",
|
||||
executable = {
|
||||
command = "js-debug-adapter",
|
||||
args = { "${port}" },
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
-- Define adapters without the "pwa-" prefix for VSCode compatibility
|
||||
if not dap.adapters[adapterType] then
|
||||
dap.adapters[adapterType] = function(cb, config)
|
||||
local nativeAdapter = dap.adapters[pwaType]
|
||||
|
||||
config.type = pwaType
|
||||
|
||||
if type(nativeAdapter) == "function" then
|
||||
nativeAdapter(cb, config)
|
||||
else
|
||||
cb(nativeAdapter)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local js_filetypes = { "typescript", "javascript", "typescriptreact", "javascriptreact" }
|
||||
|
||||
local vscode = require("dap.ext.vscode")
|
||||
vscode.type_to_filetypes["node"] = js_filetypes
|
||||
vscode.type_to_filetypes["pwa-node"] = js_filetypes
|
||||
|
||||
for _, language in ipairs(js_filetypes) do
|
||||
if not dap.configurations[language] then
|
||||
local runtimeExecutable = nil
|
||||
if language:find("typescript") then
|
||||
runtimeExecutable = vim.fn.executable("tsx") == 1 and "tsx" or "ts-node"
|
||||
end
|
||||
dap.configurations[language] = {
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "launch",
|
||||
name = "Launch file",
|
||||
program = "${file}",
|
||||
cwd = "${workspaceFolder}",
|
||||
sourceMaps = true,
|
||||
runtimeExecutable = runtimeExecutable,
|
||||
skipFiles = {
|
||||
"<node_internals>/**",
|
||||
"node_modules/**",
|
||||
},
|
||||
resolveSourceMapLocations = {
|
||||
"${workspaceFolder}/**",
|
||||
"!**/node_modules/**",
|
||||
},
|
||||
},
|
||||
{
|
||||
type = "pwa-node",
|
||||
request = "attach",
|
||||
name = "Attach",
|
||||
processId = require("dap.utils").pick_process,
|
||||
cwd = "${workspaceFolder}",
|
||||
sourceMaps = true,
|
||||
runtimeExecutable = runtimeExecutable,
|
||||
skipFiles = {
|
||||
"<node_internals>/**",
|
||||
"node_modules/**",
|
||||
},
|
||||
resolveSourceMapLocations = {
|
||||
"${workspaceFolder}/**",
|
||||
"!**/node_modules/**",
|
||||
},
|
||||
},
|
||||
}
|
||||
end
|
||||
end
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"jay-babu/mason-nvim-dap.nvim",
|
||||
optional = true,
|
||||
opts = {
|
||||
-- chrome adapter is deprecated, use js-debug-adapter instead
|
||||
automatic_installation = { exclude = { "chrome" } },
|
||||
},
|
||||
},
|
||||
|
||||
-- Filetype icons
|
||||
{
|
||||
"nvim-mini/mini.icons",
|
||||
opts = {
|
||||
file = {
|
||||
[".eslintrc.js"] = { glyph = "", hl = "MiniIconsYellow" },
|
||||
[".node-version"] = { glyph = "", hl = "MiniIconsGreen" },
|
||||
[".prettierrc"] = { glyph = "", hl = "MiniIconsPurple" },
|
||||
[".yarnrc.yml"] = { glyph = "", hl = "MiniIconsBlue" },
|
||||
["eslint.config.js"] = { glyph = "", hl = "MiniIconsYellow" },
|
||||
["package.json"] = { glyph = "", hl = "MiniIconsGreen" },
|
||||
["tsconfig.json"] = { glyph = "", hl = "MiniIconsAzure" },
|
||||
["tsconfig.build.json"] = { glyph = "", hl = "MiniIconsAzure" },
|
||||
["yarn.lock"] = { glyph = "", hl = "MiniIconsBlue" },
|
||||
},
|
||||
},
|
||||
"neovim/nvim-lspconfig",
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
|
|
@ -39,6 +39,9 @@ M.plugin = {
|
|||
group = function(_, _, data)
|
||||
---@type string
|
||||
local match = data.full_match
|
||||
if match == "#add" then
|
||||
return
|
||||
end
|
||||
local r, g, b = match:sub(2, 2), match:sub(3, 3), match:sub(4, 4)
|
||||
local hex_color = "#" .. r .. r .. g .. g .. b .. b
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ return {
|
|||
-- lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
event = "LazyFile",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"mason.nvim",
|
||||
{ "mason-org/mason-lspconfig.nvim", config = function() end },
|
||||
|
|
@ -99,6 +99,18 @@ return {
|
|||
desc = "Next Reference", enabled = function() return Snacks.words.is_enabled() end },
|
||||
{ "<a-p>", function() Snacks.words.jump(-vim.v.count1, true) end, has = "documentHighlight",
|
||||
desc = "Prev Reference", enabled = function() return Snacks.words.is_enabled() end },
|
||||
{
|
||||
"<leader>co",
|
||||
LazyVim.lsp.action["source.organizeImports"],
|
||||
desc = "Organize Imports",
|
||||
has = "codeAction",
|
||||
enabled = function(buf)
|
||||
local code_actions = vim.tbl_filter(function(action)
|
||||
return action:find("^source%.organizeImports%.?$")
|
||||
end, LazyVim.lsp.code_actions({ bufnr = buf }))
|
||||
return #code_actions > 0
|
||||
end
|
||||
},
|
||||
},
|
||||
},
|
||||
stylua = { enabled = false },
|
||||
|
|
@ -150,12 +162,15 @@ return {
|
|||
return ret
|
||||
end,
|
||||
---@param opts PluginLspOpts
|
||||
config = vim.schedule_wrap(function(_, opts)
|
||||
config = function(_, opts)
|
||||
-- setup autoformat
|
||||
LazyVim.format.register(LazyVim.lsp.formatter())
|
||||
|
||||
-- setup keymaps
|
||||
for server, server_opts in pairs(opts.servers) do
|
||||
local names = vim.tbl_keys(opts.servers) ---@type string[]
|
||||
table.sort(names)
|
||||
for _, server in ipairs(names) do
|
||||
local server_opts = opts.servers[server]
|
||||
if type(server_opts) == "table" and server_opts.keys then
|
||||
require("lazyvim.plugins.lsp.keymaps").set({ name = server ~= "*" and server or nil }, server_opts.keys)
|
||||
end
|
||||
|
|
@ -259,7 +274,7 @@ return {
|
|||
automatic_enable = { exclude = mason_exclude },
|
||||
})
|
||||
end
|
||||
end),
|
||||
end,
|
||||
},
|
||||
|
||||
-- cmdline tools and lsp servers
|
||||
|
|
|
|||
|
|
@ -3,8 +3,8 @@ local M = {}
|
|||
---@type LazyKeysLspSpec[]|nil
|
||||
M._keys = {}
|
||||
|
||||
---@alias LazyKeysLspSpec LazyKeysSpec|{has?:string|string[], enabled?:fun():boolean}
|
||||
---@alias LazyKeysLsp LazyKeys|{has?:string|string[], enabled?:fun():boolean}
|
||||
---@alias LazyKeysLspSpec LazyKeysSpec|{has?:string|string[], enabled?:(fun(buf:number):boolean)}
|
||||
---@alias LazyKeysLsp LazyKeys|{has?:string|string[], enabled?:fun(buf:number):boolean}
|
||||
|
||||
---@deprecated
|
||||
---@return LazyKeysLspSpec[]
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ return {
|
|||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
branch = "main",
|
||||
commit = vim.fn.has("nvim-0.12") == 0 and "7caec274fd19c12b55902a5b795100d21531391f" or nil,
|
||||
version = false, -- last release is way too old and doesn't work on Windows
|
||||
build = function()
|
||||
local TS = require("nvim-treesitter")
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ return {
|
|||
nav_j = { "<C-j>", term_nav("j"), desc = "Go to Lower Window", expr = true, mode = "t" },
|
||||
nav_k = { "<C-k>", term_nav("k"), desc = "Go to Upper Window", expr = true, mode = "t" },
|
||||
nav_l = { "<C-l>", term_nav("l"), desc = "Go to Right Window", expr = true, mode = "t" },
|
||||
hide_slash = { "<C-/>", "hide", desc = "Hide Terminal", mode = "t" },
|
||||
hide_underscore = { "<c-_>", "hide", desc = "which_key_ignore", mode = "t" },
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ function M.get()
|
|||
if root then
|
||||
LazyVim.walk(root, function(path, name, type)
|
||||
if (type == "file" or type == "link") and name:match("%.lua$") then
|
||||
name = path:sub(#root + 2, -5):gsub("/", ".")
|
||||
name = path:sub(#root + 2, -5):gsub("/", "."):gsub("%.init$", "")
|
||||
local ok, extra = pcall(M.get_extra, source, source.module .. "." .. name)
|
||||
if ok then
|
||||
extras[#extras + 1] = extra
|
||||
|
|
@ -115,6 +115,13 @@ function M.get_extra(source, modname)
|
|||
recommended = M.wants(recommended)
|
||||
end
|
||||
|
||||
-- language extras that are disabled because a conflict with another extra is enabled are not recommended
|
||||
local defaults = LazyVim.config.get_defaults()
|
||||
local def = defaults[modname]
|
||||
if def and def.enabled == false and vim.startswith(modname, "lazyvim.plugins.extras.lang.") then
|
||||
recommended = false
|
||||
end
|
||||
|
||||
---@type LazyExtra
|
||||
return {
|
||||
source = source,
|
||||
|
|
|
|||
|
|
@ -93,4 +93,21 @@ function M.execute(opts)
|
|||
end
|
||||
end
|
||||
|
||||
---@param filter? vim.lsp.get_clients.Filter
|
||||
function M.code_actions(filter)
|
||||
filter = filter or {}
|
||||
local ret = {} ---@type string[]
|
||||
local clients = vim.lsp.get_clients(filter)
|
||||
for _, client in ipairs(clients) do
|
||||
-- check server cababilities first
|
||||
vim.list_extend(ret, vim.tbl_get(client, "server_capabilities", "codeActionProvider", "codeActionKinds") or {})
|
||||
-- check dynamic capabilities
|
||||
local regs = client.dynamic_capabilities:get("codeActionProvider", filter)
|
||||
for _, reg in ipairs(regs or {}) do
|
||||
vim.list_extend(ret, vim.tbl_get(reg, "registerOptions", "codeActionKinds") or {})
|
||||
end
|
||||
end
|
||||
return LazyVim.dedup(ret)
|
||||
end
|
||||
|
||||
return M
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ M.deprecated_extras = {
|
|||
}
|
||||
M.renamed_extras = {
|
||||
["lazyvim.plugins.extras.lang.omnisharp"] = "lazyvim.plugins.extras.lang.dotnet",
|
||||
["lazyvim.plugins.extras.formatting.biome"] = "lazyvim.plugins.extras.lang.typescript.biome",
|
||||
}
|
||||
|
||||
M.deprecated_modules = {}
|
||||
|
|
@ -110,15 +111,43 @@ function M.fix_imports()
|
|||
)
|
||||
spec.import = rename
|
||||
end
|
||||
local dep = M.deprecated_extras[spec and spec.import]
|
||||
local dep = M.deprecated_extras[spec.import]
|
||||
if dep then
|
||||
dep = dep .. "\n" .. "Please remove the extra from `lazyvim.json` to hide this warning."
|
||||
LazyVim.warn(dep, { title = "LazyVim", once = true, stacktrace = true, stacklevel = 6 })
|
||||
return false
|
||||
end
|
||||
|
||||
local modname = spec.import
|
||||
if type(modname) == "string" and vim.startswith(modname, "lazyvim.plugins.extras.") then
|
||||
M.single_import(spec)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
---@param spec LazySpecImport
|
||||
function M.single_import(spec)
|
||||
local modname = spec.import
|
||||
if type(modname) ~= "string" then
|
||||
return
|
||||
end
|
||||
spec.name = modname
|
||||
spec.import = function()
|
||||
local modinfo = vim.loader.find(modname)[1]
|
||||
local modpath = modinfo and modinfo.modpath
|
||||
local mod, err = loadfile(modpath)
|
||||
if mod then
|
||||
local ret, foo = mod()
|
||||
if foo then
|
||||
return nil, "Spec module returned more than one value. Expected a single value."
|
||||
end
|
||||
return ret
|
||||
else
|
||||
return nil, err
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function M.fix_renames()
|
||||
---@param plugin LazyPluginSpec
|
||||
Meta.add = LazyVim.inject.args(Meta.add, function(self, plugin)
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ local Icons = require("mini.icons")
|
|||
|
||||
local Plugin = require("lazy.core.plugin")
|
||||
_G.LazyVim = require("lazyvim.util")
|
||||
require("lazyvim.config")
|
||||
LazyVim.config.get_defaults()
|
||||
LazyVim.plugin.setup()
|
||||
|
||||
describe("Extra", function()
|
||||
local Config = require("lazy.core.config")
|
||||
|
|
@ -93,8 +96,13 @@ describe("Extra", function()
|
|||
local mason = spec.plugins["mason.nvim"]
|
||||
local mason_opts = Plugin.values(mason, "opts", false)
|
||||
|
||||
for lsp in pairs(lspconfig_opts.servers or {}) do
|
||||
for lsp, lsp_opts in pairs(lspconfig_opts.servers or {}) do
|
||||
local lsp_pkg = lsp_to_pkg[lsp]
|
||||
-- Skip if the LSP server is disabled in the config since mason.nvim won't install it
|
||||
-- and it might still be used for conform.nvim or nvim-lint, etc.
|
||||
if type(lsp_opts) == "table" and lsp_opts.enabled == false then
|
||||
lsp_pkg = false
|
||||
end
|
||||
assert(
|
||||
not (lsp_pkg and vim.tbl_contains(mason_opts.ensure_installed, lsp_pkg)),
|
||||
"LSP server "
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue