Hidden settings

Is there a way (vscode or theia way) to hide preferences?
We want to set and get preferences from code but don’t want the user to see them

Are you looking to hide all preferences (UI), or are you trying to hide a single preference from users?

If it’s the former it might get complicated but you can achieve it by:

  • removing the opening of the preferences-widget
  • update the open preferences menu item to no-op (or remove it completely)
  • find a way to hide the settings.json (from the explorer for both theia and vscode) since if a user updates it the new preference values will take effect

We did not have a use-case in mind that app developers would want to remove preferences from the user (as it is a big usability downgrade as to not be able to control your settings).

Is there an API in theia (related to preference or not) to store data on the browser local storage?
I think it can work for this requirement.

You can use LocalStorage directly? If you want to store per a workspace then you should use StorageService. You should always remember that local storage is only 5mb and they are already occupied mostly by layout data. In order to persist anything bigger one should use indexed-db if it is available.