@@ -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
@@ -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 `:h '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