Skip to content

Commit 4d960a7

Browse files
committed
feat: add types for autocompletion with lua_ls
1 parent c483e32 commit 4d960a7

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

lua/astrolsp/config.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
-- @copyright 2023
99
-- @license GNU General Public License v3.0
1010

11+
---@type AstroLSPConfig
1112
return {
1213
--- Configuration table of features provided by AstroLSP
1314
-- @usage features = {

lua/astrolsp/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ function M.lsp_opts(server_name)
243243
end
244244

245245
--- Setup and configure AstroLSP
246-
---@param opts table options passed by the user to configure AstroLSP
246+
---@param opts AstroLSPConfig options passed by the user to configure AstroLSP
247247
-- @see astrolsp.config
248248
function M.setup(opts)
249249
M.config = vim.tbl_deep_extend("force", M.config, opts)

lua/astrolsp/types.lua

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---@meta
2+
3+
---@class AstroLSPFeatureOpts
4+
---@field autoformat boolean?
5+
---@field codelens boolean?
6+
---@field diagnostics_mode integer?
7+
---@field inlay_hints boolean?
8+
---@field lsp_handlers boolean?
9+
---@field semantic_tokens boolean?
10+
11+
---@class AstroLSPFormatOnSaveOpts
12+
---@field enabled boolean?
13+
---@field allow_filetypes string[]?
14+
---@field ignore_filetypes string[]?
15+
16+
---@class AstroLSPFormatOpts
17+
---@field format_on_save boolean|AstroLSPFormatOnSaveOpts?
18+
---@field disabled string[]?
19+
---@field timeout_ms integer?
20+
---@field filter (fun(client):boolean)?
21+
22+
---@class AstroLSPConfig
23+
---@field features AstroLSPFeatureOpts?
24+
---@field capabilities table?
25+
---@field config lspconfig.options?
26+
---@field diagnostics table?
27+
---@field flags table?
28+
---@field formatting AstroLSPFormatOpts?
29+
---@field handlers table<string|integer,fun(server:string,opts:_.lspconfig.options)|boolean?>?
30+
---@field mappings table<string,table<string,table|boolean>>?
31+
---@field servers string[]?
32+
---@field on_attach fun(client,bufnr)?

0 commit comments

Comments
 (0)