Use global settings only?

Hey all,

I’ve been trying to find the answer to this, but haven’t been able to locate anything. I’d like to disable the creation/use of workspace .theia configuration files, and just use the global config. Does anyone know if this is possible?

-Ryan

I believe you can create a custom extension which rebinds PreferencesContribution (dependency injection) and updates the following method which handles the creation of the .theia/settings.json file under the workspace:

protected async getOrCreateSettingsFile(folderURI: string): Promise<URI> {
  const folderSettingsURI = `${folderURI}/.theia/settings.json`;
  if (folderSettingsURI && !await this.filesystem.exists(folderSettingsURI)) {
    await this.filesystem.createFile(folderSettingsURI);
  }
  return new URI(folderSettingsURI);
}

In order to omit the preferences present in the workspace, you’ll have to look for occurrences of PreferenceScope.Workspace and adjust them accordingly, mainly in the preferences-service which sets and retrieves prefences.

That’s we have .theia hardcoded is bad, we should use a value from PreferenceConfiguration instead.