[PATCH] Vim patch for pythoncomplete: handles multi-line imports

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

[PATCH] Vim patch for pythoncomplete: handles multi-line imports

Chris Chambers-6
This patch allows the python omnicompletion plugin to recognise and
handle multi-line imports in the following form:

from django.contrib.auth.models import (

diff --git a/.vim/autoload/pythoncomplete.vim b/.vim/autoload/
index 57add71..2d7a1b4 100644
--- a/.vim/autoload/pythoncomplete.vim
+++ b/.vim/autoload/pythoncomplete.vim
@@ -399,6 +399,9 @@ class PyParser:
         imports = []
         while True:
             name, token = self._parsedotname()
+            if token == "(":
+                imports.extend([(i,i) for i in self._parenparse()])
+                return imports
             if not name: break
             name2 = ''
             if token == 'as': name2, token = self._parsedotname()

You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php