Skip to content

Commit 9224a13

Browse files
committed
Bug fix for unnamed view
I was seeing a lot of these errors in ST3: ``` Traceback (most recent call last): File "/opt/sublime_text_3_build_3065_x64/sublime_plugin.py", line 472, in is_visible_ raise ValueError("is_visible must return a bool", self) ValueError: ('is_visible must return a bool', <FileDiffs.file_diffs.FileDiffSavedCommand object at 0x7f5632ffc9d0>) ``` `file_name()` returns `None` for a new view that hasn't been saved yet and has no name, and apparently Python won't coerce that to boolean, so the return value type is wrong. Either wrapping in `bool( ... )` or using `self.view.file_name() is not None` both worked for me.
1 parent ace85cc commit 9224a13

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

file_diffs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,7 @@ def on_post_diff_tool(from_file, to_file):
311311
**kwargs)
312312

313313
def is_visible(self):
314-
return self.view.file_name() and self.view.is_dirty()
314+
return bool(self.view.file_name()) and self.view.is_dirty()
315315

316316

317317
class FileDiffFileCommand(FileDiffCommand):

0 commit comments

Comments
 (0)