Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion autoload/repl.vim
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ function! repl#REPLGetShortName()
return 'ipython'
elseif l:temp ==# 'ipython3'
return 'ipython'
elseif stridx(l:name, '--kernel=') != -1
if stridx(l:name, '--kernel=python') != -1
return 'ipython'
else
return 'R'
endif
elseif l:temp =~# '.*python.*'
return 'python'
else
Expand Down Expand Up @@ -554,7 +560,8 @@ function! repl#SendCurrentLine()
endif
endif
if repl#REPLGetShortName() ==# "ipython"
call repl#Sends(repl#ToREPLPythonCode([l:code_tobe_sent], 'ipython'), ['\.\.\.', 'In'])
let l:code_line = substitute(l:code_tobe_sent, '\r\?\n$', '', '')
call repl#Sends([l:code_line], ['\.\.\.', 'In'])
else
call term_sendkeys(repl#GetConsoleName(), l:code_tobe_sent)
endif
Expand Down
11 changes: 5 additions & 6 deletions pythonx/formatpythoncode.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,12 @@ def canbestartofblock(self, index):
if not self.isstartofline(index):
return False
line = self.rawcontents[index].strip()
if line.startswith("else:"):
compact = "".join(line.split())
if line.startswith("else") and compact.startswith("else:"):
return False
elif line.startswith("except "):
elif line.startswith("except ") or (line.startswith("except") and compact.startswith("except:")):
return False
elif line.startswith("except:"):
return False
elif line.startswith("elif "):
elif line.startswith("elif ") or (line.startswith("elif") and compact.startswith("elif:")):
return False
else:
return True
Expand Down Expand Up @@ -266,7 +265,7 @@ def AutoStop(line):
elif self.replprogram == "ipython":
version = Version(self.version)
# print(f'{version=}, {self.version=}')
if version >= Version('7.1'):
if version >= Version('7.1') or version <= Version('8.0'):
return False
if line.startswith("pass ") or line.startswith("return ") or line.startswith("raise ") or line.startswith("continue ") or line.startswith("break "):
return True
Expand Down