Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Continuation line width starting from wrong point #261

Open
Mayron opened this issue Sep 17, 2022 · 3 comments
Open

Continuation line width starting from wrong point #261

Mayron opened this issue Sep 17, 2022 · 3 comments
Labels
enhancement New feature or request

Comments

@Mayron
Copy link

Mayron commented Sep 17, 2022

I'm not sure what option I need to change or if it's a missing feature but the arguments passed to a function call are being placed relative to the function call's opening ( bracket and not the statement.

For example, after formatting I get this:

function Module:DeleteProfile(profileName)
  local popupMessage = string.format(
                         L["Are you sure you want to delete profile '%s'?"],
                         profileName);
  -- other code removed for brevity
end

However, I'd prefer this:

function Module:DeleteProfile(profileName)
  local popupMessage = string.format(
    L["Are you sure you want to delete profile '%s'?"],
    profileName);
  -- other code removed for brevity
end

I have the indentation set to 2 spaces. I'd prefer those 2 indented spaces to be relative to the statematement. Does this make sense? Is this possible?

@Mayron
Copy link
Author

Mayron commented Sep 17, 2022

My current options:

column_limit: 80
indent_width: 2
use_tab: false
continuation_indent_width: 2
keep_simple_control_block_one_line: false
keep_simple_function_one_line: false
align_args: true
break_after_functioncall_lp: true
break_before_functioncall_rp: false
align_parameter: true
chop_down_parameter: true
break_after_functiondef_lp: true
break_before_functiondef_rp: false
align_table_field: false
break_after_table_lb: true
break_before_table_rb: true
chop_down_table: false
chop_down_kv_table: true
table_sep: ";"
break_after_operator: false
extra_sep_at_table_end: true
single_quote_to_double_quote: true
spaces_inside_table_braces: true

@adoyle-h
Copy link

adoyle-h commented Sep 19, 2022

Me too. align_args: false and align_parameter: false not work when columns greater than column_limit.

What I get after formatting

local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol
	                                                                 .make_client_capabilities())

What I expect to get

local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp.protocol
	.make_client_capabilities())

I want an indentation, not align arguments.

Second point. When column_limit=80, the formatted result will be that

local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp
	                                                                 .protocol
	                                                                 .make_client_capabilities())

It takes three lines that is so ugly. I expect it to be:

local capabilities = require('cmp_nvim_lsp').update_capabilities(vim.lsp
	.protocol.make_client_capabilities())

config

column_limit: 100
indent_width: 1
use_tab: true
tab_width: 2
continuation_indent_width: 1
keep_simple_control_block_one_line: true
keep_simple_function_one_line: true
align_args: false
break_after_functioncall_lp: false
break_before_functioncall_rp: true
align_parameter: false
chop_down_parameter: false
break_after_functiondef_lp: false
break_before_functiondef_rp: false
align_table_field: true
break_after_table_lb: true
break_before_table_rb: true
chop_down_table: true
chop_down_kv_table: true
column_table_limit: 100
table_sep: ","
extra_sep_at_table_end: true
break_after_operator: true
single_quote_to_double_quote: false
double_quote_to_single_quote: true
spaces_before_call: 1
spaces_inside_functiondef_parens: false
spaces_inside_functioncall_parens: false
spaces_inside_table_braces: true
spaces_around_equals_in_field: true
line_breaks_after_function_body: 1
line_separator: input

@Koihik Koihik added the enhancement New feature or request label Sep 22, 2022
@mrvon
Copy link

mrvon commented Jul 31, 2023

@Koihik Is there any plan for issue? thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants