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

Create custom company tooltips #1012

Open
clemera opened this issue Sep 27, 2020 · 7 comments
Open

Create custom company tooltips #1012

clemera opened this issue Sep 27, 2020 · 7 comments
Labels

Comments

@clemera
Copy link

clemera commented Sep 27, 2020

As far as I know there is no package which allows creating company like overlay tooltips. I often want to display info windows in the same way company does it. Ideally I would like to do something like:

(show-tooltip "string" position)
....
(hide-tooltip)

The closest I could find is quick-peek but I don't like how it inserts the info text between the already present text and would really prefer a company like overlay display which hides any present text behind the overlay text. Company seems to have a battle tested implementation of this functionality which would be great to be able to access. What do you think?

@dgutov
Copy link
Member

dgutov commented Sep 27, 2020

I'd be very happy to see someone implement this. ;-)

It would entail extracting the popup rendering feature into a library. Preferably one that has some feature parity with popup.el (including the creation of multiple popups at the same time). I'm not sure how well it will work with the one-overlay approach we have chosen here (as opposed to popup.el's one-overlay-per-line), but someone would have to experiment with that.

@clemera
Copy link
Author

clemera commented Sep 28, 2020

Separating this out into a separate package would be great. Would you prefer to maintain it if company would depend on it? I wouldn't like to take over responsibility for that currently. Now that I know you would be interested in this I might give it a whirl next time I feel like it. I will post here if I come up with something that looks promising.

Multiple popups would be a great feature! I currently use pos-tip.el to show eldoc messages above the current line and in the past used popup.el for that but both have their problems.

@dgutov
Copy link
Member

dgutov commented Sep 28, 2020

Would you prefer to maintain it if company would depend on it?

Yes, of course. It's not a hard requirement, but I would prefer it.

Now that I know you would be interested in this I might give it a whirl next time I feel like it. I will post here if I come up with something that looks promising.

Sounds good. Thanks in advance.

I currently use pos-tip.el to show eldoc messages above the current line and in the past used popup.el for that but both have their problems.

Right. There are no perfect solutions currently. And we basically only need two: one for the graphical mode (preferably faster than the child frame based solutions are working now, but hopefully we'll just see their performance improved in later versions of Emacs) and another for the terminal.

@clemera
Copy link
Author

clemera commented Sep 29, 2020

The benefits of child frames are that their display can overlap with other Emacs UI elements like window margins and mode line right? I would be okay with that limitation and prefer the overlay approach but maybe the library should ideally cover both cases and have an option to default to child frames in graphical Emacs and overlays in terminal Emacs.

@dgutov
Copy link
Member

dgutov commented Sep 29, 2020

overlap with other Emacs UI elements like window margins and mode line right?

Also: work with different fonts sizes in the buffer, non-monospace fonts, and without covering the line numbers on the affected lines.

maybe the library should cover both cases and have an option to default to child frames in graphical Emacs and overlays in terminal Emacs

To start with, it could have an API roughly compatible with the posframe package. Then we'll see about dispatching to it later.

@clemera
Copy link
Author

clemera commented Sep 29, 2020

Also: work with different fonts sizes in the buffer, non-monospace fonts, and without covering the line numbers on the affected lines.

Ah yes, thanks.

To start with, it could have an API roughly compatible with the posframe package. Then we'll see about dispatching to it later.

Sounds like a good approach.

@clemera
Copy link
Author

clemera commented Oct 21, 2020

The benefits of child frames are that their display can overlap with other Emacs UI elements like window margins and mode line right?

Someone on reddit posted an example to create menus which overlap window boundaries for tty, I had no idea that is possible, commenting here for later reference:

(x-popup-menu `((,(- (/ (frame-width) 2) 10) ,(frame-height)) ,(selected-frame))
              (easy-menu-create-menu
               "Testing"
               `(["some testing 1" next-line]
                 ["some testing 2" previous-line])))

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

No branches or pull requests

2 participants