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

attempt to index field 'advice' - On Nix #20

Closed
LamprosPitsillos opened this issue Sep 25, 2023 · 13 comments
Closed

attempt to index field 'advice' - On Nix #20

LamprosPitsillos opened this issue Sep 25, 2023 · 13 comments
Labels

Comments

@LamprosPitsillos
Copy link

Error detected while processing VimEnter Autocommands for "*":
Error executing lua callback: ...-scrollback.nvim/lua/kitty-scrollback/kitty_commands.lua:61: attempt to index field 'advice' (a function value)
stack traceback:
        ...-scrollback.nvim/lua/kitty-scrollback/kitty_commands.lua:61: in function 'system_handle_error'
        ...-scrollback.nvim/lua/kitty-scrollback/kitty_commands.lua:158: in function 'get_kitty_colors'
        ...itty-scrollback.nvim/lua/kitty-scrollback/highlights.lua:87: in function 'setup'
        ...zy/kitty-scrollback.nvim/lua/kitty-scrollback/launch.lua:296: in function 'setup'
        ...zy/kitty-scrollback.nvim/lua/kitty-scrollback/launch.lua:457: in function 'setup_and_launch'
        [string ":lua"]:1: in function <[string ":lua"]:1>

I get the following error when trying to use ""
Running check health results in this :


kitty-scrollback: Kitty version 0.29+ ~
- ERROR Failed to run healthcheck for "kitty-scrollback" plugin. Exception:
  ...zy/kitty-scrollback.nvim/lua/kitty-scrollback/health.lua:193: attempt to index upvalue 'p' (a nil value)
  

My config:

# Generated by Home Manager.
# See https://sw.kovidgoyal.net/kitty/conf.html
font_family JetBrainsMono NF
font_size 12

include /nix/store/sl4nhldh28ks5csxnvdjg9phymqkrxqz-kitty-themes-unstable-2023-06-01/share/kitty-themes/themes/OneHalfDark.conf

# Shell integration is sourced and configured manually
shell_integration no-rc enabled

allow_remote_control socket-only
background_opacity 1
bell_on_tab no
copy_on_select yes
disable_ligatures cursor
enable_audio_bell no
window_alert_on_bell no
window_margin_width 0

map kitty_mod+s paste_from_clipboard
map kitty_mod+v paste_from_selection


modify_font underline_position 2
modify_font underline_thickness 200%

modify_font cell_width 100%
modify_font cell_height -1px

# kitty-scrollback.nvim Kitten alias
action_alias kitty_scrollback_nvim kitten /home/inferno/.local/share/nvim/lazy/kitty-scrollback.nvim/python/kitty_scrollback_nvim.py --cwd /home/inferno/.local/share/nvim/lazy/kitty-scrollback.nvim/lua/kitty-scrollback/configs
# Browse scrollback buffer in nvim
map ctrl+shift+h kitty_scrollback_nvim
# Browse output of the last shell command in nvim
map ctrl+shift+g kitty_scrollback_nvim --config-file get_text_last_cmd_output.lua
# Show clicked command output in nvim
mouse_map ctrl+shift+right press ungrabbed combine : mouse_select_command_output : kitty_scrollback_nvim --config-file get_text_last_visited_cmd_output.lua

kitty 0.29.2 created by Kovid Goyal
❯ nv --version
NVIM v0.10.0-dev-c68c121
Build type: Release
LuaJIT 2.1.1693350652
Run "nvim -V1 -v" for more info
@mikesmithgh
Copy link
Owner

Hi @LamprosPitsillos thanks for reporting. Do you have listen_on set anywhere in your config? I don't see it in the one you posted. For example, listen_on unix:/tmp/kitty

I am thinking remote calls to Kitty are failing resulting in nil values.

@LamprosPitsillos
Copy link
Author

LamprosPitsillos commented Sep 25, 2023

I added that , must have missed it somehow , thanks , but now i get this

kitty-scrollback.nvim

ERROR: failed to execute remote Kitty command 

command: kitty @ close-window --match=id:3
pid: 3189603
code: 1
signal: 0
stdout:
  <none>
stderr:
  Error: No matching windows for expression: id:3

Running check health gives the previous mentioned error

@mikesmithgh
Copy link
Owner

@LamprosPitsillos I had some bad logic around checkhealth. I pushed a fix for that would you mind pulling the latest, completely closing Kitty, reopening and running nvim +'KittyScrollbackCheckHealth'?

@LamprosPitsillos
Copy link
Author

kitty-scrollback: sed ~
- ERROR Failed to run healthcheck for "kitty-scrollback" plugin. Exception:
  ...unwrapped-c68c121/share/nvim/runtime/lua/vim/_system.lua:241: ENOENT: no such file or directory
 

Still get the error but , check health now gives this

@mikesmithgh
Copy link
Owner

Debug notes:

uname -a
Linux mikesvm 6.2.0-32-generic #32-Ubuntu SMP PREEMPT_DYNAMIC Mon Aug 14 12:37:51 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
which command
exit 1
:=vim.uv.spawn('command', {})
nil                                                                                                                         
ENOENT: no such file or directory
ENOENT

osx

which command
/usr/bin/command

use vim.fn.exepath('sed') instead

@xfzv
Copy link

xfzv commented Sep 26, 2023

kitty-scrollback: sed ~
- ERROR Failed to run healthcheck for "kitty-scrollback" plugin. Exception:
  ...unwrapped-c68c121/share/nvim/runtime/lua/vim/_system.lua:241: ENOENT: no such file or directory
 

Still get the error but , check health now gives this

I'm getting this error too:

==============================================================================
kitty-scrollback: require("kitty-scrollback.health").check()

kitty-scrollback: Neovim version 0.10+ ~
- OK NVIM 0.10.0-dev+dirty

kitty-scrollback: Kitty remote control ~
- OK `kitty @ ls` exited with code *0*

kitty-scrollback: Kitty data ~
- OK Kitty data available
  >lua
  {
    columns = 157,
    config_files = { "/home/xfzv/.local/share/nvim/lazy/kitty-scrollback.nvim/lua/kitty-scrollback/configs/checkhealth.lua" },
    cursor_x = 1,
    cursor_y = 3,
    kitty_config_dir = "/home/xfzv/.config/kitty",
    kitty_opts = {
      allow_remote_control = "yes",
      listen_on = "unix:/tmp/kitty",
      scrollback_fill_enlarged_window = false,
      scrollback_lines = 2000,
      scrollback_pager = { "less", "--chop-long-lines", "--RAW-CONTROL-CHARS", "+INPUT_LINE_NUMBER" },
      scrollback_pager_history_size = 0,
      shell_integration = { "enabled" }
    },
    kitty_version = { 0, 30, 0 },
    ksb_dir = "/home/xfzv/.local/share/nvim/lazy/kitty-scrollback.nvim",
    lines = 71,
    scrolled_by = 0,
    window_id = 1
  }
  

kitty-scrollback: Kitty version 0.29+ ~
- OK kitty 0.30.0

kitty-scrollback: clipboard ~
- OK Clipboard tool found: *xsel*

kitty-scrollback: Kitty shell integration ~
- OK Kitty shell integration is enabled

kitty-scrollback: sed ~
- ERROR Failed to run healthcheck for "kitty-scrollback" plugin. Exception:
  /usr/share/nvim/runtime/lua/vim/_system.lua:241: ENOENT: no such file or directory

@mikesmithgh
Copy link
Owner

Hey @LamprosPitsillos and @xfzv thanks for reporting, I pushed a fix. Could you try with latest and let me know if you have any more issues?

@LamprosPitsillos
Copy link
Author

LamprosPitsillos commented Sep 27, 2023

https://gist.github.com/LamprosPitsillos/01c7e4802a35782358bb8445d3a9c4bf
Here is the output of nvim +'KittyScrollbackCheckHealth' which everything shows up fine.

But the error is still there.

kitty-scrollback.nvim

ERROR: failed to execute remote Kitty command

command: kitty @ close-window --match=id:7
pid: 11513
code: 1
signal: 0
stdout:
  <none>
stderr:
  Error: No matching windows for expression: id:7



kitty-scrollback.nvim: Fatal error, see logs.
Where are these logs stored to help with debugging?

@mikesmithgh
Copy link
Owner

Hey @LamprosPitsillos , the logs are just what is displayed that you pasted.

  • What keymap are you pressing that is causing the error?
  • Do the other keymaps work? (e.g., kitty_mod+g vs kitty_mod+h)
  • If you remove no-rc from your config, does it work?
shell_integration no-rc enabled

to

shell_integration enabled

I am thinking I may have validation on shell_integration that is failing incorrectly and the error may be misleading, or some race condition that is attempting to close the same loading window twice. Thanks for the info!

@mikesmithgh
Copy link
Owner

@LamprosPitsillos I have a branch where I am refactoring the close window logic, could you try with branch tryclose (https://github.com/mikesmithgh/kitty-scrollback.nvim/tree/tryclose) and see if you still have the problem? I'm not able to reproduce on my side.

@LamprosPitsillos
Copy link
Author

The tryclose branch seems to work as expected ( at least no errors popup) , thank you!

mikesmithgh added a commit that referenced this issue Oct 1, 2023
Improve logic when closing the Kitty loading window. It is possible that
the loading window is already closed by the time we attempt to close it.
In this case, check if the window exists, otherwise reattempt.

Improve logic when getting Kitty terminal colors. If get-colors fails
with a given window ID, then reattempt without a window ID.

closed #20
mikesmithgh pushed a commit that referenced this issue Oct 1, 2023
## [1.1.6](v1.1.5...v1.1.6) (2023-10-01)

### Bug Fixes

* reattempt kitty window close and get-colors ([#28](#28)) ([abc677a](abc677a)), closes [#20](#20)
@mikesmithgh
Copy link
Owner

🎉 This issue has been resolved in version 1.1.6 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@mikesmithgh
Copy link
Owner

Thanks @LamprosPitsillos for letting me know, I have released the fix. Please let me know if you have any other issues 👍.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants