GithubHelp home page GithubHelp logo

Cannot parse inline python about vim-vimlparser HOT 2 OPEN

vim-jp avatar vim-jp commented on July 23, 2024
Cannot parse inline python

from vim-vimlparser.

Comments (2)

mattn avatar mattn commented on July 23, 2024

This is impossible to parse.

function! s:foo()
  let let s:inline_python = 'echo "I love python"'
endfunction

let s:inline_python = 'python << EOF'
call s:foo()
exec s:inline_python
import os
EOF

In this case, import os should be parsed as VimL not python.

from vim-vimlparser.

blueyed avatar blueyed commented on July 23, 2024

But the following could be supported:

let cmd_exec = 'python3'
execute 'command! -nargs=1 PythonJedi '.cmd_exec.' <args>'

PythonJedi << EOF
try:
    import foo
except Exception as excinfo:
    pass
EOF

From a quick look this would require "only" to handle the heredoc for user commands, which is currently done in parse_cmd_lua: https://github.com/Kuniwak/vint/blob/f78b0f034a70aa2d39130f6c5a3a21c6c61683e2/vint/_bundles/vimlparser.py#L1106

from vim-vimlparser.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.