mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-09 07:14:48 +08:00
a function to check if the definition is in a builtin module
This commit is contained in:
@@ -98,6 +98,9 @@ class Definition(object):
|
|||||||
|
|
||||||
return str(par.path)
|
return str(par.path)
|
||||||
|
|
||||||
|
def in_builtin_module(self):
|
||||||
|
return not self.module_path.endswith('.py')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def line_nr(self):
|
def line_nr(self):
|
||||||
return self.definition.start_pos[0]
|
return self.definition.start_pos[0]
|
||||||
|
|||||||
@@ -98,6 +98,9 @@ if 1:
|
|||||||
vim.command('normal! m`')
|
vim.command('normal! m`')
|
||||||
|
|
||||||
d = definitions[0]
|
d = definitions[0]
|
||||||
|
if d.in_builtin_module():
|
||||||
|
echo_highlight("Builtin modules cannot be displayed.")
|
||||||
|
else:
|
||||||
if d.module_path != vim.current.buffer.name:
|
if d.module_path != vim.current.buffer.name:
|
||||||
if vim.eval('g:jedi#use_tabs_not_buffers') == '1':
|
if vim.eval('g:jedi#use_tabs_not_buffers') == '1':
|
||||||
vim.command('call jedi#tabnew("%s")' % d.module_path)
|
vim.command('call jedi#tabnew("%s")' % d.module_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user