Package Control: CodeTestSwitcher 2014.09.12.14.06.52 (python 3.3) on Sublime Text 4200 / Windows.
Repro. Open an unsaved scratch (no file_name()), then run switch_between_code_and_test.
Result. Uncaught exception; nothing happens in the buffer.
Traceback (most recent call last):
File ".../python33/sublime_plugin.py", line 1437, in run_
return self.run(edit)
File ".../CodeTestSwitcher.sublime-package/code_test_switcher.py", line 10, in run
File ".../CodeTestSwitcher.sublime-package/code_test_switcher.py", line 23, in opposite_file_names
AttributeError: 'NoneType' object has no attribute 'split'
Cause. opposite_file_names does:
file_name = self.view.file_name().split(os.sep)[-1]
view.file_name() is None for untitled buffers.
Fix. Return early (or show the existing "No file found" message) when there is no path:
def opposite_file_names(self):
path = self.view.file_name()
if not path:
return []
file_name = path.split(os.sep)[-1]
...
Did not run the project-walk path (os.walk of every window folder) on a saved file.
Package Control:
CodeTestSwitcher2014.09.12.14.06.52 (python 3.3) on Sublime Text 4200 / Windows.Repro. Open an unsaved scratch (no
file_name()), then runswitch_between_code_and_test.Result. Uncaught exception; nothing happens in the buffer.
Cause.
opposite_file_namesdoes:view.file_name()isNonefor untitled buffers.Fix. Return early (or show the existing "No file found" message) when there is no path:
Did not run the project-walk path (
os.walkof every window folder) on a saved file.