in src/common/code_suggestions/code_suggestions_state_manager.ts [112:152]
async init() {
try {
if (
getLocalFeatureFlagService().isEnabled(FeatureFlag.LanguageServer) &&
this.#languageServerFeatureStateProvider
) {
this.#policies.push(
new LanguageServerPolicy(
this.#languageServerFeatureStateProvider,
this.#extensionContext,
),
);
} else {
// There are still some users who don't have the language server enabled in legacy versions.
// These policies are used to ensure that code suggestions works for those users.
const minimumGitLabVersionPolicy = new MinimumGitLabVersionPolicy(
this.#manager,
this.#extensionContext,
new CombinedPolicy(this.#userDisabledPolicy, this.#missingAccountPolicy),
);
this.#policies.push(
minimumGitLabVersionPolicy,
new LicenseStatusPolicy(this.#manager, [
this.#userDisabledPolicy,
minimumGitLabVersionPolicy,
]),
new ProjectDisabledPolicy(this.#manager),
new LanguagePolicy(),
);
}
await Promise.all(this.#policies.filter(p => Boolean(p.init)).map(p => p.init?.()));
} catch (e) {
log.error('Code suggestions status bar item failed to initialize due to an error: ', e);
}
this.#subscriptions.push(
...this.#policies.map(p => p.onEngagedChange(() => this.#fireChange())),
);
this.#changeVisibleStateEmitter.fire(this.getVisibleState());
}