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

[WIP] Refactor floats #510

Closed
wants to merge 6 commits into from
Closed

[WIP] Refactor floats #510

wants to merge 6 commits into from

Conversation

clason
Copy link
Contributor

@clason clason commented Sep 14, 2019

The current preview implementation in output.vim has gotten a bit unwieldy in trying to support vim popups, neovim floats, and preview buffers, making it difficult to extend or adapt to changes in the low-level APIs (in particular for the upcoming neovim 0.4.0).

This PR proposes a refactor to completely separate the backend-specific details from the functions handling the server response. The idea is to have

  1. a high-level API for showing and updating "tooltips" (here used as a generic name to distinguish from, e.g., neovim floats -- all names up for discussion) and
  2. an intermediate-level API for creating, updating, positioning, and closing tooltips, implemented separately for each backend using the respective low-level API.

The current goal of this PR is to solicit discussion on the design of these APIs, documented in doc/tooltip-api.txt. (The code is meant as a stub to show the proposed dispatch and to have somewhere for sketching out implementation ideas.) The most central questions are:

  1. The high-level API proposal has two separate functions for "at-cursor" (hover, peek, signature) and "at-pum" (documentation) tooltips. Is this enough? Or should these be combined?
  2. Which options should these functions support (border, relative position, width, autocommands,...)?

@thomasfaingnaert
Copy link
Collaborator

Commenting for future reference: vim/vim@dca7abe may be useful later.

@hrsh7th
Copy link
Collaborator

hrsh7th commented Nov 18, 2019

Hi there, I have floatwin/popup-win compatible codes.
The codes is similar to the proposed apis (but bit different).

If @clason don't mind, I will send PR with implementation (not spec).

@clason
Copy link
Contributor Author

clason commented Nov 18, 2019

@hrsh7th That would be very much appreciated; I have to admit I put this on a back burner due to real-life issues and the fact that neovim looks to be introducing new (and more convenient) APIs in the current release cycle (0.5), which looked worth waiting for.

The main point of this refactor is to separate the API used by vim-lsp's callbacks from the backends, and as long as your implementation does the same (in whatever way), it's fine.

@hrsh7th
Copy link
Collaborator

hrsh7th commented Nov 18, 2019

Thanks for your instructuon.

I started to switching to new implementation.
But it's bit difficult (syntax highlight etc...), So it may take sometime.

@hrsh7th
Copy link
Collaborator

hrsh7th commented Nov 19, 2019

I've sent the PR. Please check and feedback #567.

@prabirshrestha
Copy link
Owner

let us continue the discussion at vim-jp/vital.vim#747 and vim-jp/vital.vim#748.

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

Successfully merging this pull request may close these issues.

4 participants