快速解决办法
在sublime ->浏览插件目录->再进入Anaconda\anaconda_server\commands
打开goto.py,内容如下:
# Copyright (C) 2013 - Oscar Campos <oscar.campos@member.fsf.org>
# This program is Free Software see LICENSE file for details
from .base import Command
class Goto(Command):
"""Get back a python definition where to go"""
def __init__(self, callback, line, col, uid, script):
self.script = script
self.line = line
self.col = col
super(Goto, self).__init__(callback, uid)
def _get_definitions(self):
definitions = self.script.goto(
line=self.line, column=self.col, follow_imports=True
)
if all(d.type == 'import' for d in definitions):
definitions = self.script.goto_definitions()
return definitions
def run(self):
"""Run the command"""
try:
definitions = self._get_definitions()
except:
data = []
success = False
else:
# we use a set here to avoid duplication
data = set(
[
(i.full_name, i.module_path, i.line, i.column + 1 + 1)
for i in definitions
if not i.in_builtin_module()
]
)
success = True
self.callback(
{'success': success, 'result': list(data), 'uid': self.uid}
)
class GotoAssignment(Goto):
"""Get back a python assignment where to go"""
def _get_definitions(self):
return self.script.goto_assignments()
将其中的:
(i.full_name, i.module_path, i.line, i.column + 1 + 1)
修改为:
(i.full_name, str(i.module_path), i.line, i.column + 1 + 1)
即可解决转到定义失效问题,解决方案来自:
https://github.com/DamnWidget/anaconda/issues/924
在Anaconda v2.3.0 版本中修复了这些问题:
Anaconda v2.3.0版本信息
但是我查看发现我的版本就是v2.3.0
也就是说此针对ST4的版本还是没有修复转到定义问题,而且目前变量的转到定义还是会打开空白标签页