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

Allow arbitrary spacing inside function calls #69

Closed
mawkler opened this issue Oct 21, 2022 · 8 comments
Closed

Allow arbitrary spacing inside function calls #69

mawkler opened this issue Oct 21, 2022 · 8 comments
Labels
enhancement New feature or request question Further information is requested
Milestone

Comments

@mawkler
Copy link

mawkler commented Oct 21, 2022

Hi! I would like to be able to align the arguments of multiple similar function calls. Here's an example:

map('n',        '<C-j>',   quickfix_step('below'), { buffer = true })
map('n',        '<C-k>',   quickfix_step('above'), { buffer = true })
map('n',        '<Space>', '<CR><C-w>p',           { buffer = true })
map({'n', 'x'}, '<CR>',    '<CR>',                 { buffer = true })

Currently when I run the formatting it is changed to this:

map('n', '<C-j>', quickfix_step('below'), { buffer = true })
map('n', '<C-k>', quickfix_step('above'), { buffer = true })
map('n', '<Space>', '<CR><C-w>p', { buffer = true })
map({'n', 'x'}, '<CR>', '<CR>', { buffer = true })

Is it possible to tell the formatter not to touch the spaces inside function calls?

@CppCXY
Copy link
Owner

CppCXY commented Oct 21, 2022

currently not, but I'm refactoring code. want to make it possible.

@CppCXY
Copy link
Owner

CppCXY commented Oct 21, 2022

If my formatter doesn't satisfy you, you can use ---@format disable inside the statement block, disable formatting within the current statement block. eg:

function f()
    ---@format disable
    map('n',        '<C-j>',   quickfix_step('below'), { buffer = true }) 
    map('n',        '<C-k>',   quickfix_step('above'), { buffer = true })
    map('n',        '<Space>', '<CR><C-w>p',           { buffer = true })
    map({'n', 'x'}, '<CR>',    '<CR>',                 { buffer = true })
end

@CppCXY CppCXY added the question Further information is requested label Oct 21, 2022
@mawkler
Copy link
Author

mawkler commented Oct 21, 2022

Ok thank you. I look forward to the refactoring!

@CppCXY CppCXY added this to the 1.0.0 milestone Dec 8, 2022
@CppCXY
Copy link
Owner

CppCXY commented Dec 8, 2022

this feature complete by refactor branch, but it's still a few weeks before you see it

@CppCXY CppCXY added the enhancement New feature or request label Dec 8, 2022
@CppCXY CppCXY mentioned this issue Jan 4, 2023
16 tasks
@CppCXY
Copy link
Owner

CppCXY commented Feb 1, 2023

see #80 similar feature is complete.
but what are the principles for recognizing your needs?
for eg. different function call

p(1, 2, 3)
ppppp(1, 2, 3)

different but similar length

aaa(1, 2, 3)
bbb(1, 2, 3)

or only same function call

map(1, 2, 3)
map(4, 5, 6)

The previous solution was to ignore white space in function calls, now I want to automatic align it

@mawkler
Copy link
Author

mawkler commented Feb 1, 2023

@CppCXY To me it's enough if I could just tell EmmyLua not to modify the spacing between function arguments. Are you saying that #80 should support that now?

@CppCXY
Copy link
Owner

CppCXY commented Feb 1, 2023

@CppCXY To me it's enough if I could just tell EmmyLua not to modify the spacing between function arguments. Are you saying that #80 should support that now?

yes

@mawkler
Copy link
Author

mawkler commented Feb 2, 2023

Awesome, thank you!

@CppCXY CppCXY closed this as completed Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants