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

cmd/govim: ability to move popup window to top right #1012

Open
jbpratt opened this issue Jan 3, 2021 · 3 comments
Open

cmd/govim: ability to move popup window to top right #1012

jbpratt opened this issue Jan 3, 2021 · 3 comments
Labels
onhold Probably pending some 3rd party issue

Comments

@jbpratt
Copy link

jbpratt commented Jan 3, 2021

What version of Vim/Gvim are you using?

Vim/Gvim version
❯ vim --version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Nov 15 2020 16:46:37)
Included patches: 1-1989
Compiled by Arch Linux
Huge version without GUI.  Features included (+) or not (-):
+acl               -farsi             +mouse_sgr         +tag_binary
+arabic            +file_in_path      -mouse_sysmouse    -tag_old_static
+autocmd           +find_in_path      +mouse_urxvt       -tag_any_white
+autochdir         +float             +mouse_xterm       +tcl/dyn
-autoservername    +folding           +multi_byte        +termguicolors
-balloon_eval      -footer            +multi_lang        +terminal
+balloon_eval_term +fork()            -mzscheme          +terminfo
-browse            +gettext           +netbeans_intg     +termresponse
++builtin_terms    -hangul_input      +num64             +textobjects
+byte_offset       +iconv             +packages          +textprop
+channel           +insert_expand     +path_extra        +timers
+cindent           +ipv6              +perl/dyn          +title
-clientserver      +job               +persistent_undo   -toolbar
-clipboard         +jumplist          +popupwin          +user_commands
+cmdline_compl     +keymap            +postscript        +vartabs
+cmdline_hist      +lambda            +printer           +vertsplit
+cmdline_info      +langmap           +profile           +virtualedit
+comments          +libcall           +python/dyn        +visual
+conceal           +linebreak         +python3/dyn       +visualextra
+cryptv            +lispindent        +quickfix          +viminfo
+cscope            +listcmds          +reltime           +vreplace
+cursorbind        +localmap          +rightleft         +wildignore
+cursorshape       +lua/dyn           +ruby/dyn          +wildmenu
+dialog_con        +menu              +scrollbind        +windows
+diff              +mksession         +signs             +writebackup
+digraphs          +modify_fname      +smartindent       -X11
-dnd               +mouse             -sound             -xfontset
-ebcdic            -mouseshape        +spell             -xim
+emacs_tags        +mouse_dec         +startuptime       -xpm
+eval              +mouse_gpm         +statusline        -xsmp
+ex_extra          -mouse_jsbterm     -sun_workshop      -xterm_clipboard
+extra_search      +mouse_netterm     +syntax            -xterm_save
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H     -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L. -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE  -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -L/usr/local/lib -Wl,--as-needed -o vim        -lm -ltinfo -lelf    -lacl -lattr -lgpm -ldl   -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.32/core_perl/CORE -Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/perl5/5.32/core_perl/CORE -lperl -lpthread -ldl -lm -lcrypt -lutil -lc   -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm

What version of Go are you using (go version)?

❯ go version
go version go1.15.6 linux/amd64

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GOARCH="amd64"
GOOS="linux"

What version/commit of govim are you using?

fbc47f7c20fe203500d9edad3bbc93de40c2f6d7

What is the output of :messages in Vim?

E605: Exception not caught: got error whilst handling GOVIM_internal_BalloonExpr: caught panic: interface conversion: interface
{} is float64, not json.RawMessage^@goroutine 190 [running]:^@github.com/govim/govim.(*govimImpl).run.func8.1.1(0xc0002dbe88, 0x
c000198380)^@^I/home/jbpratt/.vim/plugged/govim/govim.go:533 +0x18f^@panic(0x712500, 0xc000627320)^@^I/usr/lib/go/src/runtime/pa
nic.go:969 +0x1b9^@github.com/govim/govim/internal/plugin.Driver.do.func1(0xc0002dbcf8)^@^I/home/jbpratt/.vim/plugged/govim/inte
rnal/plugin/plugin.go:53 +0xc9^@panic(0x712500, 0xc000627320)^@^I/usr/lib/go/src/runtime/panic.go:969 +0x1b9^@main.rawToInt(0x6f
8de0, 0xc000274458, 0x76ffa5, 0x4, 0xc0000c9cc8)^@^I/home/jbpratt/.vim/plugged/govim/cmd/govim/hover.go:146 +0x1f7^@main.(*vimst
ate).showHover(0xc0001d0780, 0x7a209e, 0x85, 0xc0006272f0, 0xc00021c178, 0xc000580040, 0x756ea134baaf49, 0xee454e424bdbe8a3, 0x2
000)^@^I/home/jbpratt/.vim/plugged/govim/cmd/govim/hover.go:118 +0x8f3^@main.(*vimstate).balloonExpr(0xc0001d0780, 0x9d00a8, 0x0
, 0x0, 0x1, 0xc00028

What did you do?

@leitzler posted the following setting in Slack which throws an exception when you mouse over any identifier.

call govim#config#Set("ExperimentalMouseTriggeredHoverPopupOptions", {
      \ "mousemoved": "any",
      \ "pos": "botleft",
      \ "line": -1,
      \ "col": 0,
      \ "moved": "any",
      \ "border": [],
      \ "wrap": v:false,
      \ "close": "click",
      \ "padding": [0, 1, 0, 1],
      \})

What did you expect to see?

a beautiful on-hover box in the top right

What did you see instead?

a nasty red exception that makes you shutter every time you see it.

leitzler added a commit that referenced this issue Jan 4, 2021
Setting either ExperimentalCursorTriggeredHoverPopupOptions or
ExperimentalMouseTriggeredHoverPopupOptions fields "col" or "line"
did result in a panic.

The value was parsed as a raw json message, but since it is already
parsed once before it paniced. We now type assert the value instead.

Updates #1012
leitzler added a commit that referenced this issue Jan 5, 2021
Setting either ExperimentalCursorTriggeredHoverPopupOptions or
ExperimentalMouseTriggeredHoverPopupOptions fields "col" or "line"
did result in a panic.

The value was parsed as a raw json message, but since it is already
parsed once before it paniced. We now type assert the value instead.

Updates #1012
leitzler added a commit that referenced this issue Jan 7, 2021
Setting either ExperimentalCursorTriggeredHoverPopupOptions or
ExperimentalMouseTriggeredHoverPopupOptions fields "col" or "line"
did result in a panic.

The value was parsed as a raw json message, but since it is already
parsed once before it paniced. We now type assert the value instead.

Updates #1012
leitzler added a commit that referenced this issue Jan 8, 2021
Setting either ExperimentalCursorTriggeredHoverPopupOptions or
ExperimentalMouseTriggeredHoverPopupOptions fields "col" or "line"
did result in a panic.

The value was parsed as a raw json message, but since it is already
parsed once before it paniced. We now type assert the value instead.

Updates #1012
leitzler added a commit that referenced this issue Jan 8, 2021
Setting either ExperimentalCursorTriggeredHoverPopupOptions or
ExperimentalMouseTriggeredHoverPopupOptions fields "col" or "line"
did result in a panic.

The value was parsed as a raw json message, but since it is already
parsed once before it paniced. We now type assert the value instead.

Updates #1012
@leitzler
Copy link
Member

leitzler commented Jan 9, 2021

The ExpermientalMouseTriggeredHoverOptions aren't passed to vim verbatim today, since there is no way to specify a value relative to the mouse position. The position passed will have the cursor/mouse position added so it will always be relative.

I wrote a feature request to vim, vim/vim#7645, that would allow us to set absolute positions.

Until then there is a workaround to move the popup to top right corner:

call govim#config#Set("ExperimentalMouseTriggeredHoverPopupOptions", { "pos": "topright", "col": 9999, "line": -9999  })

@leitzler leitzler added the onhold Probably pending some 3rd party issue label Jan 9, 2021
@leitzler
Copy link
Member

leitzler commented Jan 9, 2021

Let me know if the workaround doesn't work for you @jbpratt

@jbpratt
Copy link
Author

jbpratt commented Jan 9, 2021

@leitzler sure thing, it seems to be working so far though windows aren't closing/going away as expected. I can try to debug a bit on my side as it really could be me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
onhold Probably pending some 3rd party issue
Projects
None yet
Development

No branches or pull requests

2 participants