[mirror] Make your go dev experience better github.com/olexsmir/gopher.nvim
neovim golang

refactor: fix config type annotations

olexsmir.xyz d1eaebab 7c198a1b

verified
Changed files
+8 -8
doc
lua
gopher
spec
-6
doc/gopher.nvim.txt
··· 45 46 ============================================================================== 47 ------------------------------------------------------------------------------ 48 - *config* 49 - `config` 50 - Type ~ 51 - `(gopher.Config)` 52 - 53 - ------------------------------------------------------------------------------ 54 *gopher.nvim-config* 55 `default_config` 56 >lua
··· 45 46 ============================================================================== 47 ------------------------------------------------------------------------------ 48 *gopher.nvim-config* 49 `default_config` 50 >lua
+5 -2
lua/gopher/config.lua
··· 1 local config = {} 2 3 ---@tag gopher.nvim-config.ConfigGoTagTransform ··· 16 ---@tag gopher.nvim-config 17 ---@eval return MiniDoc.afterlines_to_code(MiniDoc.current.eval_section) 18 ---@class gopher.Config 19 local default_config = { 20 -- log level, you might consider using DEBUG or TRACE for debugging the plugin 21 ---@type number ··· 112 }) 113 114 ---@dochide 115 - ---@return gopher.Config 116 - return config --[[ @as gopher.Config ]]
··· 1 + ---@type gopher.Config 2 + ---@dochide 3 + ---@diagnostic disable-next-line: missing-fields .setup() gets injected later 4 local config = {} 5 6 ---@tag gopher.nvim-config.ConfigGoTagTransform ··· 19 ---@tag gopher.nvim-config 20 ---@eval return MiniDoc.afterlines_to_code(MiniDoc.current.eval_section) 21 ---@class gopher.Config 22 + ---@field setup fun(user_config?: gopher.Config) 23 local default_config = { 24 -- log level, you might consider using DEBUG or TRACE for debugging the plugin 25 ---@type number ··· 116 }) 117 118 ---@dochide 119 + return config
+3
spec/unit/config_test.lua
··· 7 end 8 9 config["can be called with empty table"] = function() 10 require("gopher").setup {} 11 end 12 13 config["should change option"] = function() 14 local log_level = 1234567890 15 require("gopher").setup { 16 log_level = log_level, 17 }
··· 7 end 8 9 config["can be called with empty table"] = function() 10 + ---@diagnostic disable-next-line: missing-fields 11 require("gopher").setup {} 12 end 13 14 config["should change option"] = function() 15 local log_level = 1234567890 16 + 17 + ---@diagnostic disable-next-line: missing-fields 18 require("gopher").setup { 19 log_level = log_level, 20 }