def getcurrentindent(buffer, linenumber: int) -> Tuple[int, bool]:
    # intentlevel, finishflag, unfinishedtype
    import afpython
    lines = [buffer[row] for row in range(linenumber)]
    return afpython.getpythonindent(lines)
예제 #2
0
파일: .old.py 프로젝트: sky8336/vim-repl
import vim

import sys

sys.path.append(vim.eval("g:REPLVIM_PATH") + "autoload/")
try:
    import afpython
except Exception:
    import replpython as afpython

codes = vim.eval("a:codes")
newcodes = []

for i in range(len(codes)):
    if codes[i].lstrip().startswith("#"):
        indentlevel, finishflag, finishtype = afpython.getpythonindent(codes[:(i+1)])
        if finishflag:
            continue
    newcodes.append(codes[i])
EOF
return py3eval('newcodes')
endfunction


function! repl#RemoveExtraEmptyLine(lines, repl_program)
python3 << EOF
import vim

def GetBlockType(codeblock):
    if not codeblock:
        return "EMPTY"
예제 #3
0
 def analysepythonindent(self):
     self.codeindent = list()
     for i in range(len(self.rawcontents)):
         indentlevel, finishflag, finishtype = afpython.getpythonindent(self.rawcontents[:(i+1)])
         self.codeindent.append((indentlevel, finishflag, finishtype))
def getcurrentindent(buffer, linenumber: int) -> Tuple[int, bool]:
    import afpython
    lines = [buffer[row] for row in range(linenumber)]
    return afpython.getpythonindent(lines)