mason.nvim icon indicating copy to clipboard operation
mason.nvim copied to clipboard

Uninstalled packages are displayed as installed packages

Open chrisgrieser opened this issue 2 years ago • 6 comments
trafficstars

I've searched open issues for similar requests

  • [X] Yes

I've recently downloaded the latest plugin version of mason.nvim

  • [X] Yes

Problem description

Occasionally, mason displays a package as installed, even though it is not installed, e.g. nvim reports that a lsp server cannot be spawned and such.

In the mason UI, those packages have solely an - as version number. Uninstalling and installing the package usually solves this.

Pasted image 2023-11-04 at 16 42 23@2x

Expected behavior

A package that is not installed should not be displayed as if it is installed.

Steps to reproduce

The problem occurs only very occasionally, I assume due to a failed installation/update. Since I do not know how to simulate a failing installation, I cannot fully confirm/reproduce though.

Neovim version (>= 0.7)

NVIM v0.9.4 Build type: Release LuaJIT 2.1.1697887905

Operating system/version

macOS 14.1

Healthcheck output

==============================================================================
mason: require("mason.health").check()

mason.nvim ~
- OK mason.nvim version v1.8.2
- OK PATH: prepend
- OK Providers: 
  mason.providers.registry-api
  mason.providers.client
- OK neovim version >= 0.7.0

mason.nvim [Registries] ~
- OK Registry `github.com/mason-org/mason-registry version: 2023-11-04-bulky-hunt` is installed.

mason.nvim [Core utils] ~
- OK unzip: `UnZip 6.00 of 20 April 2009, by Info-ZIP.  Maintained by C. Spieler.  Send`
- WARNING wget: not available
  - ADVICE:
    - spawn: wget failed with exit code - and signal -. wget is not executable
- OK curl: `curl 8.1.2 (x86_64-apple-darwin23.0) libcurl/8.1.2 (SecureTransport) LibreSSL/3.3.6 zlib/1.2.12 nghttp2/1.55.1`
- OK gzip: `Apple gzip 428`
- OK tar: `bsdtar 3.5.3 - libarchive 3.5.3 zlib/1.2.12 liblzma/5.0.5 bz2lib/1.0.8 `
- OK bash: `GNU bash, version 3.2.57(1)-release (arm64-apple-darwin23)`
- OK sh: `Ok`

mason.nvim [Languages] ~
- WARNING Go: not available
  - ADVICE:
    - spawn: go failed with exit code - and signal -. go is not executable
- WARNING Composer: not available
  - ADVICE:
    - spawn: composer failed with exit code - and signal -. composer is not executable
- WARNING PHP: not available
  - ADVICE:
    - spawn: php failed with exit code - and signal -. php is not executable
- WARNING cargo: not available
  - ADVICE:
    - spawn: cargo failed with exit code - and signal -. cargo is not executable
- WARNING luarocks: not available
  - ADVICE:
    - spawn: luarocks failed with exit code - and signal -. luarocks is not executable
- OK Ruby: `ruby 2.6.10p210 (2022-04-12 revision 67958) [universal.arm64e-darwin23]`
- OK node: `v21.1.0`
- WARNING julia: not available
  - ADVICE:
    - spawn: julia failed with exit code - and signal -. julia is not executable
- OK python: `Python 3.11.6`
- OK java: `openjdk version "21.0.1" 2023-10-17`
- OK JAVA_HOME: `openjdk version "21.0.1" 2023-10-17`
- OK RubyGem: `3.0.3.1`
- OK npm: `10.2.3`
- OK javac: `javac 21.0.1`
- OK pip: `pip 23.3.1 from /opt/homebrew/lib/python3.11/site-packages/pip (python 3.11)`
- OK python venv: `Ok`

mason.nvim [GitHub] ~
- OK GitHub API rate limit. Used: 6. Remaining: 4994. Limit: 5000. Reset: Sat Nov  4 16:56:52 2023.

Screenshots

No response

chrisgrieser avatar Nov 04 '23 15:11 chrisgrieser

Hey! Yeah I've noticed this too. This is entirely a UI issue, the package gets installed properly and if you restart Neovim it should be able to render the version. The UI code is largely built on top of a POC I built in an evening, which turned out to work well enough that I stuck with it.

I actually think this particular issue is going to be fixed in the upcoming 2.0 release (by making the UI code even messier).

williamboman avatar Nov 15 '23 22:11 williamboman

When you say UI issue, do you mean display issue? Because unfortunately, it is not just a display issue.

The packages can't be run as LSP servers, and the linter/formatters are not found, confirming that those packages are actually not available.

chrisgrieser avatar Nov 15 '23 23:11 chrisgrieser

When you say UI issue, do you mean display issue? Because unfortunately, it is not just a display issue.

Yep basically just the UI state not correctly representing the true state.

The packages can't be run as LSP servers, and the linter/formatters are not found, confirming that those packages are actually not available.

Huh that has not been my experience at all. Are you able to reproduce this reliably? When it happens are there any error logs in :MasonLog? If possible, would you also be able to provide the contents of the installed package (in this case the contents of ~/.local/share/nvim/mason/packages/html-lsp)?

williamboman avatar Nov 15 '23 23:11 williamboman

Yeah, as I said in the opening post, I cannot reproduce it reliably. :/ Will report when it occurs again.

chrisgrieser avatar Nov 16 '23 00:11 chrisgrieser

okay, the problem occurs once more. No version number in the Mason UI, and command not being found.

I just checked the mason directory, and it appears the problem is that the symlink is not created.

$ cd "$HOME/.local/share/nvim/mason/bin"
$ fd -HI "autotools"
packages/autotools-language-server/
staging/autotools-language-server.lock

The symlink is missing in the bin directory. Also, there is the lockfile in staging. Looking through the venv, it appears that while the virtual environment is there, there is no binary for autotools ther:

$ cd /packages/autotools-language-server
$ fd -HI autotools
# no results

Removing the lockfile, restarting vim and then updating autotools fixed the issue.

chrisgrieser avatar Nov 25 '23 16:11 chrisgrieser