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

bug: error on startup #754

Closed
4 tasks done
mehalter opened this issue Jul 18, 2024 · 8 comments · Fixed by #757
Closed
4 tasks done

bug: error on startup #754

mehalter opened this issue Jul 18, 2024 · 8 comments · Fixed by #757
Labels
bug Something isn't working

Comments

@mehalter
Copy link
Contributor

Did you check docs and existing issues?

  • I have read all the which-key.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of which-key.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.10.0 (github release)

Operating system/version

Arch Linux

Describe the bug

On startup I get an error: clipboard: error: Error: target STRING not available
2024-07-18_08:11:59_screenshot

Steps To Reproduce

  1. nvim -u repro.lua
  2. See error

Expected Behavior

No error on startup

Health

which-key: require("which-key.health").check()

- OK Most of these checks are for informational purposes only.
  WARNINGS should be treated as a warning, and don't necessarily indicate a problem with your config.
  Please |DON't| report these warnings as an issue.

Checking your config ~
- WARNING |mini.icons| is not installed
- WARNING |nvim-web-devicons| is not installed
- WARNING Keymap icon support will be limited.

Checking for issues with your mappings ~
- OK No issues reported

checking for overlapping keymaps ~
- WARNING In mode `n`, <gc> overlaps with <gcc>:
  - <gc>: Toggle comment
  - <gcc>: Toggle comment line
- OK Overlapping keymaps are only reported for informational purposes.
  This doesn't necessarily mean there is a problem with your config.

Checking for duplicate mappings ~
- OK No duplicate mappings found

Log

Debug Started for v3.9.0
Plugin("marks").expand
Plugin("marks").expand
Plugin("registers").expand
new Mode(n:1)
Trigger(add) Mode(n:1) ` ' " g' g` z= g z ] [ <C-W>
on_key: :
ModeChanged(n:c)
  Plugin("registers").expand
  new Mode(c:1)
  Safe(true)
Trigger(add) Mode(c:1) <C-R>
on_key: q
on_key: <CR>
ModeChanged(c:n)
  Unsafe(command-mode)
  suspend: Mode(n:1)
  Trigger(del) Mode(n:1) " g' g` z= g z ] [ ` <C-W> '
Trigger(add) Mode(n:1) ` ' " g' g` z= g z ] [ <C-W>

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    { "folke/which-key.nvim", opts = {} },
    -- add any other plugins here
  },
})
@mehalter mehalter added the bug Something isn't working label Jul 18, 2024
@folke
Copy link
Owner

folke commented Jul 18, 2024

I don't get that error.
What does :checkhealth vim.provider show?

@folke folke closed this as completed in 27e4716 Jul 18, 2024
folke added a commit that referenced this issue Jul 18, 2024
@mehalter
Copy link
Contributor Author

provider.clipboard: require("provider.clipboard.health").check()

Clipboard (optional) ~
- OK Clipboard tool found: xclip

Here is a recording of the occurrences: https://asciinema.org/a/9rJ5caRiafJol3wwDXV9IKxKm

In this recording each time it happened. It seems like every once in a while it will not display it, then go on a few restarts with it not happening, then kick back up again

@folke
Copy link
Owner

folke commented Jul 18, 2024

Fixed in two ways:

@mehalter
Copy link
Contributor Author

ah I see I'm a moment too slow! Thanks so much for taking a look! Based on the code you just pushed it seems like that's probably the problem. A race condition of some kind which would be the reason it was not happening every single time in my experience.

Thank you again for your ongoing support!

@folke
Copy link
Owner

folke commented Jul 18, 2024

I just checked the Neovim source code and unfortunately that warning can't be prevented.
It happens when the clipboard tool doesn't return a value for the register.
On wayland, this is the case after restart when the clipboard is still empty.

@mehalter
Copy link
Contributor Author

Interesting, there must be something similar with Xorg as well since I'm not using Wayland. Thanks for the insight and taking a look!

@folke
Copy link
Owner

folke commented Jul 18, 2024

But 27e4716 should at least prevent showing that warning at startup.
It may still be shown when you do " with an empty clipboard.

@folke
Copy link
Owner

folke commented Jul 18, 2024

folke pushed a commit that referenced this issue Jul 18, 2024
🤖 I have created a release *beep* *boop*
---


##
[3.10.0](v3.9.0...v3.10.0)
(2024-07-18)


### Features

* **view:** expand all nodes by default when filter.global = false
([c168905](c168905))


### Bug Fixes

* **buf:** always use nowait. Fixes
[#755](#755)
([ae1a235](ae1a235))
* **buf:** early exit to determine if a trigger is safe to create. Fixes
[#754](#754)
([27e4716](27e4716))
* **icons:** added frontier pattern for `ai`
([#760](#760))
([6fe0657](6fe0657))
* list_contains doesn't exists in Neovim &lt; 0.10. Fixes
[#758](#758)
([7e4eae8](7e4eae8))
* **node:** allow custom mappings to override proxy/plugin/expand
mappings
([9820900](9820900))
* **node:** is_local check now also includes children
([fdd27f9](fdd27f9))
* **registers:** don't try to get `+*` registers when no clipboard is
available. Fixes
[#754](#754)
([ae4ec03](ae4ec03))
* **state:** always honor defer. Fixes
[#690](#690)
([c512d13](c512d13))
* **state:** redraw cursor before getchar
([cf6cbf2](cf6cbf2))
* **triggers:** prevent creating triggers for single upper-case alpha
keys expect for Z. Fixes
[#756](#756)
([d19fa07](d19fa07))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants