[CLEAN/ADD] ruby stuff

This commit is contained in:
Daveanand Mannie
2025-04-26 20:18:28 -04:00
parent bb8dbfaeb4
commit 4d79cbf805
7 changed files with 19 additions and 312 deletions

View File

@@ -1,11 +0,0 @@
return {
"ibhagwan/fzf-lua",
opts = {
fzf_opts = {
["--layout"] = "default",
},
winopts = {
backdrop = 99
},
},
}

View File

@@ -1,124 +0,0 @@
return {
{
"neovim/nvim-lspconfig",
opts = {
servers = {
gopls = {
settings = {
gopls = {
gofumpt = true,
codelenses = {
gc_details = false,
generate = true,
regenerate_cgo = true,
run_govulncheck = true,
test = true,
tidy = true,
upgrade_dependency = true,
vendor = true,
},
hints = {
assignVariableTypes = true,
compositeLiteralFields = true,
compositeLiteralTypes = true,
constantValues = true,
functionTypeParameters = true,
parameterNames = true,
rangeVariableTypes = true,
},
analyses = {
fieldalignment = true,
nilness = true,
unusedparams = true,
unusedwrite = true,
useany = true,
},
usePlaceholders = true,
completeUnimported = true,
staticcheck = true,
directoryFilters = { "-.git", "-.vscode", "-.idea", "-.vscode-test", "-node_modules" },
semanticTokens = true,
},
},
},
},
setup = {
gopls = function(_, opts)
-- workaround for gopls not supporting semanticTokensProvider
-- https://github.com/golang/go/issues/54531#issuecomment-1464982242
LazyVim.lsp.on_attach(function(client, _)
if not client.server_capabilities.semanticTokensProvider then
local semantic = client.config.capabilities.textDocument.semanticTokens
client.server_capabilities.semanticTokensProvider = {
full = true,
legend = {
tokenTypes = semantic.tokenTypes,
tokenModifiers = semantic.tokenModifiers,
},
range = true,
}
end
end, "gopls")
-- end workaround
end,
},
},
},
-- Ensure Go tools are installed
{
"williamboman/mason.nvim",
opts = { ensure_installed = { "goimports", "gofumpt" } },
},
{
"stevearc/conform.nvim",
optional = true,
opts = {
formatters_by_ft = {
go = { "goimports", "gofumpt" },
},
},
},
{
"mfussenegger/nvim-dap",
optional = true,
dependencies = {
{
"williamboman/mason.nvim",
opts = { ensure_installed = { "delve" } },
},
{
"leoluz/nvim-dap-go",
opts = {},
},
},
},
{
"nvim-neotest/neotest",
optional = true,
dependencies = {
"fredrikaverpil/neotest-golang",
},
opts = {
adapters = {
["neotest-golang"] = {
-- Here we can set options for neotest-golang, e.g.
-- go_test_args = { "-v", "-race", "-count=1", "-timeout=60s" },
dap_go_enabled = true, -- requires leoluz/nvim-dap-go
},
},
},
},
-- Filetype icons
{
"echasnovski/mini.icons",
opts = {
file = {
[".go-version"] = { glyph = "", hl = "MiniIconsBlue" },
},
filetype = {
gotmpl = { glyph = "󰟓", hl = "MiniIconsGrey" },
},
},
},
}

View File

@@ -1,162 +0,0 @@
return {
"neovim/nvim-lspconfig",
opts = {
-- make sure mason installs the server
servers = {
tsserver = {
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 = {
completion = {
enableServerSideFuzzyMatch = true,
},
},
},
typescript = {
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 = {
tsserver = 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,
},
},
}

View File

@@ -1,9 +0,0 @@
return {
"mfussenegger/nvim-lint",
config = function()
local lint = require("lint")
lint.linters_by_ft = {
python = { "flake8" },
}
end,
}

16
lua/plugins/mason.lua Normal file
View File

@@ -0,0 +1,16 @@
return {
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"basedpyright",
"biome",
"black",
"lemminx",
"lua-language-server",
"ruby-lsp",
"ruff",
"shfmt",
"stylua",
},
},
}

View File

@@ -17,15 +17,12 @@ return {
"ninja", "ninja",
"rst", "rst",
"lua", "lua",
-- from extras -> go
"go",
"gomod",
"gowork",
"gosum",
-- --
"toml", "toml",
"json", "json",
"html", "html",
--
"ruby"
}, },
}, },
}, },

View File

@@ -3,7 +3,7 @@ return {
"folke/which-key.nvim", "folke/which-key.nvim",
opts = { opts = {
spec = { spec = {
{ "<leader>cL", "<cmd>LspRestart<CR>", icon = "🔄" }, { "<leader>cL", "<cmd>LspRestart<CR>", icon = "󰝳" },
}, },
win = { win = {
no_overlap = false, no_overlap = false,