Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with "Package Control.sublime-settings" hierarchy/ team settings #1633

Closed
DavidBrieden opened this issue Mar 17, 2023 · 3 comments
Closed

Comments

@DavidBrieden
Copy link

I work in a small team with Sublime Text and would like to set up an environment for team settings for package control.

The idea is to define global settings that apply to the whole team and store them in the Sublime folder under Data\Packages\Default. This folder will then be version controlled. In the folder under Data\Packages\User every single user can overwrite his own settings.

We would like to do the same for packages. We already have a global "Package Control.sublime-settings" in the default folder. Basically this already works, when starting Sublime these packages are installed successfully.

The problem now is when we make a change, i.e. when we delete or add packages: Here the "Package Control.sublime-settings" is completely copied into the user folder, and completely overwritten. If now a change is made to the "Package Control.sublime-settings" in the default folder, Package Control does not notice this change, because there is already an own file in the user, which overwrites everything.

Is there a solution for this problem?

@deathaxe
Copy link
Collaborator

ST's settings mechanism unfortunately doesn't merge list or dictionary values the way it would be needed to handle your request.

The easiest way would probably be to introduce a coorparate_packages setting, which PC would read but never modify. You could then add your predefined packages to it.

Sounds like something for the PC4.0 branch.

@DavidBrieden
Copy link
Author

sounds good to me.
thank you!

deathaxe referenced this issue Mar 27, 2023
This commit adds a `cooperate_packages` setting, which contains a list
of packages to automatically install/upgrade and prevent the user from
removing via Command Palette.

Package Control treats it as read-only setting.

Team admins can manage and deploy predefined lists of packages to
install on all clients by shipping a "management package", which
contains a Package Control.sublime-settings.

Example:

Create and deploy a package such as

  Data/Installed Packages/MyCooperation.sublime-package

containing a Package Control.sublime-settings with

  {
      "cooperate_packages": [
          "My package 1",
          "My package 2"
      ]
  }

Once installed, Package Control installs those settings the next time
Sublime Text is started.

Alternatively a package could also just call

    sublime.run_command(
      'install_packages', sublime.load_settings(
        'Package Control.sublime-settings'
      ).get('cooperate_packages', [])
    )

via package control update hook, to install new packages immediately.
Orphaned packages will be removed at next startup if `remove_orphaned`
is set true.

TODO:

1. Maybe track the setting for changes and install/remove packages
   automatically
2. Provide a `sync_cooperate_packages()` command.

Or just leave all of it to a 3rd-party-package, which can build such
handling via `install_packages` and `remove_packages` commands.
@deathaxe deathaxe added this to the Package Control 4.0 milestone Apr 2, 2023
@deathaxe
Copy link
Collaborator

deathaxe commented Apr 2, 2023

Package Control 4.0 will read and merge all installed_packages lists from all Package Control.sublime-settings found in any package and treat them as "predefined packages", which are automatically installed at start and kept up-to-date.

A user can't remove those packages.

A Package Control: Satisfy Packages Command Palette entry is provided to immediatly install all missing or remove orphaned packages at any time.

for details see: 369da1c

@deathaxe deathaxe closed this as completed Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants