Fix multiline params feature and auto-prefix
- Fix FB/function call parameter detection to prevent incorrect # prefixing - Preserve # prefix when filling multiline params - Add comma after first parameter and closing bracket on last param line - Fix Tab navigation to position cursor after :=/=> operators - Clean up dead code in multiline_params.lua - Add setup functions for multiline params feature in both scl and scl_lsp
This commit is contained in:
@@ -118,6 +118,36 @@ local function is_in_var_section()
|
||||
return in_var
|
||||
end
|
||||
|
||||
-- Check if we're inside an FB/Function call parameter list
|
||||
local function is_in_fb_call_params()
|
||||
local cursor_col = vim.api.nvim_win_get_cursor(0)[2]
|
||||
local line = vim.api.nvim_get_current_line()
|
||||
|
||||
-- If line ends with ");" or similar, we're at end of params
|
||||
if line:match("%s*%);?%s*$") then
|
||||
return false
|
||||
end
|
||||
|
||||
-- Count parens before cursor position
|
||||
local open_count = 0
|
||||
local close_count = 0
|
||||
for i = 1, cursor_col do
|
||||
local c = line:sub(i, i)
|
||||
if c == "(" then
|
||||
open_count = open_count + 1
|
||||
elseif c == ")" then
|
||||
close_count = close_count + 1
|
||||
end
|
||||
end
|
||||
|
||||
-- If there are unclosed parens before cursor, we're inside params
|
||||
if open_count > close_count then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
-- Check if we're after BEGIN keyword
|
||||
local function is_after_begin()
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
@@ -301,6 +331,11 @@ local function auto_prefix_current_line()
|
||||
return
|
||||
end
|
||||
|
||||
-- Don't prefix if inside FB/Function call parameters
|
||||
if is_in_fb_call_params() then
|
||||
return
|
||||
end
|
||||
|
||||
-- Only prefix after BEGIN
|
||||
if not is_after_begin() then
|
||||
return
|
||||
@@ -335,6 +370,11 @@ local function on_dot_typed()
|
||||
return
|
||||
end
|
||||
|
||||
-- Don't prefix if inside FB/Function call parameters
|
||||
if is_in_fb_call_params() then
|
||||
return
|
||||
end
|
||||
|
||||
-- Only prefix after BEGIN
|
||||
if not is_after_begin() then
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user