Git Product home page Git Product logo

Comments (9)

kiuKisas avatar kiuKisas commented on July 28, 2024 4

Given the current situation, we can have two differents commands:

  • :LspUpdate : check the commit/release version from compatible versioning manager (git, npm..), update if needed
  • :LspForceUpdate: just reinstall everything (server without compatible version manager only ?)

Server compatible with :LspUpdate should be mark in the readme

Seems dope enough for me :)

from nvim-lspinstall.

kabouzeid avatar kabouzeid commented on July 28, 2024 3

You can already do something like this, but it has a few UI problems.

function _G.lsp_reinstall_all()
  local lspinstall = require'lspinstall'
  for _, server in ipairs(lspinstall.installed_servers()) do
    lspinstall.install_server(server)
  end
end

vim.cmd 'command! -nargs=0 LspReinstallAll call v:lua.lsp_reinstall_all()'

from nvim-lspinstall.

kabouzeid avatar kabouzeid commented on July 28, 2024 1

I agree that this would be nice. Currently this is not possible because we don't have a simple way to check if a language server is already up to date. Any ideas how this could be done?

An easy way would be to provide a command :LspReinstallAll (or :LspUpdateAll, or :LspUpdate) to just reinstall all installed language servers?

from nvim-lspinstall.

strayer avatar strayer commented on July 28, 2024 1

I for now built me a simple bash script to update npm-based language servers:

#!/usr/bin/env bash
set -euo pipefail

if [ -e /usr/local/opt/findutils/libexec/gnubin/find ]; then
  export PATH="/usr/local/opt/findutils/libexec/gnubin:$PATH"
fi

NODE_LSPS="$(find . -maxdepth 2 -type d -name 'node_modules' -printf '%h\n' | sort -u)"

for i in $NODE_LSPS; do
  (
    cd $i
    echo "Upgrading $(basename $(pwd))"
    if [ -e yarn.lock ]; then
      OUTDATED_PACKAGES="$(yarn outdated -s)"

      if [ ! -z "$OUTDATED_PACKAGES" ]; then
        yarn upgrade --latest
      fi
    else
      OUTDATED_PACKAGES="$(npm outdated)"

      if [ ! -z "$OUTDATED_PACKAGES" ]; then
        npx --package=npm-check-updates -- ncu -u
        npm install
      fi
    fi
  )
done

I dislike it very much to use npm-check-updates, but npm doesn't really have anything like yarn upgrade --latest as far as I know. Since at least yaml already uses yarn it may make sense to use yarn for everything to make updating easier.

Currently the only language servers that are not npm-based that I use are html and such that are ripped out of Visual Studio Code. Checking for updates there isn't as easy, but I think it may be possible to load this via the GitHub releases of VS Code instead of the official download URL which would allow version checks (as long as the install scripts dumps the version at install somewhere). Although a new VS Code version doesn't necessarily mean that the LSP was updated, but as long as the VS Code team doesn't publish those via npm I don't see a better way to handle this.

from nvim-lspinstall.

SandWoodJones avatar SandWoodJones commented on July 28, 2024

I'm guessing you'd need a separate operation for getting the commit or release version of a specific server. I don't think this would be hard with servers downloaded from github or npm, but I'm not sure about other sources. Reinstalling all of the servers could be a minor inconvenience for a when there's a large number of installed servers, but your script worked well enough for something I may run once a week or so.

from nvim-lspinstall.

dagadbm avatar dagadbm commented on July 28, 2024

so this is why coc uses yarn to manage all of these dependencies.
makes sense now :p
can you elaborate on what the UI problem for this is and why is it difficult to implement a simple re-install for all of them?

from nvim-lspinstall.

kabouzeid avatar kabouzeid commented on July 28, 2024

Also every coc extensions has a maintainer who releases updates. lspinstall directly installs the servers.

from nvim-lspinstall.

kabouzeid avatar kabouzeid commented on July 28, 2024

UI problem is that when you have eg 10 servers installed, reinstalling will open 10 terminal buffers at once which becomes confusing.

from nvim-lspinstall.

dagadbm avatar dagadbm commented on July 28, 2024

from nvim-lspinstall.

Related Issues (20)

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.