Skip to content

Commit

Permalink
fix: Modify inlay hints config
Browse files Browse the repository at this point in the history
  • Loading branch information
MysticalDevil committed Nov 9, 2023
1 parent 9b85587 commit aeeadb6
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 30 deletions.
3 changes: 2 additions & 1 deletion .luarc.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@
"/home/delta/.local/share/nvim/lazy/project.nvim/lua",
"/home/delta/.config/nvim/lua",
"/home/delta/.config/nvim/lua",
"/home/delta/.local/share/nvim/mason/packages/lua-language-server/libexec/meta/6dde68a1"
"/home/delta/.local/share/nvim/mason/packages/lua-language-server/libexec/meta/6dde68a1",
"${3rd}/luv/library"
]
}
4 changes: 2 additions & 2 deletions lua/devil/configs/plugin/typescript-tools.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ local opts = {
displayPartsForJSDoc = true,
disableLineTextInReferences = true,
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayParameterNameHintsWhenArgumentMatchesName = false,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayVariableTypeHintsWhenTypeMatchesName = true,
includeInlayVariableTypeHintsWhenTypeMatchesName = false,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
Expand Down
40 changes: 20 additions & 20 deletions lua/devil/lsp/config/tsserver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@ opts.filetypes =
opts.settings = {
settings = {
typescript = {
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayVariableTypeHintsWhenTypeMatchesName = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
-- inlayHints = {
-- includeInlayParameterNameHints = "all",
-- includeInlayParameterNameHintsWhenArgumentMatchesName = true,
-- includeInlayFunctionParameterTypeHints = true,
-- includeInlayVariableTypeHints = true,
-- includeInlayVariableTypeHintsWhenTypeMatchesName = true,
-- includeInlayPropertyDeclarationTypeHints = true,
-- includeInlayFunctionLikeReturnTypeHints = true,
-- includeInlayEnumMemberValueHints = true,
-- },
},
javascript = {
inlayHints = {
includeInlayParameterNameHints = "all",
includeInlayParameterNameHintsWhenArgumentMatchesName = true,
includeInlayFunctionParameterTypeHints = true,
includeInlayVariableTypeHints = true,
includeInlayVariableTypeHintsWhenTypeMatchesName = true,
includeInlayPropertyDeclarationTypeHints = true,
includeInlayFunctionLikeReturnTypeHints = true,
includeInlayEnumMemberValueHints = true,
},
-- inlayHints = {
-- includeInlayParameterNameHints = "all",
-- includeInlayParameterNameHintsWhenArgumentMatchesName = true,
-- includeInlayFunctionParameterTypeHints = true,
-- includeInlayVariableTypeHints = true,
-- includeInlayVariableTypeHintsWhenTypeMatchesName = true,
-- includeInlayPropertyDeclarationTypeHints = true,
-- includeInlayFunctionLikeReturnTypeHints = true,
-- includeInlayEnumMemberValueHints = true,
-- },
},
},
}
Expand Down
6 changes: 1 addition & 5 deletions lua/devil/lsp/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ function M.enable_inlay_hints_autocmd()
local bufnr = args.buf
local client = vim.lsp.get_client_by_id(args.data.client_id)

if client then
if client.name == "null-ls" then
return
end

if client and require("devil.utils").not_proxy_lsp(client.name) then
M.set_inlay_hints(client, bufnr)
end
end,
Expand Down
1 change: 1 addition & 0 deletions lua/devil/utils/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ M.deep_print = common.deep_print
M.kind_icons = common.kind_icons

local lsp_tool = require("devil.utils.lsp_tool")
M.not_proxy_lsp = lsp_tool.not_proxy_lsp
M.async_formatting = lsp_tool.async_formatting
M.get_lsp_info = lsp_tool.get_lsp_info

Expand Down
6 changes: 4 additions & 2 deletions lua/devil/utils/lsp_tool.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ local proxy_lsps = {
["null-ls"] = true,
["efm"] = true,
["emmet_ls"] = true,
["eslint"] = true,
["cssmodule_ls"] = true,
}
-- Determine whether the obtained LSP is a proxy LSP
---@param name string
---@return boolean
local function not_proxy_lsp(name)
function M.not_proxy_lsp(name)
return not proxy_lsps[name]
end

Expand Down Expand Up @@ -67,7 +69,7 @@ function M.get_lsp_info()

for _, client in ipairs(clients) do
if client.config["filetypes"] and vim.tbl_contains(client.config["filetypes"], buf_ft) then
if not_proxy_lsp(client.name) then
if M.not_proxy_lsp(client.name) then
non_proxy_clients[buf_ft] = client
return format_client_name(client.name)
end
Expand Down

0 comments on commit aeeadb6

Please sign in to comment.