nvim: disable inlay hint request for cabal

This commit is contained in:
Primrose 2025-07-03 19:56:18 +02:00
parent 21ed72823f
commit 927f6bc4ef
Signed by: primrose
GPG key ID: 4E887A4CA9714ADA

View file

@ -1,4 +1,5 @@
local map = vim.keymap.set
local methods = vim.lsp.protocol.Methods
----------------------
-- Language servers --
@ -75,22 +76,31 @@ local servers = {
-------------
-- Helpers --
-------------
local on_attach = function(client, bufno)
vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = bufno })
local ts = require("telescope.builtin")
local opts = { buffer = bufno }
local on_attach = function(client, bufnr)
vim.api.nvim_set_option_value("omnifunc", "v:lua.vim.lsp.omnifunc", { buf = bufnr })
local telescope = require("telescope.builtin")
map("n", "K", vim.lsp.buf.hover, opts)
map("n", "<C-k>", vim.lsp.buf.signature_help, opts)
map("n", "gd", vim.lsp.buf.definition, opts)
map("n", "K", vim.lsp.buf.hover, { buffer = bufnr })
map("n", "<C-k>", vim.lsp.buf.signature_help, { buffer = bufnr })
map("n", "gd", vim.lsp.buf.definition, { buffer = bufnr })
-- conflicts with tabs
-- map("n", "gtd", vim.lsp.buf.type_definition, opts)
map("n", "gi", vim.lsp.buf.implementation, opts)
map("n", "gu", ts.lsp_references, opts)
map("n", "<leader>ca", vim.lsp.buf.code_action, opts)
map("n", "<leader>cl", vim.lsp.codelens.run, opts)
map("n", "<leader>r", vim.lsp.buf.rename, opts)
map("n", "<leader>f", function() vim.lsp.buf.format { async = true } end, opts)
-- map("n", "gtd", vim.lsp.buf.type_definition, { buffer = bufnr })
map("n", "gi", vim.lsp.buf.implementation, { buffer = bufnr })
map("n", "gu", telescope.lsp_references, { buffer = bufnr })
map("n", "<leader>ca", vim.lsp.buf.code_action, { buffer = bufnr })
map("n", "<leader>cl", vim.lsp.codelens.run, { buffer = bufnr })
map("n", "<leader>r", vim.lsp.buf.rename, { buffer = bufnr })
map("n", "<leader>f", function() vim.lsp.buf.format { async = true } end, { buffer = bufnr })
local filetype = vim.api.nvim_get_option_value("filetype", { buf = bufnr })
if
client:supports_method(methods.textDocument_inlayHint)
-- Never start cabal with inlay hint request
-- Related: https://github.com/mrcjkb/haskell-tools.nvim/discussions/485
and filetype ~= "cabal"
then
vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })
end
end
-- Helix style border
@ -117,9 +127,6 @@ vim.diagnostic.config { virtual_text = false, severity_sort = true }
-- Set log level
vim.lsp.set_log_level("off")
-- Enable inlay hints
vim.lsp.inlay_hint.enable()
-- Gutter symbols setup
vim.fn.sign_define("DiagnosticSignError", { text = "E", texthl = "DiagnosticSignError", numhl = "DiagnosticSignError" })
vim.fn.sign_define("DiagnosticSignWarn", { text = "W", texthl = "DiagnosticSignWarn", numhl = "DiagnosticSignWarn" })