File tree Expand file tree Collapse file tree
pkg/tui/components/completion Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -179,6 +179,14 @@ func (c *manager) View() string {
179179 visibleStart := c .scrollOffset
180180 visibleEnd := min (c .scrollOffset + maxItems , len (c .filteredItems ))
181181
182+ maxLabelLen := 0
183+ for i := visibleStart ; i < visibleEnd ; i ++ {
184+ labelLen := len (c .filteredItems [i ].Label )
185+ if labelLen > maxLabelLen {
186+ maxLabelLen = labelLen
187+ }
188+ }
189+
182190 for i := visibleStart ; i < visibleEnd ; i ++ {
183191 item := c .filteredItems [i ]
184192 isSelected := i == c .selected
@@ -190,7 +198,9 @@ func (c *manager) View() string {
190198 itemStyle = styles .CompletionNormalStyle
191199 }
192200
193- text := item .Label
201+ // Pad label to maxLabelLen so descriptions align
202+ paddedLabel := item .Label + strings .Repeat (" " , maxLabelLen + 1 - len (item .Label ))
203+ text := paddedLabel
194204 if item .Description != "" {
195205 text += " " + styles .CompletionDescStyle .Render (item .Description )
196206 }
You can’t perform that action at this time.
0 commit comments