-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfig.lua
180 lines (165 loc) · 5.42 KB
/
config.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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
-- defaults for omitted server options (you probably don't want to change these)
local defaultLanguageServerOptions = {
-- Unique name for the server to be shown in statusbar and logs
-- Defaults to the same as cmd if omitted
shortName = nil,
-- (REQUIRED) command to execute the language server
cmd = "",
-- Arguments for the above command
args = {},
-- List of filetypes supported by the server.
-- Defaults to accepting all filetypes if omitted.
-- NOTE: filetypes should match the names given in micro syntax files at
-- https://github.com/zyedidia/micro/tree/master/runtime/syntax
filetypes = nil,
-- Language server specific options that are sent to the server during
-- initialization – you can usually omit this field
initializationOptions = nil,
-- callback function that is called when language server is initialized
-- (useful for debugging and disabling server capabilities)
-- For example to disable getting hover information from a server:
-- onInitialized = function(client)
-- client.serverCapabilities.hoverProvider = false
-- end
onInitialized = nil,
}
-- Pre-made configurations for commonly used language servers – you can also
-- define your own servers to be used in settings at the bottom of this file.
-- See defaultLanguageServerOptions above for the available options.
languageServer = {
clangd = {
cmd = "clangd",
filetypes = {"c", "cpp", "objc", "cuda", "proto"}
},
clojurelsp = {
cmd = "clojure-lsp",
filetypes = {"clojure"}
},
crystalline = {
cmd = "crystalline",
filetypes = {"crystal"}
},
deno = {
cmd = "deno",
args = {"lsp"},
filetypes = {"javascript", "typescript", "markdown", "json"}
},
gopls = {
cmd = "gopls",
filetypes = {"go", "gomod", "godoc"}
},
hls = {
shortName = "hls",
cmd = "haskell-language-server-wrapper",
args = {"--lsp"},
filetypes = {"haskell"}
},
julials = {
shortName = "julials",
cmd = "julia",
args = {"--startup-file=no", "--history-file=no", "-e", "using LanguageServer; runserver()"},
filetypes = {"julia"}
},
lualsp = {
cmd = "lua-lsp",
filetypes = {"lua"}
},
luals = {
shortName = "luals",
cmd = "lua-language-server",
filetypes = {"lua"}
},
pylsp = {
cmd = "pylsp",
filetypes = {"python"}
},
pyright = {
shortName = "pyright",
cmd = "pyright-langserver",
args = {"--stdio"},
filetypes = {"python"}
},
quicklintjs = {
cmd = "quick-lint-js",
args = {"--lsp"},
filetypes = {"javascript", "typescript"}
},
rubocop = {
cmd = "rubocop",
args = {"--lsp"},
filetypes = {"ruby"}
},
rubylsp = {
cmd = "ruby-lsp",
filetypes = {"ruby", "eruby"}
},
ruff = {
cmd = "ruff",
args = {"server"},
onInitialized = function(client)
-- does not give useful results
client.serverCapabilities.hoverProvider = false
end,
filetypes = {"python"}
},
rustAnalyzer = {
shortName = "rust",
cmd = "rust-analyzer",
filetypes = {"rust"}
},
solargraph = {
cmd = "solargraph",
args = {"stdio"},
filetypes = {"ruby"}
},
zls = {
cmd = "zls",
filetypes = {"zig"}
}
}
-- you don't need to care about this part but it's basically filling in defaults
-- for all missing fields in language servers defined above
defaultLanguageServerOptions.__index = defaultLanguageServerOptions
for _, server in pairs(languageServer) do
setmetatable(server, defaultLanguageServerOptions)
end
settings = {
-- Use LSP completion in place of micro's default Autocomplete action when
-- available (you can bind `command:lsp autocomplete` command to a different
-- key in ~/.config/micro/bindings.json even if this setting is false)
tabAutocomplete = false,
-- Automatically start language server(s) when a buffer with matching
-- filetype is opened
autostart = {
-- Example #1: Start gopls when editing .go files:
-- go = { languageServer.gopls },
-- Example #2: Start pylsp AND ruff-lsp when editing Python files:
-- python = { languageServer.pylsp, languageServer.ruff },
},
-- Language server to use when `lsp` command is executed without args
defaultLanguageServer = {
c = languageServer.clangd,
["c++"] = languageServer.clangd,
clojure = languageServer.clojurelsp,
crystal = languageServer.crystalline,
go = languageServer.gopls,
haskell = languageServer.hls,
javascript = languageServer.deno,
julia = languageServer.julials,
json = languageServer.deno,
lua = languageServer.luals,
markdown = languageServer.deno,
python = languageServer.pylsp,
ruby = languageServer.rubylsp,
rust = languageServer.rustAnalyzer,
typescript = languageServer.deno,
zig = languageServer.zls,
},
-- Which kinds of diagnostics to show in the gutter
showDiagnostics = {
error = false,
warning = false,
information = false,
hint = false
},
}