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

hints --type=linenum --linenum-action does no path path to editor #4675

Closed
Domeee opened this issue Feb 10, 2022 · 7 comments
Closed

hints --type=linenum --linenum-action does no path path to editor #4675

Domeee opened this issue Feb 10, 2022 · 7 comments
Labels

Comments

@Domeee
Copy link

Domeee commented Feb 10, 2022

Describe the bug
Opening a file in neovim via hints mode opens the base path to the file correctly but passes only the +{line} option and ignores the path.

kitty.conf

map ctrl+shift+o kitten hints --type=linenum --linenum-action=window nvr --remote +{line} {path}

text acted on [1]

2pp/modules/footprintCalculator/components/stories/FootprintCalculator.stories.tsx:33:7 - error TS
2322: Type 'undefined' is not assignable to type 'number | null'.

33       selected_index: undefined,
         ~~~~~~~~~~~~~~

  1pp/modules/footprintCalculator/FootprintCalculator.ts:19:3
    19   selected_index: number | null;
         ~~~~~~~~~~~~~~
    The expected type comes from property 'selected_index' which is declared here on type 'Footpri
ntCalculatorField'

text acted on [2]

1home/dome/Code/enerjoy/code/enerjoy-mobile/app/modules/footprintCalculator/components/SelectListValueActionSheet.tsx:114:19: This assertion is unnecessary since it does not change the type of the exp
ression. [Error/@typescript-eslint/no-unnecessary-type-assertion]

path opened in neovim

~/Code/enerjoy/enerjoy-mobile/19
~/Code/enerjoy/enerjoy-mobile/114

Manually invoking the linenum-action works fine.

To Reproduce
Steps to reproduce the behavior:

  1. act on the text provided with the provided kitty.conf

Environment details

kitty 0.24.2 created by Kovid Goyal
Linux encore 5.16.5-arch1-1 #1 SMP PREEMPT Tue, 01 Feb 2022 21:42:50 +0000 x86_64
Arch Linux 5.16.5-arch1-1 (/dev/tty)

LSB_VERSION=1.4
DISTRIB_ID=Arch
DISTRIB_RELEASE=rolling
DISTRIB_DESCRIPTION="Arch Linux"
Running under: X11
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /usr/bin/zsh
Loaded config files:
  /home/dome/.config/kitty/kitty.conf

Config options different from defaults:
clipboard_control    ('write-clipboard', 'write-primary')
cursor_shape         3
enable_audio_bell    False
font_size            12.0
scrollback_pager     ['nvim', '-c', 'set nonumber nolist showtabline=0 foldcolumn=0 laststatus=0', '-c', 'autocmd TermOpen * normal G', '-c', 'silent write! /tmp/kitty_scrollback_buffer | te head -c-1 /tmp/kitty_scrollback_buffer; rm /tmp/kitty_scrollback_buffer; cat']
window_padding_width FloatEdges(left=5.0, top=5.0, right=5.0, bottom=5.0)
Changed shortcuts:
	ctrl+shift+g → scroll_end
	ctrl+shift+o → kitten hints --type=linenum --linenum-action=window nvr --remote +{line} {path}
Colors:
	background           #282828   
	color0               #282828   
	color1               #f43753   
	color10              #c9d05c   
	color11              #ffc24b   
	color12              #b3deef   
	color13              #d3b987   
	color14              #73cef4   
	color15              #feffff   
	color2               #c9d05c   
	color3               #ffc24b   
	color4               #b3deef   
	color5               #d3b987   
	color6               #73cef4   
	color7               #eeeeee   
	color8               #4c4c4c   
	color9               #f43753   
	cursor               #eeeeee   
	foreground           #eeeeee   

Environment variable names seen by the kitty process:
	DBUS_SESSION_BUS_ADDRESS
	DISPLAY
	DOTNET_BUNDLE_EXTRACT_BASE_DIR
	DOTNET_ROOT
	GTK_MODULES
	HOME
	I3SOCK
	INVOCATION_ID
	LANG
	LOGNAME
	MAIL
	MOTD_SHOWN
	OLDPWD
	PATH
	PWD
	SHELL
	SHLVL
	SSH_AGENT_PID
	SSH_AUTH_SOCK
	SYSTEMD_EXEC_PID
	TERM
	USER
	WINDOWPATH
	XAUTHORITY
	XDG_DATA_DIRS
	XDG_RUNTIME_DIR
	XDG_SEAT
	XDG_SESSION_CLASS
	XDG_SESSION_ID
	XDG_SESSION_TYPE
	XDG_VTNR

@Domeee Domeee added the bug label Feb 10, 2022
@kovidgoyal
Copy link
Owner

That will be because whatever nvr is, is discarding the second argument.
Try running nvim or vim instead and it will work fine.

@Domeee
Copy link
Author

Domeee commented Feb 10, 2022

Hi @kovidgoyal

Thank you very much for your fast replay. As stated in the bug report, manually invoking the linenum-action works fine. It seems that kitty is not providing the {path} to the linenum-action.

@kovidgoyal
Copy link
Owner

Works for me with:

  1. Run kitty as

kitty -o 'map ctrl+shift+o kitten hints --type=linenum --linenum-action=window vim --remote +{line} {path}'

  1. Type setup.py:33

  2. Press ctrl+shift+o

  3. press 1

  4. setup.py is opened in vim at line 33

@kovidgoyal
Copy link
Owner

Does not repro for me with

kitty -o 'map ctrl+shift+o kitten hints --type=linenum --linenum-action=window vim --remote +{line} {path}' sh -c "echo setup.py:33:**1**; read"

or with

kitty -o 'map ctrl+shift+o kitten hints --type=linenum --linenum-action=window vim --remote +{line} {path}' sh -c "echo setup.py:33:1; read"

@Frydac
Copy link

Frydac commented Feb 23, 2022

Hi,

I bumped into this while after updating my system. {path} seems to be incorrect only if the string matched has a slash and line and column in the following format:

path/myfile.cpp:10:5

I used this map to test with

map ctrl+shift+o kitten hints --type=linenum --linenum-action=self --hints-text-color=yellow path=\"{path}\" line=\"{line}\"

this prints with the above path as input (however it highlights the path and both numbers)
'path="10"' 'line="5"'

while path/myfile.cpp:10 and myfile.cpp:10:5 work as expected

In a previous version it used to also work as expected with path/myfile.cpp:10:5 but I don't know what version that was.

(FYI: it would be nice to also have a {column} :) e.g. gcc/clang also provide the column number in the above format)

@page-down
Copy link
Contributor

b2bfc44

This issue can be reproduced in the master branch.
Regular expressions need to be adjusted for matching.

@Domeee
Copy link
Author

Domeee commented Feb 24, 2022

Hi @kovidgoyal, tyvm for fixing this issue!

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

4 participants