zls icon indicating copy to clipboard operation
zls copied to clipboard

function completion should be vertical

Open asibahi opened this issue 4 months ago • 1 comments

I did search the issues, but I couldn't find searching for "Vertical". If this is duplicate or phrased differently elsewhere kindly forgive.

the issue

Using functions from the pop up menu is the min use of zls (and LSPs in general). For example, I type std.sort.h and I get heap as one of the suggestions. I press Enter and get this in the editor:

Image
    std.sort.heap(comptime T: type, items: []T, context: anytype, comptime lessThanFn: fn(@TypeOf(context), lhs:T, rhs:T)bool)

The problem is twofold:

  1. first: this is word salad to me. I can't at a glance tell how many parameters and what their types are.
  2. even if going at them one by one (and filling them one by one), I use Tab to move between the items, and it mostly works, except when it loses focus for some reason and it types the tab character and I have to do it manually with mouse and arrows.

the suggestion

make it fill in like this

    std.sort.heap(
    	comptime T: type,
     	items: []T, 
      	context: anytype,
       	comptime lessThanFn: fn(@TypeOf(context), lhs:T, rhs:T)bool,
    )

this way it is instantly easier to see how many, and what types. It is also easier to navigate when the tab-based-jumping loses focus for whatever reason.

This is by far the most frequent paper cut I get with zls. It is especially annoying in functions that take a large amount of parameters like 8 or more.

or even more vertical One step further, ideally for me, would be to fill in like this
    std.sort.heap(
    	comptime T: type,
     	items: []T, 
      	context: anytype,
       	comptime lessThanFn: fn(
            @TypeOf(context), 
            lhs:T,
            rhs:T
        )bool,
    )

but I am not unreasonable.

asibahi avatar Aug 20 '25 08:08 asibahi

This should be opt-in at most. I really don't like sacrificing vertical real estate, especially with function calls that can (and should be) within 80 columns.

basdp avatar Aug 21 '25 09:08 basdp