@@ -37,12 +37,12 @@ U.ctype = {
3737}
3838
3939--- @class CommentMotion Comment motion types
40- --- @field private _ number Compute from vim mode. See | OpMode |
41- --- @field line number Line motion (ie. ` gc2j` )
42- --- @field char number Character /left-right motion (ie. ` gc2j ` )
43- --- @field block number Visual operator-pending motion
44- --- @field v number Visual motion
45- --- @field V number Visual-line motion
40+ --- @field private _ integer Compute from vim mode. See | OpMode |
41+ --- @field line integer Line motion (ie. ' gc2j' )
42+ --- @field char integer Character /left-right motion (ie. ' gc2w ' )
43+ --- @field block integer Visual operator-pending motion
44+ --- @field v integer Visual motion ( ie. ' v3jgc ' )
45+ --- @field V integer Visual-line motion ( ie. ' V10kgc ' )
4646
4747--- An object containing comment motions
4848--- @type CommentMotion
@@ -55,13 +55,15 @@ U.cmotion = {
5555 V = 5 ,
5656}
5757
58+ --- @private
5859--- Check whether the line is empty
5960--- @param iter string | string[]
6061--- @return boolean
6162function U .is_empty (iter )
6263 return # iter == 0
6364end
6465
66+ --- @private
6567--- Get the length of the indentation
6668--- @param str string
6769--- @return integer integer Length of indent chars
@@ -97,6 +99,7 @@ function U.is_fn(fn, ...)
9799 return fn
98100end
99101
102+ --- @private
100103--- Check if the given line is ignored or not with the given pattern
101104--- @param ln string Line to be ignored
102105--- @param pat string Lua regex
@@ -122,7 +125,7 @@ function U.get_region(opmode)
122125end
123126
124127--- Get lines from the current position to the given count
125- --- @param count number
128+ --- @param count integer Probably ' vim.v.count '
126129--- @return CommentLines
127130--- @return CommentRange
128131function U .get_count_lines (count )
@@ -146,7 +149,7 @@ function U.get_lines(range)
146149end
147150
148151--- Validates and unwraps the given commentstring
149- --- @param cstr string
152+ --- @param cstr string See ' commentstring '
150153--- @return string string Left side of the commentstring
151154--- @return string string Right side of the commentstring
152155function U .unwrap_cstr (cstr )
@@ -160,10 +163,10 @@ function U.unwrap_cstr(cstr)
160163 return vim .trim (left ), vim .trim (right )
161164end
162165
163- --- Unwraps the commentstring by taking it from the following places
164- --- 1. ` pre_hook` (optionally a string can be returned)
165- --- 2. ` ft.lua` (extra commentstring table in the plugin)
166- --- 3. ` commentstring` (already set or added in pre_hook)
166+ --- Parses commentstring from the following places in the respective order
167+ --- 1. pre_hook - commentstring returned from the function
168+ --- 2. ft.lua - commentstring table bundled with the plugin
169+ --- 3. commentstring - Neovim's native. See 'commentstring'
167170--- @param cfg CommentConfig
168171--- @param ctx CommentCtx
169172--- @return string string Left side of the commentstring
@@ -179,9 +182,10 @@ function U.parse_cstr(cfg, ctx)
179182 return U .unwrap_cstr (cstr )
180183end
181184
182- --- Returns a closure which is used to comment a line
183- --- If given {string[]} to the closure then it will do blockwise
184- --- else it will do linewise
185+ --- Returns a closure which is used to do comments
186+ ---
187+ --- If given {string[]} to the closure then it will do blockwise comment
188+ --- else linewise comment will be done with the given {string}
185189--- @param left string Left side of the commentstring
186190--- @param right string Right side of the commentstring
187191--- @param padding boolean Is padding enabled ?
@@ -243,6 +247,9 @@ function U.commenter(left, right, padding, scol, ecol)
243247end
244248
245249--- Returns a closure which is used to uncomment a line
250+ ---
251+ --- If given {string[]} to the closure then it will block uncomment
252+ --- else linewise uncomment will be done with the given {string}
246253--- @param left string Left side of the commentstring
247254--- @param right string Right side of the commentstring
248255--- @param padding boolean Is padding enabled ?
@@ -299,6 +306,10 @@ function U.uncommenter(left, right, padding, scol, ecol)
299306end
300307
301308--- Check if the given string is commented or not
309+ ---
310+ --- If given {string[]} to the closure, it will check the first and last line
311+ --- with LHS and RHS of commentstring respectively else it will check the given
312+ --- line with LHS and RHS (if given) of the commenstring
302313--- @param left string Left side of the commentstring
303314--- @param right string Right side of the commentstring
304315--- @param padding boolean Is padding enabled ?
0 commit comments