This commit is contained in:
zack 2025-08-02 16:20:18 -04:00
parent 1a658f1668
commit 3ce12900b8
13 changed files with 517 additions and 309 deletions

View file

@ -1,16 +1,9 @@
{
"extras": [
"lazyvim.plugins.extras.coding.mini-comment",
"lazyvim.plugins.extras.coding.yanky",
"lazyvim.plugins.extras.dap.core",
"lazyvim.plugins.extras.editor.dial",
"lazyvim.plugins.extras.editor.inc-rename",
"lazyvim.plugins.extras.lang.angular",
"lazyvim.plugins.extras.lang.astro",
"lazyvim.plugins.extras.lang.cmake",
"lazyvim.plugins.extras.lang.docker",
"lazyvim.plugins.extras.lang.haskell",
"lazyvim.plugins.extras.lang.java",
"lazyvim.plugins.extras.lang.toml",
"lazyvim.plugins.extras.lang.json",
"lazyvim.plugins.extras.lang.clangd",
@ -20,18 +13,14 @@
"lazyvim.plugins.extras.lang.sql",
"lazyvim.plugins.extras.lang.svelte",
"lazyvim.plugins.extras.lang.tailwind",
"lazyvim.plugins.extras.lang.elixir",
"lazyvim.plugins.extras.lang.tex",
"lazyvim.plugins.extras.lang.go",
"lazyvim.plugins.extras.lang.python",
"lazyvim.plugins.extras.lang.zig",
"lazyvim.plugins.extras.lang.typescript",
"lazyvim.plugins.extras.test.core",
"lazyvim.plugins.extras.util.rest",
"lazyvim.plugins.extras.util.dot",
"lazyvim.plugins.extras.util.mini-hipatterns",
"lazyvim.plugins.extras.coding.luasnip",
"lazyvim.plugins.extras.coding.blink"
"lazyvim.plugins.extras.formatting.biome",
"lazyvim.plugins.extras.coding.luasnip"
],
"install_version": 8,
"news": {

View file

@ -12,4 +12,4 @@ vim.g.lazyvim_blink_main = true
vim.g.snacks_animate = false
vim.o.termguicolors = true
vim.g.lazyvim_python_lsp = "pyright"
vim.g.lazyvim_prettier_needs_config = true

View file

@ -59,11 +59,11 @@ return {
opts = {
formatters_by_ft = {
nix = { "alejandra" },
typescript = { "prettierd" },
typescriptreact = { "prettierd" },
javascriptreact = { "prettierd" },
javascript = { "prettierd" },
htmlangular = { "prettierd" },
typescript = { "biome" },
typescriptreact = { "biome" },
javascriptreact = { "biome" },
javascript = { "biome" },
htmlangular = { "biome" },
python = { "black" },
},
},

View file

@ -0,0 +1,284 @@
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 = {
--- @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
filetypes = {
"javascript",
"javascriptreact",
"javascript.jsx",
"typescript",
"typescriptreact",
"typescript.tsx",
},
settings = {
complete_function_calls = true,
vtsls = {
enableMoveToFileCodeAction = true,
autoUseWorkspaceTsdk = true,
experimental = {
maxInlayHintLength = 30,
completion = {
enableServerSideFuzzyMatch = true,
},
},
},
typescript = {
format = {
enable = false,
},
updateImportsOnFileMove = { enabled = "always" },
suggest = {
completeFunctionCalls = true,
},
inlayHints = {
enumMemberValues = { enabled = true },
functionLikeReturnTypes = { enabled = true },
parameterNames = { enabled = "literals" },
parameterTypes = { enabled = true },
propertyDeclarationTypes = { enabled = true },
variableTypes = { enabled = false },
},
},
},
keys = {
{
"gD",
function()
local params = vim.lsp.util.make_position_params()
LazyVim.lsp.execute({
command = "typescript.goToSourceDefinition",
arguments = { params.textDocument.uri, params.position },
open = true,
})
end,
desc = "Goto Source Definition",
},
{
"gR",
function()
LazyVim.lsp.execute({
command = "typescript.findAllFileReferences",
arguments = { vim.uri_from_bufnr(0) },
open = true,
})
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"],
desc = "Fix all diagnostics",
},
{
"<leader>cV",
function()
LazyVim.lsp.execute({ command = "typescript.selectTypeScriptVersion" })
end,
desc = "Select TS workspace version",
},
},
},
},
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)
LazyVim.lsp.on_attach(function(client, buffer)
client.commands["_typescript.moveToFileRefactoring"] = function(command, ctx)
---@type string, string, lsp.Range
local action, uri, range = unpack(command.arguments)
local function move(newf)
client.request("workspace/executeCommand", {
command = command.command,
arguments = { action, uri, range, newf },
})
end
local fname = vim.uri_to_fname(uri)
client.request("workspace/executeCommand", {
command = "typescript.tsserverRequest",
arguments = {
"getMoveToRefactoringFileSuggestions",
{
file = fname,
startLine = range.start.line + 1,
startOffset = range.start.character + 1,
endLine = range["end"].line + 1,
endOffset = range["end"].character + 1,
},
},
}, function(_, result)
---@type string[]
local files = result.body.files
table.insert(files, 1, "Enter new path...")
vim.ui.select(files, {
prompt = "Select move destination:",
format_item = function(f)
return vim.fn.fnamemodify(f, ":~:.")
end,
}, function(f)
if f and f:find("^Enter new path") then
vim.ui.input({
prompt = "Enter move destination:",
default = vim.fn.fnamemodify(fname, ":h") .. "/",
completion = "file",
}, function(newf)
return newf and move(newf)
end)
elseif f then
move(f)
end
end)
end)
end
end, "vtsls")
-- copy typescript settings to javascript
opts.settings.javascript =
vim.tbl_deep_extend("force", {}, opts.settings.typescript, opts.settings.javascript or {})
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")
if not dap.adapters["pwa-node"] then
require("dap").adapters["pwa-node"] = {
type = "server",
host = "localhost",
port = "${port}",
executable = {
command = "node",
-- 💀 Make sure to update this path to point to your installation
args = {
LazyVim.get_pkg_path("js-debug-adapter", "/js-debug/src/dapDebugServer.js"),
"${port}",
},
},
}
end
if not dap.adapters["node"] then
dap.adapters["node"] = function(cb, config)
if config.type == "node" then
config.type = "pwa-node"
end
local nativeAdapter = dap.adapters["pwa-node"]
if type(nativeAdapter) == "function" then
nativeAdapter(cb, config)
else
cb(nativeAdapter)
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
dap.configurations[language] = {
{
type = "pwa-node",
request = "launch",
name = "Launch file",
program = "${file}",
cwd = "${workspaceFolder}",
},
{
type = "pwa-node",
request = "attach",
name = "Attach",
processId = require("dap.utils").pick_process,
cwd = "${workspaceFolder}",
},
}
end
end
end,
},
-- Filetype icons
{
"echasnovski/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" },
},
},
},
}