ycm-core / YouCompleteMe

A code-completion engine for Vim
http://ycm-core.github.io/YouCompleteMe/
GNU General Public License v3.0
25.43k stars 2.81k forks source link

KeyError in YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/__init__.py #1796

Closed rgkirch closed 8 years ago

rgkirch commented 8 years ago

2015-11-24 11:21:24,949 - INFO - Received completion request 2015-11-24 11:21:25,228 - ERROR - Exception from semantic completer (using general): Traceback (most recent call last): File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 104, in GetCompletions .ComputeCandidates( request_data ) ) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 163, in ComputeCandidates candidates = self._GetCandidatesFromSubclass( request_data ) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 179, in _GetCandidatesFromSubclass raw_completions = self.ComputeCandidatesInner( request_data ) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/python/jedi_completer.py", line 83, in ComputeCandidatesInner for completion in script.completions() ] File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/api/init.py", line 185, in completions user_stmt = self._parser.user_stmt_with_whitespace() File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/cache.py", line 143, in wrapper result = func(self) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/user_context.py", line 303, in user_stmt_with_whitespace user_stmt = self.user_stmt() File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/cache.py", line 143, in wrapper result = func(self) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/user_context.py", line 293, in user_stmt module = self.module() File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/user_context.py", line 339, in module return self._parser().module File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/cache.py", line 143, in wrapper result = func(self) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/user_context.py", line 283, in _parser parser = FastParser(self._grammar, self._source, self._path) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/fast.py", line 106, in call p = super(CachedFastParser, self).call(grammar, source, module_path) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/fast.py", line 243, in init self.update(source) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/fast.py", line 257, in update self._parse(source) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/fast.py", line 383, in _parse line_offset, nodes) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/fast.py", line 435, in _get_node p = Parser(self._grammar, parser_code, self.module_path, tokenizer=tokenizer) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/init.py", line 155, in init self.module = p.parse(self._tokenize(tokenizer)) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/pgen2/parse.py", line 106, in parse if self.addtoken(type, value, prefix, start_pos): File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/pgen2/parse.py", line 170, in addtoken value, start_pos, prefix, self.addtoken) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/init.py", line 269, in error_recovery self._stack_removal(grammar, stack, index + 1, value, start_pos) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/init.py", line 304, in _stack_removal clear_names(children=node[1]) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/init.py", line 298, in clear_names self._scope_names_stack[-1][c.value].remove(c) KeyError: u'contextMenuActions'

I tried restarting the server and recompiling before I deleted the directory for YouCompleteMe and reinstalled it from scratch. I downloaded it with Vundle by running :PluginInstall and I built it with python install.py --clang-completer. When I'm editing a file, the completion prompt does not come up and I get this error in the log every time it tries to autocomplete something. I'm using it for Python.

vheon commented 8 years ago

Can you provide a minimal test case?

rgkirch commented 8 years ago

from PyQt4 import QtGui QtGui. I'm making a gui with pyqt4 and YCM is invaluable. It would complete QtGui as an ID but then not complete anything after the dot. It's working now though. It seems intermittent. Is there any other debug info that could help you? It's working now and I'll let you know when it stops working again, thanks.

rgkirch commented 8 years ago

2015-11-25 11:21:05,758 - INFO - Received completion request 2015-11-25 11:21:05,767 - ERROR - Exception from semantic completer (using general): Traceback (most recent call last): File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/handlers.py", line 104, in GetCompletions .ComputeCandidates( request_data ) ) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 163, in ComputeCandidates candidates = self._GetCandidatesFromSubclass( request_data ) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/completer.py", line 179, in _GetCandidatesFromSubclass raw_completions = self.ComputeCandidatesInner( request_data ) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/ycmd/../ycmd/completers/python/jedi_completer.py", line 83, in ComputeCandidatesInner for completion in script.completions() ] File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/api/init.py", line 188, in completions completion_names = get_completions(user_stmt, b) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/api/init.py", line 174, in get_completions completion_names += self._simple_complete(path, dot, like) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/api/init.py", line 250, in _simple_complete scopes = list(self._prepare_goto(path, True)) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/api/init.py", line 294, in _prepare_goto scopes = self._evaluator.eval_element(eval_stmt) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/evaluate/cache.py", line 41, in wrapper rv = function(obj, _args, _kwargs) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/evaluate/init.py", line 169, in eval_element return self._eval_atom(element) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/evaluate/init.py", line 230, in _eval_atom return self.find_types(scope, atom, stmt.start_pos, search_global=True) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/evaluate/init.py", line 120, in find_types return f.find(scopes, search_global) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/debug.py", line 52, in wrapper result = func(_args, _kwargs) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/evaluate/finder.py", line 86, in find names = self.filter_name(scopes) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/evaluate/finder.py", line 177, in filter_name names = self.names_dict_lookup(names_dict, position) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/evaluate/finder.py", line 119, in names_dict_lookup names = names_dict[search_str] File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/fast.py", line 78, in getitem return list(chain.from_iterable(dct.get(value, []) for dct in self.dicts)) File "/home/richie/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/jedi/jedi/parser/fast.py", line 78, in return list(chain.from_iterable(dct.get(value, []) for dct in self.dicts)) AttributeError: 'MergedNamesDict' object has no attribute 'get'

It is very intermittent and I got a new error.

vheon commented 8 years ago

From the logs that you posted is not a YCM bug, but a jedi one. So please report this upstream.