Skip to content

Commit

Permalink
Enable semantic highlighting support for the C++ language client
Browse files Browse the repository at this point in the history
Signed-off-by: Nathan Ridge <zeratul976@hotmail.com>
  • Loading branch information
HighCommander4 committed Aug 2, 2019
1 parent fe938ac commit 853032c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/cpp/src/browser/cpp-language-client-contribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@
********************************************************************************/

import { inject, injectable, postConstruct } from 'inversify';
import { MessageConnection } from 'vscode-jsonrpc';
import {
BaseLanguageClientContribution, LanguageClientFactory,
LanguageClientOptions,
ILanguageClient
} from '@theia/languages/lib/browser';
import { Languages, Workspace } from '@theia/languages/lib/browser';
import { SemanticHighlightingService } from '@theia/editor/lib/browser/semantic-highlight/semantic-highlighting-service';
import { ILogger } from '@theia/core/lib/common/logger';
import { WindowService } from '@theia/core/lib/browser/window/window-service';
import { CPP_LANGUAGE_ID, CPP_LANGUAGE_NAME, HEADER_AND_SOURCE_FILE_EXTENSIONS, CppStartParameters } from '../common';
Expand Down Expand Up @@ -62,6 +64,7 @@ export class CppLanguageClientContribution extends BaseLanguageClientContributio
@inject(Workspace) protected readonly workspace: Workspace,
@inject(Languages) protected readonly languages: Languages,
@inject(LanguageClientFactory) protected readonly languageClientFactory: LanguageClientFactory,
@inject(SemanticHighlightingService) protected readonly semanticHighlightingService: SemanticHighlightingService,
) {
super(workspace, languages, languageClientFactory);
}
Expand All @@ -83,6 +86,12 @@ export class CppLanguageClientContribution extends BaseLanguageClientContributio
this.cppBuildConfigurationsStatusBarElement.show();
}

protected createLanguageClient(connection: MessageConnection): ILanguageClient {
const client: ILanguageClient & Readonly<{ languageId: string }> = Object.assign(super.createLanguageClient(connection), { languageId: this.id });
client.registerFeature(SemanticHighlightingService.createNewFeature(this.semanticHighlightingService, client));
return client;
}

private createClangdConfigurationParams(config: CppBuildConfiguration | undefined): ClangdConfigurationParamsChange {
const clangdParams: ClangdConfigurationParamsChange = {};

Expand Down

0 comments on commit 853032c

Please sign in to comment.