-
Notifications
You must be signed in to change notification settings - Fork 0
/
completion.lua
164 lines (158 loc) · 5.67 KB
/
completion.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
return {
{
"folke/trouble.nvim",
-- opts will be merged with the parent spec
opts = { use_diagnostic_signs = true },
},
{
"olexsmir/gopher.nvim",
dependencies = { -- dependencies
"nvim-lua/plenary.nvim",
"nvim-treesitter/nvim-treesitter",
},
ft = "go",
config = function()
require("gopher").setup({})
end,
build = function()
vim.cmd([[silent! GoInstallDeps]])
end,
},
{
"kylechui/nvim-surround",
version = "*", -- Use for stability; omit to use `main` branch for the latest features
event = "VeryLazy",
config = function()
require("nvim-surround").setup({
-- Configuration here, or leave empty to use defaults
})
end,
},
-- add symbols-outline
{
"simrat39/symbols-outline.nvim",
cmd = "SymbolsOutline",
keys = { { "<leader>cs", "<cmd>SymbolsOutline<cr>", desc = "Symbols Outline" } },
config = true,
},
{
"dmmulroy/tsc.nvim",
config = function()
require("tsc").setup({
enable_progress_notifications = true,
})
end,
},
-- add tsserver and setup with typescript.nvim instead of lspconfig
{
"neovim/nvim-lspconfig",
dependencies = {
"jose-elias-alvarez/typescript.nvim",
init = function()
require("lazyvim.util").on_attach(function(_, buffer)
-- stylua: ignore
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
end)
end,
},
---@class PluginLspOpts
opts = {
---@type lspconfig.options
servers = {
-- tsserver will be automatically installed with mason and loaded with lspconfig
dockerls = {},
docker_compose_language_service = {},
intelephense = {
---@type lspconfig.options.intelephense
init_options = {
licenseKey = os.getenv("INTELEPHENSE_LICENSE_KEY"),
files = {
maxSize = 1000000,
},
},
},
---@type lspconfig.options.lua_ls
lua_ls = {
settings = {
Lua = {
diagnostics = {
-- Get the language server to recognize the `vim` global
globals = { "vim" },
},
},
},
},
gopls = {
cmd = { "gopls" },
filetypes = { "go", "gomod", "gowork", "gotmpl" },
settings = {
gopls = {
completeUnimported = true,
usePlaceholders = true,
analyses = {
unusedparams = true,
},
},
},
},
phpactor = {
init_options = {
["language_server_phpstan.enabled"] = false,
["language_server_psalm.enabled"] = false,
["language_server.diagnostics_on_update"] = true,
["language_server.diagnostics_on_save"] = true,
["language_server.diagnostics_on_open"] = true,
},
},
},
-- you can do any additional lsp server setup here
-- return true if you don't want this server to be setup with lspconfig
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
setup = {
-- Specify * to use this function as a fallback for any server
tsserver = function(_, opts)
require("lazyvim.util").on_attach(function(client, buffer)
if client.name == "tsserver" then
-- stylua: ignore
vim.keymap.set("n", "<leader>co", "<cmd>TypescriptOrganizeImports<CR>", { buffer = buffer, desc = "Organize Imports" })
-- stylua: ignore
vim.keymap.set("n", "<leader>cR", "<cmd>TypescriptRenameFile<CR>", { desc = "Rename File", buffer = buffer })
-- stop tsserver from handling formatting
client.server_capabilities.documentFormattingProvider = false
client.server_capabilities.documentRangeFormattingProvider = false
end
end)
require("typescript").setup({ server = opts })
return true
end,
-- ["*"] = function(server, opts) end,
intelephense = function(_, opts)
require("lazyvim.util").on_attach(function(client, buffer)
-- Intelephense
if client.name == "intelephense" then
client.server_capabilities.documentFormattingProvider = true -- Formatting handled by null-ls
client.server_capabilities.documentRangeFormattingProvider = true -- Formatting handled by null-ls
client.server_capabilities.codeActionProvider = false -- Handled by phpactor
client.server_capabilities.renameProvider = false -- Handled by phpactor
-- vim.notify(vim.inspect(client.name))
-- vim.notify(vim.inspect(client.server_capabilities))
end
end)
end,
phpactor = function(_, opts)
require("lazyvim.util").on_attach(function(client, buffer)
-- Phpactor
if client.name == "phpactor" then
client.server_capabilities.documentDiagnosticsProvider = false -- Diagnostics handled by intelephense
client.server_capabilities.documentFormattingProvider = false -- Formatting handled by null-ls
client.server_capabilities.documentRangeFormattingProvider = false -- Formatting handled by null-ls
-- vim.notify(vim.inspect(client.name))
-- vim.notify(vim.inspect(client.server_capabilities))
end
end)
end,
},
},
},
}