Moved ts tools to seperate file
This commit is contained in:
35
lua/taken/core/on_attach.lua
Normal file
35
lua/taken/core/on_attach.lua
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
local on_attach = function(client, bufnr)
|
||||||
|
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||||
|
vim.keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
||||||
|
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
||||||
|
vim.keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts)
|
||||||
|
vim.keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts)
|
||||||
|
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
||||||
|
vim.keymap.set("n", "K", function()
|
||||||
|
vim.lsp.buf.hover()
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>vws", function()
|
||||||
|
vim.lsp.buf.workspace_symbol()
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>vd", function()
|
||||||
|
vim.diagnostic.open_float()
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set("n", "[d", function()
|
||||||
|
vim.diagnostic.goto_next()
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set("n", "]d", function()
|
||||||
|
vim.diagnostic.goto_prev()
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set("n", "<leader>vca", function()
|
||||||
|
vim.lsp.buf.code_action()
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts)
|
||||||
|
vim.keymap.set("n", "<leader>vrn", function()
|
||||||
|
vim.lsp.buf.rename()
|
||||||
|
end, opts)
|
||||||
|
vim.keymap.set("i", "<C-h>", function()
|
||||||
|
vim.lsp.buf.signature_help()
|
||||||
|
end, opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
return on_attach
|
||||||
@@ -1,17 +1,22 @@
|
|||||||
return {
|
return {
|
||||||
"lukas-reineke/indent-blankline.nvim",
|
"lukas-reineke/indent-blankline.nvim",
|
||||||
|
main = "ibl",
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
config = function()
|
config = function()
|
||||||
local blankline = require("indent_blankline")
|
local blankline = require("ibl")
|
||||||
|
|
||||||
vim.opt.list = true
|
vim.opt.list = true
|
||||||
vim.opt.listchars:append("space:⋅")
|
vim.opt.listchars:append("space:⋅")
|
||||||
|
|
||||||
blankline.setup({
|
blankline.setup({
|
||||||
show_end_of_line = false,
|
indent = {
|
||||||
space_char_blankline = " ",
|
char = "│",
|
||||||
show_current_context = true,
|
highlight = { "Function", "Label" },
|
||||||
show_current_context_start = true,
|
},
|
||||||
|
-- show_end_of_line = false,
|
||||||
|
-- space_char_blankline = " ",
|
||||||
|
-- show_current_context = true,
|
||||||
|
-- show_current_context_start = true,
|
||||||
})
|
})
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,50 +3,14 @@ return {
|
|||||||
dependencies = {
|
dependencies = {
|
||||||
"hrsh7th/cmp-nvim-lsp",
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
"folke/neodev.nvim",
|
"folke/neodev.nvim",
|
||||||
"pmizio/typescript-tools.nvim",
|
|
||||||
"nvim-lua/plenary.nvim",
|
|
||||||
},
|
},
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
config = function()
|
config = function()
|
||||||
local neodev = require("neodev")
|
local neodev = require("neodev")
|
||||||
local lspconfig = require("lspconfig")
|
local lspconfig = require("lspconfig")
|
||||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||||
local typescript_tools = require("typescript-tools")
|
|
||||||
|
|
||||||
local on_attach = function(client, bufnr)
|
|
||||||
local opts = { noremap = true, silent = true, buffer = bufnr }
|
|
||||||
vim.keymap.set("n", "gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
|
||||||
vim.keymap.set("n", "gD", vim.lsp.buf.declaration, opts)
|
|
||||||
vim.keymap.set("n", "gi", "<cmd>Telescope lsp_implementations<CR>", opts)
|
|
||||||
vim.keymap.set("n", "gt", "<cmd>Telescope lsp_type_definitions<CR>", opts)
|
|
||||||
vim.keymap.set("n", "<leader>rn", vim.lsp.buf.rename, opts)
|
|
||||||
vim.keymap.set("n", "K", function()
|
|
||||||
vim.lsp.buf.hover()
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vws", function()
|
|
||||||
vim.lsp.buf.workspace_symbol()
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vd", function()
|
|
||||||
vim.diagnostic.open_float()
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set("n", "[d", function()
|
|
||||||
vim.diagnostic.goto_next()
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set("n", "]d", function()
|
|
||||||
vim.diagnostic.goto_prev()
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set("n", "<leader>vca", function()
|
|
||||||
vim.lsp.buf.code_action()
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set("n", "gR", "<cmd>Telescope lsp_references<CR>", opts)
|
|
||||||
vim.keymap.set("n", "<leader>vrn", function()
|
|
||||||
vim.lsp.buf.rename()
|
|
||||||
end, opts)
|
|
||||||
vim.keymap.set("i", "<C-h>", function()
|
|
||||||
vim.lsp.buf.signature_help()
|
|
||||||
end, opts)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
local on_attach = require("taken.core.on_attach")
|
||||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||||
|
|
||||||
local signs = { Error = " ", Warn = " ", Hint = "ﴞ ", Info = " " }
|
local signs = { Error = " ", Warn = " ", Hint = "ﴞ ", Info = " " }
|
||||||
@@ -72,18 +36,6 @@ return {
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
typescript_tools.setup({
|
|
||||||
capabilities = capabilities,
|
|
||||||
on_attach = on_attach,
|
|
||||||
settings = {
|
|
||||||
tsserver_file_preferences = {
|
|
||||||
includeInlayParameterNameHints = "all",
|
|
||||||
includeCompletionsForModuleExports = true,
|
|
||||||
quotePreference = "auto",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
lspconfig["html"].setup({
|
lspconfig["html"].setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
|
|||||||
27
lua/taken/plugins/lsp/ts-tools.lua
Normal file
27
lua/taken/plugins/lsp/ts-tools.lua
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
return {
|
||||||
|
"pmizio/typescript-tools.nvim",
|
||||||
|
dependencies = {
|
||||||
|
"nvim-lua/plenary.nvim",
|
||||||
|
"neovim/nvim-lspconfig",
|
||||||
|
"hrsh7th/cmp-nvim-lsp",
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
local typescript_tools = require("typescript-tools")
|
||||||
|
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||||
|
|
||||||
|
local on_attach = require("taken.core.on_attach")
|
||||||
|
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||||
|
|
||||||
|
typescript_tools.setup({
|
||||||
|
capabilities = capabilities,
|
||||||
|
on_attach = on_attach,
|
||||||
|
settings = {
|
||||||
|
tsserver_file_preferences = {
|
||||||
|
includeInlayParameterNameHints = "all",
|
||||||
|
includeCompletionsForModuleExports = true,
|
||||||
|
quotePreference = "auto",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
end,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user