in src/common/language_server/language_client_wrapper.ts [84:142]
async initAndStart() {
this.#client.registerProposedFeatures();
this.#subscriptions.push();
this.#client.onNotification(
TokenCheckNotificationType,
(response: TokenCheckNotificationParams) => {
log.warn(
`[auth] Token validation failed in Language Server: (${response.message}). This can happen during OAuth token refresh.`,
);
},
);
this.#client.onNotification('$/gitlab/openUrl', ({ url }) =>
vscode.env.openExternal(url).then(result => {
if (!result) {
log.warn(`Unable to open URL: ${url}`);
}
return result;
}),
);
this.#client.onNotification('$/gitlab/openFile', ({ filePath }) => {
const joinedPath = path.join(vscode.workspace.rootPath || '', filePath);
return vscode.commands.executeCommand('vscode.open', vscode.Uri.file(joinedPath));
});
this.#client.onRequest(AiContextEditorRequests.GIT_DIFF, (params: GitDiffRequest) => {
log.debug(`Received git diff request: ${JSON.stringify(params)}`);
return this.#handleGitDiffRequest(params);
});
this.#client.onRequest(
DEFAULT_WEBVIEW_REQUEST_METHOD,
handleWebviewRequest(this.#webviewMessageRegistry),
);
this.#client.onNotification(
DEFAULT_WEBVIEW_NOTIFICATION_METHOD,
handleWebviewNotification(this.#webviewMessageRegistry),
);
this.#client.onNotification(FeatureStateChangeNotificationType, async params => {
this.#languageServerFeatureStateProvider.setStates(params);
});
this.#webviewMessageRegistry.initNotifier(
createNotifyFn(this.#client, DEFAULT_WEBVIEW_NOTIFICATION_METHOD),
);
await this.#client.start();
this.#subscriptions.push({ dispose: () => this.#client.stop() });
await this.syncConfig();
await this.#sendOpenTabs();
await this.#sendActiveDocument();
const interval = setInterval(this.pingWithCredentials, 10 * 1000);
this.#subscriptions.push(new vscode.Disposable(() => clearInterval(interval)));
}