akiyosi / goneovim

A GUI frontend for neovim.
MIT License
2.4k stars 63 forks source link

[Bug] extPopupMenu is misaligned with text #225

Open shaunsingh opened 3 years ago

shaunsingh commented 3 years ago

Hi! First of all I would like to say I love your gui, it has since become my main gui for code editing

When typing something, the popup menu for the LSP (nvim-lsp) will obstruct the text

image

Compared to terminal neovim, the popupmenu should be slightly lower and more to the right (aligned below the first character of the word)

image

Do you recommend any fix?

Sincerely, Shaurya

akiyosi commented 3 years ago

Hi, Thanks for reporting this issue! I've seen reports of similar issues before, but I can't reproduce the problem in my environment. What are the contents of your ~/.config/goneovim/settings.toml? Also, what version of nvim are you using?

shaunsingh commented 3 years ago

Hi, my settings.toml is the following:

## Goneovim settings.toml
## All of the following commented configuration items have default values.

[Editor]
## Makes the application window frameless.
BorderlessWindow = true

## Editor minimum window width (>= 400)
# Width = 800
## Editor minimum window height (>= 300)
# Height = 600
## Create a small margin on the left and right sides of the application window.
Gap = 2

## This option makes the whole GUI window in semi-transparent.
## This setting also implicitly enables the Drawborder setting
# Transparent = 0.9

## Launch goneovim with full screen window size.
# StartFullscreen = false

## Editor external font-family, font-size, and linespace.
## This is the font and linespace settings of the graphical UI as an nvim front end.
## For example, linespace affects the margins of the external completion popup menu UI.
## Note that the linespace setting must be the same on the Neovim side. The reason for this
## is that the default value on the Neovim side is 0, which will be overwritten by the Neovim setting.
## Of course, these settings can also be changed by setting the guifont and linespace on the Neovim side.
## Fontfamily is
## In MacOS,
FontFamily = "SF Mono"
## In Linux
# FontFamily = "Consolas"
## In Windows
# FontFamily = "Windows"
## Fontsize is
# FontSize = 12
## linespace is
# Linespace = 6

## Neovim external UI features
## The following is the default value of goneovim.
## You can change the behavior of the GUI by changing the following boolean values.
## If you prefer the traditional Vim UI, set it to false for all.
## Also, `ExtMessages` is still experimental at this time and we don't recommend setting it to true if you want stability.
ExtCmdline   = true
ExtPopupmenu = true
ExtTabline   = true
ExtMessages  = true

## Goneovim has a cached rendering feature enabled to speed up the process.
## If you want to disable it, set it to false
CachedDrawing = true
## You can specify the cache size to be used by the cache rendering feature of goneovim.
## The default is 400.
# CacheSize = 400

## Disables font ligatures.
# DisableLigatures = true

## Copy yanked text to clipboard
Clipboard = true

## This setting is equivalent to Macmeta in MacVim.
# Macmeta = true

## The input method editor will be automatically disabled when the mode is changed to normal mode.
## It may be useful for users who use the input method editor (e.g. East Asian users).
## DisableImeInNormal = false

## Draw borders on the GUI side instead of the vertical border and status line that nvim draws.
DrawWindowSeparator = false
WindowSeparatorTheme = "dark"
WindowSeparatorColor = "#212337"
WindowSeparatorGradient = false

## Draw built-in indent guide
## Enabling this setting will have a slight impact on performance.
# IndentGuide = false
# IndentGuideIgnoreFtList = ["md"]
# OptionsToUseGuideWidth = "tabstop"

## Animates the scrolling behavior of Neovim when the scroll command is entered.
# SmoothScroll = false
## Disables horizontal scrolling for smooth scrolling with the touchpad.
# DisableHorizontalScroll = true

## Draw border on a float window
# DrawBorderForFloatWindow = false

## Draw shadow under a float window
DrawShadowForFloatWindow = true

## Enable desktop notification settings for nvim messages.
## This option works only if `ExtMessages` is enabled.
# DesktopNotifications = true

# Display the effect when clicked
ClickEffect = true

# Pattern that fills the diff background
# Change the background pattern used for diff display.
# This option allows you to use a visual effect pattern such as Dense, Diagonal Stripe instead of a regular solid pattern.
# The available patterns are all Qt brush styles. For more information, See: https://doc.qt.io/qt-5/qbrush.html#details
# // -- diffpattern enum --
# // SolidPattern             1
# // Dense1Pattern            2
# // Dense2Pattern            3
# // Dense3Pattern            4
# // Dense4Pattern            5
# // Dense5Pattern            6
# // Dense6Pattern            7
# // Dense7Pattern            8
# // HorPattern               9
# // VerPattern               10
# // CrossPattern             11
# // BDiagPattern             12
# // FDiagPattern             13
# // DiagCrossPattern         14
# // LinearGradientPattern    15
# // RadialGradientPattern    16
# // ConicalGradientPattern   17
# // TexturePattern           24
# DiffAddPattern    = 1
# DiffDeletePattern = 1
# DiffChangePattern = 1

## You can write a vimscript to be executed after goneovim starts,
## for example to disable the vimscript that Goneovim has embedded internally.
## GinitVim = '''
##  let g:hoge = 'fuga'
## '''
# Ginitvim = ""

## The palette is used as an input UI for externalized command lines and the Fuzzy-Finder feature built into Goneovim.
[Palette]
## Specifies the proportion of the command line palette to the height of the entire window.
# AreaRatio = 0.5
## Specifies the number of items to be displayed in the command line palette.
# MaxNumberOfResultItems = 30
## Specifies the opacity of the command line palette.
# Transparent = 1.0

## Configure externalized message UI.
[Message]
## Specifies the opacity of the message window.
# Transparent = 1.0

## The statusline configuration below relates to the display of Goenovim's own external status lines.
## If you want to use neovim's status line plugin, you should disable its display.
# [Statusline]
## Whether or not to display the external status line
# Visible = false

## Options: "textLabel" / "icon" / "background" / "none"
#jModeIndicatorType = "textLabel"

## Optional setting colors per Neovim editing modes
#NormalModeColor = "#3cabeb"
#CommandModeColor = "#5285b8"
#InsertModeColor = "#2abcb4"
#ReplaceModeColor = "#ff8c0a"
#VisualModeColor = "#9932cc"
#TerminalModeColor = "#778899"

## Statusline components
#Left = [ "mode", "filepath", "filename" ]
#Right = [ "message", "git", "filetype", "fileformat", "fileencoding", "curpos", "lint" ]

## Configure externalized tabline UI.
[Tabline]
## Whether or not to display the external tabline
Visible = true
ShowIcon = true

## Configure externalized popupmenu UI.
[Popupmenu]
## neovim's popupmenu is made up of word, menu and info parts.
## Each of these parts will display the following information.
##   word:   the text that will be inserted, mandatory
##   menu:   extra text for the popup menu, displayed after "word"
##   info:   more information about the item, can be displayed in a preview window
## The following options specify whether to display a dedicated column in the popupmenu
## to display the long text displayed in the `info` part.
ShowDetail = true

## total number to display item
# Total = 20

## width of `menu` column
# MenuWidth = 400

## width of `info` column
#InfoWidth = 1

## width of `detail` column
# DetailWidth = 250

## Show digit number which can select item for popupmenu
ShowDigit = true

[ScrollBar]
## Specifies whether to show the external scrollbar or not.
# Visible = true

[MiniMap]
## To view the minimap, launch an additional nvim instance;
## setting Disable to true will not launch this additional nvim instance
## and will completely disable the minimap feature.
# Disable = false

## Specifies whether to show the minimap or not.
Visible = true

## Specifies the width of the minimap.
Width = 100

## Configure the markdown preview feature
[Markdown]
Disable = false

## Specifying code highlighting styles
CodeHlStyle = "github"

[SideBar]
## Specifies whether to show the external sidebar or not.
# Visible = true

## Specify the sidebar width
# Width = 200

## Specify whether or not to draw a shadow under the sidebar.
# DropShadow = true

## Specify the color to use when selecting items in the sidebar or palette in hexadecimal format
# AccentColor = "#a3ace1"

[FileExplore]
## Specify the maximum number of items to be displayed in the file explorer.
# MaxDisplayItems = 30

[Workspace]
## This setting sets the format of the path string of CWD in the sidebar.
##  name: directoryname
##  full: /path/to/directoryname
##  minimum: /p/t/directoryname
# PathStyle = "minimum"

## Specifies whether the last exited session should be restored at the next startup.
# RestoreSession = false

Running nvim --version returns this:

~
❯ nvim --version
NVIM v0.5.0-dev+1327-gdc18c1e3e
Build type: Release
LuaJIT 2.1.0-beta3
Compilation: clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmi
ssing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK
_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/tmp/neovim-20210517-93098-alr64w/build/config -I/tmp/neovim-20210517-93098-alr64w/src -I/Users/shauryasingh/h
omebrew/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/Users/shauryasingh/homebrew/opt/gettext/i
nclude -I/tmp/neovim-20210517-93098-alr64w/build/src/nvim/auto -I/tmp/neovim-20210517-93098-alr64w/build/include
Compiled by shauryasingh@Shauryas-MacBook-Pro.local

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "
/Users/shauryasingh/homebrew/Cellar/neovim/HEAD-dc18c1e_2/share/nvim"

Run :checkhealth for more info

I'm on macOS 11.3.1 with the latest version of LuaJIT and goneovim from the releases page

akiyosi commented 3 years ago

Thanks for the information. Also, sorry for the late reply.

Hmmm, I am trying to reproduce based on your published neovim settings(https://github.com/shaunsingh/vimrc-dotfiles), but it does not reproduce. Do you have any experience that the problem depends on a specific language project? For example, Java projects have the problem, etc.

2021-06-04-9 07 32
gi1242 commented 2 years ago

I'm having the same problem! When I started using nvim-cmp, I found that the popup menu goes into the wrong place. It goes to the top left corner of the screen and blocks cursor. Screenshot_20220809_224414 It happens both when ExtPopupMenu=true and ExtPopupMenu=false. The issue is also not present in nvim-qt, and the console nvim.

I think the problem might be when the completion menu contains really long items, but I might be wrong.

Thanks!

akiyosi commented 2 years ago

@gi1242 Thanks for this issue report.

My understanding is that nvim-cmp's completion menu is not Neovim's native popupmenu, but uses the float window feature to display its own popup menu. Therefore, enabling or disabling Extpopupmenu should not depend on the issue. Because Extpopupmenu is a function to externalize Neovim native popupmenu. You could verify this point. That is, enabling Extpopupmenu should not change the appearance of nvim-cmp's completion menu display.

The problem probably affects the fact that goneovim is a multigrid UI architecture. Similar problems have occurred with coc.nvim and others, for which I have issued a PR. e.g. https://github.com/neoclide/coc.nvim/pull/4014 https://github.com/neoclide/coc.nvim/pull/3150 https://github.com/Yggdroot/LeaderF/issues/501

I will investigate this issue and report any progress.

akiyosi commented 2 years ago

@gi1242 What is your goenovim version? (result of exec :GonvimVersion or /path/to/goneovim --version) If possible, please check the operation with the latest version as well.

https://github.com/akiyosi/goneovim/releases/tag/nightly

Note that I have checked the operation in my environment and the nvim-cmp completion menu seems to be working. Here are my settings;

  use 'hrsh7th/cmp-nvim-lsp'
  use 'hrsh7th/cmp-buffer'
  use 'hrsh7th/cmp-path'
  use 'hrsh7th/cmp-cmdline'
  use 'hrsh7th/nvim-cmp'

-- ~~~~~~~ snip ~~~~~~

-- Setup nvim-cmp.
local cmp = require'cmp'

cmp.setup({
  snippet = {
    -- REQUIRED - you must specify a snippet engine
    expand = function(args)
      -- vim.fn["vsnip#anonymous"](args.body) -- For `vsnip` users.
      -- require('luasnip').lsp_expand(args.body) -- For `luasnip` users.
      -- require('snippy').expand_snippet(args.body) -- For `snippy` users.
      -- vim.fn["UltiSnips#Anon"](args.body) -- For `ultisnips` users.
    end,
  },
  window = {
    -- completion = cmp.config.window.bordered(),
    -- documentation = cmp.config.window.bordered(),
  },
  mapping = cmp.mapping.preset.insert({
    ['<C-b>'] = cmp.mapping.scroll_docs(-4),
    ['<C-f>'] = cmp.mapping.scroll_docs(4),
    ['<C-Space>'] = cmp.mapping.complete(),
    ['<C-e>'] = cmp.mapping.abort(),
    ['<CR>'] = cmp.mapping.confirm({ select = true }), -- Accept currently selected item. Set `select` to `false` to only confirm explicitly selected items.
  }),
  sources = cmp.config.sources({
    { name = 'nvim_lsp' },
    -- { name = 'vsnip' }, -- For vsnip users.
    -- { name = 'luasnip' }, -- For luasnip users.
    -- { name = 'ultisnips' }, -- For ultisnips users.
    -- { name = 'snippy' }, -- For snippy users.
  }, {
    { name = 'buffer' },
  })
})

-- Set configuration for specific filetype.
cmp.setup.filetype('gitcommit', {
  sources = cmp.config.sources({
    { name = 'cmp_git' }, -- You can specify the `cmp_git` source if you were installed it.
  }, {
    { name = 'buffer' },
  })
})

-- Use buffer source for `/` (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline('/', {
  mapping = cmp.mapping.preset.cmdline(),
  sources = {
    { name = 'buffer' }
  }
})

-- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
cmp.setup.cmdline(':', {
  mapping = cmp.mapping.preset.cmdline(),
  sources = cmp.config.sources({
    { name = 'path' }
  }, {
    { name = 'cmdline' }
  })
})
gi1242 commented 2 years ago

On Tue, Aug 09, 2022 at 09:25:22PM -0700, akiyosi wrote:

What is your goenovim version? (result of exec :GonvimVersion or /path/to/goneovim --version) If possible, please check the operation with the latest version as well.

Great! I'm using v0.6.2 on arch-linux, and I see the bug. However, when I tried with nightly-3-g3d98409, the problem doesn't seem to be there! So it's probably fixed now.

I'll report back if I see the issue persist.

Thanks again.

GI

-- Seen on the back of a dirty car: washme.com