feat(lsp): Set up vtsls, vue_ls, install miscellaneous plugins
This commit is contained in:
@@ -1,14 +1,20 @@
|
||||
---@type vim.lsp.Config
|
||||
local settings = {
|
||||
---@type lspconfig.settings.lua_ls
|
||||
settings = {
|
||||
Lua = {
|
||||
runtime = {
|
||||
version = 'LuaJIT',
|
||||
},
|
||||
workspace = { checkThirdParty = false, library = vim.list_extend({ vim.fn.expand('$VIMRUNTIME') }, vim.api.nvim_get_runtime_file('lua', true)) },
|
||||
},
|
||||
},
|
||||
---@type lspconfig.settings.lua_ls
|
||||
settings = {
|
||||
Lua = {
|
||||
hint = {
|
||||
enable = true,
|
||||
},
|
||||
runtime = {
|
||||
version = "LuaJIT",
|
||||
},
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = vim.list_extend({ vim.fn.expand("$VIMRUNTIME") }, vim.api.nvim_get_runtime_file("lua", true)),
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return settings
|
||||
|
||||
41
after/lsp/vtsls.lua
Normal file
41
after/lsp/vtsls.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
---@type lspconfig.Config
|
||||
return {
|
||||
filetypes = {
|
||||
"javascript",
|
||||
"typescript",
|
||||
"vue",
|
||||
},
|
||||
settings = {
|
||||
---@type lspconfig.settings.vtsls
|
||||
vtsls = {
|
||||
tsserver = {
|
||||
globalPlugins = {
|
||||
{
|
||||
name = "@vue/typescript-plugin",
|
||||
location = require("mason-registry").get_package("vue-language-server"):get_install_path(),
|
||||
languages = { "vue" },
|
||||
configNamespace = "typescript",
|
||||
},
|
||||
},
|
||||
},
|
||||
suggest = {
|
||||
autoImports = true,
|
||||
},
|
||||
updateImportsOnFileMove = { enabled = "always" },
|
||||
inlayHints = {
|
||||
enumMemberValues = {
|
||||
enabled = true,
|
||||
},
|
||||
parameterNames = {
|
||||
enabled = "literals",
|
||||
},
|
||||
parameterTypes = {
|
||||
enabled = true,
|
||||
},
|
||||
propertyDeclarationTypes = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
2
after/lsp/vue_ls.lua
Normal file
2
after/lsp/vue_ls.lua
Normal file
@@ -0,0 +1,2 @@
|
||||
---@type lspconfig.Config
|
||||
return {}
|
||||
8
after/plugin/gitsigns.lua
Normal file
8
after/plugin/gitsigns.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
local gitsigns = require("gitsigns")
|
||||
|
||||
gitsigns.setup({
|
||||
current_line_blame = true,
|
||||
current_line_blame_opts = {
|
||||
delay = 100,
|
||||
},
|
||||
})
|
||||
3
after/plugin/lualine.lua
Normal file
3
after/plugin/lualine.lua
Normal file
@@ -0,0 +1,3 @@
|
||||
local lualine = require("lualine")
|
||||
|
||||
lualine.setup({})
|
||||
12
after/plugin/null_ls.lua
Normal file
12
after/plugin/null_ls.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
local null_ls = require("null-ls")
|
||||
|
||||
local options = {
|
||||
sources = {
|
||||
null_ls.builtins.diagnostics.phpcs.with({
|
||||
command = "phpcs",
|
||||
args = { "--report=json", "--stdin-path=$FILENAME", "-" },
|
||||
}),
|
||||
},
|
||||
}
|
||||
|
||||
null_ls.setup(options)
|
||||
28
after/plugin/tree.lua
Normal file
28
after/plugin/tree.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
local tree = require("nvim-tree")
|
||||
local utils = require("utils")
|
||||
local api = require("nvim-tree.api")
|
||||
|
||||
local function on_attach(bufnr)
|
||||
api.map.on_attach.default(bufnr)
|
||||
end
|
||||
|
||||
---@type nvim_tree.config
|
||||
local options = {
|
||||
update_focused_file = {
|
||||
enable = true,
|
||||
exclude = function(args)
|
||||
for _, dir in ipairs({ "node_modules", "vendor", ".git" }) do
|
||||
if args.file:find(dir, 1, true) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
return false
|
||||
end,
|
||||
},
|
||||
on_attach = on_attach,
|
||||
}
|
||||
|
||||
tree.setup(options)
|
||||
|
||||
utils.nmap("<leader>e", api.tree.toggle, "nvim-tree: toggle")
|
||||
Reference in New Issue
Block a user