osyo-manga / vim-snowdrop

libclang in Vim
21 stars 1 forks source link

`SnowdropGotoDefinition` sometimes not working #7

Open roxma opened 7 years ago

roxma commented 7 years ago

As per https://github.com/osyo-manga/vim-snowdrop/issues/5#issuecomment-333288084

Error detected while processing function snowdrop#goto_definition_in_cursor[3]..snowdrop#definition_in_cursor[1]..snowdrop#definition[1]..snowdrop#context[1]..snowdrop#libclang#context[1]..<SNR>42_binding_call[1]..snowdrop#libclang#pyth
on#context[2]..provider#python#Call:
line   18:
error caught in request handler 'python_eval ('snowdrop.context(\t\tvim.eval("a:source"),\t\tvim.eval("a:filename"),\t\tvim.eval("option"),\t\tint(vim.eval("a:line")),\t\tint(vim.eval("a:col")) )\t',)':
Traceback (most recent call last):
  File "/home/roxma/.local/lib/python2.7/site-packages/neovim/plugin/script_host.py", line 150, in python_eval
    return eval(expr, self.module.__dict__)
  File "<string>", line 1, in <module>
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/__init__.py", line 35, in context
    return libclang.context(source, filename, options, line, col)
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/libclang.py", line 219, in context
    result["semantic_parent"] = cursor_context(cursor.semantic_parent)
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/libclang.py", line 198, in cursor_context
    "arguments_type" : cursor_arguments_type_context(cursor),
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/libclang.py", line 172, in cursor_arguments_type_context
    return ([cursor_context(x)["type"] for x in cursor.get_arguments()])
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/libclang.py", line 196, in cursor_context
    "type" : type_context(cursor.type),
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/libclang.py", line 149, in type_context
    "kind" : type.kind.name,
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/clang/cindex.py", line 1463, in kind
    return TypeKind.from_id(self._kind_id)
  File "/home/roxma/dotfiles/vim/.config/nvim/plugged/vim-snowdrop/snowdrop/python/snowdrop/clang/cindex.py", line 1403, in from_id
    raise ValueError,'Unknown type kind %d' % id
ValueError: Unknown type kind 114
Error detected while processing function snowdrop#goto_definition_in_cursor[3]..snowdrop#definition_in_cursor[1]..snowdrop#definition[2]..<SNR>39_get_definition:
line    1:
E121: Undefined variable: definition
E116: Invalid arguments for function empty(a:cursor.definition)
E15: Invalid expression: empty(a:cursor.definition)
Not found 'abcdfe'.

source code of test.cpp:

#include <iostream>

int main(int argc, const char *argv[])
{
    int abcdfe = 5;
    abcdfe = 3;
    return 0;
}

The cursor is at the start of abcdfe = 3; when executing the command.

minimal vimrc:

set nocompatible
syntax on
filetype plugin indent on
set encoding=utf-8 fileencodings=ucs-bom,utf-8,gbk,gb18030,latin1 termencoding=utf-8

call plug#begin(expand('<sfile>:h') . '/plugged/')
Plug 'osyo-manga/vim-snowdrop'
let g:snowdrop#libclang_directory = "/usr/lib"
call plug#end()
[roxma@roxma-pc nvim]$ nvim -v
NVIM v0.2.0
Build type: Release
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -Wconversion -DNVIM_MSGPACK_HAS_FLOAT32 -O2 -DNDEBUG -DDISABLE_LOG -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.2.0/src -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
Compiled by builduser

Optional features included (+) or not (-): +acl   +iconv    +jemalloc +tui      
For differences from Vim, see :help vim-differences

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

System: Manjaro Linux

osyo-manga commented 7 years ago

Thanks for Issues. Please execute :SnowdropVerify and tell the result