refactor(nvim): move typescript-tools into lspconfig configuration

This commit is contained in:
Price Hiller 2023-06-30 16:22:44 -05:00
parent 3036b24af6
commit f410a1a34e
No known key found for this signature in database
2 changed files with 25 additions and 29 deletions

View File

@ -4,6 +4,9 @@ local lspconfig = require("lspconfig")
-- NOTE: Keep this near top -- NOTE: Keep this near top
mason_lspconfig.setup({ mason_lspconfig.setup({
automatic_installation = true, automatic_installation = true,
ensure_installed = {
"tsserver",
},
}) })
local function on_attach(client, bufnr) local function on_attach(client, bufnr)
@ -14,7 +17,7 @@ local function on_attach(client, bufnr)
-- Enable inlay hints if the language server provides them -- Enable inlay hints if the language server provides them
if client.server_capabilities.inlayHintProvider then if client.server_capabilities.inlayHintProvider then
vim.lsp.buf.inlay_hint(bufnr, true) vim.lsp.inlay_hint(bufnr, true)
end end
end end
@ -44,7 +47,7 @@ local rustopts = {
inlay_hints = { inlay_hints = {
-- automatically set inlay hints (type hints) -- automatically set inlay hints (type hints)
-- default: true -- default: true
auto = false, auto = true,
-- Only show inlay hints for the current line -- Only show inlay hints for the current line
only_current_line = false, only_current_line = false,
-- whether to show parameter hints with the inlay hints or not -- whether to show parameter hints with the inlay hints or not
@ -287,25 +290,20 @@ lspconfig.texlab.setup({
}, },
}) })
local path = vim.fn.stdpath("config") .. "/spell/en.utf-8.add" -- Custom config from typescript tools
local words = {} require("typescript-tools").setup({
on_attach = on_attach,
for word in io.open(path, "r"):lines() do settings = {
table.insert(words, word) tsserver_file_preferences = {
end includeInlayParameterNameHints = "all",
includeInlayEnumMemberValueHints = true,
-- lspconfig.ltex.setup({ includeInlayFunctionLikeReturnTypeHints = true,
-- settings = { includeInlayFunctionParameterTypeHints = true,
-- ltex = { includeInlayPropertyDeclarationTypeHints = true,
-- dictionary = { includeInlayVariableTypeHints = true,
-- ["en-US"] = words, },
-- }, },
-- }, })
-- },
-- filetypes = { "bib", "markdown", "org", "plaintex", "rst", "rnoweb", "tex", "pandoc" },
-- capabilities = lsp_capabilities,
-- on_attach = on_attach,
-- })
-- NOTE: GENERIC LSP SERVERS -- NOTE: GENERIC LSP SERVERS
for _, server in ipairs({ for _, server in ipairs({

View File

@ -152,7 +152,6 @@ lazy.setup({
-- Lspconfig -- Lspconfig
{ {
"neovim/nvim-lspconfig", "neovim/nvim-lspconfig",
event = "VimEnter",
dependencies = { dependencies = {
"folke/neodev.nvim", "folke/neodev.nvim",
"Decodetalkers/csharpls-extended-lsp.nvim", "Decodetalkers/csharpls-extended-lsp.nvim",
@ -161,6 +160,11 @@ lazy.setup({
"simrat39/rust-tools.nvim", "simrat39/rust-tools.nvim",
"Hoffs/omnisharp-extended-lsp.nvim", "Hoffs/omnisharp-extended-lsp.nvim",
"b0o/schemastore.nvim", "b0o/schemastore.nvim",
{
"pmizio/typescript-tools.nvim",
dependencies = { "nvim-lua/plenary.nvim" },
},
}, },
config = function() config = function()
require("mason").setup({}) require("mason").setup({})
@ -168,12 +172,6 @@ lazy.setup({
end, end,
}, },
{
"pmizio/typescript-tools.nvim",
dependencies = { "nvim-lua/plenary.nvim", "neovim/nvim-lspconfig" },
opts = {},
},
-- Show code actions -- Show code actions
{ {
"kosayoda/nvim-lightbulb", "kosayoda/nvim-lightbulb",
@ -575,7 +573,7 @@ lazy.setup({
"tex", "tex",
"plaintex", "plaintex",
}, },
opts = {} opts = {},
}, },
-- Tint inactive windows -- Tint inactive windows