Hi, is there a way to change the configuration directory?
change ~/.theia
folder to ~/.customtheia
folder.
If multiple theia based software is installed, the configuration file will be messed up.
@kaizhi thank you for the discussion, you can follow the example from theia-blueprint
which changes the configuration folder from .theia
to .theia-blueprint
: https://github.com/eclipse-theia/theia-blueprint/pull/80.
Thanks.
Thanks @vince-fugnitto! This works fine for changing the global settings directory in the users home dir. But how would we change the workspace specific settings folder that is created in the root of the current workspace? Strangely, I can not find any other occurence of ‘.theia’ anywhere in the code base.
@cradke you’ll likely want to modify the following method, to point towards your custom configuration folder name in a given workspace:
This worked nicely. Thank you very much!
This method belongs to PreferenceConfigurations
which is a ContributionProvider
, and you cannot rebind the ContributionProvider
.
@Amora2018 I was able to successfully extend PreferenceConfigurations
to provide a custom folder name:
bindContributionProvider(bind, CustomPreferenceConfiguration);
bind(CustomPreferenceConfigurations).toSelf().inSingletonScope();
rebind(PreferenceConfigurations).to(CustomPreferenceConfigurations).inSingletonScope();
import { injectable } from '@theia/core/shared/inversify';
import { PreferenceConfigurations } from '@theia/core/lib/browser/preferences/preference-configurations';
export const CustomPreferenceConfiguration = Symbol('CustomPreferenceConfiguration');
@injectable()
export class CustomPreferenceConfigurations extends PreferenceConfigurations {
getPaths(): string[] {
return ['.custom-theia', '.vscode']
}
}
I have tried this before, that’s why I say this. If I rebind a ContributionProvider
, I have an injection
error:
I have this error if only I bind/rebind incorrectly.
@Amora2018 I confirmed in my snippet that it works correctly, perhaps you did not bind it properly like you’ve mentioned.
All right, I am confused. I have several module in my application and I moved my bindCustomPreferenceConfigurations
method to another mudule, and then it works, strange