davidhalter / jedi-vim

Using the jedi autocompletion library for VIM.
MIT License
5.27k stars 370 forks source link

Python 3.9 support (WIP) #1029

Closed hjwp closed 3 years ago

hjwp commented 3 years ago

Hi! Just thought I'd give this a go. My plan is to update the submodules for jedi and parso and then see if I can fix any errors the tests throw up.

I've done a couple so far, only one left:

test/vspec/goto.vim failed:
not found in 'runtimepath': "ftdetect/*.vim"
3 more lines:call jedi#goto()
jedi-vim: Cannot open a new buffer, use `:set hidden` or save your buffer
not ok 1 - goto simple: goto definitions
# Expected line('.') == 2 at line 2
#       Actual value: 3
#     Expected value: 2
3 more lines:call jedi#goto_assignments()
jedi-vim: Cannot open a new buffer, use `:set hidden` or save your buffer
not ok 2 - goto simple: goto assignments
# Expected line('.') == 2 at line 2
#       Actual value: 3
#     Expected value: 2:call jedi#goto_assignments()

"." is a directory
Traceback (most recent call last):
  File "/home/harry/workspace/jedi-vim/pythonx/jedi_vim.py", line 194, in wrapper
    return func(*args, **kwargs)
  File "/home/harry/workspace/jedi-vim/pythonx/jedi_vim.py", line 405, in goto
    vim.current.window.cursor = d.line, d.column
vim.error: cursor position outside buffer
not ok 3 - goto with tabs: follow import
# Expected getline('.') == 'import subprocess' at line 3
#       Actual value: ""
#     Expected value: "import subprocess"
6 buffers wiped out
jedi-vim: Cannot open a new buffer, use `:set hidden` or save your buffer
jedi-vim: Cannot open a new buffer, use `:set hidden` or save your buffer

"/usr/lib/python3.9/os.py" 
"/usr/lib/python3.9/os.py" [readonly] 1116L, 39065C
ok 4 - goto with buffers no new tabs
2 buffers wiped out:call jedi#goto_assignments()
"~/workspace/jedi-vim" is a directory
Traceback (most recent call last):
  File "/home/harry/workspace/jedi-vim/pythonx/jedi_vim.py", line 194, in wrapper
    return func(*args, **kwargs)
  File "/home/harry/workspace/jedi-vim/pythonx/jedi_vim.py", line 405, in goto
    vim.current.window.cursor = d.line, d.column
vim.error: cursor position outside buffer
not ok 5 - goto with splits follow import
# Expected getline('.') == 'import subprocess' at line 3
#       Actual value: ""
#     Expected value: "import subprocess"
2 buffers wiped out
"/usr/lib/python3.9/subprocess.py" 
"/usr/lib/python3.9/subprocess.py" [readonly] 2074L, 82465C
ok 6 - goto wildignore restores wildignore
2 buffers wiped out
"/usr/lib/python3.9/subprocess.py" 
"/usr/lib/python3.9/subprocess.py" [readonly] 2074L, 82465C
ok 7 - goto wildignore not using tagstack
2 buffers wiped out

not sure if those errors saying jedi-vim: Cannot open a new buffer, use:set hiddenor save your buffer matter? are they safe to ignore?

hjwp commented 3 years ago

ah looks like travis is unhappy too https://travis-ci.org/github/davidhalter/jedi-vim/jobs/735363787

  File "/home/travis/build/davidhalter/jedi-vim/pythonx/parso/parso/parser.py", line 113
    node_map: Dict[str, type] = {}
            ^
SyntaxError: invalid syntax# -----------------------------------------------------------------------------

maybe it needs switching to 3.9?? I'll have a hack about in the travis config, not sure if that's the right thing to do...

isidentical commented 3 years ago
  File "/home/travis/build/davidhalter/jedi-vim/pythonx/parso/parso/parser.py", line 113
    node_map: Dict[str, type] = {}
            ^
SyntaxError: invalid syntax# -----------------------------------------------------------------------------

I didn't inspected the whole thing, but can this be related Python 2? FWIW We have dropped support for 3.6< on Parso, and inlined the annotations (which was previously hold in external stub files).

hjwp commented 3 years ago

@isidentical there's a PR open to upgrade jedi which drops python 2 support, may need to merge that first #1025

hjwp commented 3 years ago

closing in favour of #1025