-
Notifications
You must be signed in to change notification settings - Fork 395
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
Adjustment of omnicomplete #2606
Comments
I can see why you would want this. This is currently not supported. The completion items provided by VimTeX only includes a "fancy" completion menu, not any additional information that would be displayed in a preview or extra popup window. PS! The
Yes, but you are reading this wrong. The popup menu here refers to the actual completion menu. Instead, the "info" item is the one we want in this particular case. I will look into if this is a quick win. If it is, I may implement it. If it turns out to be hard, then I may not have the time. |
For citation completion, it is quite easy to add information in such a popup window. However, I'm not sure I see a very big value of it compared to simply adjusting the menu as it is displayed with For reference completion for equations and similar, it is harder. Perhaps not impossible, but still, I don't think I have the time to follow that up right now. I would not mind getting a PR or similar for this, but I'll not spend time on it myself. Sorry. |
Ok. The popup is positioned to the right of the completion menu, and in my tests, it seems hard to place the popup more dynamically. One idea then might be to simplify the contents of the completion menu, which would make it less wide. With I could create a PR with necessary changes to VimTeX for something like this.
With the
Yes, that would make sense. But reference completion is based on parsing the aux file. The aux file does not contain the source position, only the output position. Thus, we do not immediately know where a particular reference is located in the source files, and so showing surrounding lines is non-trivial. Of course, we can parse the entire LaTeX source, but that is much more expensive. It could work, though, but I'm not really tempted to try it. Sorry!
Yes, adding the info popup for cite completion can be a viably feature request as mentioned above. |
Ok, I believe the changes for citation completion are not going to be intrusive, so I've pushed a first version of it directly now. Please update and test and let me know what you think. |
The citation completion looks great to me. Thank you for your work. That is exactly what I expect. One more thing is, could we control which information showed in the popup window? Like the way we set up the value of menu_fmt to change the content of completion menu. By the way, for the reference completion, I might want to know if we could also setup the values of menu_fmt and info_fmt if possible to adjust the content of completion menu and popup. I prefer to add some contents in the popup once the menu items are truncated, even they might have same information. Right now, I notice a black popup coming out for reference completion. Here is a picture of my test. It may helps us when \ref{} is closed to right boundary of vim. |
Yes, good idea. I've implemented that now, please see
I think you are mixing two different things here:
Do I understand you correctly? If so, can we please focus on one of these at a time? |
Thank you very much. That's wonderful.
If it is empty, it seems useless to show an empty popup. Is there a way to hide it?
Yes, this is what I want. What I'm thinking about is, we can adjust the value of menu_fmt and info_fmt so that if info_fmt key is not empty, then there is a popup coming out showing the information described by info_fmt. If info_fmt is empty, we just hide the popup. |
Glad to hear it!
Well, for me, there is no such empty popup. Can you explain how to reproduce this?
Ok, so: |
After trying other languages, I guess this is not directly related to vimtex. The way to reproduce is, after we insert a citation by selecting one item in the completion menu (which will have a popup window by setting |
Ah, yes, that may explain it. It seems like a bug. Not sure. Do you need |
Yes, the same thing happens if I remove |
After you start Vim, you can use But OK, I have to admit I don't quite know how to solve the case of the empty popup. Sorry! |
I see. It showed the plug
That's fine. Thank you for your work. I can set completepopup=border:off to make it less obvious. |
One more thing I would like to mention. I'm not sure if you would like to add it into vimtex. As I noticed, we can change the options of the popup to make it more fancy. Here, I added the following code in my function! UpdatePopup()
let popid=popup_findinfo()
if popid!=0
call setwinvar(popid,'&conceallevel', 3)
call setbufvar(winbufnr(popid),'&filetype', 'markdown')
endif
endfunction
au CompleteChanged * call UpdatePopup() With syntax highlight, it is easier for us to identify the important information. It is also good for us to add syntax highlight for the popup. |
Ah, yes, I agree that this is useful and can improve the popup. Notice, though, that you may want to restrict the autocommand for this particular |
Yes, that's right. Thank you. |
Here is one more thing we can do to improve the reference completion. As I have checked the content of a .aux file, there is one more piece of information we can take advantage of is the "title" of that item. I modify the auxiliary.vim by myself and put extra things to the info popup. In particular, the title is quite suitable to be put in the popup. Here is a picture of it and it shows the name of this theorem if it has one. So here are two improvements for the reference completion. The first one is, it would be better to support the custom content for the "menu" item and "info" item. For me, I prefer a very short "menu" item only containing key information. The second one is, it would be great if we could include the "title" information in the completion as it was already provided by the .aux file. |
For this, it would be better if you open a new issue where you provide an example file with which I can test while implementing. The example file should not be too long, but it should be long enough to make a good example. When I compile it, it should contain the mentioned information in the aux file. It would also be nice if you can explain slightly more the "before" and "after" of both proposed suggestions. |
I'll take the liberty of closing this issue. |
I want to show extra information about the currently selected completion in a popup window by put
:set completeopt+=popup
. But I found it did not work. I run the functionvimtex#complete#omnifunc
manually and found a lot of things are contained in "menu" item. According to the help doc of "complete-functions", the "menu" item is used in the popup menu and may be truncated, thus it should be relatively short. Hence it is hard to see the detailed info about the selected completion, especially I want to cite papers since the "menu" item is quite long. It is better that I can view them in a popup menu. This is extremely helpful if it can provide us detailed info in a popup menu about the referenced equations and citations, especially when writing a long paper with a large bib file.The text was updated successfully, but these errors were encountered: