forked from VimPlug/jedi-vim
Add g:jedi#use_tag_stack feature for jedi#goto()
This commit is contained in:
@@ -34,7 +34,8 @@ let s:default_settings = {
|
|||||||
\ 'quickfix_window_height': 10,
|
\ 'quickfix_window_height': 10,
|
||||||
\ 'completions_enabled': 1,
|
\ 'completions_enabled': 1,
|
||||||
\ 'force_py_version': "'auto'",
|
\ 'force_py_version': "'auto'",
|
||||||
\ 'smart_auto_mappings': 1
|
\ 'smart_auto_mappings': 1,
|
||||||
|
\ 'use_tag_stack': 1
|
||||||
\ }
|
\ }
|
||||||
|
|
||||||
for [s:key, s:val] in items(s:deprecations)
|
for [s:key, s:val] in items(s:deprecations)
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ Contents *jedi-vim-contents*
|
|||||||
6.11. use_splits_not_buffers |g:jedi#use_splits_not_buffers|
|
6.11. use_splits_not_buffers |g:jedi#use_splits_not_buffers|
|
||||||
6.12. force_py_version |g:jedi#force_py_version|
|
6.12. force_py_version |g:jedi#force_py_version|
|
||||||
6.13. smart_auto_mappings |g:jedi#smart_auto_mappings|
|
6.13. smart_auto_mappings |g:jedi#smart_auto_mappings|
|
||||||
|
6.14. use_tag_stack |g:jedi#use_tag_stack|
|
||||||
7. Testing |jedi-vim-testing|
|
7. Testing |jedi-vim-testing|
|
||||||
8. Contributing |jedi-vim-contributing|
|
8. Contributing |jedi-vim-contributing|
|
||||||
9. License |jedi-vim-license|
|
9. License |jedi-vim-license|
|
||||||
@@ -506,6 +507,15 @@ This option can be disabled in the .vimrc:
|
|||||||
Options: 0 or 1
|
Options: 0 or 1
|
||||||
Default: 1 (enabled by default)
|
Default: 1 (enabled by default)
|
||||||
|
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
6.14. `g:jedi#use_tag_stack` *g:jedi#use_tag_stack*
|
||||||
|
|
||||||
|
Write results of |jedi#goto| to a temporary file and use the *:tjump* command
|
||||||
|
to enable full *tagstack* functionality.
|
||||||
|
|
||||||
|
Options: 0 or 1
|
||||||
|
Default: 1 (enabled by default)
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
7. Testing *jedi-vim-testing*
|
7. Testing *jedi-vim-testing*
|
||||||
|
|
||||||
|
|||||||
17
jedi_vim.py
17
jedi_vim.py
@@ -7,6 +7,9 @@ import traceback # for exception output
|
|||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import tempfile
|
||||||
|
import string
|
||||||
|
import random
|
||||||
from shlex import split as shsplit
|
from shlex import split as shsplit
|
||||||
try:
|
try:
|
||||||
from itertools import zip_longest
|
from itertools import zip_longest
|
||||||
@@ -242,6 +245,20 @@ def goto(mode="goto", no_output=False):
|
|||||||
else:
|
else:
|
||||||
echo_highlight("Builtin modules cannot be displayed (%s)."
|
echo_highlight("Builtin modules cannot be displayed (%s)."
|
||||||
% d.desc_with_module)
|
% d.desc_with_module)
|
||||||
|
else:
|
||||||
|
if vim_eval('g:jedi#use_tag_stack') == '1':
|
||||||
|
with tempfile.NamedTemporaryFile('w') as f:
|
||||||
|
tagname = d.name
|
||||||
|
while vim_eval('taglist("^%s$")' % tagname) != []:
|
||||||
|
tagname = d.name + ' ' + ''.join(
|
||||||
|
[random.choice(string.lowercase)
|
||||||
|
for _ in range(4)])
|
||||||
|
f.write('{0}\t{1}\t{2}'.format(tagname, d.module_path,
|
||||||
|
'call cursor({0}, {1})'.format(d.line, d.column + 1)))
|
||||||
|
f.seek(0)
|
||||||
|
vim.command('set tags+=%s' % f.name)
|
||||||
|
vim.command('tjump %s' % tagname)
|
||||||
|
vim.command('set tags-=%s' % f.name)
|
||||||
else:
|
else:
|
||||||
if d.module_path != vim.current.buffer.name:
|
if d.module_path != vim.current.buffer.name:
|
||||||
result = new_buffer(d.module_path)
|
result = new_buffer(d.module_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user