Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/editor/contrib/semanticTokens/common/semanticTokensConfig.ts
3296 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { ITextModel } from '../../../common/model.js';
7
import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
8
import { IThemeService } from '../../../../platform/theme/common/themeService.js';
9
10
export const SEMANTIC_HIGHLIGHTING_SETTING_ID = 'editor.semanticHighlighting';
11
12
export interface IEditorSemanticHighlightingOptions {
13
enabled: true | false | 'configuredByTheme';
14
}
15
16
export function isSemanticColoringEnabled(model: ITextModel, themeService: IThemeService, configurationService: IConfigurationService): boolean {
17
const setting = configurationService.getValue<IEditorSemanticHighlightingOptions>(SEMANTIC_HIGHLIGHTING_SETTING_ID, { overrideIdentifier: model.getLanguageId(), resource: model.uri })?.enabled;
18
if (typeof setting === 'boolean') {
19
return setting;
20
}
21
return themeService.getColorTheme().semanticHighlighting;
22
}
23
24