Add GoToDefinitionElseDeclaration for python

This commit is contained in:
Stanislav Golovanov 2013-05-04 22:48:27 +04:00
parent f246f5b8c6
commit 54e6a9f594

View File

@ -88,6 +88,8 @@ class JediCompleter( ThreadedCompleter ):
self._GoToDefinition() self._GoToDefinition()
elif command == 'GoToDeclaration': elif command == 'GoToDeclaration':
self._GoToDeclaration() self._GoToDeclaration()
elif command == 'GoToDefinitionElseDeclaration':
self._GoToDefinitionElseDeclaration()
def _GoToDefinition( self ): def _GoToDefinition( self ):
@ -106,6 +108,15 @@ class JediCompleter( ThreadedCompleter ):
vimsupport.PostVimMessage( 'Can\'t jump to declaration.' ) vimsupport.PostVimMessage( 'Can\'t jump to declaration.' )
def _GoToDefinitionElseDeclaration( self ):
definitions = self._GetDefinitionsList() or \
self._GetDefinitionsList( declaration = True )
if definitions:
self._JumpToLocation(definitions)
else:
vimsupport.PostVimMessage( 'Can\'t jump to definition or declaration.' )
def _GetDefinitionsList( self, declaration = False ): def _GetDefinitionsList( self, declaration = False ):
definitions = [] definitions = []
script = self._GetJediScript() script = self._GetJediScript()