ms-jpq / coq_nvim

Fast as FUCK nvim completion. SQLite, concurrent scheduler, hundreds of hours of optimization.
GNU General Public License v3.0
3.54k stars 100 forks source link

Error in RPC for COQcmp_changed ('dict' has no attribute 'replace') #262

Closed smjonas closed 3 years ago

smjonas commented 3 years ago

Not like coq does not work anymore but I just got this error and thought I would report it :) My installed python version is 3.8.10.

ERROR IN RPC FOR :: COQcmp_changed :: [[{'col': 18, 'row': 16, 'scrollbar': False, 'completed_
item': {'word': 'r_multiplier', 'menu': '', 'user_data': {'lsp': {'completion_item': {'label':
 'r_multiplier', 'data': {'symbolLabel': 'r_multiplier', 'filePath': '/home/jonas/Desktop/Inac
on/Automation/stocks/price_scraping.py', 'workspacePath': '/home/jonas/Desktop/Inacon', 'posit
ion': {'character': 15, 'line': 188}}, 'sortText': '08.9999.r_multiplier', 'kind': 6}}}, 'info
': ' ', 'kind': 'Variable', 'abbr': 'r_multiplier'}, 'width': 23, 'height': 2, 'size': 2}]]
'dict' object has no attribute 'replace'
Traceback (most recent call last):
  File "/home/jonas/.vim/plugged/coq_nvim/.vars/runtime/lib/python3.8/site-packages/pynvim_pp/
client.py", line 76, in on_rpc
    return client.on_msg(nvim, (name, args))
  File "/home/jonas/.vim/plugged/coq_nvim/coq/client.py", line 66, in on_msg
    return self._handle(nvim, msg)
  File "/home/jonas/.vim/plugged/coq_nvim/coq/client.py", line 57, in _handle
    return handler(nvim, self._stack, *a)
  File "/home/jonas/.vim/plugged/coq_nvim/.vars/runtime/lib/python3.8/site-packages/pynvim_pp/
rpc.py", line 54, in __call__
    return cast(_T, self._handler(nvim, *args, **kwargs))
  File "/home/jonas/.vim/plugged/coq_nvim/coq/server/registrants/preview.py", line 350, in _cm
p_changed
    uid = UUID(user_data)
  File "/usr/lib/python3.8/uuid.py", line 168, in __init__
    hex = hex.replace('urn:', '').replace('uuid:', '')
AttributeError: 'dict' object has no attribute 'replace'
ERROR IN RPC FOR :: COQcomp_done :: [[{'word': 'r_multiplier', 'menu': '', 'user_data': {'lsp'
: {'completion_item': {'label': 'r_multiplier', 'data': {'symbolLabel': 'r_multiplier', 'fileP
ath': '/home/jonas/Desktop/Inacon/Automation/stocks/price_scraping.py', 'workspacePath': '/hom
e/jonas/Desktop/Inacon', 'position': {'character': 15, 'line': 188}}, 'sortText': '08.9999.r_m
ultiplier', 'kind': 6}}}, 'info': ' ', 'kind': 'Variable', 'abbr': 'r_multiplier'}]]
'dict' object has no attribute 'replace'
Traceback (most recent call last):
  File "/home/jonas/.vim/plugged/coq_nvim/.vars/runtime/lib/python3.8/site-packages/pynvim_pp/
client.py", line 76, in on_rpc
    return client.on_msg(nvim, (name, args))
  File "/home/jonas/.vim/plugged/coq_nvim/coq/client.py", line 66, in on_msg
    return self._handle(nvim, msg)
  File "/home/jonas/.vim/plugged/coq_nvim/coq/client.py", line 57, in _handle
    return handler(nvim, self._stack, *a)
  File "/home/jonas/.vim/plugged/coq_nvim/.vars/runtime/lib/python3.8/site-packages/pynvim_pp/
rpc.py", line 54, in __call__
    return cast(_T, self._handler(nvim, *args, **kwargs))
  File "/home/jonas/.vim/plugged/coq_nvim/coq/server/registrants/omnifunc.py", line 192, in _c
omp_done
    uid = UUID(data)
  File "/usr/lib/python3.8/uuid.py", line 168, in __init__
    hex = hex.replace('urn:', '').replace('uuid:', '')
AttributeError: 'dict' object has no attribute 'replace'
ms-jpq commented 3 years ago

Oh this is a completion item from another source, not coq right?

I assumed everything was coming from coq when i made a few changes, and apparently this is not the case!

ok let me push a quick fix

ms-jpq commented 3 years ago

https://github.com/ms-jpq/coq_nvim/pull/263

should be fixed,

i apologize for the inconvenience

smjonas commented 3 years ago

Wow that was fast thanks! :+1: Unfortunately, now I get this error. Sorry for the bad formatting.

ERROR IN RPC FOR :: COQcomp_done :: [[{'info': '```\nfrom numpy import RAISE\n```', 'menu': 'A
uto-import', 'user_data': {'lsp': {'completion_item': {'label': 'RAISE', 'data': {'autoImportT
ext': '```\nfrom numpy import RAISE\n```', 'symbolLabel': 'RAISE', 'filePath': '/home/jonas/De
sktop/somefile.py', 'workspacePath': '/home/jonas/Desktop/Inaco
n', 'position': {'character': 13, 'line': 188}}, 'textEdit': {'range': {'end': {'character': 1
3, 'line': 188}, 'start': {'character': 12, 'line': 188}}, 'newText': 'RAISE'}, 'kind': 21, 's
ortText': '11.9999.RAISE', 'additionalTextEdits': [{'range': {'end': {'character': 9, 'line':
5}, 'start': {'character': 9, 'line': 5}}, 'newText': '\nfrom numpy import RAISE'}], 'document
ation': {'kind': 'markdown', 'value': '```\nfrom numpy import RAISE\n```'}, 'detail': 'Auto-im
port'}}}, 'word': 'RAISE', 'kind': 'Constant', 'abbr': 'RAISE'}]]

Path:
<class 'uuid.UUID'>

Actual:
{ 'lsp': { 'completion_item': { 'additionalTextEdits': [ { 'newText': '\n'
                                                                      'from '
                                                                      'numpy '
                                                                      'import '
                                                                      'RAISE',
                                                           'range': { 'end': { 'character': 9,

                                                                               'line': 5},
                                                                      'start': { 'character':
9,
                                                                                 'line': 5}}}]
,
                                'data': { 'autoImportText': '```\n'
                                                            'from numpy import '
                                                            'RAISE\n'
                                                            '```',
                                          'filePath': '/home/jonas/Desktop/somefile.py',
                                          'position': { 'character': 13,
                                                        'line': 188},
                                          'symbolLabel': 'RAISE',
                                          'workspacePath': '/home/jonas/Desktop/'},
                                'detail': 'Auto-import',
'documentation': { 'kind': 'markdown',
                                                   'value': '```\n'
                                                            'from numpy import '
                                                            'RAISE\n'
                                                            '```'},
                                'kind': 21,
                                'label': 'RAISE',
                                'sortText': '11.9999.RAISE',
                                'textEdit': { 'newText': 'RAISE',
                                              'range': { 'end': { 'character': 13,
                                                                  'line': 188},
                                                         'start': { 'character': 12,
                                                                    'line': 188}}}}}}

Missing Keys: {}

Extra Keys:   {}

Args:         ()
Traceback (most recent call last):
  File "/home/jonas/.vim/plugged/coq_nvim/.vars/runtime/lib/python3.8/site-packages/pynvim_pp/
client.py", line 76, in on_rpc
    return client.on_msg(nvim, (name, args))
  File "/home/jonas/.vim/plugged/coq_nvim/coq/client.py", line 66, in on_msg
    return self._handle(nvim, msg)
  File "/home/jonas/.vim/plugged/coq_nvim/coq/client.py", line 57, in _handle
    return handler(nvim, self._stack, *a)
  File "/home/jonas/.vim/plugged/coq_nvim/.vars/runtime/lib/python3.8/site-packages/pynvim_pp/
rpc.py", line 54, in __call__
return cast(_T, self._handler(nvim, *args, **kwargs))
  File "/home/jonas/.vim/p
ugged/coq_nvim/coq/server/registrants/omnifunc.py", line 196, in _comp_done
    uid = _UDECODER(data)
  File "/home/jonas/.vim/plugged/coq_nvim/.vars/runtime/lib/python3.8/site-packages/std2/pickl
e/decoder.py", line 290, in __call__
    raise thing
std2.pickle.types.DecodeError:

Path:
<class 'uuid.UUID'>

Actual:
{ 'lsp': { 'completion_item': { 'additionalTextEdits': [ { 'newText': '\n'
                                                                      'from '
                                                                      'numpy '
                                                                      'import '
                                                                      'RAISE',
                                                           'range': { 'end': { 'character': 9,
                                                                               'line': 5},
                                                                      'start': { 'character':
9,
                                                                                 'line': 5}}}]
,
                                'data': { 'autoImportText': '```\n'
                                                            'from numpy import '
                                                            'RAISE\n'
                                                            '```',
                                          'filePath': '/home/jonas/Desktop/somefile.py',
                                          'position': { 'character': 13,
                                                        'line': 188},
                                          'symbolLabel': 'RAISE',
                                          'workspacePath': '/home/jonas/Desktop/'},
                                'detail': 'Auto-import',
                                'documentation': { 'kind': 'markdown',
value': '```\n'
                                                            'from numpy import '
                                                            'RAISE\n'
                                                            '```'},
                                'kind': 21,
                                'label': 'RAISE',
                                'sortText': '11.9999.RAISE',
                                'textEdit': { 'newText': 'RAISE',
                                              'range': { 'end': { 'character': 13,
                                                                  'line': 188},
                                                         'start': { 'character': 12,
                                                                    'line': 188}}}}}}

Missing Keys: {}

Extra Keys:   {}

Args:         ()
ms-jpq commented 3 years ago

oh oops ok ill fix , sorry i am in a rush promse my partner to hango ut

smjonas commented 3 years ago

Yeah no problem at all, take your time. I don't mind if this is fixed some time in the future. Appreciate your help :pray:

ms-jpq commented 3 years ago

https://github.com/ms-jpq/coq_nvim/pull/264

fixed , looks like I forgot to change the error signature.

anyways, it seems like you are using two different completion plugins at the same time?

not sure how well thats gonna work, but the error should be gone

sorry!

smjonas commented 3 years ago

It works thanks :D! Actually, now that you say it, I did not even notice this before but I have completion-nvim in my config because py_lsp somehow requires it. I should probably find a way to change this