sublimehq / sublime_text

Issue tracker for Sublime Text
https://www.sublimetext.com
802 stars 38 forks source link

sublime.find_resources() finds sublime-package files #4955

Open OdatNurd opened 2 years ago

OdatNurd commented 2 years ago

Description

The API endpoint sublime.find_resources() finds and returns sublime-package files from inside of the Packages folder that contains the packages that ship directly with Sublime, in cases where the file pattern would match (such as '' for all files or '*.sublime-package' for package files).

It's unclear whether this is intentional or not (I assume not), but it causes View Package File to display the shipped packages in the list, which are binary and thus not really viewable.

Checking through past versions shows that this started occurring with build 4114; prior to that this endpoint worked as one would expect.

Steps to reproduce

  1. Start Sublime Text in safe mode
  2. Open the console with View > Show Console
  3. Enter sublime.find_resources('*.sublime-package') and press enter

Expected behavior

The results of this should be an empty array because package files are not themselves resources.

Actual behavior

The API endpoint provides a list of all of the shipped packages. This appears to only be default shipped packages; files from Installed Packages are not listed here.

Environment

FichteFoll commented 7 months ago

In my mind, sublime-package files are not resource files. They are pre-packaged package folders (containing resource files) and should thus not be returned by sublime.find_resources. It even caught the built-in View Package File command by surprise.