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

wants documentation #537

Open
horseinthesky opened this issue Aug 8, 2021 · 12 comments
Open

wants documentation #537

horseinthesky opened this issue Aug 8, 2021 · 12 comments

Comments

@horseinthesky
Copy link

Describe the feature

I see a lot of people use wants term which is not mentioned in README.

Could you please explain what it is for and how I should use it?

@akinsho
Copy link
Collaborator

akinsho commented Aug 8, 2021

@horseinthesky I believe the reason that wants isn't documented is that the plan was for it to be quite a short-lived key that solved an issue for the user that contributed it. There's some plan to refactor the way the sequencing keys work which will probably lead to it being deprecated or it working differently, it isn't being advertised or explained to avoid people using it I think, although @wbthomason might have changed his mind, but from the original discussion I don't think it was planned that it would remain available in this form for this long. See #264 (comment) for reference.

@horseinthesky
Copy link
Author

Understood.

For not I don't quite understand how

use {                                      
  "hrsh7th/nvim-compe",                    
  requires = {                             
    {                                      
      "tzachar/compe-tabnine",             
      run = "./install.sh",                
      opt = true,                          
    },                                     
    { "honza/vim-snippets", opt = true },  
    {                                      
      "SirVer/ultisnips",                  
      wants = "vim-snippets",              
      opt = true,                          
    },                                     
  },                                       
  event = "InsertEnter",                   
  wants = { "compe-tabnine", "ultisnips" },
  config = function()                      
    require "config.compe"                 
  end                                      
}                                          

works exactly.

Removing wants leads to ultisnips is not loaded.

@akinsho
Copy link
Collaborator

akinsho commented Aug 9, 2021

Tbh I personally don't use the key so am not an expert on it. I've always envisioned it will change or be removed and would rather not have to tweak my config, that being said I believe the general idea around this key is that it checks if a plugin in the wants table is loaded when the plugin using the wants key is about to be loaded and if the plugin is not it then loads the plugins in the wants table, that should recursively load any plugins wanted by those plugins and so on and so for but don't know how well it all works/exactly what bits were implemented.

@horseinthesky
Copy link
Author

That is correct.

I decided to open the issue due to:

  1. People use the feature constantly.
  2. It is not documented.
  3. I don't see any other option for a plugin to load some other plugins it depends on.

@akinsho
Copy link
Collaborator

akinsho commented Aug 9, 2021

Will leave this for @wbthomason other than providing context not sure what else I can add. If the plan is still to change it's behaviour, rename or remove it then as was initially discussed in the issue then I advise against using it or documenting its current behaviour. The cat might be out of the bag a little and people are now using it but I think it still shouldn't be encouraged yet till the longterm plan for it is complete.

In any event I don't really have much else to add.

@atchim
Copy link

atchim commented Aug 25, 2021

This feature doesn't seem to be working properly. Take the following setup code as example.

require'packer'.startup{
  {
    -- `nvim-web-devicons` is denpency of several other plugins.
    {'kyazdani42/nvim-web-devicons', opt = true},
    -- `nvim-tree.lua` requires `nvim-web-devicons` to be loaded first.
    {'kyazdani42/nvim-tree.lua', wants = 'nvim-web-devicons'},
  },
  {},
}

After running :PackerSync and restarting Neovim, nvim-tree.lua is working, but with no icons because it requires nvim-web-devicons to be loaded, which isn't. :PackerStatus can be used to check this behavior.

@wbthomason
Copy link
Owner

@atchim: Please open a new issue for the problem you're observing. Thanks!

@osamuaoki
Copy link

osamuaoki commented Sep 20, 2021

Here is my 2 cents (revised):

"wants" is currently undocumented.

"after" is documented oddly with before in example found doc/packer.txt and README.md as :

   after = string or list,      -- Specifies plugins to load before this plugin.

This is correct but confusing for careless person like me.

Isn't it more like:

   after = string or list,      -- Specifies this plugin to be loaded after listed plugin(s).

(Above fixed. I was typing with sleepy eyes.)

@osamuaoki
Copy link

Of course, if wants is deprecated interface over require and after, the entry for wants can be skipped. (I am new to this packer thing).

@atchim
Copy link

atchim commented Sep 22, 2021

@atchim: Please open a new issue for the problem you're observing. Thanks!

@wbthomason, I already created an issue for this. You can find it here.

@nyngwang
Copy link

nyngwang commented Dec 21, 2022

Nobody wants to care about this one.

@homedirectory
Copy link

homedirectory commented Mar 5, 2024

Wow, I just spent 2 hours debugging my plugin dependencies and the reason turns out to be an undocumented option. It is a shame that wants is still undocumented after almost 3 years since this issue had been opened.

Neither after nor requires let me specify load dependencies correctly, which is crucial when the dependencies are optional.

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

No branches or pull requests

7 participants