Skip to content

Commit

Permalink
Enable Type Hierarchy for the C++ language client
Browse files Browse the repository at this point in the history
  • Loading branch information
HighCommander4 committed Jan 7, 2019
1 parent 8bb8545 commit 1ba85c3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/cpp/src/browser/cpp-language-client-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import { MessageService } from '@theia/core/lib/common/message-service';
import { CPP_LANGUAGE_ID, CPP_LANGUAGE_NAME, HEADER_AND_SOURCE_FILE_EXTENSIONS } from '../common';
import { CppBuildConfigurationManager, CppBuildConfiguration } from './cpp-build-configurations';
import { CppBuildConfigurationsStatusBarElement } from './cpp-build-configurations-statusbar-element';
import { MessageConnection } from 'vscode-jsonrpc';
import { TypeHierarchyService } from '@theia/typehierarchy/lib/browser/typehierarchy-service';

/**
* Clangd extension to set clangd-specific "initializationOptions" in the
Expand Down Expand Up @@ -53,7 +55,8 @@ export class CppLanguageClientContribution extends BaseLanguageClientContributio
@inject(Languages) protected readonly languages: Languages,
@inject(LanguageClientFactory) protected readonly languageClientFactory: LanguageClientFactory,
@inject(MessageService) protected readonly messageService: MessageService,
@inject(ILogger) protected readonly logger: ILogger
@inject(ILogger) protected readonly logger: ILogger,
@inject(TypeHierarchyService) protected readonly typeHierarchyService: TypeHierarchyService
) {
super(workspace, languages, languageClientFactory);
}
Expand Down Expand Up @@ -126,4 +129,10 @@ export class CppLanguageClientContribution extends BaseLanguageClientContributio
};
return clientOptions;
}

protected createLanguageClient(connection: MessageConnection): ILanguageClient {
const client: ILanguageClient & Readonly<{ languageId: string }> = Object.assign(super.createLanguageClient(connection), { languageId: this.id });
client.registerFeatures(TypeHierarchyService.createNewFeatures(this.typeHierarchyService, client));
return client;
}
}

0 comments on commit 1ba85c3

Please sign in to comment.