Skip to content

Commit d1fbc0f

Browse files
committed
refactor: prefix type annotations with refactor namespace
1 parent be83cda commit d1fbc0f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+309
-316
lines changed

lua/refactoring/code_generation/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ local java = require("refactoring.code_generation.langs.java")
1313
local cs = require("refactoring.code_generation.langs.cs")
1414
local ruby = require("refactoring.code_generation.langs.ruby")
1515

16-
---@type table<ft, code_generation>|{new_line: fun(): string}
16+
---@type table<refactor.ft, refactor.CodeGeneration>|{new_line: fun(): string}
1717
local M = {
1818
javascript = javascript, -- includes jsx because they share parser
1919
typescript = typescript,

lua/refactoring/code_generation/langs/c.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ local function c_constant(opts)
6262
return constant_string_pattern
6363
end
6464

65-
---@type code_generation
65+
---@type refactor.CodeGeneration
6666
local c = {
6767
comment = cpp.comment,
6868
default_printf_statement = cpp.default_printf_statement,

lua/refactoring/code_generation/langs/cpp.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ local function cpp_constant(opts)
6060
return constant_string_pattern
6161
end
6262

63-
---@type code_generation
63+
---@type refactor.CodeGeneration
6464
local cpp = {
6565
comment = function(statement)
6666
return ("// %s"):format(statement)

lua/refactoring/code_generation/langs/cs.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ local function cs_func_args_with_types(args, args_types)
2626
return table.concat(args_with_types, ", ")
2727
end
2828

29-
---@param opts function_opts
29+
---@param opts refactor.code_gen.function.Opts
3030
local function cs_func_args(opts)
3131
if opts.args_types ~= nil then
3232
return cs_func_args_with_types(opts.args, opts.args_types)
@@ -35,7 +35,7 @@ local function cs_func_args(opts)
3535
end
3636
end
3737

38-
---@param opts constant_opts
38+
---@param opts refactor.code_gen.constant.Opts
3939
---@return string
4040
local function cs_constant(opts)
4141
local constant_string_pattern ---@type string
@@ -68,7 +68,7 @@ local function cs_constant(opts)
6868
return constant_string_pattern
6969
end
7070

71-
---@type code_generation
71+
---@type refactor.CodeGeneration
7272
local cs = {
7373
comment = function(statement)
7474
return ("// %s"):format(statement)

lua/refactoring/code_generation/langs/go.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ local function constant(opts)
132132
return result
133133
end
134134

135-
---@type code_generation
135+
---@type refactor.CodeGeneration
136136
local go = {
137137
comment = function(statement)
138138
return ("// %s"):format(statement)

lua/refactoring/code_generation/langs/java.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ local function java_constant(opts)
6060
return constant_string_pattern
6161
end
6262

63-
---@type code_generation
63+
---@type refactor.CodeGeneration
6464
local java = {
6565
comment = function(statement)
6666
return ("// %s"):format(statement)

lua/refactoring/code_generation/langs/lua.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ end
1313
)
1414
end
1515

16-
---@param opts constant_opts
16+
---@param opts refactor.code_gen.constant.Opts
1717
---@return string
1818
local function lua_constant(opts)
1919
local result ---@type string
@@ -39,7 +39,7 @@ local function lua_constant(opts)
3939
return result
4040
end
4141

42-
---@type code_generation
42+
---@type refactor.CodeGeneration
4343
local lua = {
4444
comment = function(statement)
4545
return ("-- %s"):format(statement)

lua/refactoring/code_generation/langs/php.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ local function php_class_function(opts)
4646
)
4747
end
4848

49-
---@type code_generation
49+
---@type refactor.CodeGeneration
5050
local php = {
5151
default_print_var_statement = function()
5252
return { "printf('%s %%s'.%s, %s);" }

lua/refactoring/code_generation/langs/python.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ local function python_constant(opts)
122122
return constant_string_pattern
123123
end
124124

125-
---@type code_generation
125+
---@type refactor.CodeGeneration
126126
local python = {
127127
constant = function(opts)
128128
return python_constant(opts)

lua/refactoring/code_generation/langs/ruby.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ local function ruby_constant(opts)
4242
return constant_string_pattern
4343
end
4444

45-
---@type code_generation
45+
---@type refactor.CodeGeneration
4646
local ruby = {
4747
comment = function(statement)
4848
return ("# %s"):format(statement)

lua/refactoring/code_generation/langs/typescript.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ local function build_args(args, arg_types)
1414
return final_args
1515
end
1616

17-
---@param opts function_opts
17+
---@param opts refactor.code_gen.function.Opts
1818
local function typescript_class_function(opts)
1919
-- Need this for javascript
2020
local args
@@ -41,7 +41,7 @@ local function typescript_class_function(opts)
4141
)
4242
end
4343

44-
---@param opts function_opts
44+
---@param opts refactor.code_gen.function.Opts
4545
local function typescript_function(opts)
4646
-- Need this for javascript
4747
local args
@@ -65,7 +65,7 @@ local function typescript_function(opts)
6565
)
6666
end
6767

68-
---@param opts constant_opts
68+
---@param opts refactor.code_gen.constant.Opts
6969
---@return string
7070
local function typescript_constant(opts)
7171
local constant_string_pattern
@@ -98,7 +98,7 @@ local function typescript_constant(opts)
9898
return constant_string_pattern
9999
end
100100

101-
---@type code_generation
101+
---@type refactor.CodeGeneration
102102
local typescript = {
103103
default_printf_statement = function()
104104
return { 'console.log("%s");' }

lua/refactoring/code_generation/langs/typescriptreact.lua

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ local function build_args(args, arg_types)
1313
return final_args
1414
end
1515

16-
---@param opts function_opts
16+
---@param opts refactor.code_gen.function.Opts
1717
local function tsx_function(opts)
1818
if opts.region_type == "jsx_element" then
1919
local args
@@ -44,7 +44,7 @@ return (
4444
end
4545
end
4646

47-
---@param opts call_function_opts
47+
---@param opts refactor.code_gen.call_function.Opts
4848
local function tsx_call_function(opts)
4949
if opts.region_type == "jsx_element" or opts.contains_jsx then
5050
local args = vim.iter(opts.args)
@@ -64,7 +64,7 @@ local special_nodes = {
6464
}
6565

6666
---@param var string
67-
---@param opts special_var_opts
67+
---@param opts refactor.code_gen.special_var.Opts
6868
---@return string
6969
local function tsx_special_var(var, opts)
7070
if vim.tbl_contains(special_nodes, opts.region_node_type) then
@@ -74,7 +74,7 @@ local function tsx_special_var(var, opts)
7474
end
7575
end
7676

77-
---@type code_generation
77+
---@type refactor.CodeGeneration
7878
local tsx = {
7979
default_printf_statement = ts.default_printf_statement,
8080
print = ts.print,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
---@type code_generation
1+
---@type refactor.CodeGeneration
22
local vue = {}
33

44
return vue

lua/refactoring/command.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ local M = {}
33
local api = vim.api
44
local iter = vim.iter
55

6-
--- @alias command_opts {name: string, args: string, fargs: string[], bang: boolean, line1: number, line2: number, range: number, count: number, reg: string, mods: string, smods: string[]}
6+
---@alias refactor.command.Opts {name: string, args: string, fargs: string[], bang: boolean, line1: number, line2: number, range: number, count: number, reg: string, mods: string, smods: string[]}
77

88
local DO_NOT_PREVIEW = 0
99
local PREVIEW_IN_CURRENT_BUFFER = 1
@@ -16,7 +16,7 @@ local _needed_args = {
1616
default = 1,
1717
}
1818

19-
--- @param opts command_opts
19+
--- @param opts refactor.command.Opts
2020
--- @param ns integer
2121
local function command_preview(opts, ns)
2222
local refactors = require("refactoring.refactor")
@@ -64,7 +64,7 @@ local function command_preview(opts, ns)
6464
return PREVIEW_IN_CURRENT_BUFFER
6565
end
6666

67-
--- @param opts command_opts
67+
--- @param opts refactor.command.Opts
6868
local function command(opts)
6969
local refactor = opts.fargs[1]
7070

0 commit comments

Comments
 (0)