Skip to content

Run CSScomb does nothing on an unsaved tab (file_name() is None) #101

Open

Description

@dpc00

Claude reports: running "Run CSScomb" on an unsaved tab does nothing.

get_syntax() accepts an unsaved plain-text buffer (is_unsaved_buffer_without_syntax), but comb() then calls os.path.dirname(self.view.file_name()). For an unsaved view file_name() is None, so this raises and nothing is combed.

Steps (Sublime Text build 4200, package 2017.10.06, Windows):

  1. New tab (File > New File), plain text.
  2. Type a{color:#FFF;margin:0px}.
  3. Run CSScomb.

Result: the text is unchanged. The same text saved as a.css is combed correctly.

Suggested fix: use folder = os.path.dirname(self.view.file_name() or '') (or skip the folder argument when there is no file). The same applies to is_scss(), which calls self.view.file_name().endswith('.scss') on None when the scope is not CSS.

Related: #54 (same kind of None problem, closed), #23.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions