aboutsummaryrefslogtreecommitdiff
path: root/.config/nvim/lua/lsp.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/nvim/lua/lsp.lua')
-rw-r--r--.config/nvim/lua/lsp.lua55
1 files changed, 51 insertions, 4 deletions
diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua
index 5610629..9f9253a 100644
--- a/.config/nvim/lua/lsp.lua
+++ b/.config/nvim/lua/lsp.lua
@@ -66,18 +66,53 @@ cmp.setup({
local on_attach = function(client, bufnr)
vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc")
- local inlayhints = require("lsp-inlayhints")
- inlayhints.setup()
- inlayhints.on_attach(client, bufnr)
local lsp_signature = require("lsp_signature")
lsp_signature.on_attach({ bind = true }, bufnr)
+ require("lsp-inlayhints").setup()
+ require("lsp-inlayhints").on_attach(client, bufnr)
end
+vim.api.nvim_create_augroup("LspAttach_inlayhints", {})
+vim.api.nvim_create_autocmd("LspAttach", {
+ group = "LspAttach_inlayhints";
+ callback = function(args)
+ if not (args.data and args.data.client_id) then return end
+
+ local bufnr = args.buf
+ local client = vim.lsp.get_client_by_id(args.data.client_id)
+ require("lsp-inlayhints").on_attach(client, bufnr)
+ end;
+})
+
local lsputils = require("lspconfig").util
require("lspconfig").tsserver.setup({
on_attach = on_attach;
root_dir = lsputils.root_pattern("package.json", "tsconfig.json");
+ settings = {
+ typescript = {
+ inlayHints = {
+ includeInlayParameterNameHints = "all";
+ includeInlayParameterNameHintsWhenArgumentMatchesName = true;
+ includeInlayFunctionParameterTypeHints = true;
+ includeInlayVariableTypeHints = true;
+ includeInlayPropertyDeclarationTypeHints = true;
+ includeInlayFunctionLikeReturnTypeHints = true;
+ includeInlayEnumMemberValueHints = true;
+ };
+ };
+ javascript = {
+ inlayHints = {
+ includeInlayParameterNameHints = "all";
+ includeInlayParameterNameHintsWhenArgumentMatchesName = true;
+ includeInlayFunctionParameterTypeHints = true;
+ includeInlayVariableTypeHints = true;
+ includeInlayPropertyDeclarationTypeHints = true;
+ includeInlayFunctionLikeReturnTypeHints = true;
+ includeInlayEnumMemberValueHints = true;
+ };
+ };
+ };
})
require("deno-nvim").setup({
@@ -85,7 +120,19 @@ require("deno-nvim").setup({
root_dir = vim.loop.cwd;
capabilities = capabilities;
on_attach = on_attach;
- settings = { enable = true; unstable = true; config = "./deno.jsonc" };
+ settings = {
+ deno = {
+ unstable = true;
+ inlayHints = {
+ enumMemberValues = { enabled = true };
+ functionLikeReturnTypes = { enabled = true };
+ parameterNames = { enabled = "all" };
+ parameterTypes = { enabled = true };
+ propertyDeclarationTypes = { enabled = true };
+ variableTypes = { enabled = true; suppressWhenTypeMatchesName = false };
+ };
+ };
+ };
};
});