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

gitsigns/git.lua:222: attempt to concatenate upvalue 'line' (a nil value) #71

Closed
ttys3 opened this issue Mar 1, 2021 · 3 comments
Closed
Labels
bug Something isn't working

Comments

@ttys3
Copy link

ttys3 commented Mar 1, 2021

Describe the bug

When using with neovim official lsp client, and the client seems caused neovim CPU high.

The plugin report:

Error executing vim.schedule lua callback: ...al/share/nvim/plugged/gitsigns.nvim/lua/gitsigns/git.lua:222: attempt to concatenate upvalue 'line' (a nil value)
Press ENTER or type command to continue

To Reproduce

init.vim:

" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.local/share/nvim/plugged')


Plug 'neovim/nvim-lspconfig'
autocmd Filetype go setlocal omnifunc=v:lua.vim.lsp.omnifunc

" https://github.com/nvim-lua/completion-nvim/wiki/chain-complete-support
Plug 'nvim-lua/completion-nvim'
" Configure the completion chains
let g:completion_chain_complete_list = {
    \ 'default': [
    \    {'complete_items': ['lsp']},
    \    {'mode': '<c-p>'},
    \    {'mode': '<c-n>'}
    \]
\}

let g:completion_enable_auto_popup = 1
let g:completion_enable_auto_hover = 1
let g:completion_enable_auto_signature = 1
let g:completion_matching_smart_case = 1
let g:completion_trigger_keyword_length = 1 " default = 1
let g:completion_timer_cycle = 80 "default value is 80
" auto change sources whenever this completion source has no complete item
let g:completion_auto_change_source = 1
let g:completion_enable_auto_paren = 1

" Set completeopt to have a better completion experience
set completeopt=menuone,noinsert,noselect
" Avoid showing message extra message when using completion
set shortmess+=c


n
" The delay is governed by vim's updatetime option,
" default updatetime 4000ms is not good for async update
set updatetime=100

" set signcolumn to 2 to avoid git gutter sign conflict with linter sign
set signcolumn=yes:2

" signify show git diff sigs
" Plug 'mhinz/vim-signify'
" https://github.com/lewis6991/gitsigns.nvim
Plug 'nvim-lua/plenary.nvim'
Plug 'lewis6991/gitsigns.nvim'

lua << EOF
require('gitsigns').setup {
  signs = {
    add          = {hl = 'DiffAdd'   , text = '', numhl='GitSignsAddNr'},
    change       = {hl = 'DiffChange', text = '', numhl='GitSignsChangeNr'},
    delete       = {hl = 'DiffDelete', text = '_', numhl='GitSignsDeleteNr'},
    topdelete    = {hl = 'DiffDelete', text = '', numhl='GitSignsDeleteNr'},
    changedelete = {hl = 'DiffChange', text = '~', numhl='GitSignsChangeNr'},
  },
  numhl = false,
  sign_priority = 6,
  status_formatter = nil, -- Use default
}

local lsp = require'lspconfig'
local cmp = require'completion'


--@param client: (required, vim.lsp.client)
local mix_attach = function(client)
  -- lsp_status.on_attach(client)
  cmp.on_attach(client)
end

-- lsp.gopls.setup{}
-- https://github.com/neovim/nvim-lspconfig/blob/master/lua/lspconfig/gopls.lua
-- https://github.com/golang/tools/blob/master/gopls/doc/vim.md#neovim
-- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#gopls
lsp.gopls.setup({
  on_attach = mix_attach,
  settings = {
    gopls = {
      usePlaceholders = true,
      completeUnimported = true,
    },
  },
  capabilities = lsp_status.capabilities,
})

EOF

Steps to reproduce the behavior:

  1. open a go file under a regular go project, the file must be big, about 3000 lines code
  2. insert some go comment (and then neovim lsp client will continue to send the whole file to lsp server)
  3. neovim cpu will 100%

image

  1. See error
Error executing vim.schedule lua callback: ...al/share/nvim/plugged/gitsigns.nvim/lua/gitsigns/git.lua:222: attempt to concatenate upvalue 'line' (a nil value)
Press ENTER or type command to continue

Observed output
Error messages, logs, etc

Screenshots

image

Additional context
System: Linux Ubuntu 20.10 x86_64
Neovim version:

NVIM v0.5.0-dev+1115-gc1fbc2ddf
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -O2 -g -Og -g -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/ttys3/.config/nvim/neovim/build/config -I/home/ttys3/.config/nvim/neovim/src -I/home/ttys3/.config/nvim/neovim/.deps/usr/include -I/usr/include -I/home/ttys3/.config/nvim/neovim/build/src/nvim/auto -I/home/ttys3/.config/nvim/neovim/build/include
Compiled by ttys3@ttys3-ht

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

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/share/nvim"

Run :checkhealth for more info

also reported to nvim lsp neovim/neovim#14037

@ttys3 ttys3 added the bug Something isn't working label Mar 1, 2021
@lewis6991
Copy link
Owner

There could be a couple issues going on here. I've fixed the nil handling here cdf8e98 so that should let you see what the actual error is.

@ttys3
Copy link
Author

ttys3 commented Mar 3, 2021

Thank u, I'll try it later

@ttys3
Copy link
Author

ttys3 commented Mar 8, 2021

@lewis6991 thanks, I tried many times, and the error did not come. Seems that it's OK now (although neovim lsp is not OK, still CPU 100% 😆 )

@ttys3 ttys3 closed this as completed Mar 8, 2021
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

No branches or pull requests

2 participants