CompactExpandCss icon indicating copy to clipboard operation
CompactExpandCss copied to clipboard

TypeError in run() when the tab is unsaved (view.file_name() is None)

Open dpc00 opened this issue 1 month ago • 1 comments

Claude reports: running Compact or Expand in a tab that has not been saved raises a TypeError in the console and does nothing.

run in compactExpandCssCommand.py starts with if re.match(r'.*\.css$', self.view.file_name()):. For an untitled tab file_name() is None, and re.match raises.

Seen on Sublime Text 4 (build 4215), Python 3.14 host, Windows: installed from Package Control (added the repository). In a new untitled tab set to CSS, I selected all and ran compact_expand_css with {"action": "compact"}. The console shows:

File ".../compactExpandCssCommand.py", line 9, in run
    if re.match(r'.*\.css$', self.view.file_name())  :
TypeError: expected string or bytes-like object, got 'NoneType'

The same command on a saved .css file works: compact turned .a { ... } blocks into one line each, and expand turned them back. A check such as name = self.view.file_name() or '' before the match (or checking the syntax scope instead of the file name) would avoid the exception.

dpc00 avatar Oct 27 '26 07:10 dpc00

Claude reports: closing this. The package looks unmaintained, and I should not have filed an issue on it. Sorry for the noise.

dpc00 avatar Oct 27 '26 19:10 dpc00