feat: properly enable inlay hints
This commit is contained in:
parent
d58e5172ec
commit
ac37fc73ff
5 changed files with 12 additions and 0 deletions
|
@ -8,6 +8,8 @@ local config = {
|
||||||
border = 'rounded',
|
border = 'rounded',
|
||||||
-- LSP settings
|
-- LSP settings
|
||||||
lsp = {
|
lsp = {
|
||||||
|
-- Enable/disable inlay hints
|
||||||
|
inlay_hint = false,
|
||||||
-- True/false or table of filetypes {'.ts', '.js',}
|
-- True/false or table of filetypes {'.ts', '.js',}
|
||||||
format_on_save = true,
|
format_on_save = true,
|
||||||
-- Time in MS before format timeout
|
-- Time in MS before format timeout
|
||||||
|
|
|
@ -19,6 +19,7 @@ local default_config = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
lsp = {
|
lsp = {
|
||||||
|
inlay_hint = false,
|
||||||
format_on_save = true, -- true/false or table of filetypes {'.ts', '.js',}
|
format_on_save = true, -- true/false or table of filetypes {'.ts', '.js',}
|
||||||
format_timeout = 2000,
|
format_timeout = 2000,
|
||||||
rename_notification = true,
|
rename_notification = true,
|
||||||
|
|
|
@ -12,6 +12,10 @@ function M.on_attach(client, bufnr)
|
||||||
-- Enable completion triggered by <c-x><c-o>
|
-- Enable completion triggered by <c-x><c-o>
|
||||||
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||||
|
|
||||||
|
if user_config.lsp.inlay_hint and client.server_capabilities.inlayHintProvider then
|
||||||
|
vim.lsp.inlay_hint(bufnr, true)
|
||||||
|
end
|
||||||
|
|
||||||
if client.supports_method('textDocument/formatting') then
|
if client.supports_method('textDocument/formatting') then
|
||||||
-- set up :LspFormat for clients that are capable
|
-- set up :LspFormat for clients that are capable
|
||||||
vim.cmd(string.format("command! LspFormat lua require('cosmic.utils.lsp').format(%s)", bufnr))
|
vim.cmd(string.format("command! LspFormat lua require('cosmic.utils.lsp').format(%s)", bufnr))
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
return {
|
return {
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
|
hint = {
|
||||||
|
enable = true,
|
||||||
|
},
|
||||||
diagnostics = {
|
diagnostics = {
|
||||||
-- Get the language server to recognize the `vim` global
|
-- Get the language server to recognize the `vim` global
|
||||||
globals = { 'vim' },
|
globals = { 'vim' },
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
local default_on_attach = require('cosmic.lsp.providers.defaults').on_attach
|
local default_on_attach = require('cosmic.lsp.providers.defaults').on_attach
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
M.init_options = require('nvim-lsp-ts-utils').init_options
|
||||||
|
|
||||||
function M.on_attach(client, bufnr)
|
function M.on_attach(client, bufnr)
|
||||||
default_on_attach(client, bufnr)
|
default_on_attach(client, bufnr)
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue