Skip to content

barrett-ruth/import-cost.nvim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

import-cost.nvim

Display the costs of javascript imports inside neovim with the power of import-cost.

preview

Installation

  1. Install regularly with your neovim package manager
    • NOTE: pnpm is not supported because import-cost does not.
  2. Run install.sh with your node.js package manager to setup import-cost:
sh install.sh '<your-package-manager>'

For example, a config with yarn and lazy.nvim may look like the following:

require('lazy').setup {
    {
        'barrett-ruth/import-cost.nvim',
        build = 'sh install.sh yarn',
        -- if on windows
        -- build = 'pwsh install.ps1 yarn',
        config = true
    }
}

Configuration

Configure via the setup function (or use the defaults with no arguments):

require('import-cost').setup(opts)

See :h import-cost for more information

Known Issues

  1. CommonJS support is particularly flaky - some packages work, some dont (this is by virtue of the npm module, and, thus, unavoidable)
  2. Long wait times - once again, the npm module may take quite a while before fully parsing packages
  3. pnpm problems

Acknowledgements

  1. wix/import-cost: provides the node backend that calculates the import costs
  2. import-cost: the original VSCode plugin that started it all
  3. vim-import-cost: inspired me to do it in neovim!