misc settings

This commit is contained in:
Alexander Gehrke 2025-05-28 17:30:44 +02:00
parent a3935e52f0
commit 4742d5b88e
5 changed files with 31 additions and 17 deletions

View file

@ -41,7 +41,11 @@ local function goToCSSClassDefinition()
if className then
require("nvim-quick-switcher").toggle("tsx", "scss", { only_existing = true })
local query = vim.treesitter.query.parse("scss", '((class_name) @cn (#eq? @cn "' .. className .. '"))')
local tree = vim.treesitter.get_node():tree()
local node = vim.treesitter.get_node()
if not node then
return false
end
local tree = node:tree()
vim.fn.setqflist({})
local start, _, stop, _ = tree:root():range()
local anyMatch = false

View file

@ -10,10 +10,20 @@ return {
LogPoint = ".>",
},
diagnostics = {
Error = "",
Warn = "",
Hint = "",
Info = "",
signs = {
text = {
[vim.diagnostic.severity.ERROR] = "",
[vim.diagnostic.severity.WARN] = "",
[vim.diagnostic.severity.HINT] = "",
[vim.diagnostic.severity.INFO] = "",
},
numhl = {
[vim.diagnostic.severity.ERROR] = "DiagnosticSignError",
[vim.diagnostic.severity.WARN] = "DiagnosticSignWarn",
[vim.diagnostic.severity.INFO] = "DiagnosticSignInfo",
[vim.diagnostic.severity.HINT] = "DiagnosticSignHint",
},
},
},
git = {
added = "",

View file

@ -88,10 +88,7 @@ return {
---@param opts PluginLspOpts
config = function(_, opts)
-- diagnostics
for name, icon in pairs(require("common").icons.diagnostics) do
name = "DiagnosticSign" .. name
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
end
vim.diagnostic.config(require("common").icons.diagnostics)
if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then
opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and ""

View file

@ -14,7 +14,8 @@ return {
local utils = require("telescope.utils")
-- stylua: ignore start
return {
{ ',,',
{
',,',
function()
builtin.fd { cwd = require("findroot")(utils.buffer_dir()) }
end,

View file

@ -9,6 +9,12 @@ local on_attach = function(args)
end
--
local function diag_jump(count)
return function()
vim.diagnostic.jump({ count = count, float = true })
end
end
-- Mappings.
-- stylua: ignore start
for _, mapping in ipairs({
@ -22,8 +28,9 @@ local on_attach = function(args)
{ '<M-s>', vim.lsp.codelens.run, "Run code lens" },
{ 'gr', function() require('telescope.builtin').lsp_references() end,"Go to references" },
{ '<M-e>', vim.diagnostic.open_float, "Open diagnostics" },
{ '[d', vim.diagnostic.goto_prev, "Go to previous diagnostic" },
{ ']d', vim.diagnostic.goto_next, "Go to next diagnostic" },
{ '[d', diag_jump(-1), "Go to previous diagnostic" },
{ ']d', diag_jump(1), "Go to next diagnostic" },
{ '<F2>', diag_jump(1), "Go to next diagnostic" },
{ '<M-q>', vim.diagnostic.setloclist, "Add buffer diagnostics to location list" },
{ "<leader>dc", function() require("dap").continue() end, "Debug: Continue" },
{ "<leader>dK", function() require("dap.ui.widgets").hover() end, "Debug: Hover" },
@ -47,11 +54,6 @@ local on_attach = function(args)
require("dap").repl.toggle()
end, { silent = true, desc = "Toogle debug REPL" })
if client.server_capabilities.signatureHelpProvider then
vim.cmd([[autocmd CursorHoldI * silent! lua vim.lsp.buf.signature_help()]])
vim.cmd([[autocmd CursorHold * lua vim.diagnostic.open_float({max_width = 100, focusable = false})]])
end
if client.server_capabilities.documentHighlightingProvider then
vim.cmd([[autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()]])
vim.cmd([[autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()]])