misc settings
This commit is contained in:
parent
a3935e52f0
commit
4742d5b88e
5 changed files with 31 additions and 17 deletions
|
@ -41,7 +41,11 @@ local function goToCSSClassDefinition()
|
||||||
if className then
|
if className then
|
||||||
require("nvim-quick-switcher").toggle("tsx", "scss", { only_existing = true })
|
require("nvim-quick-switcher").toggle("tsx", "scss", { only_existing = true })
|
||||||
local query = vim.treesitter.query.parse("scss", '((class_name) @cn (#eq? @cn "' .. className .. '"))')
|
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({})
|
vim.fn.setqflist({})
|
||||||
local start, _, stop, _ = tree:root():range()
|
local start, _, stop, _ = tree:root():range()
|
||||||
local anyMatch = false
|
local anyMatch = false
|
||||||
|
|
|
@ -10,10 +10,20 @@ return {
|
||||||
LogPoint = ".>",
|
LogPoint = ".>",
|
||||||
},
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
Error = " ",
|
signs = {
|
||||||
Warn = " ",
|
text = {
|
||||||
Hint = " ",
|
[vim.diagnostic.severity.ERROR] = " ",
|
||||||
Info = " ",
|
[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 = {
|
git = {
|
||||||
added = " ",
|
added = " ",
|
||||||
|
|
|
@ -88,10 +88,7 @@ return {
|
||||||
---@param opts PluginLspOpts
|
---@param opts PluginLspOpts
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
-- diagnostics
|
-- diagnostics
|
||||||
for name, icon in pairs(require("common").icons.diagnostics) do
|
vim.diagnostic.config(require("common").icons.diagnostics)
|
||||||
name = "DiagnosticSign" .. name
|
|
||||||
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
|
|
||||||
end
|
|
||||||
|
|
||||||
if type(opts.diagnostics.virtual_text) == "table" and opts.diagnostics.virtual_text.prefix == "icons" then
|
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 "●"
|
opts.diagnostics.virtual_text.prefix = vim.fn.has("nvim-0.10.0") == 0 and "●"
|
||||||
|
|
|
@ -14,7 +14,8 @@ return {
|
||||||
local utils = require("telescope.utils")
|
local utils = require("telescope.utils")
|
||||||
-- stylua: ignore start
|
-- stylua: ignore start
|
||||||
return {
|
return {
|
||||||
{ ',,',
|
{
|
||||||
|
',,',
|
||||||
function()
|
function()
|
||||||
builtin.fd { cwd = require("findroot")(utils.buffer_dir()) }
|
builtin.fd { cwd = require("findroot")(utils.buffer_dir()) }
|
||||||
end,
|
end,
|
||||||
|
|
|
@ -9,6 +9,12 @@ local on_attach = function(args)
|
||||||
end
|
end
|
||||||
--
|
--
|
||||||
|
|
||||||
|
local function diag_jump(count)
|
||||||
|
return function()
|
||||||
|
vim.diagnostic.jump({ count = count, float = true })
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
-- Mappings.
|
-- Mappings.
|
||||||
-- stylua: ignore start
|
-- stylua: ignore start
|
||||||
for _, mapping in ipairs({
|
for _, mapping in ipairs({
|
||||||
|
@ -22,8 +28,9 @@ local on_attach = function(args)
|
||||||
{ '<M-s>', vim.lsp.codelens.run, "Run code lens" },
|
{ '<M-s>', vim.lsp.codelens.run, "Run code lens" },
|
||||||
{ 'gr', function() require('telescope.builtin').lsp_references() end,"Go to references" },
|
{ 'gr', function() require('telescope.builtin').lsp_references() end,"Go to references" },
|
||||||
{ '<M-e>', vim.diagnostic.open_float, "Open diagnostics" },
|
{ '<M-e>', vim.diagnostic.open_float, "Open diagnostics" },
|
||||||
{ '[d', vim.diagnostic.goto_prev, "Go to previous diagnostic" },
|
{ '[d', diag_jump(-1), "Go to previous diagnostic" },
|
||||||
{ ']d', vim.diagnostic.goto_next, "Go to next 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" },
|
{ '<M-q>', vim.diagnostic.setloclist, "Add buffer diagnostics to location list" },
|
||||||
{ "<leader>dc", function() require("dap").continue() end, "Debug: Continue" },
|
{ "<leader>dc", function() require("dap").continue() end, "Debug: Continue" },
|
||||||
{ "<leader>dK", function() require("dap.ui.widgets").hover() end, "Debug: Hover" },
|
{ "<leader>dK", function() require("dap.ui.widgets").hover() end, "Debug: Hover" },
|
||||||
|
@ -47,11 +54,6 @@ local on_attach = function(args)
|
||||||
require("dap").repl.toggle()
|
require("dap").repl.toggle()
|
||||||
end, { silent = true, desc = "Toogle debug REPL" })
|
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
|
if client.server_capabilities.documentHighlightingProvider then
|
||||||
vim.cmd([[autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()]])
|
vim.cmd([[autocmd CursorHold <buffer> lua vim.lsp.buf.document_highlight()]])
|
||||||
vim.cmd([[autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()]])
|
vim.cmd([[autocmd CursorHoldI <buffer> lua vim.lsp.buf.document_highlight()]])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue