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

Syntax highlight the signature preview #1020

Open
2 tasks done
leo-unglaub opened this issue Jul 6, 2024 · 3 comments
Open
2 tasks done

Syntax highlight the signature preview #1020

leo-unglaub opened this issue Jul 6, 2024 · 3 comments
Labels
feature-request Request for a feature to existing module mini.completion

Comments

@leo-unglaub
Copy link

Contributing guidelines

Module(s)

mini-completion

Description

Hey,
first of all, i love your plugins, they are clean, easy to setup and work really fast. I love that. Thanks so much for providing them.

I noticed a small thing that might be an improvement. Right now the signature preview is in one color, buy with larger signatures it would be helpful to have them rendered with syntax highlighting on. It would, at least for me, improve the readability.

image

What do you think? Is that worth the work or not?
Thanks so much and greetings
Leo

@leo-unglaub leo-unglaub added the feature-request Request for a feature to existing module label Jul 6, 2024
@leo-unglaub
Copy link
Author

Here is a better screenshot for a method that has a huge signature:
image

@echasnovski
Copy link
Owner

Thanks for suggestion and kind words!

This is interesting and might be doable. There are at least the following issues with it:

  • I don't think it is guaranteed that signature help is a valid code of a language at hand. Thus it might not be good for parsing.
  • Needs separate logic for initializing that highlight.
  • This will introduce slight overhead because adding highlighting is not exactly immediate (needs parsing, etc.).

I'll think about it.

@leo-unglaub
Copy link
Author

Those are some very well thought out concerns, you are right. My idea was as follows:

  • Only do it if Treesitter is attached to the current buffer
  • If its not valid code for the given language in the buffer, treesitter will fail very quickly
  • Treesitter selectors could be used for still highlighting the current item
  • There is a default debounce on this signature helper anyway, so it should be enought time for Treesitter to parse and render (beeing laggy would be horrible)

Greettings
Leo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for a feature to existing module mini.completion
Projects
None yet
Development

No branches or pull requests

2 participants