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

Improve complete-popup on vertical screens #581

Open
dezza opened this issue Dec 18, 2024 · 0 comments
Open

Improve complete-popup on vertical screens #581

dezza opened this issue Dec 18, 2024 · 0 comments

Comments

@dezza
Copy link
Contributor

dezza commented Dec 18, 2024

I suggest this can be improved:
Screenshot_20241218_215359
I looked around for settings and none seem like a permanent fix (except switching to preview window obviously). Yes you can set pumheight=20 which will limit it vertically, but not horizontally in a sensible way afaik. It is dictated by the item length for each row word, kind, info, (functionname, args, markdown doc)

One could make a function for how occupied the screen is by the popup from the cursor, to act on it in completion.

def ColumnPct(in: number): number
  var onePct: float = ( &columns / 100.0 )
  var retPct: number = float2nr( in / onePct )

  return retPct
enddef

https://github.com/yegappan/lsp/blob/main/autoload/lsp/completion.vim#L315
If columns occupied by screen is 70%+

  if (ColumnPct(col('.') + longestMenu + longestWord) > 69)
    completeItems->map(((k, v) => (v->extend({'menu': ''}))))
  endif

As an example, just to make a screenshot to compare without the function-args signature.
Screenshot_20241218_230457

The best ideas I could come up with quick:

  1. Append the function-args removed from screenshot above into the actual info popup d.info as a separate header in the top. (https://github.com/yegappan/lsp/blob/main/autoload/lsp/completion.vim#L281-L288)
    I suggest a lsp-options for toggling this on/off by default. Some other lsp plugins have this. I would probably opt for this myself. Straight-forward way to quickly save a lot of rows for vertical screens.

  2. Limit the func-name, func-args row in length, cut off by padding ".." to the right or both names and functions-args in length. It should be determined by both cursor pos, window size (columns) and the longest line-length in the info popup, which would ensure it never limits unnecessarily and always maximizes width.

Any other ideas?

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

No branches or pull requests

1 participant