feat: inlay hints for ts and more LSPs
This commit is contained in:
@@ -15,6 +15,15 @@ vim.filetype.add({extension = {svx = "markdown"}})
|
|||||||
vim.cmd('syntax enable')
|
vim.cmd('syntax enable')
|
||||||
vim.cmd('filetype plugin indent on')
|
vim.cmd('filetype plugin indent on')
|
||||||
|
|
||||||
require("config.lazy")
|
|
||||||
|
|
||||||
|
require("config.lazy")
|
||||||
--vim.cmd[[colorscheme tokyonight]]
|
--vim.cmd[[colorscheme tokyonight]]
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command(
|
||||||
|
"Inlay",
|
||||||
|
function()
|
||||||
|
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
|
||||||
|
end,
|
||||||
|
{desc = 'Toggles Inlay Hints'}
|
||||||
|
)
|
||||||
|
|
||||||
|
|||||||
29
.config/nvim/lsp/ts_ls.lua
Normal file
29
.config/nvim/lsp/ts_ls.lua
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
return {
|
||||||
|
settings = {
|
||||||
|
typescript = {
|
||||||
|
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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -18,7 +19,12 @@ return {
|
|||||||
{
|
{
|
||||||
"williamboman/mason-lspconfig.nvim",
|
"williamboman/mason-lspconfig.nvim",
|
||||||
opts = {
|
opts = {
|
||||||
ensure_installed = { "clangd" },
|
ensure_installed = {
|
||||||
|
"svelte",
|
||||||
|
"clangd",
|
||||||
|
"ts_ls",
|
||||||
|
"pyright"
|
||||||
|
},
|
||||||
},
|
},
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{ "mason-org/mason.nvim", opts = {} },
|
{ "mason-org/mason.nvim", opts = {} },
|
||||||
@@ -34,6 +40,7 @@ return {
|
|||||||
{ name = 'path' },
|
{ name = 'path' },
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
event = "InsertEnter",
|
||||||
dependencies = {
|
dependencies = {
|
||||||
{'L3MON4D3/LuaSnip'},
|
{'L3MON4D3/LuaSnip'},
|
||||||
{'hrsh7th/cmp-buffer'},
|
{'hrsh7th/cmp-buffer'},
|
||||||
@@ -47,13 +54,14 @@ return {
|
|||||||
-- Define your formatters
|
-- Define your formatters
|
||||||
formatters_by_ft = {
|
formatters_by_ft = {
|
||||||
cpp = { "clang-format" },
|
cpp = { "clang-format" },
|
||||||
|
python = {"black"}
|
||||||
},
|
},
|
||||||
-- Set default options
|
-- Set default options
|
||||||
default_format_opts = {
|
default_format_opts = {
|
||||||
lsp_format = "fallback",
|
lsp_format = "fallback",
|
||||||
},
|
},
|
||||||
-- Set up format-on-save
|
-- Set up format-on-save
|
||||||
format_on_save = { timeout_ms = 500 },
|
format_on_save = { timeout_ms = 1000 },
|
||||||
-- Customize formatters
|
-- Customize formatters
|
||||||
formatters = {
|
formatters = {
|
||||||
['clang-format'] = {
|
['clang-format'] = {
|
||||||
@@ -65,3 +73,4 @@ return {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ return{
|
|||||||
local configs = require("nvim-treesitter.configs")
|
local configs = require("nvim-treesitter.configs")
|
||||||
|
|
||||||
configs.setup({
|
configs.setup({
|
||||||
ensure_installed = { "c", "cpp", "lua", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html" },
|
ensure_installed = { "c", "cpp","haskell", "lua","svelte","python", "vim", "vimdoc", "query", "elixir", "heex", "javascript", "html" },
|
||||||
sync_install = false,
|
sync_install = false,
|
||||||
highlight = { enable = true },
|
highlight = { enable = true },
|
||||||
indent = { enable = true },
|
indent = { enable = true },
|
||||||
|
|||||||
Reference in New Issue
Block a user