Coder Social home page Coder Social logo

vuki656 / package-info.nvim Goto Github PK

View Code? Open in Web Editor NEW
441.0 3.0 24.0 331 KB

✍️ All the npm/yarn/pnpm commands I don't want to type

License: GNU General Public License v3.0

Lua 99.74% Makefile 0.19% Vim Script 0.08%
neovim neovim-plugin version neovim-lua neovim-gui package-json npm yarn vim pnpm

package-info.nvim's Introduction

package-info.nvim's People

Contributors

ajslater avatar aryzing avatar axieax avatar louishuyng avatar mcauley-penney avatar mhartington avatar mtoohey31 avatar pedro757 avatar reicr avatar sand4rt avatar ty3uk avatar vuki656 avatar yuki-yano avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

package-info.nvim's Issues

Figure out why on_stdout is being called twice

Currently on_stdout is being called twice and the second result is empty thus clearing the initial result.

It's fixed with a hack that stops it from running after the first run but there is probably a cleaner solution.

I'm not too sure why this is happening, need to investigate.

Release checklist

  • Add a nice readme (steal from folke, thanks folke)
  • Add image to readme
  • Add issue templates
  • Add pipeline
    • Stylua on project
  • Cut a 0.1 release
  • Post on awesome-neovim
  • Post on reddit
  • Post in VIM discord

Auto detect package manager

Provide an ability to choose a dependency manager per project.

People can have multiple projects where some of them use yarn and some npm.

Delete package on current line

  • Find package name from the current line
  • Make sure found string is actually a package by checking in the dep list
  • Open a prompt for delete confirmation
  • Delete package
  • Reload buffer
  • Handle popup not autofocusable after the first close
  • Redraw virtual text
  • Don't redraw if virtual text not visible

Fetch latest package versions

  • Figure out how to make an API call to npm
  • Figure out how to update virtual text
  • Fetch latest package version
  • Find line where to put virtual text

Breaking Changes

Follow to be notified about breaking changes.


Since 2.0 MunifTanjim/nui.nvim is now requred as a UI kit.

Packer:

use({
    "vuki656/package-info.nvim",
    requires = { "MunifTanjim/nui.nvim" },
})

Set virtual text at once

Currently, it is being set as version fetching is running which causes text to pop up one by one. The virtual text should be set after all fetch operations are finished.

  • Fetch all versions at once
  • OR => wait for all fetch operations to finish before setting the virtual text
  • Abort setting virtual text if buffer changed
    • Detect buffer change and clear everything with nvim_buf_clear_namespace()
    • Register all virtual texts under the same namespace

Maybe fetch all versions at once with this

Detect user color mode and default to 256 if truecolor not supported

If a user doesn't have a terminal that supports truecolor. no colors will be displayed at all for the plugin.

  • Detect user color mode and default to similar colors that are supported by 256 mode
    - [ ] If above not possible add a note that the user should set the supported colors trough the config

Raised in #35

Install new package

  • Figure out how to determine if its dev or prod dep
  • Install on select in the list
  • Clean up API

Ability to pick package manager

  • Option to set yarn or npm for package management commands
  • Extract commands to a list to be used depending on the pkg manager

[FEATURE REQUEST] Add commands

Issues

  • I have checked existing issues and there are no existing ones with the same request.

Feature description

Add commands for show & close. They're easier to map & call than having to script lua directly.

Help

No, sorry.

Implementation help

No response

[BUG] Reloading the buffer appends the virtual text

Issues

  • I have checked existing issues and there are no issues with the same problem.

Plugin Version

  • I am using the latest version of the plugin

Neovim Version

  • I am using the 0.5 neovim version

Neovim Version

NVIM v0.6.0-dev+112-ge7bde44d6

Branch

master

Actual behavior

With an opened package.json hit :e. With each hit, text gets appended, and ends up looking like this:

Screenshot from 2021-08-09 11-37-41

Expected behavior

I would expect virtual text to be replaced on reloading the buffer.

Steps to reproduce

See "Actual behavior"

Other information

No response

Help

No, sorry.

Implementation help

No response

Optimize itterations

  • Organize and cleanup code
  • On first parsing of package.json set package positions
  • Don't iterate buffer on each package version setting

[BUG] Highlight not working on 256 color terminals

Issues

  • I have checked existing issues and there are no issues with the same problem.

Plugin Version

  • I am using the latest version of the plugin

Neovim Version

  • I am using the 0.5 neovim version

Neovim Version

NVIM v0.5.0 Build type: Release LuaJIT 2.1.0-beta3 Compilation: clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -O2 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20210702-14987-rep9di/neovim-0.5.0/build/config -I/tmp/neovim-20210702-14987-rep9di/neovim-0.5.0/src -I/usr/local/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/gettext/include -I/tmp/neovim-20210702-14987-rep9di/neovim-0.5.0/build/src/nvim/auto -I/tmp/neovim-20210702-14987-rep9di/neovim-0.5.0/build/include

Branch

master

Actual behavior

If package-info.nvim is configured with:

  icons = { enable = false }

Then virtual text colors are not observed. The rest of the display seems fine.
Virtual text colors work fine if icons are enabled, which is the default, as i'm sure you're aware.

Tested using Terminal.app on MacOS 11.5.1

Expected behavior

I would see the default virtual text color for outdated packages (#d19a66) like i do when icons are enabled

Steps to reproduce

configure package-info.nvim like so:

require('package-info').setup {
   icons = { enable = false },                                             
}

Other information

No response

Help

Yes, but I don't know how to start. I would need guidance (check question below)

Implementation help

If I felt ambitious, maybe. But I reckon this might be a quick one for someone already familiar with the code.

[FEATURE REQUEST] Custom command to find outdated packages

Issues

  • I have checked existing issues and there are no existing ones with the same request.

Feature description

It would be useful for user to specify npm options or entirely override npm oudated command.
For example, I have a project where package.json is placed in a subdirectory, so the plugin doesn't work because I need to run npm --prefix <subdirectory> outdated.

I also believe that the plugin could provide some kind of interface and work with other languages / package managers, e.g.
Rust: { filename = "Cargo.toml", command = "cargo outdated -R --format json" }
Python: { filename = "pyproject.toml", command = "poetry show --outdated" }

Help

Yes

Implementation help

No response

Style version numbers

  • If version outdated add [red text version]
  • If version up to date add [neutral gray text]

Usage

vim.cmd("highlight PACKINFO guifg=LightGreen gui=bold,italic")

 vim.api.nvim_buf_set_virtual_text(
    0,
    0,
    buffer_line_number - 1,
    { { latest_package_version, "PACKINFO" } },
    {}
)

Upgrade package on current line

  • Find package on the current line
  • Run command to upgrade
  • Refresh buffer
  • Redraw virtual text when done
  • Don't redraw if virtual text not visible

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.